[SCM] libav/experimental: add new streams API without MAX_STREAMS limit (disabled until next major bump)

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 17:17:10 UTC 2013


The following commit has been merged in the experimental branch:
commit 38aab35f47c3c7a559c3180568695c6ad21d62ac
Author: Aurelien Jacobs <aurel at gnuage.org>
Date:   Wed Oct 6 20:56:14 2010 +0000

    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

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index d55a446..4a46a36 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -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;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 2776a0f..73f89a0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2543,11 +2543,21 @@ AVStream *av_new_stream(AVFormatContext *s, int id)
 {
     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)

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list