[FFmpeg-devel] [patch]add mmsh protocol and extract common code for mmst.c

Aurelien Jacobs aurel
Mon Aug 9 18:31:56 CEST 2010


On Tue, Aug 10, 2010 at 12:05:07AM +0800, zhentan feng wrote:
> hi
> 
> [...]
> 
> +static int mmsh_open_cnx(MMSHContext *mmsh)
> +{
> +    MMSContext *mms = &mmsh->mms;
> +    int i, port, err, offset = 0;
> +    char httpname[256], path[256], host[128];
> +    char stream_selection[10 * MAX_STREAMS];

This is not acceptable. We are trying to get ride of MAX_STREAMS.
So don't add any new usage of MAX_STREAMS.

Also see what Reimar proposed for mms (please review and comment,
so that this can be commited):

Index: libavformat/mmst.c
===================================================================
--- libavformat/mmst.c  (revision 24744)
+++ libavformat/mmst.c  (working copy)
@@ -87,13 +87,15 @@
     int id;
 }MMSStream;

+#define MMS_MAX_STREAMS 20
+
 typedef struct {
     int outgoing_packet_seq;             ///< Outgoing packet sequence
     number.
     char path[256];                      ///< Path of the resource
     being asked
for.
     char host[128];                      ///< Host of the resources.

     URLContext *mms_hd;                  ///< TCP connection handle
-    MMSStream streams[MAX_STREAMS];
+    MMSStream streams[MMS_MAX_STREAMS];

     /** Buffer for outgoing packets. */
     /*@{*/
@@ -500,7 +502,7 @@
             //The second condition is for checking
             CS_PKT_STREAM_ID_REQUEST pac
ket size,
             //we can calcuate the packet size by stream_num.
             //Please see function send_stream_selection_request().
-            if (mms->stream_num < MAX_STREAMS &&
+            if (mms->stream_num < MMS_MAX_STREAMS &&
                     46 + mms->stream_num * 6 < sizeof(mms->out_buffer))
                     {
                 mms->streams[mms->stream_num].id = stream_id;
                 mms->stream_num++;


Aurel



More information about the ffmpeg-devel mailing list