Commit fb7313e0 authored by Thomas Guillem's avatar Thomas Guillem

input: add a META_REQUEST flag to force user interaction

It this flag is set, user interaction will be forced when preparsing the item
given by libvlc_MetaRequest (there won't be user interactions for sub items).
parent 68cc74c5
......@@ -94,6 +94,9 @@ struct input_item_t
int i_preparse_depth; /**< How many level of sub items can be preparsed:
-1: recursive, 0: none, >0: n levels */
bool b_preparse_interact; /**< Force interaction with the user when
preparsing.*/
};
TYPEDEF_ARRAY(input_item_t*, input_item_array_t)
......@@ -320,7 +323,8 @@ typedef enum input_item_meta_request_option_t
META_REQUEST_OPTION_NONE = 0x00,
META_REQUEST_OPTION_SCOPE_LOCAL = 0x01,
META_REQUEST_OPTION_SCOPE_NETWORK = 0x02,
META_REQUEST_OPTION_SCOPE_ANY = 0x03
META_REQUEST_OPTION_SCOPE_ANY = 0x03,
META_REQUEST_OPTION_DO_INTERACT = 0x04
} input_item_meta_request_option_t;
VLC_API int libvlc_MetaRequest(libvlc_int_t *, input_item_t *,
......
......@@ -355,6 +355,21 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
p_item->i_preparse_depth = -1;
}
/* */
if( p_input->b_preparsing )
p_input->i_flags |= OBJECT_FLAGS_QUIET | OBJECT_FLAGS_NOINTERACT;
/* Make sure the interaction option is honored */
if( !var_InheritBool( p_input, "interact" ) )
p_input->i_flags |= OBJECT_FLAGS_NOINTERACT;
else if( p_item->b_preparse_interact )
{
/* If true, this item was asked explicitly to interact with the user
* (via libvlc_MetaRequest). Sub items created from this input won't
* have this flag and won't interact with the user */
p_input->i_flags &= ~OBJECT_FLAGS_NOINTERACT;
}
vlc_mutex_unlock( &p_item->lock );
/* No slave */
......@@ -438,14 +453,6 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
input_item_SetESNowPlaying( p_item, NULL );
input_SendEventMeta( p_input );
/* */
if( p_input->b_preparsing )
p_input->i_flags |= OBJECT_FLAGS_QUIET | OBJECT_FLAGS_NOINTERACT;
/* Make sure the interaction option is honored */
if( !var_InheritBool( p_input, "interact" ) )
p_input->i_flags |= OBJECT_FLAGS_NOINTERACT;
/* */
memset( &p_input->p->counters, 0, sizeof( p_input->p->counters ) );
vlc_mutex_init( &p_input->p->counters.counters_lock );
......
......@@ -621,6 +621,8 @@ int libvlc_MetaRequest(libvlc_int_t *libvlc, input_item_t *item,
vlc_mutex_lock( &item->lock );
if( item->i_preparse_depth == 0 )
item->i_preparse_depth = 1;
if( i_options & META_REQUEST_OPTION_DO_INTERACT )
item->b_preparse_interact = true;
vlc_mutex_unlock( &item->lock );
playlist_preparser_Push(priv->parser, item, i_options);
return VLC_SUCCESS;
......
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