Commit dceb5b62 authored by Gildas Bazin's avatar Gildas Bazin

* modules/access/vcd/*, modules/access/cdda.c: changed ioctl_ReadSector() into ioctl_ReadSectors(), a function that can read multiple sectors at a time.
  Modified the cdda plugin to read 20 sectors at a time. This was necessary because it was overkill to read the data sectors by sectors and was creating problems under Windows.
parent 9349da54
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* cdda.c : CD digital audio input module for vlc * cdda.c : CD digital audio input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000 VideoLAN * Copyright (C) 2000 VideoLAN
* $Id: cdda.c,v 1.1 2003/05/17 20:30:31 gbazin Exp $ * $Id: cdda.c,v 1.2 2003/05/18 15:44:03 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@netcourrier.com>
...@@ -240,6 +240,9 @@ static int CDDAOpen( vlc_object_t *p_this ) ...@@ -240,6 +240,9 @@ static int CDDAOpen( vlc_object_t *p_this )
p_input->pf_set_area = CDDASetArea; p_input->pf_set_area = CDDASetArea;
p_input->pf_set_program = CDDASetProgram; p_input->pf_set_program = CDDASetProgram;
/* Update default_pts to a suitable value for cdda access */
p_input->i_pts_delay = config_GetInt( p_input, "cdda-caching" ) * 1000;
return 0; return 0;
} }
...@@ -277,16 +280,15 @@ static int CDDARead( input_thread_t * p_input, byte_t * p_buffer, ...@@ -277,16 +280,15 @@ static int CDDARead( input_thread_t * p_input, byte_t * p_buffer,
i_blocks = i_len / CDDA_DATA_SIZE; i_blocks = i_len / CDDA_DATA_SIZE;
for ( i_index = 0; i_index < i_blocks; i_index++ ) if ( ioctl_ReadSectors( VLC_OBJECT(p_input), p_cdda->vcddev,
p_cdda->i_sector, p_buffer, i_blocks, CDDA_TYPE ) < 0 )
{ {
if ( ioctl_ReadSector( VLC_OBJECT(p_input), p_cdda->vcddev, msg_Err( p_input, "could not read sector %d", p_cdda->i_sector );
p_cdda->i_sector, p_buffer + i_index * CDDA_DATA_SIZE, return -1;
CDDA_DATA_START, CDDA_DATA_SIZE ) < 0 ) }
{
msg_Err( p_input, "could not read sector %d", p_cdda->i_sector );
return -1;
}
for ( i_index = 0; i_index < i_blocks; i_index++ )
{
p_cdda->i_sector ++; p_cdda->i_sector ++;
if ( p_cdda->i_sector == p_cdda->p_sectors[p_cdda->i_track + 1] ) if ( p_cdda->i_sector == p_cdda->p_sectors[p_cdda->i_track + 1] )
{ {
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* cdrom.h: cdrom tools header * cdrom.h: cdrom tools header
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: cdrom.h,v 1.5 2003/05/17 20:30:31 gbazin Exp $ * $Id: cdrom.h,v 1.6 2003/05/18 15:44:03 gbazin Exp $
* *
* Authors: Johan Bilien <jobi@via.ecp.fr> * Authors: Johan Bilien <jobi@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@netcourrier.com>
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#define CDDA_TYPE 0
#define VCD_TYPE 1
/* where the data start on a VCD sector */ /* where the data start on a VCD sector */
#define VCD_DATA_START 24 #define VCD_DATA_START 24
/* size of the availablr data on a VCD sector */ /* size of the availablr data on a VCD sector */
...@@ -90,5 +93,5 @@ typedef struct entries_sect_s ...@@ -90,5 +93,5 @@ typedef struct entries_sect_s
vcddev_t *ioctl_Open ( vlc_object_t *, const char * ); vcddev_t *ioctl_Open ( vlc_object_t *, const char * );
void ioctl_Close ( vlc_object_t *, vcddev_t * ); void ioctl_Close ( vlc_object_t *, vcddev_t * );
int ioctl_GetTracksMap ( vlc_object_t *, const vcddev_t *, int ** ); int ioctl_GetTracksMap ( vlc_object_t *, const vcddev_t *, int ** );
int ioctl_ReadSector ( vlc_object_t *, const vcddev_t *, int ioctl_ReadSectors ( vlc_object_t *, const vcddev_t *,
int, byte_t *, size_t, size_t ); int, byte_t *, int, int );
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* cdrom_internals.h: cdrom tools private header * cdrom_internals.h: cdrom tools private header
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: cdrom_internals.h,v 1.1 2003/05/17 20:30:31 gbazin Exp $ * $Id: cdrom_internals.h,v 1.2 2003/05/18 15:44:03 gbazin Exp $
* *
* Authors: Johan Bilien <jobi@via.ecp.fr> * Authors: Johan Bilien <jobi@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@netcourrier.com>
...@@ -134,7 +134,9 @@ typedef struct __RAW_READ_INFO { ...@@ -134,7 +134,9 @@ typedef struct __RAW_READ_INFO {
#define READ_CD 0xbe #define READ_CD 0xbe
#define SECTOR_TYPE_MODE2_FORM2 0x14 #define SECTOR_TYPE_MODE2_FORM2 0x14
#define SECTOR_TYPE_CDDA 0x04
#define READ_CD_RAW_MODE2 0xF0 #define READ_CD_RAW_MODE2 0xF0
#define READ_CD_USERDATA 0x10
#define READ_TOC 0x43 #define READ_TOC 0x43
#define READ_TOC_FORMAT_TOC 0x0 #define READ_TOC_FORMAT_TOC 0x0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vcd.c : VCD input module for vlc * vcd.c : VCD input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000 VideoLAN * Copyright (C) 2000 VideoLAN
* $Id: vcd.c,v 1.20 2003/05/17 20:30:31 gbazin Exp $ * $Id: vcd.c,v 1.21 2003/05/18 15:44:03 gbazin Exp $
* *
* Author: Johan Bilien <jobi@via.ecp.fr> * Author: Johan Bilien <jobi@via.ecp.fr>
* *
...@@ -297,9 +297,9 @@ static int VCDRead( input_thread_t * p_input, byte_t * p_buffer, ...@@ -297,9 +297,9 @@ static int VCDRead( input_thread_t * p_input, byte_t * p_buffer,
for ( i_index = 0 ; i_index < i_blocks ; i_index++ ) for ( i_index = 0 ; i_index < i_blocks ; i_index++ )
{ {
if ( ioctl_ReadSector( VLC_OBJECT(p_input), p_vcd->vcddev, if ( ioctl_ReadSectors( VLC_OBJECT(p_input), p_vcd->vcddev,
p_vcd->i_sector, p_buffer + i_index * VCD_DATA_SIZE, p_vcd->i_sector, p_buffer + i_index * VCD_DATA_SIZE, 1,
VCD_DATA_START, VCD_DATA_SIZE ) < 0 ) VCD_TYPE ) < 0 )
{ {
msg_Err( p_input, "could not read sector %d", p_vcd->i_sector ); msg_Err( p_input, "could not read sector %d", p_vcd->i_sector );
return -1; return -1;
...@@ -351,9 +351,8 @@ static int VCDRead( input_thread_t * p_input, byte_t * p_buffer, ...@@ -351,9 +351,8 @@ static int VCDRead( input_thread_t * p_input, byte_t * p_buffer,
if ( i_len % VCD_DATA_SIZE ) /* this should not happen */ if ( i_len % VCD_DATA_SIZE ) /* this should not happen */
{ {
if ( ioctl_ReadSector( VLC_OBJECT(p_input), p_vcd->vcddev, if ( ioctl_ReadSectors( VLC_OBJECT(p_input), p_vcd->vcddev,
p_vcd->i_sector, p_last_sector, VCD_DATA_START, p_vcd->i_sector, p_last_sector, 1, VCD_TYPE ) < 0 )
VCD_DATA_SIZE ) < 0 )
{ {
msg_Err( p_input, "could not read sector %d", p_vcd->i_sector ); msg_Err( p_input, "could not read sector %d", p_vcd->i_sector );
return -1; return -1;
...@@ -499,8 +498,8 @@ static int VCDEntryPoints( input_thread_t * p_input ) ...@@ -499,8 +498,8 @@ static int VCDEntryPoints( input_thread_t * p_input )
return -1; return -1;
} }
if( ioctl_ReadSector( VLC_OBJECT(p_input), p_vcd->vcddev, if( ioctl_ReadSectors( VLC_OBJECT(p_input), p_vcd->vcddev,
VCD_ENTRIES_SECTOR, p_sector, VCD_DATA_START, VCD_DATA_SIZE ) < 0 ) VCD_ENTRIES_SECTOR, p_sector, 1, VCD_TYPE ) < 0 )
{ {
msg_Err( p_input, "could not read entry points sector" ); msg_Err( p_input, "could not read entry points sector" );
free( p_sector ); free( p_sector );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment