[vlc-commits] Allow the demux to update its title list

Denis Charmet git at videolan.org
Thu Dec 6 11:40:27 CET 2012


vlc | branch: master | Denis Charmet <typx at dinauz.org> | Wed Dec  5 23:07:18 2012 +0100| [c2ae62db3785db388e45922290d03d5c0fdc0d01] | committer: Jean-Baptiste Kempf

Allow the demux to update its title list

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 include/vlc_input.h |    1 +
 src/input/input.c   |   30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 7882b6c..4400304 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -245,6 +245,7 @@ static inline void vlc_input_attachment_Delete( input_attachment_t *a )
 #define INPUT_UPDATE_SEEKPOINT  0x0020
 #define INPUT_UPDATE_META       0x0040
 #define INPUT_UPDATE_SIGNAL     0x0080
+#define INPUT_UPDATE_TITLE_LIST 0x0100
 
 /**
  * This defines private core storage for an input.
diff --git a/src/input/input.c b/src/input/input.c
index 1fc3ea8..da3f900 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -82,6 +82,7 @@ static void UpdateGenericFromAccess( input_thread_t * );
 
 static int  UpdateTitleSeekpointFromDemux( input_thread_t * );
 static void UpdateGenericFromDemux( input_thread_t * );
+static void UpdateTitleListfromDemux( input_thread_t * );
 
 static void MRLSections( const char *, int *, int *, int *, int *);
 
@@ -584,6 +585,11 @@ static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed, bool *pb_d
     {
         if( p_input->p->input.p_demux->info.i_update )
         {
+            if( p_input->p->input.p_demux->info.i_update & INPUT_UPDATE_TITLE_LIST )
+            {
+                UpdateTitleListfromDemux( p_input );
+                p_input->p->input.p_demux->info.i_update &= ~INPUT_UPDATE_TITLE_LIST;
+            }
             if( p_input->p->input.b_title_demux )
             {
                 i_ret = UpdateTitleSeekpointFromDemux( p_input );
@@ -2267,6 +2273,30 @@ static void UpdateGenericFromDemux( input_thread_t *p_input )
     p_demux->info.i_update &= ~INPUT_UPDATE_SIZE;
 }
 
+static void UpdateTitleListfromDemux( input_thread_t *p_input )
+{
+    input_source_t *in = &p_input->p->input;
+
+    /* Delete the preexisting titles */
+    if( in->i_title > 0 )
+    {
+        for( int i = 0; i < in->i_title; i++ )
+            vlc_input_title_Delete( in->title[i] );
+        TAB_CLEAN( in->i_title, in->title );
+        in->b_title_demux = false;
+    }
+
+    /* Get the new title list */
+    if( demux_Control( in->p_demux, DEMUX_GET_TITLE_INFO,
+                       &in->title, &in->i_title,
+                       &in->i_title_offset, &in->i_seekpoint_offset ) )
+        TAB_INIT( in->i_title, in->title );
+    else
+        in->b_title_demux = true;
+
+    InitTitle( p_input );
+}
+
 
 /*****************************************************************************
  * Update*FromAccess:



More information about the vlc-commits mailing list