mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
add new streams API without MAX_STREAMS limit
(disabled until next major bump) Originally committed as revision 25381 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
feb2440c38
commit
38aab35f47
@ -672,7 +672,11 @@ typedef struct AVFormatContext {
|
|||||||
void *priv_data;
|
void *priv_data;
|
||||||
ByteIOContext *pb;
|
ByteIOContext *pb;
|
||||||
unsigned int nb_streams;
|
unsigned int nb_streams;
|
||||||
|
#if LIBAVFORMAT_VERSION_MAJOR < 53
|
||||||
AVStream *streams[MAX_STREAMS];
|
AVStream *streams[MAX_STREAMS];
|
||||||
|
#else
|
||||||
|
AVStream **streams;
|
||||||
|
#endif
|
||||||
char filename[1024]; /**< input or output filename */
|
char filename[1024]; /**< input or output filename */
|
||||||
/* stream info */
|
/* stream info */
|
||||||
int64_t timestamp;
|
int64_t timestamp;
|
||||||
|
@ -2543,11 +2543,21 @@ AVStream *av_new_stream(AVFormatContext *s, int id)
|
|||||||
{
|
{
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
int i;
|
int i;
|
||||||
|
#if LIBAVFORMAT_VERSION_MAJOR >= 53
|
||||||
|
AVStream **streams;
|
||||||
|
|
||||||
|
if (s->nb_streams >= INT_MAX/sizeof(*streams))
|
||||||
|
return NULL;
|
||||||
|
streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams));
|
||||||
|
if (!streams)
|
||||||
|
return NULL;
|
||||||
|
s->streams = streams;
|
||||||
|
#else
|
||||||
if (s->nb_streams >= MAX_STREAMS){
|
if (s->nb_streams >= MAX_STREAMS){
|
||||||
av_log(s, AV_LOG_ERROR, "Too many streams\n");
|
av_log(s, AV_LOG_ERROR, "Too many streams\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
st = av_mallocz(sizeof(AVStream));
|
st = av_mallocz(sizeof(AVStream));
|
||||||
if (!st)
|
if (!st)
|
||||||
|
Loading…
Reference in New Issue
Block a user