[FFmpeg-devel] [PATCH 2/5] avformat/nutenc: use codec_time_base

Michael Niedermayer michaelni at gmx.at
Wed Jun 18 21:35:03 CEST 2014


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavformat/nutenc.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 5db380f..3580ae7 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -168,6 +168,7 @@ static void build_frame_code(AVFormatContext *s)
         int start2 = start + (end - start) * stream_id       / s->nb_streams;
         int end2   = start + (end - start) * (stream_id + 1) / s->nb_streams;
         AVCodecContext *codec = s->streams[stream_id]->codec;
+        AVRational codec_time_base = s->streams[stream_id]->codec_time_base;
         int is_audio          = codec->codec_type == AVMEDIA_TYPE_AUDIO;
         int intra_only        = /*codec->intra_only || */ is_audio;
         int pred_count;
@@ -178,7 +179,7 @@ static void build_frame_code(AVFormatContext *s)
             if (codec->codec_id == AV_CODEC_ID_VORBIS && !frame_size)
                 frame_size = 64;
         } else {
-            AVRational f = av_div_q(codec->time_base, *nut->stream[stream_id].time_base);
+            AVRational f = av_div_q(codec_time_base, *nut->stream[stream_id].time_base);
             if (f.den == 1 && f.num>0)
                 frame_size = f.num;
         }
@@ -524,7 +525,7 @@ static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id) {
     }
     if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
         uint8_t buf[256];
-        snprintf(buf, sizeof(buf), "%d/%d", st->codec->time_base.den, st->codec->time_base.num);
+        snprintf(buf, sizeof(buf), "%d/%d", st->codec_time_base.den, st->codec_time_base.num);
         count += add_info(dyn_bc, "r_frame_rate", buf);
     }
     dyn_size = avio_close_dyn_buf(dyn_bc, &dyn_buf);
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list