aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/avienc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-18 18:18:25 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-18 19:49:17 +0200
commitac293b66851f6c4461eab03ca91af59d5ee4e02e (patch)
tree4bcf9e474aaec1e346c368660b52e4630059e380 /libavformat/avienc.c
parent88514378bac99872265dad28072fb30160b26bfa (diff)
parent194be1f43ea391eb986732707435176e579265aa (diff)
downloadffmpeg-ac293b66851f6c4461eab03ca91af59d5ee4e02e.tar.gz
Merge commit '194be1f43ea391eb986732707435176e579265aa'
* commit '194be1f43ea391eb986732707435176e579265aa': lavf: switch to AVStream.time_base as the hint for the muxer timebase Conflicts: doc/APIchanges libavformat/filmstripenc.c libavformat/movenc.c libavformat/mxfenc.c libavformat/oggenc.c libavformat/swf.h libavformat/version.h tests/ref/lavf/mkv Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/avienc.c')
-rw-r--r--libavformat/avienc.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 461d3aa611..c45bac28c4 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -155,6 +155,7 @@ static int avi_write_header(AVFormatContext *s)
AVIOContext *pb = s->pb;
int bitrate, n, i, nb_frames, au_byterate, au_ssize, au_scale;
AVCodecContext *video_enc;
+ AVStream *video_st = NULL;
int64_t list1, list2, strh, strf;
AVDictionaryEntry *t = NULL;
int padding;
@@ -184,15 +185,18 @@ static int avi_write_header(AVFormatContext *s)
for (n = 0; n < s->nb_streams; n++) {
AVCodecContext *codec = s->streams[n]->codec;
bitrate += codec->bit_rate;
- if (codec->codec_type == AVMEDIA_TYPE_VIDEO)
+ if (codec->codec_type == AVMEDIA_TYPE_VIDEO) {
video_enc = codec;
+ video_st = s->streams[n];
+ }
}
nb_frames = 0;
- if (video_enc)
- avio_wl32(pb, (uint32_t) (INT64_C(1000000) * video_enc->time_base.num /
- video_enc->time_base.den));
+ // TODO: should be avg_frame_rate
+ if (video_st)
+ avio_wl32(pb, (uint32_t) (INT64_C(1000000) * video_st->time_base.num /
+ video_st->time_base.den));
else
avio_wl32(pb, 0);
avio_wl32(pb, bitrate / 8); /* XXX: not quite exact */
@@ -388,7 +392,8 @@ static int avi_write_header(AVFormatContext *s)
avio_wl32(pb, 0); // video format = unknown
avio_wl32(pb, 0); // video standard = unknown
- avio_wl32(pb, lrintf(1.0 / av_q2d(enc->time_base)));
+ // TODO: should be avg_frame_rate
+ avio_wl32(pb, lrintf(1.0 / av_q2d(st->time_base)));
avio_wl32(pb, enc->width);
avio_wl32(pb, enc->height);
avio_wl16(pb, den);