[vlc-commits] chromecast_demux: Switch to the main title when the current one is interactive

Hugo Beauzée-Luyssen git at videolan.org
Thu Jan 4 17:48:28 CET 2018


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Jan  4 17:48:35 2018 +0100| [3f357380d3876068c65e01ae28ac1a9b93f83a66] | committer: Hugo Beauzée-Luyssen

chromecast_demux: Switch to the main title when the current one is interactive

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

 modules/stream_out/chromecast/chromecast_demux.cpp | 53 +++++++++++++---------
 1 file changed, 31 insertions(+), 22 deletions(-)

diff --git a/modules/stream_out/chromecast/chromecast_demux.cpp b/modules/stream_out/chromecast/chromecast_demux.cpp
index 73f104329b..5ef74f2153 100644
--- a/modules/stream_out/chromecast/chromecast_demux.cpp
+++ b/modules/stream_out/chromecast/chromecast_demux.cpp
@@ -64,32 +64,41 @@ struct demux_sys_t
         if (demux_Control( demux->p_next, DEMUX_CAN_SEEK, &canSeek ) != VLC_SUCCESS)
             canSeek = false;
 
-        input_title_t** pp_titles;
-        int i_nb_titles, i_title_offset, i_chapter_offset;
-        if( demux_Control( demux->p_next, DEMUX_GET_TITLE_INFO, &pp_titles,
-                          &i_nb_titles, &i_title_offset,
-                          &i_chapter_offset ) == VLC_SUCCESS )
+        int i_current_title;
+        if( demux_Control( p_demux->p_next, DEMUX_GET_TITLE,
+                           &i_current_title ) == VLC_SUCCESS )
         {
-            int64_t i_longest_duration = 0;
-            int i_longest_title = 0;
-            for( int i = 0 ; i < i_nb_titles; ++i )
+            input_title_t** pp_titles;
+            int i_nb_titles, i_title_offset, i_chapter_offset;
+            if( demux_Control( demux->p_next, DEMUX_GET_TITLE_INFO, &pp_titles,
+                              &i_nb_titles, &i_title_offset,
+                              &i_chapter_offset ) == VLC_SUCCESS )
             {
-                if( pp_titles[i]->i_length > i_longest_duration )
+                int64_t i_longest_duration = 0;
+                int i_longest_title = 0;
+                bool b_is_interactive = false;
+                for( int i = 0 ; i < i_nb_titles; ++i )
                 {
-                    i_longest_duration = pp_titles[i]->i_length;
-                    i_longest_title = i;
+                    if( pp_titles[i]->i_length > i_longest_duration )
+                    {
+                        i_longest_duration = pp_titles[i]->i_length;
+                        i_longest_title = i;
+                    }
+                    if( i_current_title == i &&
+                            pp_titles[i]->i_flags & INPUT_TITLE_INTERACTIVE )
+                    {
+                        b_is_interactive = true;
+                    }
+                    vlc_input_title_Delete( pp_titles[i] );
+                }
+                free( pp_titles );
+
+                if( b_is_interactive == true )
+                {
+                    demux_Control( p_demux->p_next, DEMUX_SET_TITLE,
+                                   i_longest_title );
+                    p_demux->info.i_update = p_demux->p_next->info.i_update;
                 }
-                vlc_input_title_Delete( pp_titles[i] );
-            }
-            free( pp_titles );
-            int i_current_title;
-            if ( demux_Control( p_demux->p_next, DEMUX_GET_TITLE,
-                                &i_current_title ) == VLC_SUCCESS &&
-                 i_current_title != i_longest_title )
-            {
-                demux_Control( p_demux->p_next, DEMUX_SET_TITLE,
-                               i_longest_title );
-                p_demux->info.i_update = p_demux->p_next->info.i_update;
             }
         }
     }



More information about the vlc-commits mailing list