[FFmpeg-cvslog] lavf/flvdec: Set avg_frame_rate for video streams.

Carl Eugen Hoyos git at videolan.org
Fri Nov 25 12:07:28 EET 2016


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Fri Nov 25 11:06:14 2016 +0100| [e0791c5aaf1c12601322e410119ca46c6d09981d] | committer: Carl Eugen Hoyos

lavf/flvdec: Set avg_frame_rate for video streams.

Requested-by: qw, applemax82 at 163 dot com
Reviewed-by: Steven Liu

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

 libavformat/flvdec.c  | 9 ++++++++-
 libavformat/version.h | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 39e2142..18645b0 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -67,6 +67,7 @@ typedef struct FLVContext {
     int64_t *keyframe_times;
     int64_t *keyframe_filepositions;
     int missing_streams;
+    AVRational framerate;
 } FLVContext;
 
 static int probe(AVProbeData *p, int live)
@@ -142,8 +143,10 @@ static AVStream *create_stream(AVFormatContext *s, int codec_type)
         s->ctx_flags &= ~AVFMTCTX_NOHEADER;
     if (codec_type == AVMEDIA_TYPE_AUDIO)
         flv->missing_streams &= ~FLV_HEADER_FLAG_HASAUDIO;
-    if (codec_type == AVMEDIA_TYPE_VIDEO)
+    if (codec_type == AVMEDIA_TYPE_VIDEO) {
         flv->missing_streams &= ~FLV_HEADER_FLAG_HASVIDEO;
+        st->avg_frame_rate = flv->framerate;
+    }
 
 
     avpriv_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
@@ -555,6 +558,10 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream,
                     if (!st)
                         return AVERROR(ENOMEM);
                     st->codecpar->codec_id = AV_CODEC_ID_TEXT;
+                } else if (!strcmp(key, "framerate")) {
+                    flv->framerate = av_d2q(num_val, 1000);
+                    if (vstream)
+                        vstream->avg_frame_rate = flv->framerate;
                 } else if (flv->trust_metadata) {
                     if (!strcmp(key, "videocodecid") && vpar) {
                         int ret = flv_set_video_codec(s, vstream, num_val, 0);
diff --git a/libavformat/version.h b/libavformat/version.h
index 24a7534..1464326 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -33,7 +33,7 @@
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  57
 #define LIBAVFORMAT_VERSION_MINOR  58
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list