[FFmpeg-devel] [PATCH 2/3] avformat/microdvd: set AV_DISPOSITION_FRAME_BASED

wm4 nfxjfg at googlemail.com
Mon Feb 17 21:49:35 CET 2014


---
 libavformat/microdvddec.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/microdvddec.c b/libavformat/microdvddec.c
index 7b49e43..51f7f48 100644
--- a/libavformat/microdvddec.c
+++ b/libavformat/microdvddec.c
@@ -78,6 +78,7 @@ static int microdvd_read_header(AVFormatContext *s)
     AVStream *st = avformat_new_stream(s, NULL);
     int i = 0;
     char line[MAX_LINESIZE];
+    int has_real_fps = 0;
 
     if (!st)
         return AVERROR(ENOMEM);
@@ -98,8 +99,10 @@ static int microdvd_read_header(AVFormatContext *s)
 
             if ((sscanf(line, "{%d}{}%6lf",    &frame, &fps) == 2 ||
                  sscanf(line, "{%d}{%*d}%6lf", &frame, &fps) == 2)
-                && frame <= 1 && fps > 3 && fps < 100)
+                && frame <= 1 && fps > 3 && fps < 100) {
                 pts_info = av_d2q(fps, 100000);
+                has_real_fps = 1;
+            }
             if (!st->codec->extradata && sscanf(line, "{DEFAULT}{}%c", &c) == 1) {
                 st->codec->extradata = av_strdup(line + 11);
                 if (!st->codec->extradata)
@@ -131,6 +134,8 @@ static int microdvd_read_header(AVFormatContext *s)
     avpriv_set_pts_info(st, 64, pts_info.den, pts_info.num);
     st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
     st->codec->codec_id   = AV_CODEC_ID_MICRODVD;
+    if (!has_real_fps)
+        st->disposition |= AV_DISPOSITION_FRAME_BASED;
     return 0;
 }
 
-- 
1.9.0.rc3



More information about the ffmpeg-devel mailing list