[FFmpeg-cvslog] avformat/matroska: write FlagInterlaced element in WebM

James Almer git at videolan.org
Wed Oct 5 01:46:38 EEST 2016


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue Oct  4 19:42:55 2016 -0300| [3cc9d6d3824f24df677437b891b66bf84eabc45b] | committer: James Almer

avformat/matroska: write FlagInterlaced element in WebM

It's listed as supported in both https://www.webmproject.org/docs/container/
and https://matroska.org/technical/specs/index.html

Reviewed-by: Dave Rice <dave at dericed.com>
Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3cc9d6d3824f24df677437b891b66bf84eabc45b
---

 libavformat/matroskaenc.c | 41 +++++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 3eeb09b..c6a8dce 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -791,7 +791,7 @@ static int mkv_write_video_color(AVIOContext *pb, AVCodecParameters *par, AVStre
     return 0;
 }
 
-static void mkv_write_field_order(AVIOContext *pb,
+static void mkv_write_field_order(AVIOContext *pb, int mode,
                                   enum AVFieldOrder field_order)
 {
     switch (field_order) {
@@ -809,23 +809,25 @@ static void mkv_write_field_order(AVIOContext *pb,
     case AV_FIELD_BT:
         put_ebml_uint(pb, MATROSKA_ID_VIDEOFLAGINTERLACED,
                       MATROSKA_VIDEO_INTERLACE_FLAG_INTERLACED);
-        switch (field_order) {
-        case AV_FIELD_TT:
-            put_ebml_uint(pb, MATROSKA_ID_VIDEOFIELDORDER,
-                          MATROSKA_VIDEO_FIELDORDER_TT);
-            break;
-        case AV_FIELD_BB:
-             put_ebml_uint(pb, MATROSKA_ID_VIDEOFIELDORDER,
-                          MATROSKA_VIDEO_FIELDORDER_BB);
-            break;
-        case AV_FIELD_TB:
-            put_ebml_uint(pb, MATROSKA_ID_VIDEOFIELDORDER,
-                          MATROSKA_VIDEO_FIELDORDER_TB);
-            break;
-        case AV_FIELD_BT:
-            put_ebml_uint(pb, MATROSKA_ID_VIDEOFIELDORDER,
-                          MATROSKA_VIDEO_FIELDORDER_BT);
-            break;
+        if (mode != MODE_WEBM) {
+            switch (field_order) {
+            case AV_FIELD_TT:
+                put_ebml_uint(pb, MATROSKA_ID_VIDEOFIELDORDER,
+                              MATROSKA_VIDEO_FIELDORDER_TT);
+                break;
+            case AV_FIELD_BB:
+                put_ebml_uint(pb, MATROSKA_ID_VIDEOFIELDORDER,
+                              MATROSKA_VIDEO_FIELDORDER_BB);
+                break;
+            case AV_FIELD_TB:
+                put_ebml_uint(pb, MATROSKA_ID_VIDEOFIELDORDER,
+                              MATROSKA_VIDEO_FIELDORDER_TB);
+                break;
+            case AV_FIELD_BT:
+                put_ebml_uint(pb, MATROSKA_ID_VIDEOFIELDORDER,
+                              MATROSKA_VIDEO_FIELDORDER_BT);
+                break;
+            }
         }
     }
 }
@@ -1088,8 +1090,7 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
         put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELWIDTH , par->width);
         put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELHEIGHT, par->height);
 
-        if (mkv->mode != MODE_WEBM)
-            mkv_write_field_order(pb, par->field_order);
+        mkv_write_field_order(pb, mkv->mode, par->field_order);
 
         // check both side data and metadata for stereo information,
         // write the result to the bitstream if any is found



More information about the ffmpeg-cvslog mailing list