]> git.sesse.net Git - vlc/blobdiff - modules/demux/nsc.c
input: Expose input_ItemHasErrorWhenReading.
[vlc] / modules / demux / nsc.c
index ca509f8e957d9f03ddd66a83634728754a1b1d77..c889af9a8e3f321e2a127ec9fd2e043c24649e17 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <ctype.h>
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_demux.h>
-#include <vlc_playlist.h>
 
+#include <ctype.h>
 #define MAX_LINE 16024
 
 /*****************************************************************************
@@ -40,10 +43,10 @@ static int  DemuxOpen  ( vlc_object_t * );
 static void DemuxClose ( vlc_object_t * );
 
 vlc_module_begin();
-    set_description( _("Windows Media NSC metademux") );
+    set_description( N_("Windows Media NSC metademux") );
     set_category( CAT_INPUT );
     set_subcategory( SUBCAT_INPUT_DEMUX );
-    set_capability( "demux2", 2 );
+    set_capability( "demux", 3 );
     set_callbacks( DemuxOpen, DemuxClose );
 vlc_module_end();
 
@@ -210,10 +213,7 @@ static char *nscdec( vlc_object_t *p_demux, char* p_encoded )
     buf16_size = length;
     buf16 = malloc( buf16_size );
     if( buf16 == NULL )
-    {
-        msg_Err( p_demux, "out of memory" );
         return NULL;
-    }
 
     for( i = 0; i < length; i++ )
     {
@@ -229,7 +229,6 @@ static char *nscdec( vlc_object_t *p_demux, char* p_encoded )
     buf8 = malloc( buf8_size + 1 );
     if( buf8 == NULL )
     {
-        msg_Err( p_demux, "out of memory" );
         free( buf16 );
         return NULL;
     }
@@ -265,7 +264,7 @@ static char *nscdec( vlc_object_t *p_demux, char* p_encoded )
 static int DemuxOpen( 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 NSC file */
@@ -319,7 +318,7 @@ static int ParseLine ( demux_t *p_demux, char *psz_line )
     }
     *psz_value = '\0';
     psz_value++;
-    
     if( !strncasecmp( psz_value, "0x", 2 ) )
     {
         int i_value;
@@ -338,7 +337,7 @@ static int ParseLine ( demux_t *p_demux, char *psz_line )
         if( psz_out )
         {
             msg_Dbg( p_demux, "%s = %s", psz_bol, psz_out );
-            if( psz_out) free( psz_out );
+            free( psz_out );
         }
     }
     return VLC_SUCCESS;
@@ -356,7 +355,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 );
     }
     return VLC_SUCCESS;
 }