[FFmpeg-devel] [PATCH]Set dwSuggestBufferSize for video streams in avi
Carl Eugen Hoyos
cehoyos at ag.or.at
Sun May 18 22:25:54 CEST 2014
Hi!
Attached patch fixes playback of avi files with large video frames with older
WMP as described in a comment in ticket #2145 (not reproducible with current
WMP).
It may fix ticket #2818.
Should the value never be set smaller than 1024x1024?
Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 89e2a53..18871ec 100644
Index: libavformat/avienc.c
===================================================================
--- 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;
@@ -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;
More information about the ffmpeg-devel
mailing list