[vlc-devel] commit: input: Expose input_ItemHasErrorWhenReading. (Pierre d'Herbemont )

git version control git at videolan.org
Fri Aug 1 22:50:11 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Fri Aug  1 22:47:33 2008 +0200| [f2b2e37c04b2921e29daa3260dc696646ad4f10c] | committer: Pierre d'Herbemont 

input: Expose input_ItemHasErrorWhenReading.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f2b2e37c04b2921e29daa3260dc696646ad4f10c
---

 include/vlc_events.h       |    5 +++++
 include/vlc_input.h        |    8 ++++++++
 src/input/input_internal.h |    3 +++
 src/input/item.c           |   37 ++++++++++++++++++++++++-------------
 src/libvlc-module.c        |    4 ++--
 src/misc/events.c          |    1 +
 6 files changed, 43 insertions(+), 15 deletions(-)

diff --git a/include/vlc_events.h b/include/vlc_events.h
index 51a3faa..cba7fb9 100644
--- a/include/vlc_events.h
+++ b/include/vlc_events.h
@@ -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
diff --git a/include/vlc_input.h b/include/vlc_input.h
index be28212..9f20ce1 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -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 ));
 
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index a825e53..b0069e7 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -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 );
diff --git a/src/input/item.c b/src/input/item.c
index 27f7a09..1dab190 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -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;
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 04526dd..a93822a 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -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,
diff --git a/src/misc/events.c b/src/misc/events.c
index 089b5e8..a0a4498 100644
--- a/src/misc/events.c
+++ b/src/misc/events.c
@@ -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"




More information about the vlc-devel mailing list