Commit f9032314 authored by Francois Cartegnie's avatar Francois Cartegnie

vlc input control: add INPUT_GET_TITLE_INFO

as we'll need seekpoints for UI: chapters offsets were not sufficient.
parent 8b85c017
...@@ -494,6 +494,9 @@ enum input_query_e ...@@ -494,6 +494,9 @@ enum input_query_e
INPUT_DEL_BOOKMARK, /* arg1= seekpoint_t * res=can fail */ INPUT_DEL_BOOKMARK, /* arg1= seekpoint_t * res=can fail */
INPUT_SET_BOOKMARK, /* arg1= int res=can fail */ INPUT_SET_BOOKMARK, /* arg1= int res=can fail */
/* titles */
INPUT_GET_TITLE_INFO, /* arg1=input_title_t** arg2= int * res=can fail */
/* Attachments */ /* Attachments */
INPUT_GET_ATTACHMENTS, /* arg1=input_attachment_t***, arg2=int* res=can fail */ INPUT_GET_ATTACHMENTS, /* arg1=input_attachment_t***, arg2=int* res=can fail */
INPUT_GET_ATTACHMENT, /* arg1=input_attachment_t**, arg2=char* res=can fail */ INPUT_GET_ATTACHMENT, /* arg1=input_attachment_t**, arg2=char* res=can fail */
......
...@@ -325,6 +325,30 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args ) ...@@ -325,6 +325,30 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
vlc_mutex_unlock( &p_input->p->p_item->lock ); vlc_mutex_unlock( &p_input->p->p_item->lock );
return VLC_SUCCESS; return VLC_SUCCESS;
case INPUT_GET_TITLE_INFO:
{
input_title_t **p_title = (input_title_t **)va_arg( args, input_title_t ** );
int *pi_req_title_offset = (int *) va_arg( args, int * );
vlc_mutex_lock( &p_input->p->p_item->lock );
/* current title if -1 */
if ( *pi_req_title_offset < 0 )
*pi_req_title_offset = p_input->p->i_title_offset;
if( p_input->p->i_title && p_input->p->i_title > *pi_req_title_offset )
{
*p_title = vlc_input_title_Duplicate( p_input->p->title[*pi_req_title_offset] );
vlc_mutex_unlock( &p_input->p->p_item->lock );
return VLC_SUCCESS;
}
else
{
vlc_mutex_unlock( &p_input->p->p_item->lock );
return VLC_EGENERIC;
}
}
case INPUT_ADD_OPTION: case INPUT_ADD_OPTION:
{ {
const char *psz_option = va_arg( args, const char * ); const char *psz_option = va_arg( args, const char * );
......
...@@ -935,6 +935,7 @@ static void InitTitle( input_thread_t * p_input ) ...@@ -935,6 +935,7 @@ static void InitTitle( input_thread_t * p_input )
if( p_input->b_preparsing ) if( p_input->b_preparsing )
return; return;
vlc_mutex_lock( &p_input->p->p_item->lock );
/* Create global title (from master) */ /* Create global title (from master) */
p_input->p->i_title = p_master->i_title; p_input->p->i_title = p_master->i_title;
p_input->p->title = p_master->title; p_input->p->title = p_master->title;
...@@ -951,6 +952,7 @@ static void InitTitle( input_thread_t * p_input ) ...@@ -951,6 +952,7 @@ static void InitTitle( input_thread_t * p_input )
p_input->p->b_can_pace_control = p_master->b_can_pace_control; p_input->p->b_can_pace_control = p_master->b_can_pace_control;
p_input->p->b_can_pause = p_master->b_can_pause; p_input->p->b_can_pause = p_master->b_can_pause;
p_input->p->b_can_rate_control = p_master->b_can_rate_control; p_input->p->b_can_rate_control = p_master->b_can_rate_control;
vlc_mutex_unlock( &p_input->p->p_item->lock );
} }
static void StartTitle( input_thread_t * p_input ) static void StartTitle( input_thread_t * p_input )
......
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