]> git.sesse.net Git - vlc/commitdiff
libvlc_video_set_spu: fix setting to 0 when no SPU is present in the stream
authorJean-Paul Saman <jean-paul.saman@m2x.nl>
Fri, 6 Mar 2009 16:19:13 +0000 (17:19 +0100)
committerJean-Paul Saman <jean-paul.saman@m2x.nl>
Sat, 7 Mar 2009 16:01:28 +0000 (17:01 +0100)
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.

src/control/video.c

index 68e19d60d9e09c1ce5c7d95cba8f7167fae1e0e7..6efaa6fe3b2159ef853a224b67f7c545c2ecff6e 100644 (file)
@@ -432,6 +432,14 @@ void libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu,
     if( !p_input_thread ) return;
 
     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) )
     {
         libvlc_exception_raise( p_e, "Subtitle value out of range" );