Hi!

This is a patch for MPlayer that you may want to include in the 1.4 runtime! Hopefully it will be in MPlayer 1.0 because it's a very small patch. It adds a "-user-agent" option to MPlayer that let you select what User-Agent header to send when streaming over HTTP. It is needed for the 100s of radio-stations hosted by http://www.surfernetwork.com ..
SN uses a proprietary player for Windows which uses encrypted streams, but they also support iTunes for Mac-users which get unencrypted MP3-streams.


After applying the patch, try this:
$ ./mplayer http://rd1.surfernetwork.com:443/buzz/24 -user-agent "iTunes/4.0 (Macintosh; N; PPC)"


;-)

// Per Wigren

Index: cfg-common.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-common.h,v
retrieving revision 1.113
diff -u -3 -p -r1.113 cfg-common.h
--- cfg-common.h        14 Oct 2003 10:15:35 -0000      1.113
+++ cfg-common.h        14 Oct 2003 19:56:42 -0000
@@ -44,6 +44,7 @@
        
        {"prefer-ipv4", &network_prefer_ipv4, CONF_TYPE_FLAG, 0, 0, 1, NULL},   
        {"ipv4-only-proxy", &network_ipv4_only_proxy, CONF_TYPE_FLAG, 0, 0, 1, NULL},  
 
+       {"user-agent", &network_useragent, CONF_TYPE_STRING, 0, 0, 0, NULL},
 
 #ifdef HAVE_AF_INET6
        {"prefer-ipv6", &network_prefer_ipv4, CONF_TYPE_FLAG, 0, 1, 0, NULL},
@@ -270,6 +271,7 @@ extern int audio_output_channels;
 extern char *network_username;
 extern char *network_password;
 extern int   network_bandwidth;
+extern char *network_useragent;
 
 extern int network_prefer_ipv4;
 extern int network_ipv4_only_proxy;
Index: libmpdemux/network.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.c,v
retrieving revision 1.85
diff -u -3 -p -r1.85 network.c
--- libmpdemux/network.c        15 Aug 2003 19:13:23 -0000      1.85
+++ libmpdemux/network.c        14 Oct 2003 19:56:50 -0000
@@ -47,10 +47,12 @@ extern int mp_input_check_interrupt(int 
 int asf_streaming_start( stream_t *stream, int *demuxer_type );
 int rtsp_streaming_start( stream_t *stream );
 
-/* Variables for the command line option -user, -passwd & -bandwidth */
+/* Variables for the command line options -user, -passwd, -bandwidth 
+   and -user-agent */
 char *network_username=NULL;
 char *network_password=NULL;
 int   network_bandwidth=0;
+char *network_useragent="MPlayer/"VERSION;
 
 /* IPv6 options */
 int   network_prefer_ipv4 = 0;
@@ -443,7 +445,8 @@ http_send_request( URL_t *url ) {
        }
        snprintf(str, 80, "Host: %s", server_url->hostname );
        http_set_field( http_hdr, str);
-       http_set_field( http_hdr, "User-Agent: MPlayer/"VERSION);
+       snprintf(str, 80, "User-Agent: %s", network_useragent );
+       http_set_field( http_hdr, str);
        http_set_field( http_hdr, "Connection: closed");
        http_add_basic_authentication( http_hdr, url->username, url->password );
        if( http_build_request( http_hdr )==NULL ) {

Reply via email to