summaryrefslogtreecommitdiff
path: root/libavformat/avienc.c
diff options
context:
space:
mode:
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 87075d4b93..417a8e99d2 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -144,6 +144,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;
@@ -172,15 +173,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 */
@@ -337,7 +341,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);