[vlc-devel] commit: libvlc_video_set_spu: fix setting to 0 when no SPU is present in the stream (Jean-Paul Saman )

git version control git at videolan.org
Sat Mar 7 17:19:43 CET 2009


vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Fri Mar  6 17:19:13 2009 +0100| [326a3a3ce9ad216f1479a1c0fd29c1ae3897e958] | committer: 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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=326a3a3ce9ad216f1479a1c0fd29c1ae3897e958
---

 src/control/video.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/control/video.c b/src/control/video.c
index 68e19d6..6efaa6f 100644
--- a/src/control/video.c
+++ b/src/control/video.c
@@ -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" );




More information about the vlc-devel mailing list