[MPlayer-dev-eng] Re: [PATCH] of asf_mmst_streaming to only receive the resquested streams

daurat daurat at tiscali.fr
Thu Jan 20 21:37:07 CET 2005


Attached a better patch.

I simply add the option:

-mms-streams-rejected <ID1,ID2,...> (network only)
 asks  the remote host to not send the specified streams (not supported by all
 the servers).

If the option is not used then it causes no change, so no problem with
the bad servers.

For example, I have a tv channel with one audio stream (id=1) at 60 bps
and video in 3 streams id=2 at 1100bps, id=3 at 600bps, id=4 at 300bps
Then the network usage of the following commands are:

mplayer URL                                      # 2060 bps
mplayer -mms-streams-rejected 2,3 URL            #  360 bps
mplayer -mms-streams-rejected 2,3,4 -novideo URL #   60 bps
mplayer -mms-streams-rejected 1,2,3 -nosound URL #  300 bps
mplayer -dumpstream -mms-streams-rejected 2      #  960 bps

after the last command, you can of course do:
"mplayer -vid ID stream.dump" with ID=3,4

Alain
-------------- next part --------------
Index: cfg-common.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-common.h,v
retrieving revision 1.138
diff -u -r1.138 cfg-common.h
--- cfg-common.h	19 Jan 2005 18:05:03 -0000	1.138
+++ cfg-common.h	20 Jan 2005 20:29:33 -0000
@@ -56,6 +56,7 @@
 #else
 	{"prefer-ipv6", "MPlayer was compiled without IPv6 support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
 #endif
+	{"mms-streams-rejected", &mms_streams_rejected, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
 
 #else
 	{"user", "MPlayer was compiled without streaming (network) support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
@@ -312,6 +313,7 @@
 extern int network_prefer_ipv4;
 extern int network_ipv4_only_proxy;
 
+extern char **mms_streams_rejected;
 #endif
 
 extern float a52_drc_level;
Index: libmpdemux/asf_mmst_streaming.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/asf_mmst_streaming.c,v
retrieving revision 1.27
diff -u -r1.27 asf_mmst_streaming.c
--- libmpdemux/asf_mmst_streaming.c	20 Jan 2005 13:22:53 -0000	1.27
+++ libmpdemux/asf_mmst_streaming.c	20 Jan 2005 20:29:33 -0000
@@ -473,6 +473,8 @@
 
 }
 
+char **mms_streams_rejected = NULL;
+
 int
 asf_mmst_streaming_seek( int fd, off_t pos, streaming_ctrl_t *streaming_ctrl ) 
 {
@@ -493,6 +495,7 @@
   char                *path, *unescpath;
   URL_t *url1 = stream->streaming_ctrl->url;
   int s = stream->fd;
+  char **idrej;
 
   if( s>0 ) {
 	  closesocket( stream->fd );
@@ -609,6 +612,26 @@
     data [ (i-1) * 6 + 4 ] = stream_ids[i];
     data [ (i-1) * 6 + 5 ] = 0x00;
   }
+  
+  idrej=mms_streams_rejected;
+  while(idrej && *idrej) {
+    char *end;
+    long id;
+    id=strtol(*idrej, &end, 0);
+    if(*end) {
+      mp_msg(MSGT_FIXME,MSGL_WARN,"Invalid mms_streams_rejected: %s\n",*idrej);
+      idrej++;
+      continue;
+    }
+    for (i=0; i<num_stream_ids; i++)
+      if(stream_ids[i]==id) {
+	data [i*6] = 0x02;
+	break;
+      }
+    if(i==num_stream_ids)
+      mp_msg(MSGT_FIXME,MSGL_WARN,"Invalid mms_streams_rejected: %s\n",*idrej);
+    idrej++;
+  }
 
   send_command (s, 0x33, num_stream_ids, 0xFFFF | stream_ids[0] << 16, (num_stream_ids-1)*6+2 , data);
 
Index: DOCS/man/en/mplayer.1
===================================================================
RCS file: /cvsroot/mplayer/main/DOCS/man/en/mplayer.1,v
retrieving revision 1.860
diff -u -r1.860 mplayer.1
--- DOCS/man/en/mplayer.1	20 Jan 2005 17:40:25 -0000	1.860
+++ DOCS/man/en/mplayer.1	20 Jan 2005 20:29:35 -0000
@@ -991,6 +991,11 @@
 .PD 1
 .
 .TP
+.B \-mms-streams-rejected <ID1,ID2,...> (network only)
+asks the remote host to not send the specified streams
+(not supported by all the servers).
+.
+.TP
 .B \-ni (AVI only)
 Force usage of non-interleaved AVI parser (fixes playback
 of some bad AVI files).


More information about the MPlayer-dev-eng mailing list