[FFmpeg-cvslog] avienc: fix AVI stream index for files with >10 streams
longstone
git
Wed Feb 23 19:04:40 CET 2011
ffmpeg | branch: master | longstone <zhibing.min at hotmail.com> | Wed Feb 23 10:43:21 2011 -0500| [4c262dc140cf8f62d46aac6b7ed0290d3380a0a4] | committer: Michael Niedermayer
avienc: fix AVI stream index for files with >10 streams
Fixes issue 2563.
Signed-off-by: Ronald S. Bultje <rsbultje at gmail.com>
(cherry picked from commit 4acc94e97a9551d11ead29735e23283d71f1d4c2)
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4c262dc140cf8f62d46aac6b7ed0290d3380a0a4
---
libavformat/avi.h | 1 +
libavformat/avienc.c | 10 ++++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/libavformat/avi.h b/libavformat/avi.h
index f345c14..b4e5519 100644
--- a/libavformat/avi.h
+++ b/libavformat/avi.h
@@ -32,6 +32,7 @@
#define AVI_MAX_RIFF_SIZE 0x40000000LL
#define AVI_MASTER_INDEX_SIZE 256
+#define AVI_MAX_STREAM_COUNT 100
/* index flags */
#define AVIIF_INDEX 0x10
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 61af511..e109269 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -85,8 +85,8 @@ static int64_t avi_start_new_riff(AVFormatContext *s, AVIOContext *pb,
static char* avi_stream2fourcc(char* tag, int index, enum AVMediaType type)
{
- tag[0] = '0';
- tag[1] = '0' + index;
+ tag[0] = '0' + index/10;
+ tag[1] = '0' + index%10;
if (type == AVMEDIA_TYPE_VIDEO) {
tag[2] = 'd';
tag[3] = 'c';
@@ -158,6 +158,12 @@ static int avi_write_header(AVFormatContext *s)
int64_t list1, list2, strh, strf;
AVMetadataTag *t = NULL;
+ if (s->nb_streams > AVI_MAX_STREAM_COUNT) {
+ av_log(s, AV_LOG_ERROR, "AVI does not support >%d streams\n",
+ AVI_MAX_STREAM_COUNT);
+ return -1;
+ }
+
for(n=0;n<s->nb_streams;n++) {
s->streams[n]->priv_data= av_mallocz(sizeof(AVIStream));
if(!s->streams[n]->priv_data)
More information about the ffmpeg-cvslog
mailing list