* ./plugins/dvd/dvd_es.c: error in selecting SPU stream.
[vlc.git] / plugins / dvd / dvd_es.c
index 8348410..c64dee0 100644 (file)
@@ -1,7 +1,7 @@
 /* dvd_es.c: functions to find and select ES
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: dvd_es.c,v 1.13 2002/06/02 13:49:35 sam Exp $
+ * $Id: dvd_es.c,v 1.14 2002/06/27 19:46:32 sam Exp $
  *
  * Author: St├ęphane Borel <stef@via.ecp.fr>
  *
@@ -306,8 +306,19 @@ void DVDLaunchDecoders( input_thread_t * p_input )
         }
         if( i_spu > 0 )
         {
-            i_spu += p_dvd->p_ifo->vts.manager_inf.i_audio_nb;
-            input_SelectES( p_input, p_input->stream.pp_es[i_spu] );
+            int i = 0, j = 0;
+            for( i = 0; i < p_input->stream.i_es_number; i++ )
+            {
+                if ( p_input->stream.pp_es[i]->i_type == DVD_SPU_ES )
+                {
+                    j++;
+                    if ( i_spu == j ) break;
+                }
+            }
+            if( i_spu == j )
+            {
+                input_SelectES( p_input, p_input->stream.pp_es[i] );
+            }
         }
     }
 }