]> git.sesse.net Git - vlc/commitdiff
* All: moved the check for "video" and "audio" config variables to
authorGildas Bazin <gbazin@videolan.org>
Tue, 5 Nov 2002 18:25:43 +0000 (18:25 +0000)
committerGildas Bazin <gbazin@videolan.org>
Tue, 5 Nov 2002 18:25:43 +0000 (18:25 +0000)
   input_SelectES(). That allows --no-video and --no-audio to automagically
   work for all demuxers.

modules/access/dvd/es.c
modules/access/dvdplay/es.c
modules/access/dvdread/input.c
modules/access/satellite/access.c
src/input/input_programs.c

index 60e09cd85c59e772dcf81a03e911b264900f3307..15b9ca99288b521f9abfb269036dd6463c96c3c2 100644 (file)
@@ -1,7 +1,7 @@
 /* es.c: functions to find and select ES
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: es.c,v 1.2 2002/08/30 22:22:24 massiot Exp $
+ * $Id: es.c,v 1.3 2002/11/05 18:25:43 gbazin Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -254,13 +254,10 @@ void DVDLaunchDecoders( input_thread_t * p_input )
     p_dvd = (thread_dvd_data_t*)(p_input->p_access_data);
 
     /* Select Video stream (always 0) */
-    if( config_GetInt( p_input, "video" ) )
-    {
-        input_SelectES( p_input, p_input->stream.pp_es[0] );
-    }
+    input_SelectES( p_input, p_input->stream.pp_es[0] );
 
     /* Select audio stream */
-    if( p_dvd->i_audio_nb > 0 && config_GetInt( p_input, "audio" ) )
+    if( p_dvd->i_audio_nb > 0 )
     {
         /* For audio: first one if none or a not existing one specified */
         i_audio = config_GetInt( p_input, "audio-channel" );
@@ -295,7 +292,7 @@ void DVDLaunchDecoders( input_thread_t * p_input )
     }
 
     /* Select subtitle */
-    if( p_dvd->i_spu_nb > 0 && config_GetInt( p_input, "video" ) )
+    if( p_dvd->i_spu_nb )
     {
         /* for spu, default is none */
         i_spu = config_GetInt( p_input, "spu-channel" );
index a8640b0188e73ba81ede95eeb9e419ba97e8a0c8..2feefa2e4491ca1b859e38c1960f3cb79c8c3e51 100644 (file)
@@ -2,7 +2,7 @@
  * es.c: functions to handle elementary streams.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: es.c,v 1.3 2002/08/30 22:22:24 massiot Exp $
+ * $Id: es.c,v 1.4 2002/11/05 18:25:43 gbazin Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -236,16 +236,12 @@ void dvdplay_LaunchDecoders( input_thread_t * p_input )
 
     dvdplay_audio_info( p_dvd->vmg, &i_audio_nr, &i_audio );
     dvdplay_subp_info( p_dvd->vmg, &i_subp_nr, &i_subp );
-            
-    if( config_GetInt( p_input, "video" ) )
-    {
-        input_SelectES( p_input, p_input->stream.pp_es[0] );
-    }
+
+    input_SelectES( p_input, p_input->stream.pp_es[0] );
 
 //    if( !i_audio ) i_audio = 1;
     if( i_audio > p_dvd->i_audio_nb ) i_audio = 1;
-    if( config_GetInt( p_input, "audio" )
-            &&( i_audio > 0 ) && ( p_dvd->i_audio_nb > 0 ) )
+    if( ( i_audio > 0 ) && ( p_dvd->i_audio_nb > 0 ) )
     {
         if( config_GetInt( p_input, "audio-type" ) == REQUESTED_A52 )
         {
@@ -279,8 +275,7 @@ void dvdplay_LaunchDecoders( input_thread_t * p_input )
         }
     }
 
-    if( config_GetInt( p_input, "video" )
-            && ( i_subp > 0 ) && ( p_dvd->i_spu_nb > 0 ) )
+    if( ( i_subp > 0 ) && ( p_dvd->i_spu_nb > 0 ) )
     {
         i_subp += p_dvd->i_audio_nb;
         input_SelectES( p_input, p_input->stream.pp_es[i_subp] );
index 709d23b58ea97285fbb720dcc5ef478243c13168..4fb31799445d4b25f816f99f6b22d3aa5a58d6c7 100644 (file)
@@ -6,7 +6,7 @@
  * It depends on: libdvdread for ifo files and block reading.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: input.c,v 1.6 2002/10/26 15:24:19 gbazin Exp $
+ * $Id: input.c,v 1.7 2002/11/05 18:25:43 gbazin Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -1198,64 +1198,51 @@ static void DvdReadFindCell( thread_dvd_data_t * p_dvd )
  *****************************************************************************/
 static void DvdReadLauchDecoders( input_thread_t * p_input )
 {
-    thread_dvd_data_t *  p_dvd;
-    
-    p_dvd = (thread_dvd_data_t*)(p_input->p_access_data);            
-            
-    if( config_GetInt( p_input, "video" ) )
+    thread_dvd_data_t * p_dvd = (thread_dvd_data_t*)(p_input->p_access_data);
+    int i_audio, i_spu;
+
+    input_SelectES( p_input, p_input->stream.pp_es[0] );
+
+    /* For audio: first one if none or a not existing one specified */
+    i_audio = config_GetInt( p_input, "audio-channel" );
+    if( i_audio < 0 /*|| i_audio > i_audio_nb*/ )
     {
-        input_SelectES( p_input, p_input->stream.pp_es[0] );
+        config_PutInt( p_input, "audio-channel", 1 );
+        i_audio = 1;
     }
-
-    if( config_GetInt( p_input, "audio" ) )
+    if( i_audio > 0/* && i_audio_nb > 0*/ )
     {
-        /* For audio: first one if none or a not existing one specified */
-        int i_audio = config_GetInt( p_input, "audio-channel" );
-        if( i_audio < 0 /*|| i_audio > i_audio_nb*/ )
+        if( config_GetInt( p_input, "audio-type" ) == REQUESTED_A52 )
         {
-            config_PutInt( p_input, "audio-channel", 1 );
-            i_audio = 1;
-        }
-        if( i_audio > 0/* && i_audio_nb > 0*/ )
-        {
-            if( config_GetInt( p_input, "audio-type" )
-                 == REQUESTED_A52 )
+            int     i_a52 = i_audio;
+            while( ( p_input->stream.pp_es[i_a52]->i_fourcc !=
+                   VLC_FOURCC('a','5','2','b') ) && ( i_a52 <=
+                   p_dvd->p_vts_file->vtsi_mat->nr_of_vts_audio_streams ) )
             {
-                int     i_a52 = i_audio;
-                while( ( p_input->stream.pp_es[i_a52]->i_fourcc !=
-                       VLC_FOURCC('a','5','2','b') ) && ( i_a52 <=
-                       p_dvd->p_vts_file->vtsi_mat->nr_of_vts_audio_streams ) )
-                {
-                    i_a52++;
-                }
-                if( p_input->stream.pp_es[i_a52]->i_fourcc
-                     == VLC_FOURCC('a','5','2','b') )
-                {
-                    input_SelectES( p_input,
-                                    p_input->stream.pp_es[i_a52] );
-                }
+                i_a52++;
             }
-            else
+            if( p_input->stream.pp_es[i_a52]->i_fourcc
+                 == VLC_FOURCC('a','5','2','b') )
             {
-                input_SelectES( p_input,
-                                p_input->stream.pp_es[i_audio] );
+                input_SelectES( p_input, p_input->stream.pp_es[i_a52] );
             }
         }
+        else
+        {
+            input_SelectES( p_input, p_input->stream.pp_es[i_audio] );
+        }
     }
 
-    if( config_GetInt( p_input, "video" ) )
+    /* for spu, default is none */
+    i_spu = config_GetInt( p_input, "spu-channel" );
+    if( i_spu < 0 /*|| i_spu > i_spu_nb*/ )
     {
-        /* for spu, default is none */
-        int i_spu = config_GetInt( p_input, "spu-channel" );
-        if( i_spu < 0 /*|| i_spu > i_spu_nb*/ )
-        {
-            config_PutInt( p_input, "spu-channel", 0 );
-            i_spu = 0;
-        }
-        if( i_spu > 0 /*&& i_spu_nb > 0*/ )
-        {
-            i_spu += p_dvd->p_vts_file->vtsi_mat->nr_of_vts_audio_streams;
-            input_SelectES( p_input, p_input->stream.pp_es[i_spu] );
-        }
+        config_PutInt( p_input, "spu-channel", 0 );
+        i_spu = 0;
+    }
+    if( i_spu > 0 /*&& i_spu_nb > 0*/ )
+    {
+        i_spu += p_dvd->p_vts_file->vtsi_mat->nr_of_vts_audio_streams;
+        input_SelectES( p_input, p_input->stream.pp_es[i_spu] );
     }
 }
index fc32d9399b80a6b7e48d23b0cdaa998093fb4bff..b49ad798093396b785f15e1c2b64d804399e78e2 100644 (file)
@@ -400,15 +400,14 @@ int SatelliteSetProgram( input_thread_t    * p_input,
         {
             case MPEG1_VIDEO_ES:
             case MPEG2_VIDEO_ES:
-                if ( config_GetInt( p_input, "video" ) )
+                if ( input_SelectES( p_input , p_es ) == 0 )
                 {
                     ioctl_SetDMXFilter( p_es->i_id, &p_es->i_demux_fd, 1);
-                    input_SelectES( p_input , p_es );
                 }
                 break;
             case MPEG1_AUDIO_ES:
             case MPEG2_AUDIO_ES:
-                if ( config_GetInt( p_input, "audio" ) )
+                if ( input_SelectES( p_input , p_es ) == 0 )
                 {
                     ioctl_SetDMXFilter( p_es->i_id, &p_es->i_demux_fd, 2);
                     input_SelectES( p_input , p_es );
index 8306713fbea91081ac56488b8a9805d363c9c8d6..4b3b3fe804b43fa3206d237b1de0f5a0079eefae 100644 (file)
@@ -2,7 +2,7 @@
  * input_programs.c: es_descriptor_t, pgrm_descriptor_t management
  *****************************************************************************
  * Copyright (C) 1999-2002 VideoLAN
- * $Id: input_programs.c,v 1.95 2002/10/29 13:22:48 sam Exp $
+ * $Id: input_programs.c,v 1.96 2002/11/05 18:25:43 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -563,6 +563,21 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es )
         return -1;
     }
 
+    if( ((p_es->i_cat == VIDEO_ES) || (p_es->i_cat == SPU_ES))
+        && !config_GetInt( p_input, "video" ) )
+    {
+        msg_Dbg( p_input,
+                 "video is disabled, not selecting ES 0x%x", p_es->i_id );
+        return -1;
+    }
+
+    if( (p_es->i_cat == AUDIO_ES) && !config_GetInt( p_input, "audio" ) )
+    {
+        msg_Dbg( p_input,
+                 "audio is disabled, not selecting ES 0x%x", p_es->i_id );
+        return -1;
+    }
+
     msg_Dbg( p_input, "selecting ES 0x%x", p_es->i_id );
 
     if( p_es->p_decoder_fifo != NULL )