]> git.sesse.net Git - vlc/commitdiff
* src/input/es_out.c: New --audio-track-id and --sub-track-id options
authorChristophe Massiot <massiot@videolan.org>
Mon, 19 Dec 2005 16:36:30 +0000 (16:36 +0000)
committerChristophe Massiot <massiot@videolan.org>
Mon, 19 Dec 2005 16:36:30 +0000 (16:36 +0000)
   to select a precise track by its ID.
 * modules/demux/ts.c: Enable --ts-es-id-pid by default since I see no
   drawback to it.

modules/demux/ts.c
src/input/es_out.c
src/input/var.c
src/libvlc.h

index ddcf68eddefdc8efce1988d7b323be68b6773d4c..d61097e7b6fbb5b56675acd6e93c6ac9a08d6cb0 100644 (file)
@@ -127,7 +127,7 @@ vlc_module_begin();
     set_subcategory( SUBCAT_INPUT_DEMUX );
 
     add_string( "ts-extra-pmt", NULL, NULL, PMT_TEXT, PMT_LONGTEXT, VLC_TRUE );
-    add_bool( "ts-es-id-pid", 0, NULL, PID_TEXT, PID_LONGTEXT, VLC_TRUE );
+    add_bool( "ts-es-id-pid", 1, NULL, PID_TEXT, PID_LONGTEXT, VLC_TRUE );
     add_string( "ts-out", NULL, NULL, TSOUT_TEXT, TSOUT_LONGTEXT, VLC_TRUE );
     add_integer( "ts-out-mtu", 1500, NULL, MTUOUT_TEXT,
                  MTUOUT_LONGTEXT, VLC_TRUE );
index 8faf35d125ce6462cd3e8258cb42185126d7bdca..d688aba4cc939215be4574127210a3298f091fa0 100644 (file)
@@ -103,8 +103,8 @@ struct es_out_sys_t
     int         i_sub;
 
     /* es to select */
-    int         i_audio_last;
-    int         i_sub_last;
+    int         i_audio_last, i_audio_id;
+    int         i_sub_last, i_sub_id;
     char        **ppsz_audio_language;
     char        **ppsz_sub_language;
 
@@ -194,6 +194,12 @@ es_out_t *input_EsOutNew( input_thread_t *p_input )
     }
     if( val.psz_string ) free( val.psz_string );
 
+    var_Get( p_input, "audio-track-id", &val );
+    p_sys->i_audio_id = val.i_int;
+
+    var_Get( p_input, "sub-track-id", &val );
+    p_sys->i_sub_id = val.i_int;
+
     p_sys->p_es_audio = NULL;
     p_sys->p_es_video = NULL;
     p_sys->p_es_sub   = NULL;
@@ -903,6 +909,14 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, vlc_bool_t b_force )
 
             if( p_sys->i_audio_last >= 0 )
                 i_wanted = p_sys->i_audio_last;
+
+            if( p_sys->i_audio_id >= 0 )
+            {
+                if( es->i_id == p_sys->i_audio_id )
+                    i_wanted = es->i_channel;
+                else
+                    return;
+            }
         }
         else if( i_cat == SPU_ES )
         {
@@ -933,6 +947,14 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, vlc_bool_t b_force )
             }
             if( p_sys->i_sub_last >= 0 )
                 i_wanted  = p_sys->i_sub_last;
+
+            if( p_sys->i_sub_id >= 0 )
+            {
+                if( es->i_id == p_sys->i_sub_id )
+                    i_wanted = es->i_channel;
+                else
+                    return;
+            }
         }
         else if( i_cat == VIDEO_ES )
         {
index b675396b0b3c884ecffe1098b7a6c5865827e259..4a60bcf1e307008759d79c573da73bc9e0ecae68 100644 (file)
@@ -2,7 +2,7 @@
  * var.c: object variables for input thread
  *****************************************************************************
  * Copyright (C) 2004 the VideoLAN team
- * $Id: input.c 7955 2004-06-07 22:21:33Z fenrir $
+ * $Id$
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -395,6 +395,9 @@ void input_ConfigVarInit ( input_thread_t *p_input )
     var_Create( p_input, "audio-language", VLC_VAR_STRING|VLC_VAR_DOINHERIT );
     var_Create( p_input, "sub-language", VLC_VAR_STRING|VLC_VAR_DOINHERIT );
 
+    var_Create( p_input, "audio-track-id", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
+    var_Create( p_input, "sub-track-id", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
+
     var_Create( p_input, "sub-file", VLC_VAR_FILE | VLC_VAR_DOINHERIT );
     var_Create( p_input, "sub-autodetect-file", VLC_VAR_BOOL |
                 VLC_VAR_DOINHERIT );
index ef6abcb640cc289deffa1be248523c429dd178c4..021ba1f444242fa6de799fce8f4cf39889ea1159 100644 (file)
@@ -370,7 +370,7 @@ static char *ppsz_clock_descriptions[] =
 
 #define INPUT_AUDIOTRACK_TEXT N_("Audio track")
 #define INPUT_AUDIOTRACK_LONGTEXT N_( \
-    "Give the stream number of the audio track you want to use" \
+    "Give the stream number of the audio track you want to use " \
     "(from 0 to n).")
 
 #define INPUT_SUBTRACK_TEXT N_("Subtitles track")
@@ -388,6 +388,14 @@ static char *ppsz_clock_descriptions[] =
     "Give the language of the subtitle track you want to use " \
     "(comma separted, two or tree letter country code).")
 
+#define INPUT_AUDIOTRACK_ID_TEXT N_("Audio track ID")
+#define INPUT_AUDIOTRACK_ID_LONGTEXT N_( \
+    "Give the stream ID of the audio track you want to use.")
+
+#define INPUT_SUBTRACK_ID_TEXT N_("Subtitles track ID")
+#define INPUT_SUBTRACK_ID_LONGTEXT N_( \
+    "Give the stream ID of the subtitle track you want to use.")
+
 #define INPUT_REPEAT_TEXT N_("Input repetitions")
 #define INPUT_REPEAT_LONGTEXT N_("Number of time the same input will be " \
                                  "repeated")
@@ -1132,6 +1140,10 @@ vlc_module_begin();
     add_string( "sub-language", "", NULL,
                  INPUT_SUBTRACK_LANG_TEXT, INPUT_SUBTRACK_LANG_LONGTEXT,
                   VLC_FALSE );
+    add_integer( "audio-track-id", -1, NULL, INPUT_AUDIOTRACK_ID_TEXT,
+                 INPUT_AUDIOTRACK_ID_LONGTEXT, VLC_TRUE );
+    add_integer( "sub-track-id", -1, NULL,
+                 INPUT_SUBTRACK_ID_TEXT, INPUT_SUBTRACK_ID_LONGTEXT, VLC_TRUE );
 
     set_section( N_( "Playback control" ) , NULL);
     add_integer( "input-repeat", 0, NULL,