]> git.sesse.net Git - vlc/blobdiff - modules/demux/sgimb.c
* modules/demux/demux2.c: added v4l.
[vlc] / modules / demux / sgimb.c
index b6e75838aa4d7271986244d209532a38f984b747..8fba62c7c997f8093e5ab013864b46adb42414e9 100644 (file)
@@ -107,34 +107,36 @@ static int Activate( vlc_object_t * p_this )
     byte_t *p_peek;
     int i_size;
 
-    p_demux->pf_demux = Demux;
-    p_demux->pf_control = Control;
-    p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
-    p_sys->psz_uri = NULL;
-    p_sys->psz_server = NULL;
-    p_sys->psz_location = NULL;
-    p_sys->psz_name = NULL;
-    p_sys->psz_user = NULL;
-    p_sys->psz_password = NULL;
-    p_sys->psz_mcast_ip = NULL;
-    p_sys->i_mcast_port = 0;
-    p_sys->i_packet_size = 0;
-    p_sys->i_duration = (mtime_t)0;
-    p_sys->i_port = 0;
-
-
     /* Lets check the content to see if this is a sgi mediabase file */
     i_size = stream_Peek( p_demux->s, &p_peek, MAX_LINE );
     i_size -= sizeof("sgiNameServerHost=") - 1;
-    if ( i_size > 0 ) {
-        while ( i_size
-            && strncasecmp( p_peek, "sgiNameServerHost=", sizeof("sgiNameServerHost=") - 1 ) )
+    if ( i_size > 0 )
+    {
+        while ( i_size && strncasecmp( p_peek, "sgiNameServerHost=",
+                                       sizeof("sgiNameServerHost=") - 1 ) )
         {
             p_peek++;
             i_size--;
         }
-        if ( !strncasecmp( p_peek, "sgiNameServerHost=", sizeof("sgiNameServerHost=") -1 ) )
+        if ( !strncasecmp( p_peek, "sgiNameServerHost=",
+                           sizeof("sgiNameServerHost=") -1 ) )
         {
+            p_demux->pf_demux = Demux;
+            p_demux->pf_control = Control;
+
+            p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
+            p_sys->psz_uri = NULL;
+            p_sys->psz_server = NULL;
+            p_sys->psz_location = NULL;
+            p_sys->psz_name = NULL;
+            p_sys->psz_user = NULL;
+            p_sys->psz_password = NULL;
+            p_sys->psz_mcast_ip = NULL;
+            p_sys->i_mcast_port = 0;
+            p_sys->i_packet_size = 0;
+            p_sys->i_duration = 0;
+            p_sys->i_port = 0;
+
             return VLC_SUCCESS;
         }
     }
@@ -293,8 +295,8 @@ static int Demux ( demux_t *p_demux )
     {
         char *temp;
 
-        temp = (char *)malloc( sizeof("udp/ts2://@000.000.000.000:123456789" ) );
-        sprintf( temp, "udp/ts2://@" "%s:%i", p_sys->psz_mcast_ip, p_sys->i_mcast_port );
+        temp = (char *)malloc( sizeof("udp://@000.000.000.000:123456789" ) );
+        sprintf( temp, "udp://@" "%s:%i", p_sys->psz_mcast_ip, p_sys->i_mcast_port );
         if( p_sys->psz_uri ) free( p_sys->psz_uri );
         p_sys->psz_uri = strdup( temp );
         free( temp );
@@ -326,9 +328,9 @@ static int Demux ( demux_t *p_demux )
 
     if( p_sys->i_packet_size && p_sys->psz_mcast_ip )
     {
-        char *psz_option = (char *) malloc( 20 );
+        char *psz_option;
         p_sys->i_packet_size += 1000;
-        sprintf( psz_option, "mtu=%i", p_sys->i_packet_size );
+        asprintf( &psz_option, "mtu=%i", p_sys->i_packet_size );
         playlist_ItemAddOption( p_item, psz_option );
         free( psz_option );
     }