aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/matroskadec.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2016-10-13 14:22:07 -0300
committerJames Almer <jamrial@gmail.com>2016-10-13 14:22:07 -0300
commit1273bc6d26c856470381649cf1213217eb4f516a (patch)
treef53cf2935593759ec88caf4b83b33058eb30112d /libavformat/matroskadec.c
parent04b0792e4a7ac2866d269f9a1a921385ad410964 (diff)
downloadffmpeg-1273bc6d26c856470381649cf1213217eb4f516a.tar.gz
avformat/matroskadec: workaround the field_order bug in the Matroska muxer
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r--libavformat/matroskadec.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index a94398bd82..acf1ccb496 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1752,8 +1752,15 @@ static int matroska_parse_flac(AVFormatContext *s,
return 0;
}
-static int mkv_field_order(int64_t field_order)
+static int mkv_field_order(MatroskaDemuxContext *matroska, int64_t field_order)
{
+ int major, minor, micro, bttb = 0;
+
+ /* workaround a bug in our Matroska muxer, introduced in version 57.36 alongside
+ * this function, and fixed in 57.52 */
+ if (sscanf(matroska->muxingapp, "Lavf%d.%d.%d", &major, &minor, &micro) == 3)
+ bttb = (major == 57 && minor >= 36 && minor <= 51 && micro >= 100);
+
switch (field_order) {
case MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE:
return AV_FIELD_PROGRESSIVE;
@@ -1764,9 +1771,9 @@ static int mkv_field_order(int64_t field_order)
case MATROSKA_VIDEO_FIELDORDER_BB:
return AV_FIELD_BB;
case MATROSKA_VIDEO_FIELDORDER_BT:
- return AV_FIELD_BT;
+ return bttb ? AV_FIELD_TB : AV_FIELD_BT;
case MATROSKA_VIDEO_FIELDORDER_TB:
- return AV_FIELD_TB;
+ return bttb ? AV_FIELD_BT : AV_FIELD_TB;
default:
return AV_FIELD_UNKNOWN;
}
@@ -2282,7 +2289,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
st->codecpar->height = track->video.pixel_height;
if (track->video.interlaced == MATROSKA_VIDEO_INTERLACE_FLAG_INTERLACED)
- st->codecpar->field_order = mkv_field_order(track->video.field_order);
+ st->codecpar->field_order = mkv_field_order(matroska, track->video.field_order);
else if (track->video.interlaced == MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE)
st->codecpar->field_order = AV_FIELD_PROGRESSIVE;