Commit 73c96a16 authored by Laurent Aimar's avatar Laurent Aimar

Fixed input bookmark thread safety, support and event.

parent 23eae026
......@@ -435,7 +435,6 @@ struct input_thread_t
* TODO complete the documentation.
* The read only variables are:
* - "length"
* - "bookmarks"
* - "can-seek" (if you can seek, it doesn't say if 'bar display' has be shown
* or not, for that check position != 0.0)
* - "can-pause"
......@@ -455,7 +454,7 @@ struct input_thread_t
* - chapter, next-chapter, next-chapter-prev
* - program, audio-es, video-es, spu-es
* - audio-delay, spu-delay
* - bookmark
* - bookmark (bookmark list)
* - record
* - frame-next
* - navigation (list of "title %2i")
......@@ -560,6 +559,9 @@ typedef enum input_event_type_e
/* "spu-delay" has changed */
INPUT_EVENT_SUBTITLE_DELAY,
/* "bookmark" has changed */
INPUT_EVENT_BOOKMARK,
} input_event_type_e;
/** @}*/
......
This diff is collapsed.
......@@ -304,6 +304,14 @@ void input_SendEventVout( input_thread_t *p_input )
Trigger( p_input, INPUT_EVENT_VOUT );
}
/*****************************************************************************
* Event for control.c/input.c
*****************************************************************************/
void input_SendEventBookmark( input_thread_t *p_input )
{
Trigger( p_input, INPUT_EVENT_BOOKMARK );
}
/*****************************************************************************
*
*****************************************************************************/
......
......@@ -68,5 +68,11 @@ void input_SendEventTeletext( input_thread_t *p_input, int i_id );
*****************************************************************************/
void input_SendEventVout( input_thread_t *p_input );
/*****************************************************************************
* Event for control.c/input.c
*****************************************************************************/
void input_SendEventBookmark( input_thread_t *p_input );
#endif
......@@ -2115,6 +2115,45 @@ static bool Control( input_thread_t *p_input, int i_type,
break;
case INPUT_CONTROL_SET_BOOKMARK:
{
seekpoint_t bookmark;
bookmark.i_time_offset = -1;
bookmark.i_byte_offset = -1;
vlc_mutex_lock( &p_input->p->p_item->lock );
if( val.i_int >= 0 && val.i_int < p_input->p->i_bookmark )
{
const seekpoint_t *p_bookmark = p_input->p->pp_bookmark[val.i_int];
bookmark.i_time_offset = p_bookmark->i_time_offset;
bookmark.i_byte_offset = p_bookmark->i_byte_offset;
}
vlc_mutex_unlock( &p_input->p->p_item->lock );
if( bookmark.i_time_offset < 0 && bookmark.i_byte_offset < 0 )
{
msg_Err( p_input, "invalid bookmark %d", val.i_int );
break;
}
if( bookmark.i_time_offset >= 0 )
{
val.i_time = bookmark.i_time_offset;
b_force_update = Control( p_input, INPUT_CONTROL_SET_TIME, val );
}
else if( bookmark.i_byte_offset >= 0 &&
p_input->p->input.p_stream )
{
const int64_t i_size = stream_Size( p_input->p->input.p_stream );
if( i_size > 0 && bookmark.i_byte_offset <= i_size )
{
val.f_float = (double)bookmark.i_byte_offset / i_size;
b_force_update = Control( p_input, INPUT_CONTROL_SET_POSITION, val );
}
}
break;
}
default:
msg_Err( p_input, "not yet implemented" );
break;
......
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