diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2014-05-19 00:05:40 +0200 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2014-05-19 00:05:40 +0200 |
commit | e705d0ce1cd3b428ee2d03db6517e189dc3b142d (patch) | |
tree | 029501d9cd217645d44cdcc8057a1b771a8be030 /libavformat/avienc.c | |
parent | 057ebf122276e50d52ad0a3e2da7db8913fceaf6 (diff) | |
download | ffmpeg-e705d0ce1cd3b428ee2d03db6517e189dc3b142d.tar.gz |
Set dwSuggestBufferSize to largest chunk size for every stream in avi.
Fixes playback with WMP 9 for files with large (rawvideo) frames
as explained in ticket #2145.
Fixes ticket #2818.
Diffstat (limited to 'libavformat/avienc.c')
-rw-r--r-- | libavformat/avienc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 2e09dd3929..4544a6876b 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -64,6 +64,7 @@ typedef struct { int64_t audio_strm_length; int packet_count; int entry; + int max_size; AVIIndex indexes; } AVIStream; @@ -282,7 +283,7 @@ static int avi_write_header(AVFormatContext *s) else avio_wl32(pb, 0); /* length, XXX: filled later */ - /* suggested buffer size */ //FIXME set at the end to largest chunk + /* suggested buffer size, is set to largest chunk size in avi_write_trailer */ if (enc->codec_type == AVMEDIA_TYPE_VIDEO) avio_wl32(pb, 1024 * 1024); else if (enc->codec_type == AVMEDIA_TYPE_AUDIO) @@ -628,6 +629,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) idx->cluster[cl][id].flags = flags; idx->cluster[cl][id].pos = avio_tell(pb) - avi->movi_list; idx->cluster[cl][id].len = size; + avist->max_size = FFMAX(avist->max_size, size); idx->entry++; } @@ -689,6 +691,10 @@ static int avi_write_trailer(AVFormatContext *s) av_freep(&avist->indexes.cluster[j]); av_freep(&avist->indexes.cluster); avist->indexes.ents_allocated = avist->indexes.entry = 0; + if (pb->seekable) { + avio_seek(pb, avist->frames_hdr_strm + 4, SEEK_SET); + avio_wl32(pb, avist->max_size); + } } return res; |