]> git.sesse.net Git - vlc/blobdiff - modules/access/mms/mmstu.c
MMS: remove debug warn about ACCESS_GET_META
[vlc] / modules / access / mms / mmstu.c
index 326b4313fef103e7034326a821d36167002bfba7..3e3b76940a72205e35383bbeabf979cadeef33e4 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * mms.c: MMS access plug-in
+ * mmstu.c: MMS access plug-in
  *****************************************************************************
  * Copyright (C) 2001, 2002 the VideoLAN team
  * $Id$
@@ -106,7 +106,7 @@ int  MMSTUOpen( access_t *p_access )
     vlc_mutex_init( &p_sys->lock_netwrite );
 
     /* *** Parse URL and get server addr/port and path *** */
-    vlc_UrlParse( &p_sys->url, p_access->psz_path, 0 );
+    vlc_UrlParse( &p_sys->url, p_access->psz_location, 0 );
     if( p_sys->url.psz_host == NULL || *p_sys->url.psz_host == '\0' )
     {
         msg_Err( p_access, "invalid server name" );
@@ -253,7 +253,8 @@ static int Control( access_t *p_access, int i_query, va_list args )
         /* */
         case ACCESS_GET_PTS_DELAY:
             pi_64 = (int64_t*)va_arg( args, int64_t * );
-            *pi_64 = (int64_t)var_GetInteger( p_access, "mms-caching" ) * INT64_C(1000);
+            *pi_64 = INT64_C(1000)
+                   * var_InheritInteger( p_access, "network-caching" );
             break;
 
         case ACCESS_GET_PRIVATE_ID_STATE:
@@ -285,6 +286,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
         case ACCESS_SET_SEEKPOINT:
         case ACCESS_SET_PRIVATE_ID_STATE:
         case ACCESS_GET_CONTENT_TYPE:
+        case ACCESS_GET_META:
             return VLC_EGENERIC;
 
 
@@ -455,7 +457,7 @@ static int MMSOpen( access_t  *p_access, vlc_url_t *p_url, int  i_proto )
     int           b_udp = ( i_proto == MMS_PROTO_UDP ) ? 1 : 0;
 
     var_buffer_t buffer;
-    char         tmp[4096];
+    char         *tmp;
     uint16_t     *p;
     int          i_server_version;
     int          i_tool_version;
@@ -531,11 +533,18 @@ static int MMSOpen( access_t  *p_access, vlc_url_t *p_url, int  i_proto )
     var_buffer_initwrite( &buffer, 0 );
     var_buffer_add16( &buffer, 0x001c );
     var_buffer_add16( &buffer, 0x0003 );
-    sprintf( tmp,
+    if( asprintf( &tmp,
              "NSPlayer/7.0.0.1956; {"GUID_FMT"}; Host: %s",
              GUID_PRINT( p_sys->guid ),
-             p_url->psz_host );
-    var_buffer_addUTF16( &buffer, tmp );
+             p_url->psz_host ) < 0 )
+    {
+        var_buffer_free( &buffer );
+        net_Close( p_sys->i_handle_tcp );
+        return VLC_ENOMEM;
+    }
+
+    var_buffer_addUTF16( p_access, &buffer, tmp );
+    free( tmp );
 
     mms_CommandSend( p_access,
                      0x01,          /* connexion request */
@@ -588,17 +597,28 @@ static int MMSOpen( access_t  *p_access, vlc_url_t *p_url, int  i_proto )
     var_buffer_add32( &buffer, 0x00000002 );
     if( b_udp )
     {
-        sprintf( tmp,
-                 "\\\\%s\\UDP\\%d",
-                 p_sys->sz_bind_addr,
-                 7000 ); // FIXME
+        if( asprintf( &tmp,
+                    "\\\\%s\\UDP\\%d",
+                    p_sys->sz_bind_addr,
+                    7000 ) < 0) // FIXME
+        {
+            var_buffer_free( &buffer );
+            MMSClose( p_access );
+            return VLC_EGENERIC;
+        }
     }
     else
     {
-        sprintf( tmp, "\\\\192.168.0.1\\TCP\\1242"  );
+        if( asprintf( &tmp, "\\\\192.168.0.1\\TCP\\1242" ) < 0 )
+        {
+            var_buffer_free( &buffer );
+            MMSClose( p_access );
+            return VLC_EGENERIC;
+        }
     }
-    var_buffer_addUTF16( &buffer, tmp );
+    var_buffer_addUTF16( p_access, &buffer, tmp );
     var_buffer_add16( &buffer, '0' );
+    free( tmp );
 
     mms_CommandSend( p_access,
                      0x02,          /* connexion request */
@@ -628,11 +648,11 @@ static int MMSOpen( access_t  *p_access, vlc_url_t *p_url, int  i_proto )
 
     /* media file path shouldn't start with / character */
     mediapath = p_url->psz_path;
-    if ( *mediapath == '/' )
+    if ( mediapath && *mediapath == '/' )
     {
         mediapath++;
     }
-    var_buffer_addUTF16( &buffer, mediapath );
+    var_buffer_addUTF16( p_access, &buffer, mediapath );
 
     mms_CommandSend( p_access,
                      0x05,
@@ -799,7 +819,7 @@ static int MMSOpen( access_t  *p_access, vlc_url_t *p_url, int  i_proto )
             {
                 var_buffer_add16( &buffer, 0x0000 );
                 msg_Info( p_access,
-                          "selecting stream[0x%x] %s (%d kb/s)",
+                          "selecting stream[0x%x] %s (%d Kib/s)",
                           i,
                           ( p_sys->asfh.stream[i].i_cat == ASF_STREAM_AUDIO  ) ?
                                                   "audio" : "video" ,
@@ -809,7 +829,7 @@ static int MMSOpen( access_t  *p_access, vlc_url_t *p_url, int  i_proto )
             {
                 var_buffer_add16( &buffer, 0x0002 );
                 msg_Info( p_access,
-                          "ignoring stream[0x%x] %s (%d kb/s)",
+                          "ignoring stream[0x%x] %s (%d Kib/s)",
                           i,
                           ( p_sys->asfh.stream[i].i_cat == ASF_STREAM_AUDIO  ) ?
                                     "audio" : "video" ,
@@ -1554,6 +1574,7 @@ static int mms_HeaderMediaRead( access_t *p_access, int i_type )
     return -1;
 }
 
+VLC_NORETURN
 static void *KeepAliveThread( void *p_data )
 {
     access_t *p_access = p_data;