]> git.sesse.net Git - vlc/blobdiff - modules/access/vcd/vcd.c
macosx: Fix crashlog opening.
[vlc] / modules / access / vcd / vcd.c
index d434d1ad516987d1d7b4ceb5311837cc846b6be1..575ff326686a9b0343a577442561414b1196f725 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>
 
-#include <vlc/vlc.h>
-#include <vlc/input.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"
 
@@ -39,20 +45,20 @@ static void Close( vlc_object_t * );
 
 #define CACHING_TEXT N_("Caching value in ms")
 #define CACHING_LONGTEXT N_( \
-    "Allows you to modify the default caching value for cdda streams. This " \
-    "value should be set in milliseconds units." )
+    "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_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_integer( "vcd-caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT,
-                 CACHING_LONGTEXT, VLC_TRUE );
+                 CACHING_LONGTEXT, true );
     add_shortcut( "vcd" );
     add_shortcut( "svcd" );
 vlc_module_end();
@@ -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;
@@ -124,6 +130,11 @@ static int Open( vlc_object_t *p_this )
         }
     }
 
+#ifdef WIN32
+    if( psz_dup[0] && psz_dup[1] == ':' &&
+        psz_dup[2] == '\\' && psz_dup[3] == '\0' ) psz_dup[2] = '\0';
+#endif
+
     /* Open VCD */
     if( !(vcddev = ioctl_Open( p_this, psz_dup )) )
     {
@@ -140,7 +151,7 @@ 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 ) );
@@ -168,8 +179,8 @@ static int Open( vlc_object_t *p_this )
     {
         input_title_t *t = p_sys->title[i] = vlc_input_title_New();
 
-        fprintf( stderr, "title[%d] start=%d\n", i, p_sys->p_sectors[1+i] );
-        fprintf( stderr, "title[%d] end=%d\n", i, p_sys->p_sectors[i+2] );
+        msg_Dbg( p_access, "title[%d] start=%d\n", i, p_sys->p_sectors[1+i] );
+        msg_Dbg( p_access, "title[%d] end=%d\n", i, p_sys->p_sectors[i+2] );
 
         t->i_size = ( p_sys->p_sectors[i+2] - p_sys->p_sectors[i+1] ) *
                     (int64_t)VCD_DATA_SIZE;
@@ -200,6 +211,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;
@@ -228,7 +240,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;
@@ -241,8 +253,8 @@ 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;
 
         /* */
@@ -309,6 +321,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
         }
 
         case ACCESS_SET_PRIVATE_ID_STATE:
+        case ACCESS_GET_CONTENT_TYPE:
             return VLC_EGENERIC;
 
         default:
@@ -337,7 +350,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;
         }
 
@@ -429,6 +442,9 @@ static int Seek( access_t *p_access, int64_t i_pos )
         p_access->info.i_seekpoint = i_seekpoint;
     }
 
+    /* Reset eof */
+    p_access->info.b_eof = false;
+
     return VLC_SUCCESS;
 }
 
@@ -491,3 +507,4 @@ static int EntryPoints( access_t *p_access )
 
     return VLC_SUCCESS;
 }
+