]> git.sesse.net Git - vlc/commitdiff
Allow the demux to update its title list
authorDenis Charmet <typx@dinauz.org>
Wed, 5 Dec 2012 22:07:18 +0000 (23:07 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 6 Dec 2012 10:40:12 +0000 (11:40 +0100)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
include/vlc_input.h
src/input/input.c

index 7882b6c8e461e3cf9e7b9a01e5b55924979b95f3..44003041ad4f2418987f0f113cfec801c7278863 100644 (file)
@@ -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.
index 1fc3ea8babfbfcc0212b3f6b2cf9faa18aad0683..da3f900e9a4e7981d029576238286eee57945409 100644 (file)
@@ -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: