summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/aviio.cpp
diff options
context:
space:
mode:
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;
}