Commit eb5ef13c authored by Rocky Bernstein's avatar Rocky Bernstein

Fix bugs in disc-view slider. (May still have a couple left)

Fix bug in paranoia mode. Now allow two kinds of paranoia - overlap and full.

libcddb 0.96 has regexp memory leaks in - 1.0.0 won't. Be leak free if using
1.0.0.

parent cd136585
......@@ -175,8 +175,9 @@ static block_t * CDDAReadBlocks( access_t * p_access )
cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys;
int i_blocks = p_cdda->i_blocks_per_read;
dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT|INPUT_DBG_LSN), "called %d",
p_cdda->i_lsn);
dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT|INPUT_DBG_LSN),
"called %d pos: %lld, size: %lld",
p_cdda->i_lsn, p_access->info.i_pos, p_access->info.i_size);
/* Check end of file */
if( p_access->info.b_eof ) return NULL;
......@@ -191,8 +192,8 @@ static block_t * CDDAReadBlocks( access_t * p_access )
}
/* Check end of track */
while( p_cdda->i_lsn >= cdio_get_track_lsn(p_cdda->p_cdio,
p_cdda->i_track+1) )
while( p_cdda->i_lsn > cdio_get_track_last_lsn(p_cdda->p_cdio,
p_cdda->i_track) )
{
if( p_cdda->i_track >= p_cdda->i_first_track + p_cdda->i_titles - 1 )
{
......@@ -237,7 +238,7 @@ static block_t * CDDAReadBlocks( access_t * p_access )
#if LIBCDIO_VERSION_NUM >= 72
driver_return_code_t rc = DRIVER_OP_SUCCESS;
if ( p_cdda->b_paranoia_enabled )
if ( p_cdda->e_paranoia && p_cdda->paranoia )
{
int i;
for( i = 0; i < i_blocks; i++ )
......@@ -256,8 +257,8 @@ static block_t * CDDAReadBlocks( access_t * p_access )
msg_Err( p_access, "paranoia read error on frame %i\n",
p_cdda->i_lsn+i );
} else
memcpy(p_block + i * CDIO_CD_FRAMESIZE_RAW, p_readbuf,
CDIO_CD_FRAMESIZE_RAW);
memcpy(p_block->p_buffer + i * CDIO_CD_FRAMESIZE_RAW,
p_readbuf, CDIO_CD_FRAMESIZE_RAW);
}
}
else
......@@ -286,7 +287,7 @@ static block_t * CDDAReadBlocks( access_t * p_access )
}
p_cdda->i_lsn += i_blocks;
p_access->info.i_pos += p_block->i_buffer;
p_access->info.i_pos += i_blocks * CDIO_CD_FRAMESIZE_RAW;
return p_block;
}
......@@ -302,7 +303,7 @@ static int CDDASeek( access_t * p_access, int64_t i_pos )
p_cdda->i_lsn = (i_pos / CDIO_CD_FRAMESIZE_RAW);
#if LIBCDIO_VERSION_NUM >= 72
if ( p_cdda->b_paranoia_enabled )
if ( p_cdda->e_paranoia && p_cdda->paranoia )
cdio_paranoia_seek(p_cdda->paranoia, p_cdda->i_lsn, SEEK_SET);
#endif
......@@ -438,7 +439,7 @@ CDDAOpen( vlc_object_t *p_this )
config_GetInt( p_access, MODULE_STRING "-cddb-enabled" );
#endif
p_cdda->b_cdtext_enabled =
p_cdda->b_cdtext =
config_GetInt( p_access, MODULE_STRING "-cdtext-enabled" );
p_cdda->b_cdtext_prefer =
......@@ -483,7 +484,19 @@ CDDAOpen( vlc_object_t *p_this )
p_access->pf_control = CDDAControl;
p_access->pf_seek = CDDASeek;
p_access->info.i_size = 0;
{
lsn_t i_last_lsn;
if (p_cdda->b_nav_mode)
i_last_lsn = cdio_get_track_lsn(p_cdio, CDIO_CDROM_LEADOUT_TRACK);
else
i_last_lsn = cdio_get_track_last_lsn(p_cdio, i_track);
if (CDIO_INVALID_LSN != i_last_lsn)
p_access->info.i_size = i_last_lsn * (uint64_t) CDIO_CD_FRAMESIZE_RAW;
else
p_access->info.i_size = 0;
}
p_access->info.i_update = 0;
p_access->info.b_eof = VLC_FALSE;
......@@ -499,28 +512,43 @@ CDDAOpen( vlc_object_t *p_this )
CDDAFixupPlaylist( p_access, p_cdda, b_single_track );
#if LIBCDIO_VERSION_NUM >= 72
p_cdda->b_paranoia_enabled =
config_GetInt( p_access, MODULE_STRING "-paranoia-enabled" );
/* Use CD Paranoia? */
if ( p_cdda->b_paranoia_enabled ) {
p_cdda->paranoia_cd = cdio_cddap_identify_cdio(p_cdio, 1, NULL);
/* We'll set for verbose paranoia messages. */
cdio_cddap_verbose_set(p_cdda->paranoia_cd, CDDA_MESSAGE_PRINTIT,
CDDA_MESSAGE_PRINTIT);
if ( 0 != cdio_cddap_open(p_cdda->paranoia_cd) ) {
msg_Warn( p_cdda_input, "Unable to get paranoia support - "
"continuing without it." );
p_cdda->b_paranoia_enabled = VLC_FALSE;
} else {
p_cdda->paranoia = cdio_paranoia_init(p_cdda->paranoia_cd);
cdio_paranoia_seek(p_cdda->paranoia, p_cdda->i_lsn, SEEK_SET);
/* Set reading mode for full paranoia, but allow skipping sectors. */
cdio_paranoia_modeset(p_cdda->paranoia,
PARANOIA_MODE_FULL^PARANOIA_MODE_NEVERSKIP);
{
char *psz_paranoia = config_GetPsz( p_access,
MODULE_STRING "-paranoia" );
p_cdda->e_paranoia = paranoia_none;
if( psz_paranoia && *psz_paranoia )
{
if( !strncmp( psz_paranoia, "full", strlen("full") ) )
p_cdda->e_paranoia = paranoia_full;
else if( !strncmp( psz_paranoia, "overlap", strlen("overlap") ) )
p_cdda->e_paranoia = paranoia_overlap;
/* Use CD Paranoia? */
if ( p_cdda->e_paranoia ) {
p_cdda->paranoia_cd = cdio_cddap_identify_cdio(p_cdio, 1, NULL);
/* We'll set for verbose paranoia messages. */
cdio_cddap_verbose_set(p_cdda->paranoia_cd, CDDA_MESSAGE_PRINTIT,
CDDA_MESSAGE_PRINTIT);
if ( 0 != cdio_cddap_open(p_cdda->paranoia_cd) ) {
msg_Warn( p_cdda_input, "Unable to get paranoia support - "
"continuing without it." );
p_cdda->e_paranoia = paranoia_none;
} else {
p_cdda->paranoia = cdio_paranoia_init(p_cdda->paranoia_cd);
cdio_paranoia_seek(p_cdda->paranoia, p_cdda->i_lsn, SEEK_SET);
/* Set reading mode for full or overlap paranoia,
but allow skipping sectors. */
cdio_paranoia_modeset(p_cdda->paranoia,
paranoia_full == p_cdda->e_paranoia ?
PARANOIA_MODE_FULL^PARANOIA_MODE_NEVERSKIP :
PARANOIA_MODE_OVERLAP^PARANOIA_MODE_NEVERSKIP
);
}
}
}
}
#endif
......@@ -599,6 +627,10 @@ CDDAClose (vlc_object_t *p_this )
if (p_cdda->psz_mcn) free( p_cdda->psz_mcn );
if (p_cdda->psz_source) free( p_cdda->psz_source );
#if LIBCDDB_VERSION_NUM >= 1
libcddb_shutdown();
#endif
free( p_cdda );
p_cdda = NULL;
p_cdda_input = NULL;
......@@ -638,14 +670,16 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args )
}
}
case ACCESS_CAN_SEEK:
case ACCESS_CAN_CONTROL_PACE:
case ACCESS_CAN_FASTSEEK:
case ACCESS_CAN_SEEK:
case ACCESS_CAN_PAUSE:
case ACCESS_CAN_CONTROL_PACE:
{
vlc_bool_t *pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
dbg_print( INPUT_DBG_META,
"can seek/fastseek/pause/control pace");
*pb_bool = VLC_TRUE;
return VLC_SUCCESS;;
return VLC_SUCCESS;
}
/* */
......@@ -653,6 +687,7 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args )
{
pi_int = (int*)va_arg( args, int * );
*pi_int = p_cdda-> i_blocks_per_read * CDIO_CD_FRAMESIZE_RAW;
dbg_print( INPUT_DBG_META, "Get MTU %d", *pi_int);
break;
}
......@@ -666,6 +701,7 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args )
/* */
case ACCESS_SET_PAUSE_STATE:
dbg_print( INPUT_DBG_META, "Set pause state");
break;
case ACCESS_GET_TITLE_INFO:
......@@ -720,23 +756,30 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args )
if( i != p_access->info.i_title )
{
/* Update info */
p_access->info.i_update |= INPUT_UPDATE_TITLE;
p_access->info.i_title = i;
if ( p_cdda->b_nav_mode) {
if ( p_cdda->b_nav_mode)
{
lsn_t i_last_lsn;
char *psz_title =
CDDAFormatTitle( p_access, i+1 );
input_Control( p_cdda->p_input, INPUT_SET_NAME,
psz_title );
free(psz_title);
p_cdda->i_track = i+1;
p_access->info.i_pos =
p_cdda->i_track = p_cdda->i_first_track+i;
i_last_lsn = cdio_get_track_lsn(p_cdda->p_cdio,
CDIO_CDROM_LEADOUT_TRACK);
if (CDIO_INVALID_LSN != i_last_lsn)
p_access->info.i_size = (int64_t) CDIO_CD_FRAMESIZE_RAW
* i_last_lsn ;
p_access->info.i_pos = (int64_t)
cdio_get_track_lsn( p_cdda->p_cdio, p_cdda->i_track )
* CDIO_CD_FRAMESIZE_RAW;
} else {
p_access->info.i_update |= INPUT_UPDATE_SIZE;
p_access->info.i_size = p_cdda->p_title[i]->i_size;
p_access->info.i_pos = 0;
}
p_access->info.i_update =
INPUT_UPDATE_TITLE | INPUT_UPDATE_SIZE;
/* Next sector to read */
p_cdda->i_lsn =
......@@ -747,6 +790,7 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args )
case ACCESS_SET_SEEKPOINT:
case ACCESS_SET_PRIVATE_ID_STATE:
dbg_print( INPUT_DBG_META, "set seekpoint/set private id state");
return VLC_EGENERIC;
default:
......
......@@ -80,9 +80,9 @@ CDTextEnabledCB ( vlc_object_t *p_this, const char *psz_name,
if (p_cdda->i_debug & (INPUT_DBG_CALL|INPUT_DBG_EXT))
{
msg_Dbg( p_cdda_input, "Old CDText Enabled %d, new %d",
p_cdda->b_cdtext_enabled, val.b_bool);
p_cdda->b_cdtext, val.b_bool);
}
p_cdda->b_cdtext_enabled = val.b_bool;
p_cdda->b_cdtext = val.b_bool;
return VLC_SUCCESS;
}
......
......@@ -37,6 +37,10 @@
* Option help text
*****************************************************************************/
static char *psz_paranoia_list[] = { "none", "overlap", "full" };
static char *psz_paranoia_list_text[] = { N_("none"), N_("overlap"),
N_("full") };
#define DEBUG_LONGTEXT N_( \
"This integer when viewed in binary is a debugging mask\n" \
"meta info 1\n" \
......@@ -91,6 +95,13 @@
" %t : The track title or MRL if no title\n" \
" %% : a % \n")
#define PARANOIA_TEXT N_("Enable CD paranoia?")
#define PARANOIA_LONGTEXT N_( \
"Select whether to use CD Paranoia for jitter/error correction.\n" \
"none: no paranoia - fastest.\n" \
"overlap: do only overlap detection - not generally recommended.\n" \
"full: complete jitter and error correction detection - slowest.\n" )
/*****************************************************************************
* Module descriptor
*****************************************************************************/
......@@ -99,7 +110,7 @@ vlc_module_begin();
add_usage_hint( N_("cddax://[device-or-file][@[T]track]") );
set_description( _("Compact Disc Digital Audio (CD-DA) input") );
set_capability( "access2", 10 /* compare with priority of cdda */ );
set_shortname( N_("Audio CD"));
set_shortname( N_("Audio Compact Disc"));
set_callbacks( CDDAOpen, CDDAClose );
add_shortcut( "cddax" );
add_shortcut( "cd" );
......@@ -126,7 +137,32 @@ vlc_module_begin();
N_("Format to use in playlist \"title\" field when no CDDB"),
TITLE_FMT_LONGTEXT, VLC_TRUE );
add_bool( MODULE_STRING "-cdtext-enabled", VLC_TRUE, CDTextEnabledCB,
N_("Do CD-Text lookups?"),
N_("If set, get CD-Text information"),
VLC_FALSE );
add_bool( MODULE_STRING "-navigation-mode", VLC_TRUE,
#if FIXED
CDDANavModeCB,
#else
NULL,
#endif
N_("Use Navigation-style playback?"),
N_("If set, tracks are navigated via Navagation rather than "
"a playlist entries"),
VLC_FALSE );
#if LIBCDIO_VERSION_NUM >= 72
add_string( MODULE_STRING "-paranoia", NULL, NULL,
PARANOIA_TEXT,
PARANOIA_LONGTEXT,
VLC_FALSE );
change_string_list( psz_paranoia_list, psz_paranoia_list_text, 0 );
#endif /* LIBCDIO_VERSION_NUM >= 72 */
#ifdef HAVE_LIBCDDB
set_section( N_("CDDB" ), 0 );
add_string( MODULE_STRING "-cddb-title-format",
"Track %T. %t - %p %A", NULL,
N_("Format to use in playlist \"title\" field when using CDDB"),
......@@ -180,33 +216,6 @@ vlc_module_begin();
N_("If set, CD-Text information will be preferred "
"to CDDB information when both are available"),
VLC_FALSE );
#endif
add_bool( MODULE_STRING "-cdtext-enabled", VLC_TRUE, CDTextEnabledCB,
N_("Do CD-Text lookups?"),
N_("If set, get CD-Text information"),
VLC_FALSE );
add_bool( MODULE_STRING "-navigation-mode", VLC_TRUE,
#if FIXED
CDDANavModeCB,
#else
NULL,
#endif
N_("Use Navigation-style playback?"),
N_("If set, tracks are navigated via Navagation rather than "
"a playlist entries"),
VLC_FALSE );
#if LIBCDIO_VERSION_NUM >= 72
add_bool( MODULE_STRING "-paranoia-enabled",
// VLC_FALSE, NULL,
VLC_TRUE, NULL,
N_("Enable CD paranoia?"),
N_("If set, CD-DA reading will go through paranoia "
"jitter/error correction"),
VLC_FALSE );
#endif
#endif /*HAVE_LIBCDDB*/
vlc_module_end();
......@@ -64,6 +64,13 @@
#define CdIo_t CdIo
#endif
typedef enum {
paranoia_none = 0, /* Note: We make use of 0 as being the same as false */
paranoia_overlap = 1,
paranoia_full = 2
} paranoia_mode_t;
/*****************************************************************************
* cdda_data_t: CD audio information
*****************************************************************************/
......@@ -90,7 +97,7 @@ typedef struct cdda_data_s
#if LIBCDIO_VERSION_NUM >= 72
/* Paranoia support */
vlc_bool_t b_paranoia_enabled; /* Use cd paranoia for reads? */
paranoia_mode_t e_paranoia; /* Use cd paranoia for reads? */
cdrom_drive_t *paranoia_cd; /* Place to store drive
handle given by paranoia. */
cdrom_paranoia_t *paranoia;
......@@ -108,7 +115,7 @@ typedef struct cdda_data_s
} cddb;
#endif
vlc_bool_t b_cdtext_enabled; /* Use CD-Text at all? If not,
vlc_bool_t b_cdtext; /* Use CD-Text at all? If not,
cdtext_preferred is meaningless. */
vlc_bool_t b_cdtext_prefer; /* Prefer CD-Text info over
CDDB? If no CDDB, the issue
......
......@@ -894,6 +894,9 @@ int CDDAAddMetaToItem( access_t *p_access, cdda_data_t *p_cdda,
return VLC_SUCCESS;
}
/*
Fixes up playlist.
*/
int
CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
vlc_bool_t b_single_track )
......@@ -937,8 +940,6 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
CDDAMetaInfo( p_access, p_cdda->i_track );
if (p_playlist) {
p_item = playlist_LockItemGetByInput( p_playlist,
((input_thread_t *)p_access->p_parent)->input.p_item );
if( p_item == p_playlist->status.p_item && !b_single_track )
{
......@@ -950,22 +951,20 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
}
}
if( b_single_track )
if( b_single_track && !p_cdda->b_nav_mode )
{
/*May fill out more information when the playlist user interface becomes
more mature.
*/
track_t i_track = p_cdda->i_track;
unsigned int i_track_frames =
cdio_get_track_lsn(p_cdda->p_cdio, i_track+1) -
cdio_get_track_lsn(p_cdda->p_cdio, i_track);
cdio_get_track_sec_count(p_cdda->p_cdio, i_track);
input_title_t *t = p_cdda->p_title[0] = //i_track-i_first_track] =
vlc_input_title_New();
asprintf( &t->psz_name, _("Track %i"), i_track );
t->i_size = p_access->info.i_size =
i_track_frames * (int64_t) CDIO_CD_FRAMESIZE_RAW;
t->i_size = i_track_frames * (int64_t) CDIO_CD_FRAMESIZE_RAW;
t->i_length = I64C(1000000) * t->i_size / CDDA_FREQUENCY_SAMPLE / 4;
......@@ -979,16 +978,14 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
}
p_cdda->i_titles = 1;
p_access->info.i_size =
i_track_frames * (int64_t) CDIO_CD_FRAMESIZE_RAW;
p_access->info.i_update |= INPUT_UPDATE_TITLE|INPUT_UPDATE_SIZE;
p_access->info.i_update = INPUT_UPDATE_TITLE;
}
else
{
input_title_t *t;
if ( ! p_cdda->b_nav_mode )
if ( !p_cdda->b_nav_mode )
playlist_ItemToNode( p_playlist, p_item );
for( i = 0 ; i < p_cdda->i_tracks ; i++ )
......@@ -996,8 +993,7 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
playlist_item_t *p_child;
const track_t i_track = i_first_track + i;
unsigned int i_track_frames =
cdio_get_track_lsn(p_cdda->p_cdio, i_track+1) -
cdio_get_track_lsn(p_cdda->p_cdio, i_track);
cdio_get_track_sec_count(p_cdda->p_cdio, i_track);
t = p_cdda->p_title[i] = vlc_input_title_New();
......@@ -1017,9 +1013,6 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
}
p_cdda->i_titles = p_cdda->i_tracks;
p_access->info.i_size =
cdio_get_track_lba(p_cdda->p_cdio, CDIO_CDROM_LEADOUT_TRACK)
* (int64_t) CDIO_CD_FRAMESIZE_RAW;
p_access->info.i_update |= INPUT_UPDATE_TITLE|INPUT_UPDATE_SIZE;
if (p_item) {
p_item->input.i_duration =
......
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