]> git.sesse.net Git - vlc/blobdiff - modules/demux/playlist/sgimb.c
sgimb: Don't use playlist code.
[vlc] / modules / demux / playlist / sgimb.c
index 1564f89bfe5140378a7abdd48b1273f96ffb1adf..6a8d4d677dffe2903ed975c24c1596dafec07321 100644 (file)
@@ -81,7 +81,7 @@
  * AutoStart=True
  *     Start playing automatically
  * DeliveryService=cds
- *     Simulcasted (scheduled unicast) content. (Green dot in Kasenna web interface) 
+ *     Simulcasted (scheduled unicast) content. (Green dot in Kasenna web interface)
  * sgiShowingName=A nice name that everyone likes
  *     A human readible descriptive title for this stream.
  * sgiSid=2311
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#define _GNU_SOURCE
-#include <stdlib.h>                                      /* malloc(), free() */
 
-#include <vlc/vlc.h>
-#include <vlc/input.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_demux.h>
 #include "playlist.h"
 
 /*****************************************************************************
@@ -123,8 +125,8 @@ struct demux_sys_t
     mtime_t     i_duration;     /* sgiDuration= */
     int         i_port;         /* sgiRtspPort= */
     int         i_sid;          /* sgiSid= */
-    vlc_bool_t  b_concert;      /* DeliveryService=cds */
-    vlc_bool_t  b_rtsp_kasenna; /* kasenna style RTSP */
+    bool  b_concert;      /* DeliveryService=cds */
+    bool  b_rtsp_kasenna; /* kasenna style RTSP */
 };
 
 static int Demux ( demux_t *p_demux );
@@ -133,10 +135,10 @@ static int Control( demux_t *p_demux, int i_query, va_list args );
 /*****************************************************************************
  * Activate: initializes m3u demux structures
  *****************************************************************************/
-int E_(Import_SGIMB)( vlc_object_t * p_this )
+int Import_SGIMB( vlc_object_t * p_this )
 {
     demux_t *p_demux = (demux_t *)p_this;
-    byte_t *p_peek;
+    const uint8_t *p_peek;
     int i_size;
 
     /* Lets check the content to see if this is a sgi mediabase file */
@@ -165,9 +167,9 @@ int E_(Import_SGIMB)( vlc_object_t * p_this )
             p_demux->p_sys->i_duration = 0;
             p_demux->p_sys->i_port = 0;
             p_demux->p_sys->i_sid = 0;
-            p_demux->p_sys->b_rtsp_kasenna = VLC_FALSE;
-            p_demux->p_sys->b_concert = VLC_FALSE;
-            
+            p_demux->p_sys->b_rtsp_kasenna = false;
+            p_demux->p_sys->b_concert = false;
             return VLC_SUCCESS;
         }
     }
@@ -177,24 +179,17 @@ int E_(Import_SGIMB)( vlc_object_t * p_this )
 /*****************************************************************************
  * Deactivate: frees unused data
  *****************************************************************************/
-void E_(Close_SGIMB)( vlc_object_t *p_this )
+void Close_SGIMB( vlc_object_t *p_this )
 {
     demux_t *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys = p_demux->p_sys;
-    if( p_sys->psz_uri )
-        free( p_sys->psz_uri );
-    if( p_sys->psz_server )
-        free( p_sys->psz_server );
-    if( p_sys->psz_location )
-        free( p_sys->psz_location );
-    if( p_sys->psz_name )
-        free( p_sys->psz_name );
-    if( p_sys->psz_user )
-        free( p_sys->psz_user );
-    if( p_sys->psz_password )
-        free( p_sys->psz_password );
-    if( p_sys->psz_mcast_ip )
-        free( p_sys->psz_mcast_ip );
+    free( p_sys->psz_uri );
+    free( p_sys->psz_server );
+    free( p_sys->psz_location );
+    free( p_sys->psz_name );
+    free( p_sys->psz_user );
+    free( p_sys->psz_password );
+    free( p_sys->psz_mcast_ip );
     free( p_demux->p_sys );
     return;
 }
@@ -263,7 +258,7 @@ static int ParseLine ( demux_t *p_demux, char *psz_line )
     {
         psz_bol += sizeof("sgiFormatName=") - 1;
         if( strcasestr( psz_bol, "MPEG-4") == NULL ) /*not mpeg4 found in string */
-            p_sys->b_rtsp_kasenna = VLC_TRUE;
+            p_sys->b_rtsp_kasenna = true;
     }
     else if( !strncasecmp( psz_bol, "sgiMulticastAddress=", sizeof("sgiMulticastAddress=") - 1 ) )
     {
@@ -297,7 +292,7 @@ static int ParseLine ( demux_t *p_demux, char *psz_line )
     }
     else if( !strncasecmp( psz_bol, "DeliveryService=cds", sizeof("DeliveryService=cds") - 1 ) )
     {
-        p_sys->b_concert = VLC_TRUE;
+        p_sys->b_concert = true;
     }
     else
     {
@@ -323,7 +318,7 @@ static int Demux ( demux_t *p_demux )
     while( ( psz_line = stream_ReadLine( p_demux->s ) ) )
     {
         ParseLine( p_demux, psz_line );
-        if( psz_line ) free( psz_line );
+        free( psz_line );
     }
 
     if( p_sys->psz_mcast_ip )
@@ -333,7 +328,7 @@ static int Demux ( demux_t *p_demux )
         char *temp;
 
         asprintf( &temp, "udp://@" "%s:%i", p_sys->psz_mcast_ip, p_sys->i_mcast_port );
-        if( p_sys->psz_uri ) free( p_sys->psz_uri );
+        free( p_sys->psz_uri );
         p_sys->psz_uri = strdup( temp );
         free( temp );
     }
@@ -372,17 +367,17 @@ static int Demux ( demux_t *p_demux )
         free( temp );
     }
 
-    p_child = input_ItemNewWithType( (vlc_object_t *)p_playlist, p_sys->psz_uri,
+    p_child = input_ItemNewWithType( p_demux, p_sys->psz_uri,
                       p_sys->psz_name ? p_sys->psz_name : p_sys->psz_uri,
                       0, NULL, p_sys->i_duration, ITEM_TYPE_NET );
-    
     if( !p_child )
     {
         msg_Err( p_demux, "A valid playlistitem could not be created" );
-        return VLC_EGENERIC;
+        return -1;
     }
 
-    input_ItemCopyOptions( p_current->p_input, p_child );
+    input_ItemCopyOptions( p_current_input, p_child );
     if( p_sys->i_packet_size && p_sys->psz_mcast_ip )
     {
         char *psz_option;
@@ -406,14 +401,15 @@ static int Demux ( demux_t *p_demux )
         free( psz_option );
     }
 
-    playlist_BothAddInput( p_playlist, p_child, p_item_in_category,
-                           PLAYLIST_APPEND, PLAYLIST_END );
+    input_ItemAddSubItem( p_current_input, p_child );
+    vlc_gc_decref( p_child );
     HANDLE_PLAY_AND_RELEASE
-    return VLC_SUCCESS;
+    return 0; /* Needed for correct operation of go back */
 }
 
 static int Control( demux_t *p_demux, int i_query, va_list args )
 {
+    VLC_UNUSED(p_demux); VLC_UNUSED(i_query); VLC_UNUSED(args);
     return VLC_EGENERIC;
 }