]> git.sesse.net Git - vlc/blobdiff - modules/access/vcd/vcd.c
Trailing ;
[vlc] / modules / access / vcd / vcd.c
index 943272f4e7a08f95ec006ac16f09d24d56fb077c..4747221462ae95309f02e296a5b5cdc30ac90616 100644 (file)
  * Preamble
  *****************************************************************************/
 
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_input.h>
 #include <vlc_access.h>
+#include <vlc_charset.h>
 
 #include "cdrom.h"
 
@@ -42,20 +48,20 @@ static void Close( vlc_object_t * );
     "Caching value for VCDs. This " \
     "value should be set in milliseconds." )
 
-vlc_module_begin();
-    set_shortname( _("VCD"));
-    set_description( _("VCD input") );
-    set_capability( "access2", 60 );
-    set_callbacks( Open, Close );
-    set_category( CAT_INPUT );
-    set_subcategory( SUBCAT_INPUT_ACCESS );
+vlc_module_begin ()
+    set_shortname( N_("VCD"))
+    set_description( N_("VCD input") )
+    set_capability( "access", 60 )
+    set_callbacks( Open, Close )
+    set_category( CAT_INPUT )
+    set_subcategory( SUBCAT_INPUT_ACCESS )
 
-    add_usage_hint( N_("[vcd:][device][@[title][,[chapter]]]") );
+    add_usage_hint( N_("[vcd:][device][@[title][,[chapter]]]") )
     add_integer( "vcd-caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT,
-                 CACHING_LONGTEXT, VLC_TRUE );
-    add_shortcut( "vcd" );
-    add_shortcut( "svcd" );
-vlc_module_end();
+                 CACHING_LONGTEXT, true )
+    add_shortcut( "vcd" )
+    add_shortcut( "svcd" )
+vlc_module_end ()
 
 /*****************************************************************************
  * Local prototypes
@@ -90,7 +96,7 @@ static int Open( vlc_object_t *p_this )
 {
     access_t     *p_access = (access_t *)p_this;
     access_sys_t *p_sys;
-    char *psz_dup = strdup( p_access->psz_path );
+    char *psz_dup = ToLocaleDup( p_access->psz_path );
     char *psz;
     int i_title = 0;
     int i_chapter = 0;
@@ -145,11 +151,12 @@ static int Open( vlc_object_t *p_this )
     p_access->info.i_update = 0;
     p_access->info.i_size = 0;
     p_access->info.i_pos = 0;
-    p_access->info.b_eof = VLC_FALSE;
+    p_access->info.b_eof = false;
     p_access->info.i_title = 0;
     p_access->info.i_seekpoint = 0;
-    p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) );
-    memset( p_sys, 0, sizeof( access_sys_t ) );
+    p_access->p_sys = p_sys = calloc( 1, sizeof( access_sys_t ) );
+    if( !p_sys )
+        goto error;
     p_sys->vcddev = vcddev;
 
     /* We read the Table Of Content information */
@@ -205,6 +212,7 @@ static int Open( vlc_object_t *p_this )
     p_access->info.i_pos = ( p_sys->i_sector - p_sys->p_sectors[1+i_title] ) *
         VCD_DATA_SIZE;
 
+    free( p_access->psz_demux );
     p_access->psz_demux = strdup( "ps" );
 
     return VLC_SUCCESS;
@@ -233,7 +241,7 @@ static void Close( vlc_object_t *p_this )
 static int Control( access_t *p_access, int i_query, va_list args )
 {
     access_sys_t *p_sys = p_access->p_sys;
-    vlc_bool_t   *pb_bool;
+    bool   *pb_bool;
     int          *pi_int;
     int64_t      *pi_64;
     input_title_t ***ppp_title;
@@ -246,16 +254,11 @@ static int Control( access_t *p_access, int i_query, va_list args )
         case ACCESS_CAN_FASTSEEK:
         case ACCESS_CAN_PAUSE:
         case ACCESS_CAN_CONTROL_PACE:
-            pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
-            *pb_bool = VLC_TRUE;
+            pb_bool = (bool*)va_arg( args, bool* );
+            *pb_bool = true;
             break;
 
         /* */
-        case ACCESS_GET_MTU:
-            pi_int = (int*)va_arg( args, int * );
-            *pi_int = VCD_DATA_ONCE;
-            break;
-
         case ACCESS_GET_PTS_DELAY:
             pi_64 = (int64_t*)va_arg( args, int64_t * );
             *pi_64 = var_GetInteger( p_access, "vcd-caching" ) * 1000;
@@ -343,7 +346,7 @@ static block_t *Block( access_t *p_access )
     {
         if( p_access->info.i_title + 2 >= p_sys->i_titles )
         {
-            p_access->info.b_eof = VLC_TRUE;
+            p_access->info.b_eof = true;
             return NULL;
         }
 
@@ -436,7 +439,7 @@ static int Seek( access_t *p_access, int64_t i_pos )
     }
 
     /* Reset eof */
-    p_access->info.b_eof = VLC_FALSE;
+    p_access->info.b_eof = false;
 
     return VLC_SUCCESS;
 }