]> git.sesse.net Git - vlc/blobdiff - modules/demux/playlist/dvb.c
Remove useless test before a free (again).
[vlc] / modules / demux / playlist / dvb.c
index 91662f32dc359bfce8fd892f8c7190d8c4fb896d..1dd1461d59959788721059eec9fe8c590c97ff1b 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
-#include <vlc/input.h>
-#include <vlc/intf.h>
-#include "charset.h"
+#include <vlc_demux.h>
+#include <vlc_interface.h>
+#include <vlc_charset.h>
 
 #include "playlist.h"
 
@@ -50,11 +54,11 @@ static int ParseLine( char *, char **, char ***, int *);
 int E_(Import_DVB)( vlc_object_t *p_this )
 {
     demux_t *p_demux = (demux_t *)p_this;
-    uint8_t *p_peek;
+    const uint8_t *p_peek;
     int     i_peek;
     vlc_bool_t b_valid = VLC_FALSE;
 
-    if( !isExtension( p_demux, ".conf" ) && !p_demux->b_force )
+    if( !demux2_IsPathExtension( p_demux, ".conf" ) && !p_demux->b_force )
         return VLC_EGENERIC;
 
     /* Check if this really is a channels file */
@@ -87,6 +91,7 @@ int E_(Import_DVB)( vlc_object_t *p_this )
  *****************************************************************************/
 void E_(Close_DVB)( vlc_object_t *p_this )
 {
+    VLC_UNUSED(p_this);
 }
 
 /*****************************************************************************
@@ -118,23 +123,22 @@ static int Demux( demux_t *p_demux )
             EnsureUTF8( ppsz_options[i] );
             input_ItemAddOption( p_input, ppsz_options[i] );
         }
-        playlist_BothAddInput( p_playlist, p_input, p_item_in_category,
-                               PLAYLIST_APPEND, PLAYLIST_END );
-
+        input_ItemAddSubItem( p_current_input, p_input );
+        vlc_gc_decref( p_input );
         while( i_options-- ) free( ppsz_options[i_options] );
-        if( ppsz_options ) free( ppsz_options );
+        free( ppsz_options );
 
         free( psz_line );
     }
 
     HANDLE_PLAY_AND_RELEASE;
-    return VLC_SUCCESS;
+    return 0; /* Needed for correct operation of go back */
 }
 
 static struct
 {
-    char *psz_name;
-    char *psz_option;
+    const char *psz_name;
+    const char *psz_option;
 
 } dvb_options[] =
 {
@@ -176,6 +180,8 @@ static struct
     { "QAM_64", "dvb-modulation=64" },
     { "QAM_128", "dvb-modulation=128" },
     { "QAM_256", "dvb-modulation=256" },
+    { "8VSB", "dvb-modulation=8"  },
+    { "16VSB", "dvb-modulation=16"  },
 
     { "TRANSMISSION_MODE_AUTO", "dvb-transmission=0" },
     { "TRANSMISSION_MODE_2K", "dvb-transmission=2" },
@@ -204,7 +210,7 @@ static int ParseLine( char *psz_line, char **ppsz_name,
 
     while( psz_parse )
     {
-        char *psz_option = 0;
+        const char *psz_option = 0;
         char *psz_end = strchr( psz_parse, ':' );
         if( psz_end ) { *psz_end = 0; psz_end++; }
 
@@ -260,9 +266,10 @@ static int ParseLine( char *psz_line, char **ppsz_name,
 
         if( psz_option && pppsz_options && pi_options )
         {
-            psz_option = strdup( psz_option );
-            INSERT_ELEM( *pppsz_options, (*pi_options), (*pi_options),
-                         psz_option );
+            char *psz_dup = strdup( psz_option );
+            if (psz_dup != NULL)
+                INSERT_ELEM( *pppsz_options, (*pi_options), (*pi_options),
+                             psz_dup );
         }
 
         psz_parse = psz_end;
@@ -273,7 +280,7 @@ static int ParseLine( char *psz_line, char **ppsz_name,
     {
         /* This isn't a valid channels file, cleanup everything */
         while( (*pi_options)-- ) free( (*pppsz_options)[*pi_options] );
-        if( *pppsz_options ) free( *pppsz_options );
+        free( *pppsz_options );
         *pppsz_options = 0; *pi_options = 0;
     }
 
@@ -300,5 +307,6 @@ static int ParseLine( char *psz_line, char **ppsz_name,
 
 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;
 }