Commit d1cbbc19 authored by Laurent Aimar's avatar Laurent Aimar

* cdda: converted to access2. It seems stable.

 * access2: added/fixed title support.
parent 4d342851
...@@ -56,6 +56,9 @@ vlc_module_begin(); ...@@ -56,6 +56,9 @@ vlc_module_begin();
add_shortcut( "rtp" ); add_shortcut( "rtp" );
add_shortcut( "rtp4" ); add_shortcut( "rtp4" );
add_shortcut( "rtp6" ); add_shortcut( "rtp6" );
add_shortcut( "cdda" );
add_shortcut( "cddasimple" );
vlc_module_end(); vlc_module_end();
/***************************************************************************** /*****************************************************************************
...@@ -123,6 +126,11 @@ static int Access2Open( vlc_object_t * p_this ) ...@@ -123,6 +126,11 @@ static int Access2Open( vlc_object_t * p_this )
p_input->pf_set_area = Access2SetArea; p_input->pf_set_area = Access2SetArea;
p_input->pf_access_control = Access2Control; p_input->pf_access_control = Access2Control;
p_input->p_access_data = (access_sys_t*)p_sys; p_input->p_access_data = (access_sys_t*)p_sys;
p_sys->p_access = p_access;
p_sys->p_block = NULL;
p_sys->b_first_read = VLC_TRUE;
/* mtu */ /* mtu */
access2_Control( p_access, ACCESS_GET_MTU, &i_int ); access2_Control( p_access, ACCESS_GET_MTU, &i_int );
p_input->i_mtu = i_int; p_input->i_mtu = i_int;
...@@ -151,8 +159,11 @@ static int Access2Open( vlc_object_t * p_this ) ...@@ -151,8 +159,11 @@ static int Access2Open( vlc_object_t * p_this )
int64_t i_start = 0; int64_t i_start = 0;
int i; int i;
/* Initialize ES structures */
input_InitStream( p_input, 0 );
#define area p_input->stream.pp_areas #define area p_input->stream.pp_areas
for( i = 0 ; i <= p_sys->i_title ; i++ ) for( i = 0 ; i < p_sys->i_title ; i++ )
{ {
input_title_t *t = p_sys->title[i]; input_title_t *t = p_sys->title[i];
...@@ -168,7 +179,7 @@ static int Access2Open( vlc_object_t * p_this ) ...@@ -168,7 +179,7 @@ static int Access2Open( vlc_object_t * p_this )
#undef area #undef area
/* Set the area */ /* Set the area */
Access2SetArea( p_input, p_input->stream.pp_areas[1] ); Access2SetArea( p_input, p_input->stream.pp_areas[1+p_access->info.i_title] );
} }
/* size */ /* size */
...@@ -188,11 +199,6 @@ static int Access2Open( vlc_object_t * p_this ) ...@@ -188,11 +199,6 @@ static int Access2Open( vlc_object_t * p_this )
p_input->stream.p_selected_area->i_tell = p_access->info.i_pos; p_input->stream.p_selected_area->i_tell = p_access->info.i_pos;
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
p_sys->p_access = p_access;
p_sys->p_block = NULL;
p_sys->b_first_read = VLC_TRUE;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -288,6 +294,23 @@ update: ...@@ -288,6 +294,23 @@ update:
} }
p_sys->b_first_read = VLC_FALSE; p_sys->b_first_read = VLC_FALSE;
} }
/* Title change */
if( p_access->info.i_update & INPUT_UPDATE_TITLE )
{
vlc_value_t val;
msg_Dbg( p_input, "INPUT_UPDATE_TITLE" );
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.p_selected_area = p_input->stream.pp_areas[p_access->info.i_title+1];
p_input->stream.b_changed = VLC_TRUE;
vlc_mutex_unlock( &p_input->stream.stream_lock );
val.i_int = p_access->info.i_title+1;
var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL );
p_access->info.i_update &= ~INPUT_UPDATE_TITLE;
}
/* Size change */
if( p_access->info.i_update & INPUT_UPDATE_SIZE ) if( p_access->info.i_update & INPUT_UPDATE_SIZE )
{ {
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
...@@ -298,11 +321,6 @@ update: ...@@ -298,11 +321,6 @@ update:
p_access->info.i_update &= ~INPUT_UPDATE_SIZE; p_access->info.i_update &= ~INPUT_UPDATE_SIZE;
} }
if( p_access->info.i_update & INPUT_UPDATE_TITLE )
{
/* TODO */
msg_Err( p_input, "INPUT_UPDATE_TITLE to do" );
}
if( p_access->info.i_update & INPUT_UPDATE_SEEKPOINT ) if( p_access->info.i_update & INPUT_UPDATE_SEEKPOINT )
{ {
/* TODO */ /* TODO */
...@@ -318,36 +336,34 @@ update: ...@@ -318,36 +336,34 @@ update:
****************************************************************************/ ****************************************************************************/
static int Access2SetArea( input_thread_t * p_input, input_area_t * p_area ) static int Access2SetArea( input_thread_t * p_input, input_area_t * p_area )
{ {
#if 0 access2_sys_t *p_sys = (access2_sys_t*)p_input->p_access_data;
access_sys_t *p_sys = p_input->p_access_data; access_t *p_access = p_sys->p_access;
vlc_value_t val; vlc_value_t val;
/* we can't use the interface slider until initilization is complete */ /* we can't use the interface slider until initilization is complete */
p_input->stream.b_seekable = 0; p_input->stream.b_seekable = 0;
if( p_area != p_input->stream.p_selected_area ) if( p_area != p_input->stream.p_selected_area )
{ {
/* Change the default area */ /* Call access2 control */
p_input->stream.p_selected_area = p_area; if( access2_Control( p_access, ACCESS_SET_TITLE, (int)(p_area->i_id - 1) ) )
return VLC_EGENERIC;
/* Change the current track */ /* Change the default area */
p_sys->i_track = p_area->i_id - 1; p_input->stream.p_selected_area = p_input->stream.pp_areas[p_access->info.i_title+1];
p_sys->i_sector = p_sys->p_sectors[p_sys->i_track]; p_input->stream.p_selected_area->i_tell = p_access->info.i_pos;
/* Update the navigation variables without triggering a callback */ /* Update the navigation variables without triggering a callback */
val.i_int = p_area->i_id; val.i_int = p_access->info.i_title+1;;
var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL ); var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL );
}
p_sys->i_sector = p_sys->p_sectors[p_sys->i_track]; /* Clear the flag */
p_access->info.i_update &= ~INPUT_UPDATE_TITLE;
p_input->stream.p_selected_area->i_tell = }
(off_t)p_sys->i_sector * (off_t)CDDA_DATA_SIZE
- p_input->stream.p_selected_area->i_start;
/* warn interface that something has changed */ /* warn interface that something has changed */
p_input->stream.b_seekable = 1; p_input->stream.b_seekable = VLC_TRUE;
p_input->stream.b_changed = 1; p_input->stream.b_changed = VLC_TRUE;
#endif
return VLC_EGENERIC; return VLC_EGENERIC;
} }
......
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
/***************************************************************************** /*****************************************************************************
* Module descriptior * Module descriptior
*****************************************************************************/ *****************************************************************************/
static int AccessOpen ( vlc_object_t * ); static int Open ( vlc_object_t * );
static void AccessClose( vlc_object_t * ); static void Close( vlc_object_t * );
#define CACHING_TEXT N_("Caching value in ms") #define CACHING_TEXT N_("Caching value in ms")
#define CACHING_LONGTEXT N_( \ #define CACHING_LONGTEXT N_( \
...@@ -50,8 +50,8 @@ vlc_module_begin(); ...@@ -50,8 +50,8 @@ vlc_module_begin();
add_integer( "cdda-caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT, add_integer( "cdda-caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT,
CACHING_LONGTEXT, VLC_TRUE ); CACHING_LONGTEXT, VLC_TRUE );
set_capability( "access", 70 ); set_capability( "access2", 10 );
set_callbacks( AccessOpen, AccessClose ); set_callbacks( Open, Close );
add_shortcut( "cdda" ); add_shortcut( "cdda" );
add_shortcut( "cddasimple" ); add_shortcut( "cddasimple" );
vlc_module_end(); vlc_module_end();
...@@ -67,157 +67,126 @@ vlc_module_end(); ...@@ -67,157 +67,126 @@ vlc_module_end();
struct access_sys_t struct access_sys_t
{ {
vcddev_t *vcddev; /* vcd device descriptor */ vcddev_t *vcddev; /* vcd device descriptor */
int i_nb_tracks; /* Nb of tracks (titles) */
int i_track; /* Current track */ /* Title infos */
int i_titles;
input_title_t *title[99]; /* No more that 99 track in a cd-audio */
/* */
int i_sector; /* Current Sector */ int i_sector; /* Current Sector */
int * p_sectors; /* Track sectors */ int * p_sectors; /* Track sectors */
vlc_bool_t b_end_of_track; /* If the end of track was reached */
WAVEHEADER waveheader; /* Wave header for the output data */ /* Wave header for the output data */
int i_header_pos; WAVEHEADER waveheader;
}; };
static int Read ( input_thread_t *, byte_t *, size_t ); static block_t *Block( access_t * );
static void Seek ( input_thread_t *, off_t ); static int Seek( access_t *, int64_t );
static int SetArea ( input_thread_t *, input_area_t * ); static int Control( access_t *, int, va_list );
static int SetProgram( input_thread_t *, pgrm_descriptor_t * );
/***************************************************************************** /*****************************************************************************
* AccessOpen: open cdda * Open: open cdda
*****************************************************************************/ *****************************************************************************/
static int AccessOpen( vlc_object_t *p_this ) static int Open( vlc_object_t *p_this )
{ {
input_thread_t * p_input = (input_thread_t *)p_this; access_t *p_access = (access_t*)p_this;
access_sys_t * p_sys; access_sys_t *p_sys;
char * psz_orig; char *psz_dup = strdup( p_access->psz_path );
char * psz_parser; char *psz;
char * psz_source; int i;
int i; int i_title = 0;
input_area_t * p_area; vcddev_t *vcddev;
int i_title = 1; vlc_value_t val;
vcddev_t *vcddev;
/* Command line: cdda://[dev_path][@title] */
/* parse the options passed in command line : */ if( ( psz = strchr( psz_dup, '@' ) ) )
psz_orig = psz_parser = psz_source = strdup( p_input->psz_name );
if( !psz_orig )
{ {
return( -1 ); *psz++ = '\0';
}
while( *psz_parser && *psz_parser != '@' ) i_title = strtol( psz, NULL, 0 );
{
psz_parser++;
} }
if( *psz_parser == '@' ) if( *psz_dup == '\0' )
{ {
/* Found options */ free( psz_dup );
*psz_parser = '\0';
++psz_parser;
i_title = (int)strtol( psz_parser, NULL, 10 ); /* Only when selected */
i_title = i_title ? i_title : 1; if( *p_access->psz_access == '\0' )
} return VLC_EGENERIC;
if( !*psz_source )
{ var_Create( p_access, "cd-audio", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
/* No source specified, so figure it out. */ var_Get( p_access, "cd-audio", &val );
if( !p_input->psz_access ) psz_dup = val.psz_string;
if( *psz_dup == '\0' )
{ {
free( psz_orig ); free( psz_dup );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
psz_source = config_GetPsz( p_input, "cd-audio" );
if( !psz_source ) return -1;
} }
/* Open CDDA */ /* Open CDDA */
if( !(vcddev = ioctl_Open( p_this, psz_source )) ) if( (vcddev = ioctl_Open( VLC_OBJECT(p_access), psz_dup )) == NULL )
{
msg_Warn( p_input, "could not open %s", psz_source );
free( psz_source );
return VLC_EGENERIC;
}
free( psz_source );
p_input->p_access_data = p_sys = malloc( sizeof(access_sys_t) );
if( p_sys == NULL )
{ {
msg_Err( p_input, "out of memory" ); msg_Warn( p_access, "could not open %s", psz_dup );
free( psz_source ); free( psz_dup );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
free( psz_dup );
/* Set up p_access */
p_access->pf_read = NULL;
p_access->pf_block = Block;
p_access->pf_control = Control;
p_access->pf_seek = Seek;
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.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_sys->vcddev = vcddev; p_sys->vcddev = vcddev;
p_input->i_mtu = CDDA_DATA_ONCE;
/* We read the Table Of Content information */ /* We read the Table Of Content information */
p_sys->i_nb_tracks = ioctl_GetTracksMap( VLC_OBJECT(p_input), p_sys->i_titles = ioctl_GetTracksMap( VLC_OBJECT(p_access),
p_sys->vcddev, &p_sys->p_sectors ); p_sys->vcddev, &p_sys->p_sectors );
if( p_sys->i_nb_tracks < 0 ) if( p_sys->i_titles < 0 )
{ {
msg_Err( p_input, "unable to count tracks" ); msg_Err( p_access, "unable to count tracks" );
goto error;
} }
else if( p_sys->i_nb_tracks <= 0 ) else if( p_sys->i_titles <= 0 )
{ {
msg_Err( p_input, "no audio tracks found" ); msg_Err( p_access, "no audio tracks found" );
goto error;
} }
if( p_sys->i_nb_tracks <= 0 ) /* Build title table */
for( i = 0; i < p_sys->i_titles; i++ )
{ {
ioctl_Close( p_this, p_sys->vcddev ); input_title_t *t = p_sys->title[i] = vlc_input_title_New();
free( p_sys );
return VLC_EGENERIC;
}
if( i_title >= p_sys->i_nb_tracks || i_title < 1 ) fprintf( stderr, "title[%d] start=%d\n", i, p_sys->p_sectors[i] );
{ fprintf( stderr, "title[%d] end=%d\n", i, p_sys->p_sectors[i+1] );
i_title = 1;
}
/* Set stream and area data */ t->i_size = sizeof( WAVEHEADER ) +
vlc_mutex_lock( &p_input->stream.stream_lock ); ( p_sys->p_sectors[i+1] - p_sys->p_sectors[i] ) *
(int64_t)CDDA_DATA_SIZE;
/* Initialize ES structures */ t->i_length = I64C(1000000) * t->i_size / 44100 / 4;
input_InitStream( p_input, 0 );
/* cdda input method */
p_input->stream.i_method = INPUT_METHOD_CDDA;
p_input->stream.b_pace_control = 1;
p_input->stream.b_seekable = 1;
p_input->stream.i_mux_rate = 44100 * 4 / 50;
#define area p_input->stream.pp_areas
for( i = 1 ; i <= p_sys->i_nb_tracks ; i++ )
{
input_AddArea( p_input, i, 1 );
/* Absolute start offset and size */
area[i]->i_start =
(off_t)p_sys->p_sectors[i-1] * (off_t)CDDA_DATA_SIZE;
area[i]->i_size =
(off_t)(p_sys->p_sectors[i] - p_sys->p_sectors[i-1])
* (off_t)CDDA_DATA_SIZE;
} }
#undef area
p_area = p_input->stream.pp_areas[i_title];
SetArea( p_input, p_area );
vlc_mutex_unlock( &p_input->stream.stream_lock ); /* Starting title and sector */
if( i_title >= p_sys->i_titles )
p_input->pf_read = Read; i_title = 0;
p_input->pf_seek = Seek; p_sys->i_sector = p_sys->p_sectors[i_title];
p_input->pf_set_area = SetArea; p_access->info.i_title = i_title;
p_input->pf_set_program = SetProgram; p_access->info.i_size = p_sys->title[i_title]->i_size;
/* Update default_pts to a suitable value for cdda access */
p_input->i_pts_delay = config_GetInt( p_input, "cdda-caching" ) * 1000;
/* Build a WAV header for the output data */ /* Build a WAV header for the output data */
memset( &p_sys->waveheader, 0, sizeof(WAVEHEADER) ); memset( &p_sys->waveheader, 0, sizeof(WAVEHEADER) );
...@@ -236,146 +205,229 @@ static int AccessOpen( vlc_object_t *p_this ) ...@@ -236,146 +205,229 @@ static int AccessOpen( vlc_object_t *p_this )
2*16/8 /*BytesPerSample*/ * 44100 /*SampleFreq*/ ); 2*16/8 /*BytesPerSample*/ * 44100 /*SampleFreq*/ );
p_sys->waveheader.DataChunkID = VLC_FOURCC('d', 'a', 't', 'a'); p_sys->waveheader.DataChunkID = VLC_FOURCC('d', 'a', 't', 'a');
p_sys->waveheader.DataLength = 0; /* we just don't know */ p_sys->waveheader.DataLength = 0; /* we just don't know */
p_sys->i_header_pos = 0;
/* Pts delay */
var_Create( p_access, "cdda-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
return VLC_SUCCESS; return VLC_SUCCESS;
error:
ioctl_Close( VLC_OBJECT(p_access), p_sys->vcddev );
free( p_sys );
return VLC_EGENERIC;
} }
/***************************************************************************** /*****************************************************************************
* AccessClose: closes cdda * Close: closes cdda
*****************************************************************************/ *****************************************************************************/
static void AccessClose( vlc_object_t *p_this ) static void Close( vlc_object_t *p_this )
{ {
input_thread_t *p_input = (input_thread_t *)p_this; access_t *p_access = (access_t *)p_this;
access_sys_t *p_sys = p_input->p_access_data; access_sys_t *p_sys = p_access->p_sys;
int i;
for( i = 0; i < p_sys->i_titles; i++ )
{
vlc_input_title_Delete( p_sys->title[i] );
}
ioctl_Close( p_this, p_sys->vcddev ); ioctl_Close( p_this, p_sys->vcddev );
free( p_sys ); free( p_sys );
} }
/***************************************************************************** /*****************************************************************************
* Read: reads from the CDDA into PES packets. * Block: read data (CDDA_DATA_ONCE)
*****************************************************************************
* Returns -1 in case of error, 0 in case of EOF, otherwise the number of
* bytes.
*****************************************************************************/ *****************************************************************************/
static int Read( input_thread_t * p_input, byte_t * p_buffer, size_t i_len ) static block_t *Block( access_t *p_access )
{ {
access_sys_t *p_sys = p_input->p_access_data; access_sys_t *p_sys = p_access->p_sys;
int i_blocks = i_len / CDDA_DATA_SIZE; block_t *p_block;
int i_read = 0; int i_blocks;
int i_index; int i_read;
int i;
if( p_access->info.b_eof )
return NULL;
if( !p_sys->i_header_pos ) if( p_access->info.i_pos < sizeof( WAVEHEADER ) )
{ {
p_sys->i_header_pos = sizeof(WAVEHEADER); /* Return only the header */
i_blocks = (i_len - sizeof(WAVEHEADER)) / CDDA_DATA_SIZE; p_block = block_New( p_access, sizeof( WAVEHEADER ) );
memcpy( p_buffer, &p_sys->waveheader, sizeof(WAVEHEADER) ); memcpy( p_block->p_buffer, &p_sys->waveheader, sizeof(WAVEHEADER) );
p_buffer += sizeof(WAVEHEADER);
i_read += sizeof(WAVEHEADER); p_block->i_buffer -= p_access->info.i_pos;
p_block->p_buffer += p_access->info.i_pos;
p_access->info.i_pos += p_block->i_buffer;
return p_block;
} }
if( ioctl_ReadSectors( VLC_OBJECT(p_input), p_sys->vcddev, p_sys->i_sector, /* Read raw data */
p_buffer, i_blocks, CDDA_TYPE ) < 0 ) i_blocks = CDDA_BLOCKS_ONCE;
if( p_sys->i_sector + i_blocks >= p_sys->p_sectors[p_access->info.i_title + 1 ] )
{ {
msg_Err( p_input, "could not read sector %d", p_sys->i_sector ); i_blocks = p_sys->p_sectors[p_access->info.i_title + 1 ] - p_sys->i_sector;
return -1; if( i_blocks <= 0 ) i_blocks = 1; /* Should never occur */
} }
for( i_index = 0; i_index < i_blocks; i_index++ ) p_block = block_New( p_access, i_blocks * CDDA_DATA_SIZE );
{
p_sys->i_sector ++;
if( p_sys->i_sector == p_sys->p_sectors[p_sys->i_track + 1] )
{
input_area_t *p_area;
if ( p_sys->i_track >= p_sys->i_nb_tracks - 1 ) if( ioctl_ReadSectors( VLC_OBJECT(p_access), p_sys->vcddev, p_sys->i_sector,
{ p_block->p_buffer, i_blocks, CDDA_TYPE ) < 0 )
return 0; /* EOF */ {
} msg_Err( p_access, "cannot read a sector" );
block_Release( p_block );
vlc_mutex_lock( &p_input->stream.stream_lock ); p_block = NULL;
p_area = p_input->stream.pp_areas[ i_blocks = 1; /* Next sector */
p_input->stream.p_selected_area->i_id + 1 ]; }
msg_Dbg( p_input, "new title" ); i_read = 0;
for( i = 0; i < i_blocks; i++ )
{
/* A good sector read */
i_read++;
p_sys->i_sector++;
p_area->i_part = 1; /* Check end of title */
SetArea( p_input, p_area ); if( p_sys->i_sector >= p_sys->p_sectors[p_access->info.i_title + 1] )
vlc_mutex_unlock( &p_input->stream.stream_lock ); {
if( p_access->info.i_title + 1 >= p_sys->i_titles )
{
p_access->info.b_eof = VLC_TRUE;
break;
}
p_access->info.i_update |= INPUT_UPDATE_TITLE|INPUT_UPDATE_SIZE;
p_access->info.i_title++;
p_access->info.i_size = p_sys->title[p_access->info.i_title]->i_size;
p_access->info.i_pos = sizeof( WAVEHEADER );
} }
i_read += CDDA_DATA_SIZE;
} }
if ( i_len % CDDA_DATA_SIZE ) /* this should not happen */ if( i_read <= 0 )
{ {
msg_Err( p_input, "must read full sectors" ); block_Release( p_block );
return NULL;
} }
return i_read; if( p_block )
} {
int i_skip = ( p_access->info.i_pos - sizeof( WAVEHEADER ) ) % CDDA_DATA_SIZE;
/***************************************************************************** /* Really read data */
* SetProgram: Does nothing since a CDDA is mono_program p_block->i_buffer = i_read * CDDA_DATA_SIZE;
*****************************************************************************/ /* */
static int SetProgram( input_thread_t * p_input, p_block->i_buffer -= i_skip;
pgrm_descriptor_t * p_program) p_block->p_buffer += i_skip;
{
return VLC_EGENERIC; p_access->info.i_pos += p_block->i_buffer;
}
return p_block;
} }
/***************************************************************************** /****************************************************************************
* SetArea: initialize input data for title x. * Seek
* It should be called for each user navigation request.
****************************************************************************/ ****************************************************************************/
static int SetArea( input_thread_t * p_input, input_area_t * p_area ) static int Seek( access_t *p_access, int64_t i_pos )
{ {
access_sys_t *p_sys = p_input->p_access_data; access_sys_t * p_sys = p_access->p_sys;
vlc_value_t val;
/* we can't use the interface slider until initilization is complete */ p_access->info.i_pos = i_pos;
p_input->stream.b_seekable = 0;
if( p_area != p_input->stream.p_selected_area ) if( i_pos >= sizeof( WAVEHEADER ) )
{ {
/* Change the default area */ /* Fix sector */
p_input->stream.p_selected_area = p_area; p_sys->i_sector = p_sys->p_sectors[p_access->info.i_title] +
( i_pos - sizeof( WAVEHEADER ) ) / (int64_t)CDDA_DATA_SIZE;
/* Change the current track */ if( p_sys->i_sector >= p_sys->p_sectors[p_access->info.i_title + 1] )
p_sys->i_track = p_area->i_id - 1; {
p_sys->i_sector = p_sys->p_sectors[p_sys->i_track]; p_sys->i_sector = p_sys->p_sectors[p_access->info.i_title + 1] - 1;
}
/* Update the navigation variables without triggering a callback */
val.i_int = p_area->i_id;
var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL );
} }
else
p_sys->i_sector = p_sys->p_sectors[p_access->info.i_title];
p_sys->i_sector = p_sys->p_sectors[p_sys->i_track]; p_access->info.b_eof = VLC_FALSE;
return VLC_SUCCESS;
}
p_input->stream.p_selected_area->i_tell = /*****************************************************************************
(off_t)p_sys->i_sector * (off_t)CDDA_DATA_SIZE * Control:
- p_input->stream.p_selected_area->i_start; *****************************************************************************/
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;
int *pi_int;
int64_t *pi_64;
input_title_t ***ppp_title;
vlc_value_t val;
int i;
/* warn interface that something has changed */ switch( i_query )
p_input->stream.b_seekable = 1; {
p_input->stream.b_changed = 1; /* */
case ACCESS_CAN_SEEK:
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;
break;
/* */
case ACCESS_GET_MTU:
pi_int = (int*)va_arg( args, int * );
*pi_int = CDDA_DATA_ONCE;
break;
case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * );
var_Get( p_access, "cdda-caching", &val );
*pi_64 = val.i_int * 1000;
break;
/* */
case ACCESS_SET_PAUSE_STATE:
break;
case ACCESS_GET_TITLE_INFO:
ppp_title = (input_title_t***)va_arg( args, input_title_t*** );
pi_int = (int*)va_arg( args, int* );
/* Duplicate title infos */
*pi_int = p_sys->i_titles;
*ppp_title = malloc( sizeof( input_title_t ** ) * p_sys->i_titles );
for( i = 0; i < p_sys->i_titles; i++ )
{
(*ppp_title)[i] = vlc_input_title_Duplicate( p_sys->title[i] );
}
break;
return 0; case ACCESS_SET_TITLE:
} i = (int)va_arg( args, int );
if( i != p_access->info.i_title )
{
/* Update info */
p_access->info.i_update |= INPUT_UPDATE_TITLE|INPUT_UPDATE_SIZE;
p_access->info.i_title = i;
p_access->info.i_size = p_sys->title[i]->i_size;
p_access->info.i_pos = sizeof(WAVEHEADER);
/* Next sector to read */
p_sys->i_sector = p_sys->p_sectors[i];
}
break;
/**************************************************************************** case ACCESS_SET_SEEKPOINT:
* Seek return VLC_EGENERIC;
****************************************************************************/
static void Seek( input_thread_t * p_input, off_t i_off )
{
access_sys_t * p_sys = p_input->p_access_data;
p_sys->i_sector = p_sys->p_sectors[p_sys->i_track] default:
+ i_off / (off_t)CDDA_DATA_SIZE; msg_Err( p_access, "unimplemented query in control" );
return VLC_EGENERIC;
vlc_mutex_lock( &p_input->stream.stream_lock ); }
p_input->stream.p_selected_area->i_tell = return VLC_SUCCESS;
(off_t)p_sys->i_sector * (off_t)CDDA_DATA_SIZE
- p_input->stream.p_selected_area->i_start;
vlc_mutex_unlock( &p_input->stream.stream_lock );
} }
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