]> git.sesse.net Git - vlc/blobdiff - plugins/vcd/input_vcd.c
* ./extras/MacOSX_dvdioctl: removed outdated files.
[vlc] / plugins / vcd / input_vcd.c
index 8f7418646e20c03ed8de4757604f91998cb830f9..fa850ba7c5e2aa6af189645016d34ff2c870ea00 100644 (file)
 
 #include <fcntl.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <string.h>
 #include <errno.h>
 
-#ifdef STRNCASECMP_IN_STRINGS_H
-#   include <strings.h>
-#endif
-
 #if defined( WIN32 )
 #   include <io.h>                                                 /* read() */
 #else
@@ -167,7 +164,7 @@ static int VCDOpen( struct input_thread_s *p_input )
             free( psz_orig );
             return -1;
         }
-        psz_source = config_GetPszVariable( INPUT_VCD_DEVICE_VAR );
+        psz_source = config_GetPszVariable( "vcd_device" );
     }
 
     /* test the type of file given */
@@ -238,8 +235,9 @@ static int VCDOpen( struct input_thread_s *p_input )
 
     p_vcd->p_sectors = ioctl_GetSectors( p_vcd->i_handle,
                                          psz_source );
-    if ( p_vcd->p_sectors == NULL )
+    if( p_vcd->p_sectors == NULL )
     {
+        input_BuffersEnd( p_input->p_method_data );
         close( p_vcd->i_handle );
         free( p_vcd );
         return -1;
@@ -282,19 +280,17 @@ static int VCDOpen( struct input_thread_s *p_input )
     vlc_mutex_unlock( &p_input->stream.stream_lock );
 
     p_input->psz_demux = "vcd";
-    
+
     return 0;
 }
 
-    
-
 /*****************************************************************************
  * VCDClose: closes vcd
  *****************************************************************************/
 static void VCDClose( struct input_thread_s *p_input )
 {
-    thread_vcd_data_t *     p_vcd
-        = (thread_vcd_data_t *)p_input->p_access_data;
+    thread_vcd_data_t *p_vcd = (thread_vcd_data_t *)p_input->p_access_data;
+
     close( p_vcd->i_handle );
     free( p_vcd );
 }
@@ -458,6 +454,11 @@ static int VCDInit( input_thread_t * p_input )
 {
     es_descriptor_t *       p_es;
     
+    if( p_input->stream.i_method != INPUT_METHOD_VCD )
+    {
+        return -1;
+    }
+
     vlc_mutex_lock( &p_input->stream.stream_lock );
     
     /* Set program information. */
@@ -498,13 +499,7 @@ static int VCDInit( input_thread_t * p_input )
  *****************************************************************************/
 static void VCDEnd( input_thread_t * p_input )
 {
-    thread_vcd_data_t *     p_vcd;
-
-    input_BuffersEnd( p_input->p_method_data );
-
-    p_vcd = (thread_vcd_data_t*)p_input->p_access_data;
-
-    free( p_vcd );
+    ;
 }