Commit 3a9b48da authored by Clément Stenac's avatar Clément Stenac

CDDAX:

    - coding style fixes
    - adapted to new playlist API
    - only put generic things in Meta-information

wxWidgets:
    - Fixed playlist updating

core:
    - added playlist_ItemGetByInput
    - implemented input_item_t.b_fixed name : if this is set, the interface should not try to "improve" the display string.
parent 180ca722
...@@ -62,6 +62,8 @@ struct input_item_t ...@@ -62,6 +62,8 @@ struct input_item_t
int i_es; /**< Number of es format descriptions */ int i_es; /**< Number of es format descriptions */
es_format_t **es; /**< Pointer to an array of es formats */ es_format_t **es; /**< Pointer to an array of es formats */
vlc_bool_t b_fixed_name; /**< Can the interface change the name ?*/
vlc_mutex_t lock; /**< Item cannot be changed without this lock */ vlc_mutex_t lock; /**< Item cannot be changed without this lock */
}; };
...@@ -85,6 +87,7 @@ static inline void vlc_input_item_Init( vlc_object_t *p_o, input_item_t *p_i ) ...@@ -85,6 +87,7 @@ static inline void vlc_input_item_Init( vlc_object_t *p_o, input_item_t *p_i )
p_i->pp_categories = 0; p_i->pp_categories = 0;
p_i->es = 0; p_i->es = 0;
p_i->i_type = ITEM_TYPE_UNKNOWN; p_i->i_type = ITEM_TYPE_UNKNOWN;
p_i->b_fixed_name = VLC_TRUE;
vlc_mutex_init( p_o, &p_i->lock ); vlc_mutex_init( p_o, &p_i->lock );
} }
......
...@@ -63,8 +63,8 @@ access_t *p_cdda_input = NULL; ...@@ -63,8 +63,8 @@ access_t *p_cdda_input = NULL;
*****************************************************************************/ *****************************************************************************/
static block_t *CDDAReadBlocks( access_t * p_access ); static block_t *CDDAReadBlocks( access_t * p_access );
static int CDDASeek( access_t * p_access, int64_t i_pos ); static int CDDASeek( access_t * p_access, int64_t i_pos );
static int CDDAControl( access_t *p_access, int i_query, static int CDDAControl( access_t *p_access, int i_query,
va_list args ); va_list args );
static int CDDAInit( access_t *p_access, cdda_data_t *p_cdda ) ; static int CDDAInit( access_t *p_access, cdda_data_t *p_cdda ) ;
...@@ -111,15 +111,17 @@ cdio_log_handler (cdio_log_level_t level, const char message[]) ...@@ -111,15 +111,17 @@ cdio_log_handler (cdio_log_level_t level, const char message[])
static void static void
cddb_log_handler (cddb_log_level_t level, const char message[]) cddb_log_handler (cddb_log_level_t level, const char message[])
{ {
cdda_data_t *p_cdda = (cdda_data_t *)p_cdda_input->p_sys; cdda_data_t *p_cdda = (cdda_data_t *)p_cdda_input->p_sys;
switch (level) { switch (level)
case CDDB_LOG_DEBUG: {
case CDDB_LOG_INFO: case CDDB_LOG_DEBUG:
if (!(p_cdda->i_debug & INPUT_DBG_CDDB)) return; case CDDB_LOG_INFO:
/* Fall through if to warn case */ if (!(p_cdda->i_debug & INPUT_DBG_CDDB)) return;
default:
cdio_log_handler (level, message); /* Fall through if to warn case */
} default:
cdio_log_handler (level, message);
}
} }
#endif /*HAVE_LIBCDDB*/ #endif /*HAVE_LIBCDDB*/
...@@ -130,34 +132,35 @@ cddb_log_handler (cddb_log_level_t level, const char message[]) ...@@ -130,34 +132,35 @@ cddb_log_handler (cddb_log_level_t level, const char message[])
static void static void
uninit_log_handler (cdio_log_level_t level, const char message[]) uninit_log_handler (cdio_log_level_t level, const char message[])
{ {
cdda_data_t *p_cdda = NULL; cdda_data_t *p_cdda = NULL;
if (p_cdda_input) if (p_cdda_input)
p_cdda = (cdda_data_t *)p_cdda_input->p_sys; p_cdda = (cdda_data_t *)p_cdda_input->p_sys;
switch (level) { switch (level)
case CDIO_LOG_DEBUG: {
case CDIO_LOG_INFO: case CDIO_LOG_DEBUG:
if (!p_cdda || !(p_cdda->i_debug & (INPUT_DBG_CDIO|INPUT_DBG_CDDB))) case CDIO_LOG_INFO:
return; if (!p_cdda || !(p_cdda->i_debug & (INPUT_DBG_CDIO|INPUT_DBG_CDDB)))
/* Fall through if to warn case */ return;
case CDIO_LOG_WARN:
fprintf(stderr, "WARN: %s\n", message); /* Fall through if to warn case */
break; case CDIO_LOG_WARN:
case CDIO_LOG_ERROR: fprintf(stderr, "WARN: %s\n", message);
fprintf(stderr, "ERROR: %s\n", message); break;
break; case CDIO_LOG_ERROR:
case CDIO_LOG_ASSERT: fprintf(stderr, "ERROR: %s\n", message);
fprintf(stderr, "ASSERT ERROR: %s\n", message); break;
break; case CDIO_LOG_ASSERT:
default: fprintf(stderr, "ASSERT ERROR: %s\n", message);
fprintf(stderr, "UNKNOWN ERROR: %s\n%s %d\n", break;
message, default:
"The above message had unknown cdio log level", fprintf(stderr, "UNKNOWN ERROR: %s\n%s %d\n", message,
level); "The above message had unknown cdio log level",
} level);
}
/* gl_default_cdio_log_handler (level, message); */ /* gl_default_cdio_log_handler (level, message); */
} }
/***************************************************************************** /*****************************************************************************
...@@ -166,15 +169,14 @@ uninit_log_handler (cdio_log_level_t level, const char message[]) ...@@ -166,15 +169,14 @@ uninit_log_handler (cdio_log_level_t level, const char message[])
* read. It is also possible if we haven't read a RIFF header in which * read. It is also possible if we haven't read a RIFF header in which
* case one that we creaded during Open/Initialization is returned. * case one that we creaded during Open/Initialization is returned.
*****************************************************************************/ *****************************************************************************/
static block_t * static block_t * CDDAReadBlocks( access_t * p_access )
CDDAReadBlocks( access_t * p_access )
{ {
block_t *p_block; block_t *p_block;
cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys; cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys;
int i_blocks = p_cdda->i_blocks_per_read; int i_blocks = p_cdda->i_blocks_per_read;
dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT|INPUT_DBG_LSN), "called %d", dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT|INPUT_DBG_LSN), "called %d",
p_cdda->i_lsn); p_cdda->i_lsn);
/* Check end of file */ /* Check end of file */
if( p_access->info.b_eof ) return NULL; if( p_access->info.b_eof ) return NULL;
...@@ -199,10 +201,10 @@ CDDAReadBlocks( access_t * p_access ) ...@@ -199,10 +201,10 @@ CDDAReadBlocks( access_t * p_access )
p_access->info.i_update |= INPUT_UPDATE_TITLE | INPUT_UPDATE_SIZE; p_access->info.i_update |= INPUT_UPDATE_TITLE | INPUT_UPDATE_SIZE;
p_access->info.i_title++; p_access->info.i_title++;
p_access->info.i_size = p_access->info.i_size =
p_cdda->p_title[p_access->info.i_title]->i_size; p_cdda->p_title[p_access->info.i_title]->i_size;
p_access->info.i_pos = 0; p_access->info.i_pos = 0;
p_cdda->i_track++; p_cdda->i_track++;
} }
/* Possibly adjust i_blocks so we don't read past the end of a track. */ /* Possibly adjust i_blocks so we don't read past the end of a track. */
...@@ -216,26 +218,26 @@ CDDAReadBlocks( access_t * p_access ) ...@@ -216,26 +218,26 @@ CDDAReadBlocks( access_t * p_access )
if( !p_block) if( !p_block)
{ {
msg_Err( p_access, "Cannot get a new block of size: %i", msg_Err( p_access, "Cannot get a new block of size: %i",
i_blocks * CDIO_CD_FRAMESIZE_RAW ); i_blocks * CDIO_CD_FRAMESIZE_RAW );
return NULL; return NULL;
} }
if( cdio_read_audio_sectors( p_cdda->p_cdio, p_block->p_buffer, if( cdio_read_audio_sectors( p_cdda->p_cdio, p_block->p_buffer,
p_cdda->i_lsn, i_blocks) != 0 ) p_cdda->i_lsn, i_blocks) != 0 )
{ {
msg_Err( p_access, "could not read sector %lu", msg_Err( p_access, "could not read sector %lu",
(long unsigned int) p_cdda->i_lsn ); (long unsigned int) p_cdda->i_lsn );
block_Release( p_block ); block_Release( p_block );
/* If we had problems above, assume the problem is with /* If we had problems above, assume the problem is with
the first sector of the read and set to skip it. In the first sector of the read and set to skip it. In
the future libcdio may have cdparanoia support. the future libcdio may have cdparanoia support.
*/ */
p_cdda->i_lsn++; p_cdda->i_lsn++;
p_access->info.i_pos += CDIO_CD_FRAMESIZE_RAW; p_access->info.i_pos += CDIO_CD_FRAMESIZE_RAW;
return NULL; return NULL;
} }
p_cdda->i_lsn += i_blocks; p_cdda->i_lsn += i_blocks;
p_access->info.i_pos += p_block->i_buffer; p_access->info.i_pos += p_block->i_buffer;
...@@ -246,8 +248,7 @@ CDDAReadBlocks( access_t * p_access ) ...@@ -246,8 +248,7 @@ CDDAReadBlocks( access_t * p_access )
* CDDASeek - change position for subsequent reads. For example, this * CDDASeek - change position for subsequent reads. For example, this
* can happen if the user moves a position slider bar in a GUI. * can happen if the user moves a position slider bar in a GUI.
****************************************************************************/ ****************************************************************************/
static int static int CDDASeek( access_t * p_access, int64_t i_pos )
CDDASeek( access_t * p_access, int64_t i_pos )
{ {
cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys; cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys;
...@@ -256,8 +257,8 @@ CDDASeek( access_t * p_access, int64_t i_pos ) ...@@ -256,8 +257,8 @@ CDDASeek( access_t * p_access, int64_t i_pos )
p_access->info.i_pos = i_pos; p_access->info.i_pos = i_pos;
dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT|INPUT_DBG_SEEK), dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT|INPUT_DBG_SEEK),
"lsn %lu, offset: %lld", "lsn %lu, offset: %lld",
(long unsigned int) p_cdda->i_lsn, i_pos ); (long unsigned int) p_cdda->i_lsn, i_pos );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -266,11 +267,10 @@ CDDASeek( access_t * p_access, int64_t i_pos ) ...@@ -266,11 +267,10 @@ CDDASeek( access_t * p_access, int64_t i_pos )
****************************************************************************/ ****************************************************************************/
/***************************************************************************** /*****************************************************************************
* Open: open cdda device or image file and initialize structures * Open: open cdda device or image file and initialize structures
* for subsequent operations. * for subsequent operations.
*****************************************************************************/ *****************************************************************************/
int int E_(CDDAOpen)( vlc_object_t *p_this )
E_(CDDAOpen)( vlc_object_t *p_this )
{ {
access_t *p_access = (access_t*)p_this; access_t *p_access = (access_t*)p_this;
char * psz_source = NULL; char * psz_source = NULL;
...@@ -289,51 +289,53 @@ E_(CDDAOpen)( vlc_object_t *p_this ) ...@@ -289,51 +289,53 @@ E_(CDDAOpen)( vlc_object_t *p_this )
if( p_access->psz_path && *p_access->psz_path ) if( p_access->psz_path && *p_access->psz_path )
{ {
char *psz_parser = psz_source = strdup( p_access->psz_path ); char *psz_parser = psz_source = strdup( p_access->psz_path );
while( *psz_parser && *psz_parser != '@' ) while( *psz_parser && *psz_parser != '@' )
{ {
psz_parser++; psz_parser++;
} }
if( *psz_parser == '@' ) if( *psz_parser == '@' )
{ {
/* Found options */ /* Found options */
*psz_parser = '\0'; *psz_parser = '\0';
++psz_parser; ++psz_parser;
if ('T' == *psz_parser || 't' == *psz_parser ) if ('T' == *psz_parser || 't' == *psz_parser )
++psz_parser; ++psz_parser;
i_track = (int)strtol( psz_parser, NULL, 10 ); i_track = (int)strtol( psz_parser, NULL, 10 );
i_track = i_track ? i_track : 1; i_track = i_track ? i_track : 1;
b_single_track = true; b_single_track = true;
} }
} }
if (!psz_source || !*psz_source) if (!psz_source || !*psz_source)
{ {
/* No device/track given. Continue only when this plugin was /* No device/track given. Continue only when this plugin was
selected */ selected */
if( !p_this->b_force ) return VLC_EGENERIC; if( !p_this->b_force ) return VLC_EGENERIC;
psz_source = var_CreateGetString( p_this, "cd-audio" ); psz_source = var_CreateGetString( p_this, "cd-audio" );
if( !psz_source || !*psz_source ) { if( !psz_source || !*psz_source )
/* Scan for a CD-ROM drive with a CD-DA in it. */ {
char **cd_drives = /* Scan for a CD-ROM drive with a CD-DA in it. */
cdio_get_devices_with_cap(NULL, CDIO_FS_AUDIO, false); char **cd_drives =
cdio_get_devices_with_cap(NULL, CDIO_FS_AUDIO, false);
if (NULL == cd_drives || NULL == cd_drives[0] ) {
msg_Err( p_access, if (NULL == cd_drives || NULL == cd_drives[0] )
"libcdio couldn't find something with a CD-DA in it" ); {
if (cd_drives) cdio_free_device_list(cd_drives); msg_Err( p_access,
return VLC_EGENERIC; "libcdio couldn't find something with a CD-DA in it" );
} if (cd_drives) cdio_free_device_list(cd_drives);
return VLC_EGENERIC;
psz_source = strdup(cd_drives[0]); }
cdio_free_device_list(cd_drives);
} psz_source = strdup(cd_drives[0]);
cdio_free_device_list(cd_drives);
}
} }
cdio_log_set_handler ( cdio_log_handler ); cdio_log_set_handler ( cdio_log_handler );
...@@ -342,7 +344,7 @@ E_(CDDAOpen)( vlc_object_t *p_this ) ...@@ -342,7 +344,7 @@ E_(CDDAOpen)( vlc_object_t *p_this )
if( !(p_cdio = cdio_open( psz_source, DRIVER_UNKNOWN )) ) if( !(p_cdio = cdio_open( psz_source, DRIVER_UNKNOWN )) )
{ {
msg_Warn( p_access, "could not open %s", psz_source ); msg_Warn( p_access, "could not open %s", psz_source );
goto error2; goto error2;
} }
p_cdda = malloc( sizeof(cdda_data_t) ); p_cdda = malloc( sizeof(cdda_data_t) );
...@@ -375,23 +377,23 @@ E_(CDDAOpen)( vlc_object_t *p_this ) ...@@ -375,23 +377,23 @@ E_(CDDAOpen)( vlc_object_t *p_this )
p_cdda->i_blocks_per_read p_cdda->i_blocks_per_read
= config_GetInt(p_this, MODULE_STRING "-blocks-per-read"); = config_GetInt(p_this, MODULE_STRING "-blocks-per-read");
p_cdda->p_input = vlc_object_find( p_access, VLC_OBJECT_INPUT, p_cdda->p_input = vlc_object_find( p_access, VLC_OBJECT_INPUT,
FIND_PARENT ); FIND_PARENT );
if (0 == p_cdda->i_blocks_per_read) if (0 == p_cdda->i_blocks_per_read)
p_cdda->i_blocks_per_read = DEFAULT_BLOCKS_PER_READ; p_cdda->i_blocks_per_read = DEFAULT_BLOCKS_PER_READ;
if ( p_cdda->i_blocks_per_read < MIN_BLOCKS_PER_READ
|| p_cdda->i_blocks_per_read > MAX_BLOCKS_PER_READ ) {
msg_Warn( p_cdda_input,
"Number of blocks (%d) has to be between %d and %d. "
"Using %d.",
p_cdda->i_blocks_per_read,
MIN_BLOCKS_PER_READ, MAX_BLOCKS_PER_READ,
DEFAULT_BLOCKS_PER_READ );
p_cdda->i_blocks_per_read = DEFAULT_BLOCKS_PER_READ;
}
if ( p_cdda->i_blocks_per_read < MIN_BLOCKS_PER_READ
|| p_cdda->i_blocks_per_read > MAX_BLOCKS_PER_READ )
{
msg_Warn( p_cdda_input,
"Number of blocks (%d) has to be between %d and %d. "
"Using %d.",
p_cdda->i_blocks_per_read,
MIN_BLOCKS_PER_READ, MAX_BLOCKS_PER_READ,
DEFAULT_BLOCKS_PER_READ );
p_cdda->i_blocks_per_read = DEFAULT_BLOCKS_PER_READ;
}
dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT), "%s", psz_source ); dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT), "%s", psz_source );
...@@ -415,8 +417,8 @@ E_(CDDAOpen)( vlc_object_t *p_this ) ...@@ -415,8 +417,8 @@ E_(CDDAOpen)( vlc_object_t *p_this )
if ( VLC_SUCCESS != i_rc ) goto error; if ( VLC_SUCCESS != i_rc ) goto error;
CDDAFixupPlaylist( p_access, p_cdda, psz_source, b_single_track ); CDDAFixupPlaylist( p_access, p_cdda, psz_source, b_single_track );
/* Build a WAV header to put in front of the output data. /* Build a WAV header to put in front of the output data.
This gets sent back in the Block (read) routine. This gets sent back in the Block (read) routine.
*/ */
memset( &p_cdda->waveheader, 0, sizeof(WAVEHEADER) ); memset( &p_cdda->waveheader, 0, sizeof(WAVEHEADER) );
...@@ -432,13 +434,14 @@ E_(CDDAOpen)( vlc_object_t *p_this ) ...@@ -432,13 +434,14 @@ E_(CDDAOpen)( vlc_object_t *p_this )
SetWLE( &p_cdda->waveheader.BytesPerSample, SetWLE( &p_cdda->waveheader.BytesPerSample,
2 /*Modus*/ * 16 /*BitsPerSample*/ / 8 ); 2 /*Modus*/ * 16 /*BitsPerSample*/ / 8 );
SetDWLE( &p_cdda->waveheader.BytesPerSec, SetDWLE( &p_cdda->waveheader.BytesPerSec,
2*16/8 /*BytesPerSample*/ * CDDA_FREQUENCY_SAMPLE ); 2*16/8 /*BytesPerSample*/ * CDDA_FREQUENCY_SAMPLE );
p_cdda->waveheader.DataChunkID = VLC_FOURCC('d', 'a', 't', 'a'); p_cdda->waveheader.DataChunkID = VLC_FOURCC('d', 'a', 't', 'a');
p_cdda->waveheader.DataLength = 0; /* we just don't know */ p_cdda->waveheader.DataLength = 0; /* we just don't know */
/* PTS delay */ /* PTS delay */
var_Create( p_access, MODULE_STRING "-caching", var_Create( p_access, MODULE_STRING "-caching",
VLC_VAR_INTEGER|VLC_VAR_DOINHERIT ); VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
vlc_object_release( p_cdda->p_input );
return VLC_SUCCESS; return VLC_SUCCESS;
error: error:
...@@ -446,6 +449,7 @@ E_(CDDAOpen)( vlc_object_t *p_this ) ...@@ -446,6 +449,7 @@ E_(CDDAOpen)( vlc_object_t *p_this )
free( p_cdda ); free( p_cdda );
error2: error2:
free( psz_source ); free( psz_source );
vlc_object_release( p_cdda->p_input );
return i_rc; return i_rc;
} }
...@@ -453,8 +457,7 @@ E_(CDDAOpen)( vlc_object_t *p_this ) ...@@ -453,8 +457,7 @@ E_(CDDAOpen)( vlc_object_t *p_this )
/***************************************************************************** /*****************************************************************************
* CDDAClose: closes cdda and frees any resources associded with it. * CDDAClose: closes cdda and frees any resources associded with it.
*****************************************************************************/ *****************************************************************************/
void void E_(CDDAClose)( vlc_object_t *p_this )
E_(CDDAClose)( vlc_object_t *p_this )
{ {
access_t *p_access = (access_t *) p_this; access_t *p_access = (access_t *) p_this;
cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys; cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys;
...@@ -500,73 +503,83 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args ) ...@@ -500,73 +503,83 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args )
switch( i_query ) switch( i_query )
{ {
/* Pass back a copy of meta information that was gathered when we /* Pass back a copy of meta information that was gathered when we
during the Open/Initialize call. during the Open/Initialize call.
*/ */
case ACCESS_GET_META: case ACCESS_GET_META:
{ {
vlc_meta_t **pp_meta = (vlc_meta_t**)va_arg( args, vlc_meta_t** ); vlc_meta_t **pp_meta = (vlc_meta_t**)va_arg( args, vlc_meta_t** );
if ( p_cdda->p_meta ) { if ( p_cdda->p_meta )
*pp_meta = vlc_meta_Duplicate( p_cdda->p_meta ); {
dbg_print( INPUT_DBG_META, "%s", "Meta copied" ); *pp_meta = vlc_meta_Duplicate( p_cdda->p_meta );
} else dbg_print( INPUT_DBG_META, "%s", "Meta copied" );
msg_Warn( p_access, "tried to copy NULL meta info" ); }
else
return VLC_SUCCESS; msg_Warn( p_access, "tried to copy NULL meta info" );
}
return VLC_EGENERIC; return VLC_SUCCESS;
}
case ACCESS_CAN_SEEK: case ACCESS_CAN_SEEK:
case ACCESS_CAN_FASTSEEK: case ACCESS_CAN_FASTSEEK:
case ACCESS_CAN_PAUSE: case ACCESS_CAN_PAUSE:
case ACCESS_CAN_CONTROL_PACE: case ACCESS_CAN_CONTROL_PACE:
{ {
vlc_bool_t *pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* ); vlc_bool_t *pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
*pb_bool = VLC_TRUE; *pb_bool = VLC_TRUE;
break; return VLC_SUCCESS;;
} }
/* */ /* */
case ACCESS_GET_MTU: case ACCESS_GET_MTU:
{
pi_int = (int*)va_arg( args, int * ); pi_int = (int*)va_arg( args, int * );
*pi_int = p_cdda-> i_blocks_per_read * CDIO_CD_FRAMESIZE_RAW; *pi_int = p_cdda-> i_blocks_per_read * CDIO_CD_FRAMESIZE_RAW;
break; break;
}
case ACCESS_GET_PTS_DELAY: case ACCESS_GET_PTS_DELAY:
{ {
int64_t *pi_64 = (int64_t*)va_arg( args, int64_t * ); int64_t *pi_64 = (int64_t*)va_arg( args, int64_t * );
*pi_64 = var_GetInteger( p_access, MODULE_STRING "-caching" ) *pi_64 = var_GetInteger( p_access, MODULE_STRING "-caching" )
* MILLISECONDS_PER_SEC; * MILLISECONDS_PER_SEC;
break; break;
} }
/* */ /* */
case ACCESS_SET_PAUSE_STATE: case ACCESS_SET_PAUSE_STATE:
break; break;
case ACCESS_GET_TITLE_INFO: case ACCESS_GET_TITLE_INFO:
{ input_title_t ***ppp_title; {
input_title_t ***ppp_title;
ppp_title = (input_title_t***)va_arg( args, input_title_t*** ); ppp_title = (input_title_t***)va_arg( args, input_title_t*** );
pi_int = (int*)va_arg( args, int* ); pi_int = (int*)va_arg( args, int* );
*((int*)va_arg( args, int* )) = 1; /* Title offset */ *((int*)va_arg( args, int* )) = 1; /* Title offset */
/* Duplicate title info */ /* Duplicate title info */
/*** printf("+++ i_tracks %d, i_titles %d\n", printf("+++ i_tracks %d, i_titles %d\n",
p_cdda->i_tracks, p_cdda->i_titles); ***/ p_cdda->i_tracks, p_cdda->i_titles);
if( p_cdda->i_titles == 0 )
{
*pi_int = 0; ppp_title = NULL;
return VLC_SUCCESS;
}
*pi_int = p_cdda->i_titles; *pi_int = p_cdda->i_titles;
*ppp_title = malloc(sizeof( input_title_t **) * p_cdda->i_titles ); *ppp_title = malloc(sizeof( input_title_t **) * p_cdda->i_titles );
if (!*ppp_title) return VLC_ENOMEM; if (!*ppp_title) return VLC_ENOMEM;
for( i = 0; i < p_cdda->i_titles; i++ ) for( i = 0; i < p_cdda->i_titles; i++ )
{ {
if ( p_cdda->p_title[i] ) if ( p_cdda->p_title[i] )
(*ppp_title)[i] = (*ppp_title)[i] =
vlc_input_title_Duplicate( p_cdda->p_title[i] ); vlc_input_title_Duplicate( p_cdda->p_title[i] );
} }
} break;
break; }
case ACCESS_SET_TITLE: case ACCESS_SET_TITLE:
{
i = (int)va_arg( args, int ); i = (int)va_arg( args, int );
if( i != p_access->info.i_title ) if( i != p_access->info.i_title )
{ {
...@@ -581,13 +594,14 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args ) ...@@ -581,13 +594,14 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args )