Commit 326a3a3c authored by Jean-Paul Saman's avatar Jean-Paul Saman

libvlc_video_set_spu: fix setting to 0 when no SPU is present in the stream

In streams that do not have SPU ES setting spu-es to zero using libvlc_video_set_spu() results in playback being stopped. This is unwanted behaviour against which this patch protects now.
parent e00d4da8
...@@ -432,6 +432,14 @@ void libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu, ...@@ -432,6 +432,14 @@ void libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu,
if( !p_input_thread ) return; if( !p_input_thread ) return;
var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL ); var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL );
if( val_list.p_list->i_count == 0 )
{
libvlc_exception_raise( p_e, "Subtitle value out of range" );
vlc_object_release( p_input_thread );
return;
}
if( (i_spu < 0) && (i_spu > val_list.p_list->i_count) ) if( (i_spu < 0) && (i_spu > val_list.p_list->i_count) )
{ {
libvlc_exception_raise( p_e, "Subtitle value out of range" ); libvlc_exception_raise( p_e, "Subtitle value out of range" );
......
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