[vlc-commits] chromecast: Use the longest title when the current one is interactive
Hugo Beauzée-Luyssen
git at videolan.org
Fri Jan 5 17:35:54 CET 2018
vlc/vlc-3.0 | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Jan 4 13:39:01 2018 +0100| [d3eacd3625d29cbfafe2fbde3b195e63235c2ec8] | committer: Jean-Baptiste Kempf
chromecast: Use the longest title when the current one is interactive
To avoid casting the main menu of a DVD
(cherry picked from commit d80518fb1bdceafa7df1bdfbc8d8f474b50d19df)
(cherry picked from commit 3f357380d3876068c65e01ae28ac1a9b93f83a66)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=d3eacd3625d29cbfafe2fbde3b195e63235c2ec8
---
modules/stream_out/chromecast/chromecast_demux.cpp | 38 ++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/modules/stream_out/chromecast/chromecast_demux.cpp b/modules/stream_out/chromecast/chromecast_demux.cpp
index fa653ea04f..12365026c9 100644
--- a/modules/stream_out/chromecast/chromecast_demux.cpp
+++ b/modules/stream_out/chromecast/chromecast_demux.cpp
@@ -63,6 +63,44 @@ struct demux_sys_t
}
if (demux_Control( demux->p_next, DEMUX_CAN_SEEK, &canSeek ) != VLC_SUCCESS)
canSeek = false;
+
+ int i_current_title;
+ if( demux_Control( p_demux->p_next, DEMUX_GET_TITLE,
+ &i_current_title ) == VLC_SUCCESS )
+ {
+ 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;
+ bool b_is_interactive = false;
+ 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;
+ }
+ 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;
+ }
+ }
+ }
}
~demux_sys_t()
More information about the vlc-commits
mailing list