summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/aviio.cpp
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2016-07-16 14:36:42 +0200
committer ImJezze <jezze@gmx.net>2016-07-16 14:42:41 +0200
commit6a592feca96e30d92685f310fcc082c8950de195 (patch)
tree5e2a47e00c323504fc60c0660b05c5469a26744d /src/lib/util/aviio.cpp
parentae0761f64610e63a9f2d6b535eebc8733fe46cc2 (diff)
Added generic fix for #6286
- this does not fix #6291
Diffstat (limited to 'src/lib/util/aviio.cpp')
-rw-r--r--src/lib/util/aviio.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/lib/util/aviio.cpp b/src/lib/util/aviio.cpp
index acd1a83a9b1..7a75330abe7 100644
--- a/src/lib/util/aviio.cpp
+++ b/src/lib/util/aviio.cpp
@@ -223,6 +223,14 @@
#define HUFFYUV_PREDICT_DECORR 0x40
+ /**
+ * @def ENSURE_EVEN_WIDTH_HEIGHT
+ *
+ * @brief Ensures that width and height of the output steam are even integers.
+ */
+
+#define ENSURE_EVEN_WIDTH_HEIGHT 1
+
namespace {
/***************************************************************************
@@ -288,12 +296,28 @@ public:
void initialize_video(avi_file::movie_info const &info)
{
+ std::uint32_t width = info.video_width;
+ std::uint32_t height = info.video_height;
+
+ /* ensure even width and height because most video players are not capable to playback a video stream with uneven width or height */
+ if (ENSURE_EVEN_WIDTH_HEIGHT)
+ {
+ if (width % 2 > 0)
+ {
+ width--;
+ }
+ if (height % 2 > 0)
+ {
+ height--;
+ }
+ }
+
m_type = STREAMTYPE_VIDS;
m_format = info.video_format;
m_rate = info.video_timescale;
m_scale = info.video_sampletime;
- m_width = info.video_width;
- m_height = info.video_height;
+ m_width = width;
+ m_height = height;
m_depth = info.video_depth;
}