[FFmpeg-cvslog] r25381 - in trunk/libavformat: avformat.h utils.c

aurel subversion
Wed Oct 6 22:56:14 CEST 2010


Author: aurel
Date: Wed Oct  6 22:56:14 2010
New Revision: 25381

Log:
add new streams API without MAX_STREAMS limit
(disabled until next major bump)

Modified:
   trunk/libavformat/avformat.h
   trunk/libavformat/utils.c

Modified: trunk/libavformat/avformat.h
==============================================================================
--- trunk/libavformat/avformat.h	Wed Oct  6 22:52:26 2010	(r25380)
+++ trunk/libavformat/avformat.h	Wed Oct  6 22:56:14 2010	(r25381)
@@ -672,7 +672,11 @@ typedef struct AVFormatContext {
     void *priv_data;
     ByteIOContext *pb;
     unsigned int nb_streams;
+#if LIBAVFORMAT_VERSION_MAJOR < 53
     AVStream *streams[MAX_STREAMS];
+#else
+    AVStream **streams;
+#endif
     char filename[1024]; /**< input or output filename */
     /* stream info */
     int64_t timestamp;

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	Wed Oct  6 22:52:26 2010	(r25380)
+++ trunk/libavformat/utils.c	Wed Oct  6 22:56:14 2010	(r25381)
@@ -2543,11 +2543,21 @@ AVStream *av_new_stream(AVFormatContext 
 {
     AVStream *st;
     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){
         av_log(s, AV_LOG_ERROR, "Too many streams\n");
         return NULL;
     }
+#endif
 
     st = av_mallocz(sizeof(AVStream));
     if (!st)



More information about the ffmpeg-cvslog mailing list