Commit 3f357380 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

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

parent 7e61d9a2
......@@ -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;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment