Commit f2b2e37c authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

input: Expose input_ItemHasErrorWhenReading.

parent d727c459
......@@ -123,6 +123,7 @@ typedef enum vlc_event_type_t {
vlc_InputItemPreparsedChanged,
vlc_InputItemNameChanged,
vlc_InputItemInfoChanged,
vlc_InputItemErrorWhenReadingChanged,
/* Service Discovery event */
vlc_ServicesDiscoveryItemAdded,
......@@ -173,6 +174,10 @@ typedef struct vlc_event_t
{
void * unused;
} input_item_info_changed;
struct input_item_error_when_reading_changed
{
bool new_value;
} input_item_error_when_reading_changed;
/* Service discovery events */
struct vlc_services_discovery_item_added
......
......@@ -78,6 +78,8 @@ struct input_item_t
input_stats_t *p_stats; /**< Statistics */
int i_nb_played; /**< Number of times played */
bool b_error_when_reading; /**< Error When Reading */
vlc_meta_t *p_meta;
vlc_event_manager_t event_manager;
......@@ -157,6 +159,12 @@ int input_ItemAddOption (input_item_t *item, const char *str)
return input_ItemAddOpt (item, str, VLC_INPUT_OPTION_TRUSTED);
}
static inline
int input_ItemHasErrorWhenReading (input_item_t *item)
{
return item->b_error_when_reading;
}
VLC_EXPORT( void, input_item_SetMeta, ( input_item_t *p_i, vlc_meta_type_t meta_type, const char *psz_val ));
......
......@@ -281,6 +281,7 @@ static inline void input_item_SetArtFetched( input_item_t *p_i, bool artfetched
p_i->p_meta->i_status &= ~ITEM_ART_FETCHED;
}
void input_item_SetHasErrorWhenReading( input_item_t *p_i, bool error );
/**********************************************************************
* Item metadata
......@@ -390,6 +391,8 @@ static inline void input_ChangeStateWithVarCallback( input_thread_t *p_input, in
p_input->i_state = state;
input_item_SetHasErrorWhenReading( p_input->p->input.p_item, (state == ERROR_S) );
if( callback )
{
var_SetInteger( p_input, "state", state );
......
......@@ -53,19 +53,15 @@ static inline void input_ItemInit( vlc_object_t *p_o, input_item_t *p_i )
p_i->p_meta = NULL;
vlc_mutex_init( &p_i->lock );
vlc_event_manager_init( &p_i->event_manager, p_i, p_o );
vlc_event_manager_register_event_type( &p_i->event_manager,
vlc_InputItemMetaChanged );
vlc_event_manager_register_event_type( &p_i->event_manager,
vlc_InputItemSubItemAdded );
vlc_event_manager_register_event_type( &p_i->event_manager,
vlc_InputItemDurationChanged );
vlc_event_manager_register_event_type( &p_i->event_manager,
vlc_InputItemPreparsedChanged );
vlc_event_manager_register_event_type( &p_i->event_manager,
vlc_InputItemNameChanged );
vlc_event_manager_register_event_type( &p_i->event_manager,
vlc_InputItemInfoChanged );
vlc_event_manager_t * p_em = &p_i->event_manager;
vlc_event_manager_init( p_em, p_i, p_o );
vlc_event_manager_register_event_type( p_em, vlc_InputItemMetaChanged );
vlc_event_manager_register_event_type( p_em, vlc_InputItemSubItemAdded );
vlc_event_manager_register_event_type( p_em, vlc_InputItemDurationChanged );
vlc_event_manager_register_event_type( p_em, vlc_InputItemPreparsedChanged );
vlc_event_manager_register_event_type( p_em, vlc_InputItemNameChanged );
vlc_event_manager_register_event_type( p_em, vlc_InputItemInfoChanged );
vlc_event_manager_register_event_type( p_em, vlc_InputItemErrorWhenReadingChanged );
}
static inline void input_ItemClean( input_item_t *p_i )
......@@ -120,6 +116,21 @@ static inline void input_ItemClean( input_item_t *p_i )
vlc_mutex_destroy( &p_i->lock );
}
void input_item_SetHasErrorWhenReading( input_item_t *p_i, bool error )
{
vlc_event_t event;
if( p_i->b_error_when_reading == error )
return;
p_i->b_error_when_reading = error;
/* Notify interested third parties */
event.type = vlc_InputItemErrorWhenReadingChanged;
event.u.input_item_error_when_reading_changed.new_value = error;
vlc_event_send( &p_i->event_manager, &event );
}
void input_item_SetMeta( input_item_t *p_i, vlc_meta_type_t meta_type, const char *psz_val )
{
vlc_event_t event;
......
......@@ -1513,8 +1513,8 @@ vlc_module_begin();
add_integer( "video-title-position", 8, NULL, VIDEO_TITLE_POSITION_TEXT,
VIDEO_TITLE_POSITION_LONGTEXT, false );
change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 );
// autohide after 3s
add_integer( "mouse-hide-timeout", 3000, NULL, MOUSE_HIDE_TIMEOUT_TEXT,
// autohide after 1.5s
add_integer( "mouse-hide-timeout", 1500, NULL, MOUSE_HIDE_TIMEOUT_TEXT,
MOUSE_HIDE_TIMEOUT_LONGTEXT, false );
set_section( N_("Snapshot") , NULL );
add_directory( "snapshot-path", NULL, NULL, SNAP_PATH_TEXT,
......
......@@ -81,6 +81,7 @@ static const char ppsz_event_type_to_name[][33] =
[vlc_InputItemPreparsedChanged] = "vlc_InputItemPreparsedChanged",
[vlc_InputItemNameChanged] = "vlc_InputItemNameChanged",
[vlc_InputItemInfoChanged] = "vlc_InputItemInfoChanged",
[vlc_InputItemErrorWhenReadingChanged] = "vlc_InputItemErrorWhenReadingChanged",
[vlc_ServicesDiscoveryItemAdded] = "vlc_ServicesDiscoveryItemAdded",
[vlc_ServicesDiscoveryItemRemoved] = "vlc_ServicesDiscoveryItemRemoved"
......
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