Commit 546b08b6 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Coding Style fixes

parent 61b7f84a
...@@ -78,14 +78,15 @@ static int CDDAInit( access_t *p_access, cdda_data_t *p_cdda ) ; ...@@ -78,14 +78,15 @@ static int CDDAInit( access_t *p_access, cdda_data_t *p_cdda ) ;
called by CDDAOpen called by CDDAOpen
*/ */
static void static void
cdio_log_handler (cdio_log_level_t level, const char message[]) cdio_log_handler( cdio_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;
if( p_cdda == NULL ) if( p_cdda == NULL )
return; return;
switch (level) { switch( level )
{
case CDIO_LOG_DEBUG: case CDIO_LOG_DEBUG:
case CDIO_LOG_INFO: case CDIO_LOG_INFO:
if (p_cdda->i_debug & INPUT_DBG_CDIO) if (p_cdda->i_debug & INPUT_DBG_CDIO)
...@@ -102,28 +103,28 @@ cdio_log_handler (cdio_log_level_t level, const char message[]) ...@@ -102,28 +103,28 @@ cdio_log_handler (cdio_log_level_t level, const char message[])
msg_Warn( p_cdda_input, message, msg_Warn( p_cdda_input, message,
"the above message had unknown cdio log level", "the above message had unknown cdio log level",
level); level);
break;
} }
return;
} }
#ifdef HAVE_LIBCDDB #ifdef HAVE_LIBCDDB
/*! This routine is called by libcddb routines on error. /*! This routine is called by libcddb routines on error.
called by CDDAOpen called by CDDAOpen
*/ */
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_DEBUG:
case CDDB_LOG_INFO: case CDDB_LOG_INFO:
if (!(p_cdda->i_debug & INPUT_DBG_CDDB)) return; if( !(p_cdda->i_debug & INPUT_DBG_CDDB) )
return;
/* Fall through if to warn case */ /* Fall through if to warn case */
default: default:
cdio_log_handler (level, message); cdio_log_handler( level, message );
break;
} }
} }
#endif /*HAVE_LIBCDDB*/ #endif /*HAVE_LIBCDDB*/
...@@ -133,80 +134,78 @@ cddb_log_handler (cddb_log_level_t level, const char message[]) ...@@ -133,80 +134,78 @@ cddb_log_handler (cddb_log_level_t level, const char message[])
or is not around (before finalization). or is not around (before finalization).
*/ */
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_DEBUG:
case CDIO_LOG_INFO: case CDIO_LOG_INFO:
if (!p_cdda || !(p_cdda->i_debug & (INPUT_DBG_CDIO|INPUT_DBG_CDDB))) if( !p_cdda || !(p_cdda->i_debug & (INPUT_DBG_CDIO|INPUT_DBG_CDDB)) )
return; return;
/* Fall through if to warn case */ /* Fall through if to warn case */
case CDIO_LOG_WARN: case CDIO_LOG_WARN:
fprintf(stderr, "WARN: %s\n", message); fprintf( stderr, "WARN: %s\n", message );
break; break;
case CDIO_LOG_ERROR: case CDIO_LOG_ERROR:
fprintf(stderr, "ERROR: %s\n", message); fprintf( stderr, "ERROR: %s\n", message );
break; break;
case CDIO_LOG_ASSERT: case CDIO_LOG_ASSERT:
fprintf(stderr, "ASSERT ERROR: %s\n", message); fprintf( stderr, "ASSERT ERROR: %s\n", message );
break; break;
default: default:
fprintf(stderr, "UNKNOWN ERROR: %s\n%s %d\n", message, fprintf( stderr, "UNKNOWN ERROR: %s\n%s %d\n", message,
"The above message had unknown cdio log level", "The above message had unknown cdio log level",
level); level );
break;
} }
/* gl_default_cdio_log_handler (level, message); */ /* gl_default_cdio_log_handler (level, message); */
} }
/* Only used in audio control mode. Gets the current LSN from the /* Only used in audio control mode. Gets the current LSN from the
CD-ROM drive. */ CD-ROM drive. */
static int64_t static int64_t get_audio_position ( access_t *p_access )
get_audio_position ( access_t *p_access )
{ {
cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys; cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys;
lsn_t i_offset; lsn_t i_offset;
#if LIBCDIO_VERSION_NUM >= 73 #if LIBCDIO_VERSION_NUM >= 73
if (p_cdda->b_audio_ctl) if( p_cdda->b_audio_ctl )
{ {
cdio_subchannel_t sub; cdio_subchannel_t sub;
CdIo_t *p_cdio = p_cdda->p_cdio; CdIo_t *p_cdio = p_cdda->p_cdio;
if (DRIVER_OP_SUCCESS == cdio_audio_read_subchannel(p_cdio, &sub)) {
if (sub.audio_status != CDIO_MMC_READ_SUB_ST_PAUSED && if( DRIVER_OP_SUCCESS == cdio_audio_read_subchannel(p_cdio, &sub) )
sub.audio_status != CDIO_MMC_READ_SUB_ST_PLAY) {
if( (sub.audio_status != CDIO_MMC_READ_SUB_ST_PAUSED) &&
(sub.audio_status != CDIO_MMC_READ_SUB_ST_PLAY) )
return CDIO_INVALID_LSN; return CDIO_INVALID_LSN;
if ( ! p_cdda->b_nav_mode ) { if( ! p_cdda->b_nav_mode )
// char *psz = cdio_msf_to_str(&sub.abs_addr); {
// fprintf(stderr, "+++disk mode abs msf %s", psz); i_offset = cdio_msf_to_lba( (&sub.abs_addr) );
// free(psz); }
i_offset = cdio_msf_to_lba((&sub.abs_addr)); else
// fprintf(stderr, " frame offset %d\n", i_offset); {
} else { i_offset = cdio_msf_to_lba( (&sub.rel_addr) );
// char *psz = cdio_msf_to_str(&sub.rel_addr); }
// fprintf(stderr, "+++track abs msf %s", psz); }
// free(psz); else
i_offset = cdio_msf_to_lba((&sub.rel_addr)); {
// fprintf(stderr, " frame offset %d\n", i_offset);
}
} else {
// fprintf(stderr, "+++Error reading current pos\n");
i_offset = p_cdda->i_lsn; i_offset = p_cdda->i_lsn;
} }
} else }
else
{
i_offset = p_cdda->i_lsn; i_offset = p_cdda->i_lsn;
#else #else
i_offset = p_cdda->i_lsn; i_offset = p_cdda->i_lsn;
;
#endif #endif
}
return i_offset; return i_offset;
} }
...@@ -222,12 +221,13 @@ static block_t * CDDAReadBlocks( access_t * p_access ) ...@@ -222,12 +221,13 @@ static block_t * CDDAReadBlocks( access_t * p_access )
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), dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT|INPUT_DBG_LSN),
"called i_lsn: %d i_pos: %lld, size: %lld", "called i_lsn: %d i_pos: %lld, size: %lld",
p_cdda->i_lsn, p_access->info.i_pos, p_access->info.i_size); p_cdda->i_lsn, p_access->info.i_pos, p_access->info.i_size );
/* Check end of file */ /* Check end of file */
if( p_access->info.b_eof ) return NULL; if( p_access->info.b_eof )
return NULL;
if( !p_cdda->b_header ) if( !p_cdda->b_header )
{ {
...@@ -260,11 +260,14 @@ static block_t * CDDAReadBlocks( access_t * p_access ) ...@@ -260,11 +260,14 @@ static block_t * CDDAReadBlocks( access_t * p_access )
p_access->info.i_title++; p_access->info.i_title++;
p_cdda->i_track++; p_cdda->i_track++;
if ( p_cdda-> b_nav_mode ) { if( p_cdda-> b_nav_mode )
{
char *psz_title = CDDAFormatTitle( p_access, p_cdda->i_track ); char *psz_title = CDDAFormatTitle( p_access, p_cdda->i_track );
input_Control( p_cdda->p_input, INPUT_SET_NAME, psz_title ); input_Control( p_cdda->p_input, INPUT_SET_NAME, psz_title );
free(psz_title); free(psz_title);
} else { }
else
{
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;
...@@ -293,38 +296,42 @@ static block_t * CDDAReadBlocks( access_t * p_access ) ...@@ -293,38 +296,42 @@ static block_t * CDDAReadBlocks( access_t * p_access )
#if LIBCDIO_VERSION_NUM >= 72 #if LIBCDIO_VERSION_NUM >= 72
driver_return_code_t rc = DRIVER_OP_SUCCESS; driver_return_code_t rc = DRIVER_OP_SUCCESS;
if ( p_cdda->e_paranoia && p_cdda->paranoia ) if( p_cdda->e_paranoia && p_cdda->paranoia )
{ {
int i; int i;
for( i = 0; i < i_blocks; i++ ) for( i = 0; i < i_blocks; i++ )
{ {
int16_t *p_readbuf = cdio_paranoia_read(p_cdda->paranoia, NULL); int16_t *p_readbuf = cdio_paranoia_read( p_cdda->paranoia, NULL );
char *psz_err=cdio_cddap_errors(p_cdda->paranoia_cd); char *psz_err = cdio_cddap_errors( p_cdda->paranoia_cd );
char *psz_mes=cdio_cddap_messages(p_cdda->paranoia_cd); char *psz_mes = cdio_cddap_messages( p_cdda->paranoia_cd );
if (psz_mes || psz_err) if( psz_mes || psz_err )
msg_Err( p_access, "%s%s\n", psz_mes ? psz_mes: "", msg_Err( p_access, "%s%s\n", psz_mes ? psz_mes: "",
psz_err ? psz_err: "" ); psz_err ? psz_err: "" );
if (psz_err) free(psz_err); if( psz_err ) free( psz_err );
if (psz_mes) free(psz_mes); if( psz_mes ) free( psz_mes );
if( !p_readbuf ) { if( !p_readbuf )
{
msg_Err( p_access, "paranoia read error on frame %i\n", msg_Err( p_access, "paranoia read error on frame %i\n",
p_cdda->i_lsn+i ); p_cdda->i_lsn+i );
} else }
memcpy(p_block->p_buffer + i * CDIO_CD_FRAMESIZE_RAW, else
p_readbuf, CDIO_CD_FRAMESIZE_RAW); memcpy( p_block->p_buffer + i * CDIO_CD_FRAMESIZE_RAW,
p_readbuf, CDIO_CD_FRAMESIZE_RAW );
} }
} }
else else
{
rc = cdio_read_audio_sectors( p_cdda->p_cdio, p_block->p_buffer, rc = cdio_read_audio_sectors( p_cdda->p_cdio, p_block->p_buffer,
p_cdda->i_lsn, i_blocks); p_cdda->i_lsn, i_blocks );
#else #else
#define DRIVER_OP_SUCCESS 0 #define DRIVER_OP_SUCCESS 0
int rc; int rc;
rc = cdio_read_audio_sectors( p_cdda->p_cdio, p_block->p_buffer, rc = cdio_read_audio_sectors( p_cdda->p_cdio, p_block->p_buffer,
p_cdda->i_lsn, i_blocks); p_cdda->i_lsn, i_blocks);
#endif #endif
}
if( rc != DRIVER_OP_SUCCESS ) if( rc != DRIVER_OP_SUCCESS )
{ {
msg_Err( p_access, "could not read %d sectors starting from %lu", msg_Err( p_access, "could not read %d sectors starting from %lu",
...@@ -355,17 +362,19 @@ CDDARead( access_t * p_access, uint8_t *p_buffer, int i_len ) ...@@ -355,17 +362,19 @@ CDDARead( access_t * p_access, uint8_t *p_buffer, int i_len )
{ {
cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys; cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys;
dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT|INPUT_DBG_LSN), dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT|INPUT_DBG_LSN),
"called lsn: %d pos: %lld, size: %lld", "called lsn: %d pos: %lld, size: %lld",
p_cdda->i_lsn, p_access->info.i_pos, p_access->info.i_size); p_cdda->i_lsn, p_access->info.i_pos, p_access->info.i_size);
/* Check end of file */ /* Check end of file */
if( p_access->info.b_eof ) return 0; if( p_access->info.b_eof )
return 0;
{ {
lsn_t i_lsn = get_audio_position(p_access); lsn_t i_lsn = get_audio_position(p_access);
if (CDIO_INVALID_LSN == i_lsn) { if( CDIO_INVALID_LSN == i_lsn )
dbg_print((INPUT_DBG_LSN), "invalid lsn"); {
dbg_print( (INPUT_DBG_LSN), "invalid lsn" );
memset( p_buffer, 0, i_len ); memset( p_buffer, 0, i_len );
return i_len; return i_len;
} }
...@@ -374,10 +383,10 @@ CDDARead( access_t * p_access, uint8_t *p_buffer, int i_len ) ...@@ -374,10 +383,10 @@ CDDARead( access_t * p_access, uint8_t *p_buffer, int i_len )
p_access->info.i_pos = p_cdda->i_lsn * CDIO_CD_FRAMESIZE_RAW; p_access->info.i_pos = p_cdda->i_lsn * CDIO_CD_FRAMESIZE_RAW;
} }
dbg_print((INPUT_DBG_LSN), "updated lsn: %d", p_cdda->i_lsn); dbg_print( (INPUT_DBG_LSN), "updated lsn: %d", p_cdda->i_lsn );
/* Check end of track */ /* Check end of track */
while( p_cdda->i_lsn > cdio_get_track_last_lsn(p_cdda->p_cdio, while( p_cdda->i_lsn > cdio_get_track_last_lsn( p_cdda->p_cdio,
p_cdda->i_track) ) p_cdda->i_track) )
{ {
if( p_cdda->i_track >= p_cdda->i_first_track + p_cdda->i_titles - 1 ) if( p_cdda->i_track >= p_cdda->i_first_track + p_cdda->i_titles - 1 )
...@@ -386,39 +395,43 @@ CDDARead( access_t * p_access, uint8_t *p_buffer, int i_len ) ...@@ -386,39 +395,43 @@ CDDARead( access_t * p_access, uint8_t *p_buffer, int i_len )
p_access->info.b_eof = VLC_TRUE; p_access->info.b_eof = VLC_TRUE;
return 0; return 0;
} }
p_access->info.i_update |= INPUT_UPDATE_TITLE; p_access->info.i_update |= INPUT_UPDATE_TITLE;
p_access->info.i_title++; p_access->info.i_title++;
p_cdda->i_track++; p_cdda->i_track++;
if ( p_cdda-> b_nav_mode ) { if( p_cdda-> b_nav_mode )
{
char *psz_title = CDDAFormatTitle( p_access, p_cdda->i_track ); char *psz_title = CDDAFormatTitle( p_access, p_cdda->i_track );
input_Control( p_cdda->p_input, INPUT_SET_NAME, psz_title ); input_Control( p_cdda->p_input, INPUT_SET_NAME, psz_title );
free(psz_title); free(psz_title);
} else { }
else
{
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_access->info.i_update |= INPUT_UPDATE_SIZE; p_access->info.i_update |= INPUT_UPDATE_SIZE;
} }
} }
memset( p_buffer, 0, i_len ); memset( p_buffer, 0, i_len );
return i_len; return i_len;
} }
/*! Pause CD playing via audio control */ /*! Pause CD playing via audio control */
static bool static bool cdda_audio_pause( CdIo_t *p_cdio )
cdda_audio_pause(CdIo_t *p_cdio)
{ {
bool b_ok = true; bool b_ok = true;
#if LIBCDIO_VERSION_NUM >= 73 #if LIBCDIO_VERSION_NUM >= 73
cdio_subchannel_t sub; cdio_subchannel_t sub;
if (DRIVER_OP_SUCCESS == cdio_audio_read_subchannel(p_cdio, &sub)) {
if (sub.audio_status == CDIO_MMC_READ_SUB_ST_PLAY) { if( DRIVER_OP_SUCCESS == cdio_audio_read_subchannel( p_cdio, &sub ) )
{
if( sub.audio_status == CDIO_MMC_READ_SUB_ST_PLAY )
{
b_ok = DRIVER_OP_SUCCESS == cdio_audio_pause(p_cdio); b_ok = DRIVER_OP_SUCCESS == cdio_audio_pause(p_cdio);
} }
} else }
else
b_ok = false; b_ok = false;
#endif #endif
return b_ok; return b_ok;
...@@ -427,14 +440,14 @@ cdda_audio_pause(CdIo_t *p_cdio) ...@@ -427,14 +440,14 @@ cdda_audio_pause(CdIo_t *p_cdio)
#if LIBCDIO_VERSION_NUM >= 73 #if LIBCDIO_VERSION_NUM >= 73
/*! play CD using audio controls */ /*! play CD using audio controls */
static driver_return_code_t static driver_return_code_t
cdda_audio_play(CdIo_t *p_cdio, lsn_t start_lsn, lsn_t end_lsn) cdda_audio_play( CdIo_t *p_cdio, lsn_t start_lsn, lsn_t end_lsn )
{ {
msf_t start_msf; msf_t start_msf;
msf_t last_msf; msf_t last_msf;
cdio_lsn_to_msf(start_lsn, &start_msf); cdio_lsn_to_msf( start_lsn, &start_msf );
cdio_lsn_to_msf(end_lsn, &last_msf); cdio_lsn_to_msf( end_lsn, &last_msf );
cdda_audio_pause(p_cdio); cdda_audio_pause( p_cdio );
return cdio_audio_play_msf (p_cdio, &start_msf, &last_msf); return cdio_audio_play_msf( p_cdio, &start_msf, &last_msf );
} }
#endif #endif
...@@ -442,8 +455,7 @@ cdda_audio_play(CdIo_t *p_cdio, lsn_t start_lsn, lsn_t end_lsn) ...@@ -442,8 +455,7 @@ cdda_audio_play(CdIo_t *p_cdio, lsn_t start_lsn, lsn_t end_lsn)
* 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;
...@@ -454,48 +466,48 @@ CDDASeek( access_t * p_access, int64_t i_pos ) ...@@ -454,48 +466,48 @@ CDDASeek( access_t * p_access, int64_t i_pos )
p_cdda->i_lsn = (i_pos / CDIO_CD_FRAMESIZE_RAW); p_cdda->i_lsn = (i_pos / CDIO_CD_FRAMESIZE_RAW);
#if LIBCDIO_VERSION_NUM >= 72 #if LIBCDIO_VERSION_NUM >= 72
if ( p_cdda->e_paranoia && p_cdda->paranoia ) if( p_cdda->e_paranoia && p_cdda->paranoia )
cdio_paranoia_seek(p_cdda->paranoia, p_cdda->i_lsn, SEEK_SET); cdio_paranoia_seek( p_cdda->paranoia, p_cdda->i_lsn, SEEK_SET );
#endif #endif
#if LIBCDIO_VERSION_NUM >= 73 #if LIBCDIO_VERSION_NUM >= 73
if ( p_cdda->b_audio_ctl ) { if( p_cdda->b_audio_ctl )
track_t i_track = cdio_get_track(p_cdda->p_cdio, p_cdda->i_lsn); {
track_t i_track = cdio_get_track( p_cdda->p_cdio, p_cdda->i_lsn );
lsn_t i_last_lsn; lsn_t i_last_lsn;
if ( p_cdda->b_nav_mode ) if( p_cdda->b_nav_mode )
i_last_lsn = p_cdda->last_disc_frame; i_last_lsn = p_cdda->last_disc_frame;
else else
i_last_lsn = cdio_get_track_last_lsn(p_cdda->p_cdio, i_track); i_last_lsn = cdio_get_track_last_lsn( p_cdda->p_cdio, i_track );
cdda_audio_play(p_cdda->p_cdio, p_cdda->i_lsn, i_last_lsn); cdda_audio_play( p_cdda->p_cdio, p_cdda->i_lsn, i_last_lsn );
} }
#endif #endif
if ( ! p_cdda->b_nav_mode ) if( ! p_cdda->b_nav_mode )
p_cdda->i_lsn += cdio_get_track_lsn(p_cdda->p_cdio, p_cdda->i_track); p_cdda->i_lsn += cdio_get_track_lsn( p_cdda->p_cdio, p_cdda->i_track );
/* Seeked backwards and we are doing disc mode. */ /* Seeked backwards and we are doing disc mode. */
if ( p_cdda->b_nav_mode && p_access->info.i_pos > i_pos ) { if( p_cdda->b_nav_mode && p_access->info.i_pos > i_pos )
{
track_t i_track; track_t i_track;
char *psz_title; char *psz_title;
for( i_track = p_cdda->i_track; for( i_track = p_cdda->i_track; i_track > 1 &&
i_track > 1 && p_cdda->i_lsn < cdio_get_track_lsn( p_cdda->p_cdio, i_track );
p_cdda->i_lsn < cdio_get_track_lsn(p_cdda->p_cdio, i_track); i_track--, p_access->info.i_title-- )
i_track--, p_access->info.i_title-- ) ; ;
p_cdda->i_track = i_track; p_cdda->i_track = i_track;
p_access->info.i_update |= INPUT_UPDATE_TITLE | INPUT_UPDATE_META ; p_access->info.i_update |= INPUT_UPDATE_TITLE | INPUT_UPDATE_META ;
psz_title = CDDAFormatTitle( p_access, p_cdda->i_track ); psz_title = CDDAFormatTitle( p_access, p_cdda->i_track );
input_Control( p_cdda->p_input, INPUT_SET_NAME, input_Control( p_cdda->p_input, INPUT_SET_NAME,
psz_title ); psz_title );
free(psz_title); free( psz_title );
} }
p_access->info.i_pos = i_pos; p_access->info.i_pos = i_pos;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -504,40 +516,37 @@ CDDASeek( access_t * p_access, int64_t i_pos ) ...@@ -504,40 +516,37 @@ CDDASeek( access_t * p_access, int64_t i_pos )
If we are using audio-ctl mode we also activate CD-ROM If we are using audio-ctl mode we also activate CD-ROM
to play. to play.
*/ */
static bool static bool cdda_play_track( access_t *p_access, track_t i_track )
cdda_play_track( access_t *p_access, track_t i_track )
{ {
cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys; cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys;
dbg_print((INPUT_DBG_CALL), "called track: %d\n", i_track); dbg_print( (INPUT_DBG_CALL), "called track: %d\n", i_track );
if (i_track > p_cdda->i_tracks) if( i_track > p_cdda->i_tracks )
{ {
msg_Err( p_access, "CD has %d tracks, and you requested track %d", msg_Err( p_access, "CD has %d tracks, and you requested track %d",
p_cdda->i_tracks, i_track ); p_cdda->i_tracks, i_track );
return false; return false;
} }
p_cdda->i_track = i_track; p_cdda->i_track = i_track;
/* set up the frame boundaries for this particular track */ /* set up the frame boundaries for this particular track */
p_cdda->first_frame = p_cdda->i_lsn = p_cdda->first_frame = p_cdda->i_lsn =
cdio_get_track_lsn(p_cdda->p_cdio, i_track); cdio_get_track_lsn( p_cdda->p_cdio, i_track );
p_cdda->last_frame = cdio_get_track_lsn(p_cdda->p_cdio, i_track+1) - 1; p_cdda->last_frame = cdio_get_track_lsn( p_cdda->p_cdio, i_track+1 ) - 1;
#if LIBCDIO_VERSION_NUM >= 73 #if LIBCDIO_VERSION_NUM >= 73
if (p_cdda->b_audio_ctl) if( p_cdda->b_audio_ctl )
{ {
lsn_t i_last_lsn; lsn_t i_last_lsn;
if ( p_cdda->b_nav_mode ) if( p_cdda->b_nav_mode )
i_last_lsn = p_cdda->last_disc_frame; i_last_lsn = p_cdda->last_disc_frame;
else else
i_last_lsn = cdio_get_track_last_lsn(p_cdda->p_cdio, i_track); i_last_lsn = cdio_get_track_last_lsn( p_cdda->p_cdio, i_track );
cdda_audio_play(p_cdda->p_cdio, p_cdda->i_lsn, i_last_lsn); cdda_audio_play( p_cdda->p_cdio, p_cdda->i_lsn, i_last_lsn );
} }
#endif #endif
return true; return true;
} }
...@@ -549,8 +558,7 @@ cdda_play_track( access_t *p_access, track_t i_track ) ...@@ -549,8 +558,7 @@ cdda_play_track( access_t *p_access, track_t i_track )
* 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 CDDAOpen( vlc_object_t *p_this )
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;
...@@ -566,7 +574,6 @@ CDDAOpen( vlc_object_t *p_this ) ...@@ -566,7 +574,6 @@ CDDAOpen( vlc_object_t *p_this )
p_cdda_input = p_access; p_cdda_input = p_access;
/* parse the options passed in command line : */ /* parse the options passed in command line : */
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 );
...@@ -591,40 +598,40 @@ CDDAOpen( vlc_object_t *p_this ) ...@@ -591,40 +598,40 @@ CDDAOpen( vlc_object_t *p_this )
} }
} }
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. */ /* Scan for a CD-ROM drive with a CD-DA in it. */
char **ppsz_drives = char **ppsz_drives =
cdio_get_devices_with_cap(NULL, CDIO_FS_AUDIO, false); cdio_get_devices_with_cap( NULL, CDIO_FS_AUDIO, false );
if (NULL == ppsz_drives || NULL == ppsz_drives[0] ) if( (NULL == ppsz_drives) || (NULL == ppsz_drives[0]) )
{ {
msg_Err( p_access, msg_Err( p_access,
"libcdio couldn't find something with a CD-DA in it" ); "libcdio couldn't find something with a CD-DA in it" );
if (ppsz_drives) cdio_free_device_list(ppsz_drives); if( ppsz_drives )
cdio_free_device_list( ppsz_drives );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
psz_source = strdup( ppsz_drives[0] );
psz_source = strdup(ppsz_drives[0]); cdio_free_device_list( ppsz_drives );
cdio_free_device_list(ppsz_drives);
} }
} }
cdio_log_set_handler( cdio_log_handler );
cdio_log_set_handler ( cdio_log_handler );
/* Open CDDA */ /* Open CDDA */
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 );
if (psz_source) free( psz_source ); if ( psz_source )
free( psz_source );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -642,41 +649,34 @@ CDDAOpen( vlc_object_t *p_this ) ...@@ -642,41 +649,34 @@ CDDAOpen( vlc_object_t *p_this )
p_cdda->b_cddb_enabled = p_cdda->b_cddb_enabled =
config_GetInt( p_access, MODULE_STRING "-cddb-enabled" ); config_GetInt( p_access, MODULE_STRING "-cddb-enabled" );
#endif #endif
p_cdda->b_cdtext = p_cdda->b_cdtext =
config_GetInt( p_access, MODULE_STRING "-cdtext-enabled" ); config_GetInt( p_access, MODULE_STRING "-cdtext-enabled" );
p_cdda->b_cdtext_prefer = p_cdda->b_cdtext_prefer =
config_GetInt( p_access, MODULE_STRING "-cdtext-prefer" ); config_GetInt( p_access, MODULE_STRING "-cdtext-prefer" );
#if LIBCDIO_VERSION_NUM >= 73 #if LIBCDIO_VERSION_NUM >= 73
p_cdda->b_audio_ctl = p_cdda->b_audio_ctl =
config_GetInt( p_access, MODULE_STRING "-analog-output" ); config_GetInt( p_access, MODULE_STRING "-analog-output" );
#endif #endif
p_cdda->psz_source = strdup(psz_source); p_cdda->psz_source = strdup( psz_source );
p_cdda->b_header = VLC_FALSE; p_cdda->b_header = VLC_FALSE;
p_cdda->p_cdio = p_cdio; p_cdda->p_cdio = p_cdio;
p_cdda->i_tracks = 0; p_cdda->i_tracks = 0;
p_cdda->i_titles = 0; p_cdda->i_titles = 0;
p_cdda->i_debug = config_GetInt(p_this, MODULE_STRING p_cdda->i_debug = config_GetInt( p_this, MODULE_STRING "-debug" );
"-debug"); p_cdda->b_nav_mode = config_GetInt(p_this, MODULE_STRING "-navigation-mode" );
p_cdda->b_nav_mode = config_GetInt(p_this, MODULE_STRING p_cdda->i_blocks_per_read =
"-navigation-mode" ); config_GetInt( p_this, MODULE_STRING "-blocks-per-read" );
p_cdda->i_blocks_per_read
= config_GetInt(p_this, MODULE_STRING "-blocks-per-read");
p_cdda->last_disc_frame = p_cdda->last_disc_frame =
cdio_get_track_lsn(p_cdio, CDIO_CDROM_LEADOUT_TRACK); cdio_get_track_lsn( p_cdio, CDIO_CDROM_LEADOUT_TRACK );
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 if( (p_cdda->i_blocks_per_read < MIN_BLOCKS_PER_READ)
|| p_cdda->i_blocks_per_read > MAX_BLOCKS_PER_READ ) || (p_cdda->i_blocks_per_read > MAX_BLOCKS_PER_READ) )
{ {
msg_Warn( p_cdda_input, msg_Warn( p_cdda_input,
"number of blocks (%d) has to be between %d and %d. " "number of blocks (%d) has to be between %d and %d. "
...@@ -690,11 +690,12 @@ CDDAOpen( vlc_object_t *p_this ) ...@@ -690,11 +690,12 @@ CDDAOpen( vlc_object_t *p_this )
dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT), "%s", psz_source ); dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT), "%s", psz_source );
/* Set up p_access */ /* Set up p_access */
if (p_cdda->b_audio_ctl) if( p_cdda->b_audio_ctl )
{ {
p_access->pf_read = CDDARead; p_access->pf_read = CDDARead;
p_access->pf_block = NULL; p_access->pf_block = NULL;
} else }
else
{ {
p_access->pf_read = NULL; p_access->pf_read = NULL;
p_access->pf_block = CDDAReadBlocks; p_access->pf_block = CDDAReadBlocks;
...@@ -706,12 +707,12 @@ CDDAOpen( vlc_object_t *p_this ) ...@@ -706,12 +707,12 @@ CDDAOpen( vlc_object_t *p_this )
{ {
lsn_t i_last_lsn; lsn_t i_last_lsn;
if (p_cdda->b_nav_mode) if( p_cdda->b_nav_mode )
i_last_lsn = p_cdda->last_disc_frame; i_last_lsn = p_cdda->last_disc_frame;
else else
i_last_lsn = cdio_get_track_last_lsn(p_cdio, i_track); i_last_lsn = cdio_get_track_last_lsn( p_cdio, i_track );
if (CDIO_INVALID_LSN != i_last_lsn) if( CDIO_INVALID_LSN != i_last_lsn )
p_access->info.i_size = i_last_lsn * (uint64_t) CDIO_CD_FRAMESIZE_RAW; p_access->info.i_size = i_last_lsn * (uint64_t) CDIO_CD_FRAMESIZE_RAW;
else else
p_access->info.i_size = 0; p_access->info.i_size = 0;
...@@ -726,47 +727,52 @@ CDDAOpen( vlc_object_t *p_this ) ...@@ -726,47 +727,52 @@ CDDAOpen( vlc_object_t *p_this )
/* We read the Table Of Content information */ /* We read the Table Of Content information */
i_rc = CDDAInit( p_access, p_cdda ); i_rc = CDDAInit( p_access, p_cdda );
if ( VLC_SUCCESS != i_rc ) goto error; if( VLC_SUCCESS != i_rc )
goto error;
cdda_play_track( p_access, i_track ); cdda_play_track( p_access, i_track );
CDDAFixupPlaylist( p_access, p_cdda, b_single_track ); CDDAFixupPlaylist( p_access, p_cdda, b_single_track );
#if LIBCDIO_VERSION_NUM >= 72 #if LIBCDIO_VERSION_NUM >= 72
{ {
char *psz_paranoia = config_GetPsz( p_access, char *psz_paranoia = config_GetPsz( p_access,
MODULE_STRING "-paranoia" ); MODULE_STRING "-paranoia" );
p_cdda->e_paranoia = paranoia_none; p_cdda->e_paranoia = paranoia_none;
if( psz_paranoia && *psz_paranoia ) if( psz_paranoia && *psz_paranoia )
{ {
if( !strncmp( psz_paranoia, "full", strlen("full") ) ) if( !strncmp( psz_paranoia, "full", strlen("full") ) )
p_cdda->e_paranoia = paranoia_full; p_cdda->e_paranoia = paranoia_full;
else if( !strncmp( psz_paranoia, "overlap", strlen("overlap") ) ) else if( !strncmp(psz_paranoia, "overlap", strlen("overlap")) )
p_cdda->e_paranoia = paranoia_overlap; p_cdda->e_paranoia = paranoia_overlap;
/* Use CD Paranoia? */ /* Use CD Paranoia? */
if ( p_cdda->e_paranoia ) { if( p_cdda->e_paranoia )
p_cdda->paranoia_cd = cdio_cddap_identify_cdio(p_cdio, 1, NULL); {
p_cdda->paranoia_cd =
cdio_cddap_identify_cdio( p_cdio, 1, NULL );
/* We'll set for verbose paranoia messages. */ /* We'll set for verbose paranoia messages. */
cdio_cddap_verbose_set(p_cdda->paranoia_cd, CDDA_MESSAGE_PRINTIT, cdio_cddap_verbose_set( p_cdda->paranoia_cd,
CDDA_MESSAGE_PRINTIT); CDDA_MESSAGE_PRINTIT,
if ( 0 != cdio_cddap_open(p_cdda->paranoia_cd) ) { CDDA_MESSAGE_PRINTIT );
if ( 0 != cdio_cddap_open(p_cdda->paranoia_cd) )
{
msg_Warn( p_cdda_input, "unable to get paranoia support - " msg_Warn( p_cdda_input, "unable to get paranoia support - "
"continuing without it." ); "continuing without it." );
p_cdda->e_paranoia = paranoia_none; p_cdda->e_paranoia = paranoia_none;
} else { }
else
{
p_cdda->paranoia = cdio_paranoia_init(p_cdda->paranoia_cd); p_cdda->paranoia = cdio_paranoia_init(p_cdda->paranoia_cd);
cdio_paranoia_seek(p_cdda->paranoia, p_cdda->i_lsn, SEEK_SET); cdio_paranoia_seek( p_cdda->paranoia, p_cdda->i_lsn,
SEEK_SET);
/* Set reading mode for full or overlap paranoia, /* Set reading mode for full or overlap paranoia,
but allow skipping sectors. */ * but allow skipping sectors. */
cdio_paranoia_modeset(p_cdda->paranoia, cdio_paranoia_modeset( p_cdda->paranoia,
paranoia_full == p_cdda->e_paranoia ? paranoia_full == p_cdda->e_paranoia ?
PARANOIA_MODE_FULL^PARANOIA_MODE_NEVERSKIP : PARANOIA_MODE_FULL^PARANOIA_MODE_NEVERSKIP :
PARANOIA_MODE_OVERLAP^PARANOIA_MODE_NEVERSKIP PARANOIA_MODE_OVERLAP^PARANOIA_MODE_NEVERSKIP );
);
} }
} }
} }
...@@ -777,12 +783,15 @@ CDDAOpen( vlc_object_t *p_this ) ...@@ -777,12 +783,15 @@ CDDAOpen( vlc_object_t *p_this )
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) );
SetWLE( &p_cdda->waveheader.Format, 1 ); /*WAVE_FORMAT_PCM*/ SetWLE( &p_cdda->waveheader.Format, 1 ); /*WAVE_FORMAT_PCM*/
SetWLE( &p_cdda->waveheader.BitsPerSample, 16); SetWLE( &p_cdda->waveheader.BitsPerSample, 16);
p_cdda->waveheader.MainChunkID = VLC_FOURCC('R', 'I', 'F', 'F'); p_cdda->waveheader.MainChunkID = VLC_FOURCC('R', 'I', 'F', 'F');
p_cdda->waveheader.Length = 0; /* we just don't know */ p_cdda->waveheader.Length = 0; /* we just don't know */
p_cdda->waveheader.ChunkTypeID = VLC_FOURCC('W', 'A', 'V', 'E'); p_cdda->waveheader.ChunkTypeID = VLC_FOURCC('W', 'A', 'V', 'E');
p_cdda->waveheader.SubChunkID = VLC_FOURCC('f', 'm', 't', ' '); p_cdda->waveheader.SubChunkID = VLC_FOURCC('f', 'm', 't', ' ');
SetDWLE( &p_cdda->waveheader.SubChunkLength, 16); SetDWLE( &p_cdda->waveheader.SubChunkLength, 16);
SetWLE( &p_cdda->waveheader.Modus, 2); SetWLE( &p_cdda->waveheader.Modus, 2);
SetDWLE( &p_cdda->waveheader.SampleFreq, CDDA_FREQUENCY_SAMPLE); SetDWLE( &p_cdda->waveheader.SampleFreq, CDDA_FREQUENCY_SAMPLE);
...@@ -790,6 +799,7 @@ CDDAOpen( vlc_object_t *p_this ) ...@@ -790,6 +799,7 @@ CDDAOpen( vlc_object_t *p_this )
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 */
...@@ -802,28 +812,26 @@ CDDAOpen( vlc_object_t *p_this ) ...@@ -802,28 +812,26 @@ CDDAOpen( vlc_object_t *p_this )
error: error:
cdio_destroy( p_cdda->p_cdio ); cdio_destroy( p_cdda->p_cdio );
if( psz_source) free( psz_source ); if( psz_source) free( psz_source );
if( p_cdda ) { if( p_cdda )
{
if ( p_cdda->p_input ) if ( p_cdda->p_input )
vlc_object_release( p_cdda->p_input ); vlc_object_release( p_cdda->p_input );
free(p_cdda); free(p_cdda);
} }
return i_rc; return i_rc;
} }
/***************************************************************************** /*****************************************************************************
* CDDAClose: closes cdda and frees any resources associded with it. * CDDAClose: closes cdda and frees any resources associded with it.
*****************************************************************************/ *****************************************************************************/
void void CDDAClose (vlc_object_t *p_this )
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;
track_t i; track_t i;
#if LIBCDIO_VERSION_NUM >= 73 #if LIBCDIO_VERSION_NUM >= 73
if (p_cdda->b_audio_ctl) if( p_cdda->b_audio_ctl )
cdio_audio_stop(p_cdda->p_cdio); cdio_audio_stop(p_cdda->p_cdio);
#endif #endif
...@@ -836,23 +844,23 @@ CDDAClose (vlc_object_t *p_this ) ...@@ -836,23 +844,23 @@ CDDAClose (vlc_object_t *p_this )
} }
#ifdef HAVE_LIBCDDB #ifdef HAVE_LIBCDDB
cddb_log_set_handler ((cddb_log_handler_t) uninit_log_handler); cddb_log_set_handler( (cddb_log_handler_t) uninit_log_handler );
if (p_cdda->b_cddb_enabled) if( p_cdda->b_cddb_enabled )
cddb_disc_destroy(p_cdda->cddb.disc); cddb_disc_destroy( p_cdda->cddb.disc );
#endif #endif
cdio_destroy( p_cdda->p_cdio ); cdio_destroy( p_cdda->p_cdio );
cdio_log_set_handler (uninit_log_handler); cdio_log_set_handler( uninit_log_handler );
#if LIBCDIO_VERSION_NUM >= 72 #if LIBCDIO_VERSION_NUM >= 72
if (p_cdda->paranoia) if( p_cdda->paranoia )
cdio_paranoia_free(p_cdda->paranoia); cdio_paranoia_free(p_cdda->paranoia);
if (p_cdda->paranoia_cd) if( p_cdda->paranoia_cd )
cdio_cddap_close_no_free_cdio(p_cdda->paranoia_cd); cdio_cddap_close_no_free_cdio( p_cdda->paranoia_cd );
#endif #endif
if (p_cdda->psz_mcn) free( p_cdda->psz_mcn ); if( p_cdda->psz_mcn ) free( p_cdda->psz_mcn );
if (p_cdda->psz_source) free( p_cdda->psz_source ); if( p_cdda->psz_source ) free( p_cdda->psz_source );
#if LIBCDDB_VERSION_NUM >= 1 #if LIBCDDB_VERSION_NUM >= 1
libcddb_shutdown(); libcddb_shutdown();
...@@ -953,11 +961,10 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args ) ...@@ -953,11 +961,10 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args )
CDDAMetaInfo( p_access, CDIO_INVALID_TRACK ); CDDAMetaInfo( p_access, CDIO_INVALID_TRACK );
if ( p_cdda->b_nav_mode) { if( p_cdda->b_nav_mode)
char *psz_title = {
CDDAFormatTitle( p_access, p_cdda->i_track ); char *psz_title = CDDAFormatTitle( p_access, p_cdda->i_track );
input_Control( p_cdda->p_input, INPUT_SET_NAME, input_Control( p_cdda->p_input, INPUT_SET_NAME, psz_title );
psz_title );
free(psz_title); free(psz_title);
} }
...@@ -968,14 +975,16 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args ) ...@@ -968,14 +975,16 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args )
return VLC_SUCCESS; return VLC_SUCCESS;
} }
*pi_int = p_cdda->i_titles; *pi_int = p_cdda->i_titles;
*ppp_title = calloc(1, *ppp_title = calloc(1, sizeof( input_title_t **)
sizeof( input_title_t **) * p_cdda->i_titles ); * 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] );
} }
...@@ -993,7 +1002,7 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args ) ...@@ -993,7 +1002,7 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args )
const track_t i_track = p_cdda->i_first_track + i; const track_t i_track = p_cdda->i_first_track + i;
/* Update info */ /* Update info */
p_access->info.i_title = i; p_access->info.i_title = i;
if ( p_cdda->b_nav_mode) if( p_cdda->b_nav_mode)
{ {
lsn_t i_last_lsn; lsn_t i_last_lsn;
char *psz_title = CDDAFormatTitle( p_access, i_track ); char *psz_title = CDDAFormatTitle( p_access, i_track );
...@@ -1001,31 +1010,32 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args ) ...@@ -1001,31 +1010,32 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args )
psz_title ); psz_title );
free(psz_title); free(psz_title);
p_cdda->i_track = i_track; p_cdda->i_track = i_track;
i_last_lsn = cdio_get_track_lsn(p_cdda->p_cdio, i_last_lsn = cdio_get_track_lsn( p_cdda->p_cdio,
CDIO_CDROM_LEADOUT_TRACK); CDIO_CDROM_LEADOUT_TRACK );
if (CDIO_INVALID_LSN != i_last_lsn) if( CDIO_INVALID_LSN != i_last_lsn )
p_access->info.i_size = (int64_t) CDIO_CD_FRAMESIZE_RAW p_access->info.i_size = (int64_t) CDIO_CD_FRAMESIZE_RAW
* i_last_lsn ; * i_last_lsn ;
p_access->info.i_pos = (int64_t) p_access->info.i_pos = (int64_t)
cdio_get_track_lsn( p_cdda->p_cdio, i_track ) cdio_get_track_lsn( p_cdda->p_cdio, i_track )
* CDIO_CD_FRAMESIZE_RAW; * CDIO_CD_FRAMESIZE_RAW;
} else { }
else
{
p_access->info.i_size = p_cdda->p_title[i]->i_size; p_access->info.i_size = p_cdda->p_title[i]->i_size;
p_access->info.i_pos = 0; p_access->info.i_pos = 0;
} }
p_access->info.i_update = p_access->info.i_update = INPUT_UPDATE_TITLE|INPUT_UPDATE_SIZE;
INPUT_UPDATE_TITLE | INPUT_UPDATE_SIZE;
/* Next sector to read */ /* Next sector to read */
p_cdda->i_lsn = cdio_get_track_lsn(p_cdda->p_cdio, i_track); p_cdda->i_lsn = cdio_get_track_lsn( p_cdda->p_cdio, i_track );
} }
break; break;
} }
case ACCESS_SET_PAUSE_STATE: case ACCESS_SET_PAUSE_STATE:
dbg_print( INPUT_DBG_META, "Pause"); dbg_print( INPUT_DBG_META, "Pause");
if (p_cdda->b_audio_ctl) if( p_cdda->b_audio_ctl )
cdda_audio_pause(p_cdda->p_cdio); cdda_audio_pause( p_cdda->p_cdio );
break; break;
case ACCESS_SET_SEEKPOINT: case ACCESS_SET_SEEKPOINT:
...@@ -1061,11 +1071,12 @@ static int CDDAInit( access_t *p_access, cdda_data_t *p_cdda ) ...@@ -1061,11 +1071,12 @@ static int CDDAInit( access_t *p_access, cdda_data_t *p_cdda )
{ {
discmode_t discmode = CDIO_DISC_MODE_NO_INFO; discmode_t discmode = CDIO_DISC_MODE_NO_INFO;
p_cdda->i_tracks = cdio_get_num_tracks(p_cdda->p_cdio); p_cdda->i_tracks = cdio_get_num_tracks( p_cdda->p_cdio );
p_cdda->i_first_track = cdio_get_first_track_num(p_cdda->p_cdio); p_cdda->i_first_track = cdio_get_first_track_num( p_cdda->p_cdio );
discmode = cdio_get_discmode(p_cdda->p_cdio); discmode = cdio_get_discmode( p_cdda->p_cdio );
switch(discmode) { switch( discmode )
{
case CDIO_DISC_MODE_CD_DA: case CDIO_DISC_MODE_CD_DA:
case CDIO_DISC_MODE_CD_MIXED: case CDIO_DISC_MODE_CD_MIXED:
/* These are possible for CD-DA */ /* These are possible for CD-DA */
......
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