]> git.sesse.net Git - vlc/blobdiff - src/input/input_internal.h
input: Expose input_ItemHasErrorWhenReading.
[vlc] / src / input / input_internal.h
index 755a0ca37a2cc6a30f737166fc9193e75a3f392b..b0069e7f124d183c002cbb32e39735501603ea7f 100644 (file)
@@ -47,7 +47,7 @@ typedef struct
     demux_t  *p_demux;
 
     /* Title infos for that input */
-    bool   b_title_demux; /* Titles/Seekpoints provided by demux */
+    bool         b_title_demux; /* Titles/Seekpoints provided by demux */
     int          i_title;
     input_title_t **title;
 
@@ -65,7 +65,7 @@ typedef struct
     bool b_can_rate_control;
     bool b_rescale_ts;
 
-    bool b_eof;   /* eof of demuxer */
+    bool       b_eof;   /* eof of demuxer */
     double     f_fps;
 
     /* Clock average variation */
@@ -80,8 +80,8 @@ struct input_thread_private_t
     vlc_event_manager_t event_manager;
 
     /* Global properties */
-    bool  b_can_pause;
-    bool  b_can_rate_control;
+    bool        b_can_pause;
+    bool        b_can_rate_control;
 
     int         i_rate;
     /* */
@@ -105,9 +105,9 @@ struct input_thread_private_t
     input_attachment_t **attachment;
 
     /* Output */
-    es_out_t    *p_es_out;
+    es_out_t        *p_es_out;
     sout_instance_t *p_sout;            /* XXX Move it to es_out ? */
-    bool      b_out_pace_control; /*     idem ? */
+    bool            b_out_pace_control; /*     idem ? */
 
     /* Main input properties */
     input_source_t input;
@@ -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
@@ -314,7 +315,7 @@ sout_instance_t * input_DetachSout( input_thread_t *p_input );
 
 /* var.c */
 void input_ControlVarInit ( input_thread_t * );
-void input_ControlVarClean( input_thread_t * );
+void input_ControlVarStop( input_thread_t * );
 void input_ControlVarNavigation( input_thread_t * );
 void input_ControlVarTitle( input_thread_t *, int i_title );
 
@@ -363,7 +364,7 @@ typedef struct
     mtime_t                 last_update;
     int                     i_synchro_state;
 
-    bool              b_master;
+    bool                    b_master;
 
     int                     i_rate;
 
@@ -384,11 +385,39 @@ int subtitles_Filter( const char *);
 
 void MRLSplit( char *, const char **, const char **, char ** );
 
+static inline void input_ChangeStateWithVarCallback( input_thread_t *p_input, int state, bool callback )
+{
+    const bool changed = p_input->i_state != state;
+
+    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 );
+    }
+    else
+    {
+        vlc_value_t val;
+        val.i_int = state;
+        var_Change( p_input, "state", VLC_VAR_SETVALUE, &val, NULL );
+    }
+    if( changed )
+    {
+        vlc_event_t event;
+        event.type = vlc_InputStateChanged;
+        event.u.input_state_changed.new_state = state;
+        vlc_event_send( &p_input->p->event_manager, &event );
+    }
+}
+
 static inline void input_ChangeState( input_thread_t *p_input, int state )
 {
-    var_SetInteger( p_input, "state", p_input->i_state = state );
+    input_ChangeStateWithVarCallback( p_input, state, true );
 }
 
+
 /* Access */
 
 #define access_New( a, b, c, d ) __access_New(VLC_OBJECT(a), b, c, d )
@@ -445,7 +474,7 @@ struct stream_t
     /* UTF-16 and UTF-32 file reading */
     vlc_iconv_t     conv;
     int             i_char_width;
-    bool      b_little_endian;
+    bool            b_little_endian;
 };
 
 #include <libvlc.h>
@@ -453,7 +482,7 @@ struct stream_t
 static inline stream_t *vlc_stream_create( vlc_object_t *obj )
 {
     return (stream_t *)vlc_custom_create( obj, sizeof(stream_t),
-                                          VLC_OBJECT_STREAM, "stream" );
+                                          VLC_OBJECT_GENERIC, "stream" );
 }
 
 #endif