1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

properly check for FF_API_MAX_STREAMS instead of LIBAVFORMAT_VERSION_MAJOR

Originally committed as revision 25382 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Aurelien Jacobs 2010-10-06 21:43:46 +00:00
parent 38aab35f47
commit 61138c43e0
2 changed files with 8 additions and 7 deletions

View File

@ -672,7 +672,7 @@ typedef struct AVFormatContext {
void *priv_data;
ByteIOContext *pb;
unsigned int nb_streams;
#if LIBAVFORMAT_VERSION_MAJOR < 53
#if FF_API_MAX_STREAMS
AVStream *streams[MAX_STREAMS];
#else
AVStream **streams;

View File

@ -2543,7 +2543,13 @@ AVStream *av_new_stream(AVFormatContext *s, int id)
{
AVStream *st;
int i;
#if LIBAVFORMAT_VERSION_MAJOR >= 53
#if FF_API_MAX_STREAMS
if (s->nb_streams >= MAX_STREAMS){
av_log(s, AV_LOG_ERROR, "Too many streams\n");
return NULL;
}
#else
AVStream **streams;
if (s->nb_streams >= INT_MAX/sizeof(*streams))
@ -2552,11 +2558,6 @@ AVStream *av_new_stream(AVFormatContext *s, int id)
if (!streams)
return NULL;
s->streams = streams;
#else
if (s->nb_streams >= MAX_STREAMS){
av_log(s, AV_LOG_ERROR, "Too many streams\n");
return NULL;
}
#endif
st = av_mallocz(sizeof(AVStream));