Commit 55e3dca3 authored by Laurent Aimar's avatar Laurent Aimar

Allow to only specify --cdda-track to select a cd audio track.

parent 97732ebb
...@@ -77,7 +77,7 @@ vlc_module_begin () ...@@ -77,7 +77,7 @@ 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, true ) CACHING_LONGTEXT, true )
add_integer( "cdda-track", -1 , NULL, NULL, NULL, true ) add_integer( "cdda-track", 0 , NULL, NULL, NULL, true )
change_internal () change_internal ()
add_integer( "cdda-first-sector", -1, NULL, NULL, NULL, true ) add_integer( "cdda-first-sector", -1, NULL, NULL, NULL, true )
change_internal () change_internal ()
...@@ -142,7 +142,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -142,7 +142,6 @@ static int Open( vlc_object_t *p_this )
access_sys_t *p_sys; access_sys_t *p_sys;
vcddev_t *vcddev; vcddev_t *vcddev;
char *psz_name; char *psz_name;
int i_mrl_tracknum = -1;
int i_ret; int i_ret;
if( !p_access->psz_path || !*p_access->psz_path ) if( !p_access->psz_path || !*p_access->psz_path )
...@@ -178,9 +177,9 @@ static int Open( vlc_object_t *p_this ) ...@@ -178,9 +177,9 @@ static int Open( vlc_object_t *p_this )
p_sys->vcddev = vcddev; p_sys->vcddev = vcddev;
/* Do we play a single track ? */ /* Do we play a single track ? */
p_sys->i_track = var_CreateGetInteger( p_access, "cdda-track" ); p_sys->i_track = var_CreateGetInteger( p_access, "cdda-track" ) - 1;
if( p_sys->i_track < 0 && i_mrl_tracknum <= 0 ) if( p_sys->i_track < 0 )
{ {
/* We only do separate items if the whole disc is requested */ /* We only do separate items if the whole disc is requested */
input_thread_t *p_input = (input_thread_t*)vlc_object_find( p_access, VLC_OBJECT_INPUT, FIND_PARENT ); input_thread_t *p_input = (input_thread_t*)vlc_object_find( p_access, VLC_OBJECT_INPUT, FIND_PARENT );
...@@ -224,17 +223,17 @@ static int Open( vlc_object_t *p_this ) ...@@ -224,17 +223,17 @@ static int Open( vlc_object_t *p_this )
/* Tracknumber in MRL */ /* Tracknumber in MRL */
if( p_sys->i_first_sector < 0 || p_sys->i_last_sector < 0 ) if( p_sys->i_first_sector < 0 || p_sys->i_last_sector < 0 )
{ {
int i_titles; const int i_titles = ioctl_GetTracksMap( VLC_OBJECT(p_access),
if( i_mrl_tracknum <= 0 ) p_sys->vcddev, &p_sys->p_sectors );
if( p_sys->i_track >= i_titles )
{ {
msg_Err( p_access, "wrong sector information" ); msg_Err( p_access, "invalid track number" );
goto error; goto error;
} }
i_titles = ioctl_GetTracksMap( VLC_OBJECT(p_access), p_sys->i_first_sector = p_sys->p_sectors[p_sys->i_track];
p_sys->vcddev, &p_sys->p_sectors ); p_sys->i_last_sector = p_sys->p_sectors[p_sys->i_track+1];
} }
p_sys->i_sector = p_sys->i_first_sector; p_sys->i_sector = p_sys->i_first_sector;
p_access->info.i_size = (p_sys->i_last_sector - p_sys->i_first_sector) p_access->info.i_size = (p_sys->i_last_sector - p_sys->i_first_sector)
* (int64_t)CDDA_DATA_SIZE; * (int64_t)CDDA_DATA_SIZE;
......
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