[vlc-commits] chromecast: Use the longuest title
Hugo Beauzée-Luyssen
git at videolan.org
Thu Jan 4 17:26:46 CET 2018
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Jan 4 13:39:01 2018 +0100| [d80518fb1bdceafa7df1bdfbc8d8f474b50d19df] | committer: Hugo Beauzée-Luyssen
chromecast: Use the longuest title
To avoid casting the main menu of a DVD
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d80518fb1bdceafa7df1bdfbc8d8f474b50d19df
---
modules/stream_out/chromecast/chromecast_demux.cpp | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/modules/stream_out/chromecast/chromecast_demux.cpp b/modules/stream_out/chromecast/chromecast_demux.cpp
index b47f7a133c..73f104329b 100644
--- a/modules/stream_out/chromecast/chromecast_demux.cpp
+++ b/modules/stream_out/chromecast/chromecast_demux.cpp
@@ -63,6 +63,35 @@ 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 )
+ {
+ int64_t i_longest_duration = 0;
+ int i_longest_title = 0;
+ for( int i = 0 ; i < i_nb_titles; ++i )
+ {
+ if( pp_titles[i]->i_length > i_longest_duration )
+ {
+ i_longest_duration = pp_titles[i]->i_length;
+ i_longest_title = i;
+ }
+ 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;
+ }
+ }
}
~demux_sys_t()
More information about the vlc-commits
mailing list