[vlc-devel] [PATCH 1/2] src/input: add metadata feedback mechanism for access modules (refs #9332)

Felix Paul Kühne fkuehne at videolan.org
Sun Mar 23 14:20:36 CET 2014


---
 include/vlc_access.h       |  2 ++
 src/input/input.c          | 31 +++++++++++++++++++++++++------
 src/input/input_internal.h |  1 +
 3 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/include/vlc_access.h b/include/vlc_access.h
index 8a8f1fa..790840b 100644
--- a/include/vlc_access.h
+++ b/include/vlc_access.h
@@ -104,6 +104,8 @@ struct access_t
     /* Access has to maintain them uptodate */
     struct
     {
+        unsigned int i_update;  /* access sets them on change,
+                                   Input removes them once take into account*/
         uint64_t     i_pos;     /* idem */
         bool         b_eof;     /* idem */
     } info;
diff --git a/src/input/input.c b/src/input/input.c
index bec3f93..c2407bf 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -76,6 +76,7 @@ static bool       Control( input_thread_t *, int, vlc_value_t );
 
 static int  UpdateTitleSeekpointFromDemux( input_thread_t * );
 static void UpdateGenericFromDemux( input_thread_t * );
+static void UpdateGenericFromAccess( input_thread_t * );
 static void UpdateTitleListfromDemux( input_thread_t * );
 
 static void MRLSections( const char *, int *, int *, int *, int *);
@@ -571,6 +572,8 @@ static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed, bool *pb_d
             }
             UpdateGenericFromDemux( p_input );
         }
+        if( p_input->p->input.p_access->info.i_update )
+            UpdateGenericFromAccess( p_input );
     }
 
     if( i_ret == 0 )    /* EOF */
@@ -2162,6 +2165,22 @@ static void UpdateGenericFromDemux( input_thread_t *p_input )
     }
 }
 
+static void UpdateGenericFromAccess( input_thread_t *p_input )
+{
+    access_t *p_access = p_input->p->input.p_access;
+
+    if( p_access->info.i_update & INPUT_UPDATE_META )
+    {
+        vlc_meta_t *p_meta = vlc_meta_New();
+        if( p_meta )
+        {
+            access_Control( p_input->p->input.p_access, ACCESS_GET_META, p_meta );
+            InputUpdateMeta( p_input, p_meta );
+        }
+        p_access->info.i_update &= ~INPUT_UPDATE_META;
+    }
+}
+
 static void UpdateTitleListfromDemux( input_thread_t *p_input )
 {
     input_source_t *in = &p_input->p->input;
@@ -2304,9 +2323,9 @@ static int InputSourceInit( input_thread_t *p_input,
     }
     else
     {   /* Now try a real access */
-        access_t *p_access = access_New( p_input, p_input,
-                                         psz_access, psz_demux, psz_path );
-        if( p_access == NULL )
+        in->p_access = access_New( p_input, p_input,
+                                   psz_access, psz_demux, psz_path );
+        if( in->p_access == NULL )
         {
             if( vlc_object_alive( p_input ) )
             {
@@ -2320,8 +2339,8 @@ static int InputSourceInit( input_thread_t *p_input,
         }
 
         /* Access-forced demuxer (PARENTAL ADVISORY: EXPLICIT HACK) */
-        if( !*psz_demux && *p_access->psz_demux )
-            psz_demux = p_access->psz_demux;
+        if( !*psz_demux && *in->p_access->psz_demux )
+            psz_demux = in->p_access->psz_demux;
 
         /* */
         int  i_input_list;
@@ -2365,7 +2384,7 @@ static int InputSourceInit( input_thread_t *p_input,
             TAB_APPEND( i_input_list, ppsz_input_list, NULL );
 
         /* Create the stream_t */
-        stream_t *p_stream = stream_AccessNew( p_access, ppsz_input_list );
+        stream_t *p_stream = stream_AccessNew( in->p_access, ppsz_input_list );
         if( ppsz_input_list )
         {
             for( int i = 0; ppsz_input_list[i] != NULL; i++ )
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index 9f71294..3c31899 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -40,6 +40,7 @@
 typedef struct
 {
     demux_t  *p_demux; /**< Demux plugin instance */
+    access_t *p_access; /**< Access plugin instance */
 
     /* Title infos for that input */
     bool         b_title_demux; /* Titles/Seekpoints provided by demux */
-- 
1.8.5.2 (Apple Git-48)




More information about the vlc-devel mailing list