[vlc-commits] vlc input control: add INPUT_GET_TITLE_INFO
Francois Cartegnie
git at videolan.org
Mon Jul 11 23:14:22 CEST 2011
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Jun 25 16:57:06 2011 +0200| [f90323146eef46030d4d056ccc253e5e66755cf5] | committer: Francois Cartegnie
vlc input control: add INPUT_GET_TITLE_INFO
as we'll need seekpoints for UI: chapters offsets were not sufficient.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f90323146eef46030d4d056ccc253e5e66755cf5
---
include/vlc_input.h | 3 +++
src/input/control.c | 24 ++++++++++++++++++++++++
src/input/input.c | 2 ++
3 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/include/vlc_input.h b/include/vlc_input.h
index 266a0ce..5d7df89 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -494,6 +494,9 @@ enum input_query_e
INPUT_DEL_BOOKMARK, /* arg1= seekpoint_t * 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 */
INPUT_GET_ATTACHMENTS, /* arg1=input_attachment_t***, arg2=int* res=can fail */
INPUT_GET_ATTACHMENT, /* arg1=input_attachment_t**, arg2=char* res=can fail */
diff --git a/src/input/control.c b/src/input/control.c
index e1cd747..e93b6dc 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -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 );
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:
{
const char *psz_option = va_arg( args, const char * );
diff --git a/src/input/input.c b/src/input/input.c
index 2bcfaf7..7927480 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -935,6 +935,7 @@ static void InitTitle( input_thread_t * p_input )
if( p_input->b_preparsing )
return;
+ vlc_mutex_lock( &p_input->p->p_item->lock );
/* Create global title (from master) */
p_input->p->i_title = p_master->i_title;
p_input->p->title = p_master->title;
@@ -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_pause = p_master->b_can_pause;
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 )
More information about the vlc-commits
mailing list