changeset 6376:91076395b8d3 libavformat

Remove use of MAX_STREAMS in MMSContext->streams[] array. Instead, dynamically allocate the array.
author rbultje
date Fri, 13 Aug 2010 17:30:01 +0000
parents 256e51c4f44b
children 7eafa931f4e4
files mms.c mms.h mmst.c
diffstat 3 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mms.c	Fri Aug 13 17:08:57 2010 +0000
+++ b/mms.c	Fri Aug 13 17:30:01 2010 +0000
@@ -99,6 +99,9 @@
             //Please see function send_stream_selection_request().
             if (mms->stream_num < MAX_STREAMS &&
                     46 + mms->stream_num * 6 < sizeof(mms->out_buffer)) {
+                mms->streams = av_fast_realloc(mms->streams,
+                                   &mms->nb_streams_allocated,
+                                   (mms->stream_num + 1) * sizeof(MMSStream));
                 mms->streams[mms->stream_num].id = stream_id;
                 mms->stream_num++;
             } else {
--- a/mms.h	Fri Aug 13 17:08:57 2010 +0000
+++ b/mms.h	Fri Aug 13 17:30:01 2010 +0000
@@ -29,7 +29,7 @@
 
 typedef struct {
     URLContext *mms_hd;                  ///< TCP connection handle
-    MMSStream streams[MAX_STREAMS];
+    MMSStream *streams;
 
     /** Buffer for outgoing packets. */
     /*@{*/
@@ -54,6 +54,7 @@
     /*@}*/
 
     int stream_num;                      ///< stream numbers.
+    unsigned int nb_streams_allocated;   ///< allocated size of streams
 } MMSContext;
 
 int ff_mms_asf_header_parser(MMSContext * mms);
--- a/mmst.c	Fri Aug 13 17:08:57 2010 +0000
+++ b/mmst.c	Fri Aug 13 17:30:01 2010 +0000
@@ -468,6 +468,7 @@
     }
 
     /* free all separately allocated pointers in mms */
+    av_free(mms->streams);
     av_free(mms->asf_header);
     av_freep(&h->priv_data);