[FFmpeg-devel] [PATCH 02/16] lavf: remove FF_API_MAX_STREAMS cruft

Anton Khirnov anton
Thu Feb 3 16:36:29 CET 2011


---
 ffmpeg.c               |    2 --
 ffserver.c             |    6 ------
 libavformat/avformat.h |    8 --------
 libavformat/mms.c      |    4 ----
 libavformat/mpegts.c   |    5 -----
 libavformat/nutdec.c   |    4 ----
 libavformat/utils.c    |    8 --------
 libavformat/version.h  |    3 ---
 8 files changed, 0 insertions(+), 40 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index fac6063..488f701 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -111,9 +111,7 @@ typedef struct AVChapterMap {
 static const OptionDef options[];
 
 #define MAX_FILES 100
-#if !FF_API_MAX_STREAMS
 #define MAX_STREAMS 1024    /* arbitrary sanity check value */
-#endif
 
 static const char *last_asked_format = NULL;
 static AVFormatContext *input_files[MAX_FILES];
diff --git a/ffserver.c b/ffserver.c
index 9a32408..73c64ad 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -92,9 +92,7 @@ static const char *http_state[] = {
     "RTSP_SEND_PACKET",
 };
 
-#if !FF_API_MAX_STREAMS
 #define MAX_STREAMS 20
-#endif
 
 #define IOBUFFER_INIT_SIZE 8192
 
@@ -2942,11 +2940,9 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
         snprintf(avc->filename, 1024, "rtp://0.0.0.0");
     }
 
-#if !FF_API_MAX_STREAMS
     if (avc->nb_streams >= INT_MAX/sizeof(*avc->streams) ||
         !(avc->streams = av_malloc(avc->nb_streams * sizeof(*avc->streams))))
         goto sdp_done;
-#endif
     if (avc->nb_streams >= INT_MAX/sizeof(*avs) ||
         !(avs = av_malloc(avc->nb_streams * sizeof(*avs))))
         goto sdp_done;
@@ -2959,9 +2955,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
     avf_sdp_create(&avc, 1, *pbuffer, 2048);
 
  sdp_done:
-#if !FF_API_MAX_STREAMS
     av_free(avc->streams);
-#endif
     av_metadata_free(&avc->metadata);
     av_free(avc);
     av_free(avs);
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index f9f9be5..b177b6a 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -666,10 +666,6 @@ typedef struct AVChapter {
     AVMetadata *metadata;
 } AVChapter;
 
-#if FF_API_MAX_STREAMS
-#define MAX_STREAMS 20
-#endif
-
 /**
  * Format I/O context.
  * New fields can be added to the end with minor version bumps.
@@ -685,11 +681,7 @@ typedef struct AVFormatContext {
     void *priv_data;
     ByteIOContext *pb;
     unsigned int nb_streams;
-#if FF_API_MAX_STREAMS
-    AVStream *streams[MAX_STREAMS];
-#else
     AVStream **streams;
-#endif
     char filename[1024]; /**< input or output filename */
     /* stream info */
     int64_t timestamp;
diff --git a/libavformat/mms.c b/libavformat/mms.c
index d995a43..4ae6581 100644
--- a/libavformat/mms.c
+++ b/libavformat/mms.c
@@ -24,11 +24,7 @@
 #include "asf.h"
 #include "libavutil/intreadwrite.h"
 
-#if FF_API_MAX_STREAMS
-#define MMS_MAX_STREAMS MAX_STREAMS
-#else
 #define MMS_MAX_STREAMS 256    /**< arbitrary sanity check value */
-#endif
 
 int ff_mms_read_header(MMSContext *mms, uint8_t *buf, const int size)
 {
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 8467e85..b1c5518 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -677,11 +677,6 @@ static int mpegts_push_data(MpegTSFilter *filter,
                         code == 0x1be) /* padding_stream */
                         goto skip;
 
-#if FF_API_MAX_STREAMS
-                    if (!pes->st && pes->stream->nb_streams == MAX_STREAMS)
-                        goto skip;
-#endif
-
                     /* stream not present in PMT */
                     if (!pes->st) {
                         pes->st = av_new_stream(ts->stream, pes->pid);
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index a574108..1892a3e 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -29,11 +29,7 @@
 #undef NDEBUG
 #include <assert.h>
 
-#if FF_API_MAX_STREAMS
-#define NUT_MAX_STREAMS MAX_STREAMS
-#else
 #define NUT_MAX_STREAMS 256    /* arbitrary sanity check value */
-#endif
 
 static int get_str(ByteIOContext *bc, char *string, unsigned int maxlen){
     unsigned int len= ff_get_v(bc);
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 4f51c26..ba640cf 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2602,13 +2602,6 @@ AVStream *av_new_stream(AVFormatContext *s, int id)
 {
     AVStream *st;
     int i;
-
-#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))
@@ -2617,7 +2610,6 @@ AVStream *av_new_stream(AVFormatContext *s, int id)
     if (!streams)
         return NULL;
     s->streams = streams;
-#endif
 
     st = av_mallocz(sizeof(AVStream));
     if (!st)
diff --git a/libavformat/version.h b/libavformat/version.h
index 864e886..d6c4b25 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -41,9 +41,6 @@
  * Those FF_API_* defines are not part of public API.
  * They may change, break or disappear at any time.
  */
-#ifndef FF_API_MAX_STREAMS
-#define FF_API_MAX_STREAMS             (LIBAVFORMAT_VERSION_MAJOR < 53)
-#endif
 #ifndef FF_API_OLD_METADATA
 #define FF_API_OLD_METADATA            (LIBAVFORMAT_VERSION_MAJOR < 53)
 #endif
-- 
1.7.2.3




More information about the ffmpeg-devel mailing list