* -dvd_udf to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: dvd_access.c,v 1.3 2002/03/08 22:58:12 stef Exp $
+ * $Id: dvd_access.c,v 1.4 2002/03/09 13:42:46 sam Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
static int DVDOpen( struct input_thread_s *p_input )
{
char * psz_device;
- dvdcss_handle dvdhandle;
thread_dvd_data_t * p_dvd;
input_area_t * p_area;
int i;
/*
* get plugin ready
*/
- dvdhandle = dvdcss_open( psz_device );
+ p_dvd->dvdhandle = dvdcss_open( psz_device );
/* free allocated string */
free( psz_device );
-
- if( dvdhandle == NULL )
+ if( p_dvd->dvdhandle == NULL )
{
intf_ErrMsg( "dvd error: dvdcss can't open device" );
+ free( p_dvd );
return -1;
}
- p_dvd->dvdhandle = (dvdcss_handle) dvdhandle;
-
if( dvdcss_seek( p_dvd->dvdhandle, 0, DVDCSS_NOFLAGS ) < 0 )
{
intf_ErrMsg( "dvd error: %s", dvdcss_error( p_dvd->dvdhandle ) );
+ dvdcss_close( p_dvd->dvdhandle );
+ free( p_dvd );
return -1;
}
if( IfoCreate( p_dvd ) < 0 )
{
intf_ErrMsg( "dvd error: allcation error in ifo" );
+ dvdcss_close( p_dvd->dvdhandle );
free( p_dvd );
return -1;
}
{
intf_ErrMsg( "dvd error: fatal failure in ifo" );
IfoDestroy( p_dvd->p_ifo );
+ dvdcss_close( p_dvd->dvdhandle );
free( p_dvd );
return -1;
}
if( DVDSetArea( p_input, p_area ) < 0 )
{
vlc_mutex_unlock( &p_input->stream.stream_lock );
+ IfoDestroy( p_dvd->p_ifo );
+ dvdcss_close( p_dvd->dvdhandle );
+ free( p_dvd );
return -1;
}
*****************************************************************************/
static void DVDClose( struct input_thread_s *p_input )
{
- thread_dvd_data_t * p_dvd;
-
- p_dvd = (thread_dvd_data_t*)p_input->p_access_data;
+ thread_dvd_data_t *p_dvd = (thread_dvd_data_t*)p_input->p_access_data;
IfoDestroy( p_dvd->p_ifo );
-
- p_input->p_access_data = (void *)(p_dvd->dvdhandle);
+ dvdcss_close( p_dvd->dvdhandle );
free( p_dvd );
-
- /* Clean up libdvdcss */
- dvdcss_close( (dvdcss_handle) p_input->p_access_data );
}
/*****************************************************************************
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;
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;
+
+ input_BuffersEnd( p_input->p_method_data );
close( p_vcd->i_handle );
free( p_vcd );
}
*****************************************************************************/
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 );
+ ;
}