]> git.sesse.net Git - vlc/blobdiff - src/input/input_internal.h
input: Expose input_ItemHasErrorWhenReading.
[vlc] / src / input / input_internal.h
index 0ed89a24924dee1a64c8c14280c8fb0d986d354f..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 */
@@ -76,9 +76,12 @@ typedef struct
 /** Private input fields */
 struct input_thread_private_t
 {
+    /* Object's event manager */
+    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;
     /* */
@@ -102,11 +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_sout_keep;
-    bool      b_out_pace_control; /*     idem ? */
-    bool      b_owns_its_sout;
+    bool            b_out_pace_control; /*     idem ? */
 
     /* Main input properties */
     input_source_t input;
@@ -114,6 +115,13 @@ struct input_thread_private_t
     int            i_slave;
     input_source_t **slave;
 
+    /* pts delay fixup */
+    struct {
+        int  i_num_faulty;
+        bool to_high;
+        bool auto_adjust;
+    } pts_adjust;
+
     /* Stats counters */
     struct {
         counter_t *p_read_packets;
@@ -251,17 +259,6 @@ static inline void input_item_SetPreparsed( input_item_t *p_i, bool preparsed )
     }
 }
 
-static inline void input_item_SetMetaFetched( input_item_t *p_i, bool metafetched )
-{
-    if( !p_i->p_meta )
-        p_i->p_meta = vlc_meta_New();
-
-    if( metafetched )
-        p_i->p_meta->i_status |= ITEM_META_FETCHED;
-    else
-        p_i->p_meta->i_status &= ~ITEM_META_FETCHED;
-}
-
 static inline void input_item_SetArtNotFound( input_item_t *p_i, bool notfound )
 {
     if( !p_i->p_meta )
@@ -284,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
@@ -296,10 +294,7 @@ typedef struct playlist_album_t
     bool b_found;
 } playlist_album_t;
 
-int         input_MetaFetch     ( playlist_t *, input_item_t * );
 int         input_ArtFind       ( playlist_t *, input_item_t * );
-bool  input_MetaSatisfied ( playlist_t*, input_item_t*,
-                                  uint32_t*, uint32_t* );
 int         input_DownloadAndCacheArt ( playlist_t *, input_item_t * );
 
 /* Becarefull; p_item lock HAS to be taken */
@@ -320,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 );
 
@@ -369,7 +364,7 @@ typedef struct
     mtime_t                 last_update;
     int                     i_synchro_state;
 
-    bool              b_master;
+    bool                    b_master;
 
     int                     i_rate;
 
@@ -390,44 +385,72 @@ 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 access2_New( a, b, c, d ) __access2_New(VLC_OBJECT(a), b, c, d )
-access_t * __access2_New( vlc_object_t *p_obj, const char *psz_access,
+#define access_New( a, b, c, d ) __access_New(VLC_OBJECT(a), b, c, d )
+access_t * __access_New( vlc_object_t *p_obj, const char *psz_access,
                           const char *psz_demux, const char *psz_path );
-access_t * access2_FilterNew( access_t *p_source,
+access_t * access_FilterNew( access_t *p_source,
                               const char *psz_access_filter );
-void access2_Delete( access_t * );
+void access_Delete( access_t * );
 
 /* Demuxer */
 #include <vlc_demux.h>
 
 /* stream_t *s could be null and then it mean a access+demux in one */
-#define demux2_New( a, b, c, d, e, f,g ) __demux2_New(VLC_OBJECT(a),b,c,d,e,f,g)
-demux_t *__demux2_New(vlc_object_t *p_obj, const char *psz_access, const char *psz_demux, const char *psz_path, stream_t *s, es_out_t *out, bool );
+#define demux_New( a, b, c, d, e, f,g ) __demux_New(VLC_OBJECT(a),b,c,d,e,f,g)
+demux_t *__demux_New(vlc_object_t *p_obj, const char *psz_access, const char *psz_demux, const char *psz_path, stream_t *s, es_out_t *out, bool );
 
-void demux2_Delete(demux_t *);
+void demux_Delete(demux_t *);
 
-static inline int demux2_Demux( demux_t *p_demux )
+static inline int demux_Demux( demux_t *p_demux )
 {
     return p_demux->pf_demux( p_demux );
 }
-static inline int demux2_vaControl( demux_t *p_demux, int i_query, va_list args )
+static inline int demux_vaControl( demux_t *p_demux, int i_query, va_list args )
 {
     return p_demux->pf_control( p_demux, i_query, args );
 }
-static inline int demux2_Control( demux_t *p_demux, int i_query, ... )
+static inline int demux_Control( demux_t *p_demux, int i_query, ... )
 {
     va_list args;
     int     i_result;
 
     va_start( args, i_query );
-    i_result = demux2_vaControl( p_demux, i_query, args );
+    i_result = demux_vaControl( p_demux, i_query, args );
     va_end( args );
     return i_result;
 }
@@ -451,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>
@@ -459,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