Commit 4acc94e9 authored by longstone's avatar longstone Committed by Ronald S. Bultje

avienc: fix AVI stream index for files with >10 streams

Fixes issue 2563.
Signed-off-by: 's avatarRonald S. Bultje <rsbultje@gmail.com>
parent 22a3212e
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#define AVI_MAX_RIFF_SIZE 0x40000000LL #define AVI_MAX_RIFF_SIZE 0x40000000LL
#define AVI_MASTER_INDEX_SIZE 256 #define AVI_MASTER_INDEX_SIZE 256
#define AVI_MAX_STREAM_COUNT 100
/* index flags */ /* index flags */
#define AVIIF_INDEX 0x10 #define AVIIF_INDEX 0x10
......
...@@ -85,8 +85,8 @@ static int64_t avi_start_new_riff(AVFormatContext *s, AVIOContext *pb, ...@@ -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) static char* avi_stream2fourcc(char* tag, int index, enum AVMediaType type)
{ {
tag[0] = '0'; tag[0] = '0' + index/10;
tag[1] = '0' + index; tag[1] = '0' + index%10;
if (type == AVMEDIA_TYPE_VIDEO) { if (type == AVMEDIA_TYPE_VIDEO) {
tag[2] = 'd'; tag[2] = 'd';
tag[3] = 'c'; tag[3] = 'c';
...@@ -158,6 +158,12 @@ static int avi_write_header(AVFormatContext *s) ...@@ -158,6 +158,12 @@ static int avi_write_header(AVFormatContext *s)
int64_t list1, list2, strh, strf; int64_t list1, list2, strh, strf;
AVMetadataTag *t = NULL; 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++) { for(n=0;n<s->nb_streams;n++) {
s->streams[n]->priv_data= av_mallocz(sizeof(AVIStream)); s->streams[n]->priv_data= av_mallocz(sizeof(AVIStream));
if(!s->streams[n]->priv_data) if(!s->streams[n]->priv_data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment