Commit 3e666faf authored by Laurent Aimar's avatar Laurent Aimar

* vcd/vcd.c: ported to access2.

 * access2: added chapter support.
parent d279ea85
...@@ -64,6 +64,9 @@ vlc_module_begin(); ...@@ -64,6 +64,9 @@ vlc_module_begin();
add_shortcut( "mmsh" ); add_shortcut( "mmsh" );
add_shortcut( "mmst" ); add_shortcut( "mmst" );
add_shortcut( "mmsu" ); add_shortcut( "mmsu" );
add_shortcut( "vcd" );
add_shortcut( "svcd" );
vlc_module_end(); vlc_module_end();
/***************************************************************************** /*****************************************************************************
...@@ -86,6 +89,8 @@ typedef struct ...@@ -86,6 +89,8 @@ typedef struct
} access2_sys_t; } access2_sys_t;
static void UpdateInfo( input_thread_t *p_input, vlc_bool_t b_force_chapter );
/***************************************************************************** /*****************************************************************************
* Access2Open: initializes structures * Access2Open: initializes structures
*****************************************************************************/ *****************************************************************************/
...@@ -299,38 +304,10 @@ update: ...@@ -299,38 +304,10 @@ 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; vlc_mutex_lock( &p_input->stream.stream_lock );
var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL ); UpdateInfo( p_input, VLC_FALSE );
vlc_mutex_unlock( &p_input->stream.stream_lock );
p_access->info.i_update &= ~INPUT_UPDATE_TITLE;
}
/* Size change */
if( p_access->info.i_update & INPUT_UPDATE_SIZE )
{
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.p_selected_area->i_size = p_access->info.i_size;
p_input->stream.b_changed = VLC_TRUE;
vlc_mutex_unlock( &p_input->stream.stream_lock );
p_access->info.i_update &= ~INPUT_UPDATE_SIZE;
}
if( p_access->info.i_update & INPUT_UPDATE_SEEKPOINT )
{
/* TODO */
msg_Err( p_input, "INPUT_UPDATE_SEEKPOINT to do" );
}
return i_total; return i_total;
} }
...@@ -343,7 +320,7 @@ static int Access2SetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -343,7 +320,7 @@ static int Access2SetArea( input_thread_t * p_input, input_area_t * p_area )
{ {
access2_sys_t *p_sys = (access2_sys_t*)p_input->p_access_data; access2_sys_t *p_sys = (access2_sys_t*)p_input->p_access_data;
access_t *p_access = p_sys->p_access; access_t *p_access = p_sys->p_access;
vlc_value_t val; int i_seekpoint = p_area->i_part - 1;
/* 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;
...@@ -354,18 +331,21 @@ static int Access2SetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -354,18 +331,21 @@ static int Access2SetArea( input_thread_t * p_input, input_area_t * p_area )
if( access2_Control( p_access, ACCESS_SET_TITLE, (int)(p_area->i_id - 1) ) ) if( access2_Control( p_access, ACCESS_SET_TITLE, (int)(p_area->i_id - 1) ) )
return VLC_EGENERIC; return VLC_EGENERIC;
/* Change the default area */ p_input->stream.p_selected_area = p_area;
p_input->stream.p_selected_area = p_input->stream.pp_areas[p_access->info.i_title+1]; }
p_input->stream.p_selected_area->i_tell = p_access->info.i_pos; fprintf( stderr, "Access2SetArea: part=%d seekpart=%d nbseekpoint=%d\n",
p_area->i_part, i_seekpoint, p_sys->title[p_access->info.i_title]->i_seekpoint );
/* Update the navigation variables without triggering a callback */
val.i_int = p_access->info.i_title+1;;
var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL );
/* Clear the flag */ if( i_seekpoint != p_access->info.i_seekpoint &&
p_access->info.i_update &= ~INPUT_UPDATE_TITLE; i_seekpoint >= 0 &&
i_seekpoint < p_sys->title[p_access->info.i_title]->i_seekpoint )
{
msg_Dbg( p_input, "setting seekpoint" );
access2_Control( p_access, ACCESS_SET_SEEKPOINT, (int)i_seekpoint );
} }
UpdateInfo( p_input, VLC_TRUE );
/* warn interface that something has changed */ /* warn interface that something has changed */
p_input->stream.b_seekable = VLC_TRUE; p_input->stream.b_seekable = VLC_TRUE;
p_input->stream.b_changed = VLC_TRUE; p_input->stream.b_changed = VLC_TRUE;
...@@ -412,3 +392,62 @@ static int Access2Control( input_thread_t *p_input, int i_query, va_list args ) ...@@ -412,3 +392,62 @@ static int Access2Control( input_thread_t *p_input, int i_query, va_list args )
return access2_vaControl( p_access, i_query, args ); return access2_vaControl( p_access, i_query, args );
} }
/*****************************************************************************
* UpdateInfo:
*****************************************************************************/
static void UpdateInfo( input_thread_t *p_input, vlc_bool_t b_force_chapter )
{
access2_sys_t *p_sys = (access2_sys_t*)p_input->p_access_data;
access_t *p_access = p_sys->p_access;
/* Title change */
if( p_access->info.i_update & INPUT_UPDATE_TITLE )
{
int i_seekpoint;
int i;
vlc_value_t val;
msg_Dbg( p_input, "INPUT_UPDATE_TITLE" );
p_input->stream.p_selected_area = p_input->stream.pp_areas[p_access->info.i_title+1];
p_input->stream.p_selected_area->i_part = 1;
p_input->stream.p_selected_area->i_tell = p_access->info.i_pos;
p_input->stream.b_changed = VLC_TRUE;
val.i_int = p_access->info.i_title+1;
var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL );
var_Change( p_input, "chapter", VLC_VAR_CLEARCHOICES, NULL, NULL );
i_seekpoint = p_sys->title[p_access->info.i_title]->i_seekpoint;
for( i = 0; i < i_seekpoint ? i_seekpoint : 0; i++ )
{
val.i_int = i + 1;
var_Change( p_input, "chapter", VLC_VAR_ADDCHOICE, &val, NULL );
}
p_access->info.i_update &= ~INPUT_UPDATE_TITLE;
}
/* b_force_chapter: don't force a chapter change when a there is
* pending user one (as it reset i_part */
if( p_access->info.i_update & INPUT_UPDATE_SEEKPOINT &&
( b_force_chapter || !p_input->stream.p_new_area ) )
{
vlc_value_t val;
/* TODO is it complete ? */
p_input->stream.p_selected_area->i_part = p_access->info.i_seekpoint + 1;
val.i_int = p_input->stream.p_selected_area->i_part;
var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val, NULL );
p_access->info.i_update &= ~INPUT_UPDATE_SEEKPOINT;
}
/* Size change */
if( p_access->info.i_update & INPUT_UPDATE_SIZE )
{
p_input->stream.p_selected_area->i_size = p_access->info.i_size;
p_input->stream.b_changed = VLC_TRUE;
p_access->info.i_update &= ~INPUT_UPDATE_SIZE;
}
}
This diff is collapsed.
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