* ALL: changed the prototype of input_AddES() to include enough information so we...
authorGildas Bazin <gbazin@videolan.org>
Mon, 5 May 2003 22:23:42 +0000 (22:23 +0000)
committerGildas Bazin <gbazin@videolan.org>
Mon, 5 May 2003 22:23:42 +0000 (22:23 +0000)
* modules/gui/wxwindows/menus.cpp: use the "foo-es" object variables.

32 files changed:
include/input_ext-intf.h
include/input_ext-plugins.h
modules/access/dvd/es.c
modules/access/dvdplay/es.c
modules/access/dvdread/input.c
modules/access/v4l/v4l.c
modules/control/rc/rc.c
modules/demux/a52sys.c
modules/demux/aac/demux.c
modules/demux/asf/asf.c
modules/demux/au.c
modules/demux/avi/avi.c
modules/demux/flac.c
modules/demux/mp4/mp4.c
modules/demux/mpeg/audio.c
modules/demux/mpeg/es.c
modules/demux/mpeg/m4v.c
modules/demux/mpeg/system.c
modules/demux/mpeg/ts.c
modules/demux/ogg.c
modules/demux/rawdv.c
modules/demux/util/sub.c
modules/demux/wav/wav.c
modules/gui/beos/VlcWrapper.cpp
modules/gui/gtk/menu.c
modules/gui/macosx/intf.m
modules/gui/win32/menu.cpp
modules/gui/wxwindows/menus.cpp
modules/stream_out/display.c
po/POTFILES.in
src/input/input_programs.c
src/libvlc.h

index 6b382fe..d2d7924 100644 (file)
@@ -4,7 +4,7 @@
  * control the pace of reading.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ext-intf.h,v 1.88 2003/04/13 20:00:20 fenrir Exp $
+ * $Id: input_ext-intf.h,v 1.89 2003/05/05 22:23:31 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -52,7 +52,7 @@ struct es_descriptor_t
     uint8_t                 i_cat;    /* stream category (audio, video, spu) */
     int                     i_demux_fd;   /* used to store demux device
                                              file handle */
-    char                    psz_desc[20]; /* description of ES: audio language
+    char                    *psz_desc;    /* description of ES: audio language
                                            * for instance ; NULL if not
                                            *  available */
 
index ab0dce9..e84a44d 100644 (file)
@@ -3,7 +3,7 @@
  *                      but exported to plug-ins
  *****************************************************************************
  * Copyright (C) 1999-2002 VideoLAN
- * $Id: input_ext-plugins.h,v 1.41 2003/03/11 23:56:53 gbazin Exp $
+ * $Id: input_ext-plugins.h,v 1.42 2003/05/05 22:23:31 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -47,7 +47,7 @@ VLC_EXPORT( int, input_SetProgram,( input_thread_t *, pgrm_descriptor_t * ) );
 VLC_EXPORT( input_area_t *, input_AddArea,( input_thread_t *, uint16_t, uint16_t ) );
 VLC_EXPORT( void, input_DelArea,   ( input_thread_t *, input_area_t * ) );
 VLC_EXPORT( es_descriptor_t *, input_FindES,( input_thread_t *, uint16_t ) );
-VLC_EXPORT( es_descriptor_t *, input_AddES, ( input_thread_t *, pgrm_descriptor_t *, uint16_t, size_t ) );
+VLC_EXPORT( es_descriptor_t *, input_AddES, ( input_thread_t *, pgrm_descriptor_t *, uint16_t, int, char const *, size_t ) );
 VLC_EXPORT( void, input_DelES,     ( input_thread_t *, es_descriptor_t * ) );
 VLC_EXPORT( int,  input_SelectES,  ( input_thread_t *, es_descriptor_t * ) );
 VLC_EXPORT( int,  input_UnselectES,( input_thread_t *, es_descriptor_t * ) );
index d228806..06bf34b 100644 (file)
@@ -1,7 +1,7 @@
 /* es.c: functions to find and select ES
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: es.c,v 1.4 2002/12/06 16:34:04 sam Exp $
+ * $Id: es.c,v 1.5 2003/05/05 22:23:32 gbazin Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -64,16 +64,20 @@ void DVDLaunchDecoders( input_thread_t * p_input );
 #define vmg p_dvd->p_ifo->vmg
 #define vts p_dvd->p_ifo->vts
 
-#define ADDES( stream_id, private_id, fourcc, cat, lang, size )         \
+#define ADDES( stream_id, private_id, fourcc, cat, lang, descr, size )  \
     i_id = ( (private_id) << 8 ) | (stream_id);                         \
-    p_es = input_AddES( p_input, NULL, i_id, size );                    \
-    p_es->i_stream_id = (stream_id);                                    \
-    p_es->i_fourcc = (fourcc);                                          \
-    p_es->i_cat = (cat);                                                \
-    if( lang )                                                          \
     {                                                                   \
-        strcpy( p_es->psz_desc, DecodeLanguage( lang ) );               \
-    }
+        char *psz_descr;                                                \
+        psz_descr = malloc( strlen(DecodeLanguage( lang )) +            \
+                            strlen(descr) + 1 );                        \
+        if( psz_descr ) {strcpy( psz_descr, DecodeLanguage( lang ) );   \
+            strcat( psz_descr, descr );}                                \
+        p_es = input_AddES( p_input, NULL, i_id, cat,                   \
+                            psz_descr, size );                          \
+        if( psz_descr ) free( psz_descr );                              \
+    }                                                                   \
+    p_es->i_stream_id = (stream_id);                                    \
+    p_es->i_fourcc = (fourcc);
 
 
 /*****************************************************************************
@@ -94,12 +98,13 @@ void DVDReadVideo( input_thread_t * p_input )
 
     if( i_ratio )
     {
-        ADDES( 0xe0, 0, VLC_FOURCC('m','p','g','v'), VIDEO_ES, 0, sizeof(int) );
+        ADDES( 0xe0, 0, VLC_FOURCC('m','p','g','v'), VIDEO_ES, 0,
+               "", sizeof(int) );
         *(int*)(p_es->p_demux_data) = i_ratio;
     }
     else
     {
-        ADDES( 0xe0, 0, VLC_FOURCC('m','p','g','v'), VIDEO_ES, 0, 0 );
+        ADDES( 0xe0, 0, VLC_FOURCC('m','p','g','v'), VIDEO_ES, 0, "", 0 );
     }
 
 }
@@ -137,27 +142,27 @@ void DVDReadAudio( input_thread_t * p_input )
             {
             case 0x00:              /* A52 */
                 ADDES( 0xbd, 0x80 + audio_status.i_position,
-                       VLC_FOURCC('a','5','2','b'), AUDIO_ES, i_lang, 0 );
-                strcat( p_es->psz_desc, " (A52)" );
+                       VLC_FOURCC('a','5','2','b'), AUDIO_ES, i_lang,
+                       " (A52)", 0 );
 
                 break;
             case 0x02:
             case 0x03:              /* MPEG audio */
                 ADDES( 0xc0 + audio_status.i_position, 0,
-                       VLC_FOURCC('m','p','g','a'), AUDIO_ES, i_lang, 0 );
-                strcat( p_es->psz_desc, " (mpeg)" );
+                       VLC_FOURCC('m','p','g','a'), AUDIO_ES, i_lang,
+                       " (mpeg)", 0 );
 
                 break;
             case 0x04:              /* LPCM */
                 ADDES( 0xbd, 0xa0 + audio_status.i_position,
-                       VLC_FOURCC('l','p','c','b'), AUDIO_ES, i_lang, 0 );
-                strcat( p_es->psz_desc, " (lpcm)" );
+                       VLC_FOURCC('l','p','c','b'), AUDIO_ES, i_lang,
+                       " (lpcm)", 0 );
 
                 break;
             case 0x06:              /* DTS */
                 ADDES( 0xbd, 0x88 + audio_status.i_position,
-                       VLC_FOURCC('d','t','s','b'), AUDIO_ES, i_lang, 0 );
-                strcat( p_es->psz_desc, " (dts)" );
+                       VLC_FOURCC('d','t','s','b'), AUDIO_ES, i_lang,
+                       " (dts)", 0 );
 
                 break;
             default:
@@ -222,7 +227,7 @@ void DVDReadSPU( input_thread_t * p_input )
             if( vmg.title.pi_yuv_color )
             {
                 ADDES( 0xbd, 0x20 + i_id, VLC_FOURCC('s','p','u','b'), SPU_ES,
-                       vts.manager_inf.p_spu_attr[i-1].i_lang_code,
+                       vts.manager_inf.p_spu_attr[i-1].i_lang_code, "",
                        sizeof(int) + 16*sizeof(u32) );
                 *(int*)p_es->p_demux_data = 0xBeeF;
                 memcpy( (char*)p_es->p_demux_data + sizeof(int),
@@ -231,7 +236,7 @@ void DVDReadSPU( input_thread_t * p_input )
             else
             {
                 ADDES( 0xbd, 0x20 + i_id, VLC_FOURCC('s','p','u','b'), SPU_ES,
-                   vts.manager_inf.p_spu_attr[i-1].i_lang_code, 0 );
+                   vts.manager_inf.p_spu_attr[i-1].i_lang_code, "", 0 );
             }
         }
     }
index caec0ad..9fdb502 100644 (file)
@@ -2,7 +2,7 @@
  * es.c: functions to handle elementary streams.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: es.c,v 1.5 2003/01/29 11:17:44 gbazin Exp $
+ * $Id: es.c,v 1.6 2003/05/05 22:23:32 gbazin Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -71,16 +71,20 @@ void dvdplay_DeleteES( input_thread_t* p_input )
 
 }
 
-#define ADDES( id, fourcc, cat, lang, size )                            \
+#define ADDES( id, fourcc, cat, lang, descr, size )                     \
     msg_Dbg( p_input, "new es 0x%x", i_id );                            \
-    p_es = input_AddES( p_input, NULL, id, size );                      \
-    p_es->i_stream_id = i_id & 0xff;                                    \
-    p_es->i_fourcc = (fourcc);                                          \
-    p_es->i_cat = (cat);                                                \
-    if( lang )                                                          \
     {                                                                   \
-        strcpy( p_es->psz_desc, DecodeLanguage( lang ) );               \
-    }
+        char *psz_descr;                                                \
+        psz_descr = malloc( strlen(DecodeLanguage( lang )) +            \
+                            strlen(descr) + 1 );                        \
+        if( psz_descr ) {strcpy( psz_descr, DecodeLanguage( lang ) );   \
+            strcat( psz_descr, descr );}                                \
+        p_es = input_AddES( p_input, NULL, id, cat,                     \
+                            psz_descr, size );                          \
+        if( psz_descr ) free( psz_descr );                              \
+    }                                                                   \
+    p_es->i_stream_id = i_id & 0xff;                                    \
+    p_es->i_fourcc = (fourcc);
 
 /*****************************************************************************
  * dvdplay_Video: read video ES
@@ -100,12 +104,13 @@ void dvdplay_Video( input_thread_t * p_input )
     
     if( p_attr->display_aspect_ratio )
     {
-        ADDES( 0xe0, VLC_FOURCC('m','p','g','v'), VIDEO_ES, 0, sizeof(int) );
+        ADDES( 0xe0, VLC_FOURCC('m','p','g','v'), VIDEO_ES, 0,
+               "", sizeof(int) );
         *(int*)(p_es->p_demux_data) = p_attr->display_aspect_ratio;
     }
     else
     {
-        ADDES( 0xe0, VLC_FOURCC('m','p','g','v'), VIDEO_ES, 0, 0 );
+        ADDES( 0xe0, VLC_FOURCC('m','p','g','v'), VIDEO_ES, 0, "", 0 );
     }
         
 }
@@ -143,29 +148,29 @@ void dvdplay_Audio( input_thread_t * p_input )
             switch( p_attr->audio_format )
             {
             case 0x00:              /* A52 */
-                ADDES( i_id, VLC_FOURCC('a','5','2','b'), AUDIO_ES, i_lang, 0 );
-                strcat( p_es->psz_desc, " (A52)" );
+                ADDES( i_id, VLC_FOURCC('a','5','2','b'), AUDIO_ES, i_lang,
+                       " (A52)", 0 );
 
                 break;
             case 0x02:
             case 0x03:              /* MPEG audio */
-                ADDES( i_id, VLC_FOURCC('m','p','g','a'), AUDIO_ES, i_lang, 0 );
-                strcat( p_es->psz_desc, " (mpeg)" );
+                ADDES( i_id, VLC_FOURCC('m','p','g','a'), AUDIO_ES, i_lang,
+                       " (mpeg)", 0 );
 
                 break;
             case 0x04:              /* LPCM */
-                ADDES( i_id, VLC_FOURCC('l','p','c','b'), AUDIO_ES, i_lang, 0 );
-                strcat( p_es->psz_desc, " (lpcm)" );
+                ADDES( i_id, VLC_FOURCC('l','p','c','b'), AUDIO_ES, i_lang,
+                       " (lpcm)", 0 );
 
                 break;
             case 0x05:              /* SDDS */
-                ADDES( i_id, VLC_FOURCC('s','d','d','b'), AUDIO_ES, i_lang, 0 );
-                strcat( p_es->psz_desc, " (sdds)" );
+                ADDES( i_id, VLC_FOURCC('s','d','d','b'), AUDIO_ES, i_lang,
+                       " (sdds)", 0 );
 
                 break;
             case 0x06:              /* DTS */
-                ADDES( i_id, VLC_FOURCC('d','t','s','b'), AUDIO_ES, i_lang, 0 );
-                strcat( p_es->psz_desc, " (dts)" );
+                ADDES( i_id, VLC_FOURCC('d','t','s','b'), AUDIO_ES, i_lang,
+                       " (dts)", 0 );
 
                 break;
             default:
@@ -207,7 +212,7 @@ void dvdplay_Subp( input_thread_t * p_input )
             if( pi_palette )
             {
                 ADDES( i_id, VLC_FOURCC('s','p','u','b'), SPU_ES,
-                       p_attr->lang_code, sizeof(int) + 16*sizeof(u32) );
+                       p_attr->lang_code, "", sizeof(int) + 16*sizeof(u32) );
                 *(int*)p_es->p_demux_data = 0xBeeF;
                 memcpy( (void*)p_es->p_demux_data + sizeof(int),
                         pi_palette, 16*sizeof(u32) ); 
@@ -215,7 +220,7 @@ void dvdplay_Subp( input_thread_t * p_input )
             else
             {
                 ADDES( i_id, VLC_FOURCC('s','p','u','b'), SPU_ES,
-                       p_attr->lang_code, 0 );
+                       p_attr->lang_code, "", 0 );
             }
         }
     }
index f5724f4..b3a0a53 100644 (file)
@@ -6,7 +6,7 @@
  * It depends on: libdvdread for ifo files and block reading.
  *****************************************************************************
  * Copyright (C) 2001, 2003 VideoLAN
- * $Id: input.c,v 1.20 2003/05/04 22:42:14 gbazin Exp $
+ * $Id: input.c,v 1.21 2003/05/05 22:23:33 gbazin Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -666,10 +666,9 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area )
         /* ES 0 -> video MPEG2 */
 //        IfoPrintVideo( p_dvd );
 
-        p_es = input_AddES( p_input, NULL, 0xe0, 0 );
+        p_es = input_AddES( p_input, NULL, 0xe0, VIDEO_ES, NULL, 0 );
         p_es->i_stream_id = 0xe0;
         p_es->i_fourcc = VLC_FOURCC('m','p','g','v');
-        p_es->i_cat = VIDEO_ES;
 
 #define audio_control \
     p_dvd->p_vts_file->vts_pgcit->pgci_srp[pgc_id-1].pgc->audio_control[i-1]
@@ -687,42 +686,36 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area )
                 i_audio_nb++;
                 i_position = ( audio_control & 0x7F00 ) >> 8;
 
-            msg_Dbg( p_input, "audio position  %d", i_position );
+                msg_Dbg( p_input, "audio position  %d", i_position );
                 switch( p_vts->vtsi_mat->vts_audio_attr[i-1].audio_format )
                 {
                 case 0x00:              /* A52 */
                     i_id = ( ( 0x80 + i_position ) << 8 ) | 0xbd;
-                    p_es = input_AddES( p_input, NULL, i_id, 0 );
+                    p_es = input_AddES( p_input, NULL, i_id, AUDIO_ES,
+                                        DecodeLanguage(
+                        p_vts->vtsi_mat->vts_audio_attr[i-1].lang_code ), 0 );
                     p_es->i_stream_id = 0xbd;
                     p_es->i_fourcc = VLC_FOURCC('a','5','2','b');
-                    p_es->i_cat = AUDIO_ES;
-                    strcpy( p_es->psz_desc, DecodeLanguage(
-                        p_vts->vtsi_mat->vts_audio_attr[i-1].lang_code ) );
-                    strcat( p_es->psz_desc, " (A52)" );
 
                     break;
                 case 0x02:
                 case 0x03:              /* MPEG audio */
                     i_id = 0xc0 + i_position;
-                    p_es = input_AddES( p_input, NULL, i_id, 0 );
+                    p_es = input_AddES( p_input, NULL, i_id, AUDIO_ES,
+                                        DecodeLanguage(
+                        p_vts->vtsi_mat->vts_audio_attr[i-1].lang_code ), 0 );
                     p_es->i_stream_id = i_id;
                     p_es->i_fourcc = VLC_FOURCC('m','p','g','a');
-                    p_es->i_cat = AUDIO_ES;
-                    strcpy( p_es->psz_desc, DecodeLanguage(
-                        p_vts->vtsi_mat->vts_audio_attr[i-1].lang_code ) );
-                    strcat( p_es->psz_desc, " (mpeg)" );
 
                     break;
                 case 0x04:              /* LPCM */
 
                     i_id = ( ( 0xa0 + i_position ) << 8 ) | 0xbd;
-                    p_es = input_AddES( p_input, NULL, i_id, 0 );
+                    p_es = input_AddES( p_input, NULL, i_id, AUDIO_ES,
+                                        DecodeLanguage(
+                        p_vts->vtsi_mat->vts_audio_attr[i-1].lang_code ), 0 );
                     p_es->i_stream_id = i_id;
                     p_es->i_fourcc = VLC_FOURCC('l','p','c','b');
-                    p_es->i_cat = AUDIO_ES;
-                    strcpy( p_es->psz_desc, DecodeLanguage(
-                        p_vts->vtsi_mat->vts_audio_attr[i-1].lang_code ) );
-                    strcat( p_es->psz_desc, " (lpcm)" );
 
                     break;
                 case 0x06:              /* DTS */
@@ -779,12 +772,11 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area )
                 }
 
                 i_id = ( ( 0x20 + i_position ) << 8 ) | 0xbd;
-                p_es = input_AddES( p_input, NULL, i_id, 0 );
+                p_es = input_AddES( p_input, NULL, i_id, SPU_ES,
+                                    DecodeLanguage(
+                    p_vts->vtsi_mat->vts_subp_attr[i-1].lang_code ), 0 );
                 p_es->i_stream_id = 0xbd;
                 p_es->i_fourcc = VLC_FOURCC('s','p','u','b');
-                p_es->i_cat = SPU_ES;
-                strcpy( p_es->psz_desc, DecodeLanguage(
-                    p_vts->vtsi_mat->vts_subp_attr[i-1].lang_code ) );
             }
         }
 #undef spu_control
index 13be6f0..390b9cc 100644 (file)
@@ -2,7 +2,7 @@
  * v4l.c : Video4Linux input module for vlc
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: v4l.c,v 1.12 2003/05/03 12:36:17 fenrir Exp $
+ * $Id: v4l.c,v 1.13 2003/05/05 22:23:33 gbazin Exp $
  *
  * Author: Samuel Hocevar <sam@zoy.org>
  *
@@ -1191,13 +1191,12 @@ static int DemuxOpen( vlc_object_t *p_this )
     {
         es_descriptor_t *p_es;
 
-        p_es = input_AddES( p_input,
-                            p_input->stream.pp_programs[0], i + 1, 0 );
-        p_es->i_stream_id   = i + 1;
         if( !strncmp( p_peek, "auds", 4 ) )
         {
 #define wf ((WAVEFORMATEX*)p_es->p_waveformatex)
-            p_es->i_cat         = AUDIO_ES;
+            p_es = input_AddES( p_input, p_input->stream.pp_programs[0],
+                                i + 1, AUDIO_ES, NULL, 0 );
+            p_es->i_stream_id   = i + 1;
             p_es->i_fourcc      =
                 VLC_FOURCC( p_peek[4], p_peek[5], p_peek[6], p_peek[7] );
 
@@ -1220,7 +1219,9 @@ static int DemuxOpen( vlc_object_t *p_this )
         else if( !strncmp( p_peek, "vids", 4 ) )
         {
 #define bih ((BITMAPINFOHEADER*)p_es->p_bitmapinfoheader)
-            p_es->i_cat = VIDEO_ES;
+            p_es = input_AddES( p_input, p_input->stream.pp_programs[0],
+                                i + 1, VIDEO_ES, NULL, 0 );
+            p_es->i_stream_id   = i + 1;
             p_es->i_fourcc  =
                 VLC_FOURCC( p_peek[4], p_peek[5], p_peek[6], p_peek[7] );
 
index 6650e31..036dc68 100644 (file)
@@ -2,7 +2,7 @@
  * rc.c : remote control stdin/stdout plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: rc.c,v 1.31 2003/05/04 22:42:15 gbazin Exp $
+ * $Id: rc.c,v 1.32 2003/05/05 22:23:34 gbazin Exp $
  *
  * Authors: Peter Surda <shurdeek@panorama.sth.ac.at>
  *
@@ -845,7 +845,7 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd,
                        text.p_list->p_values[i].psz_string );
         }
         var_Change( (vlc_object_t *)p_aout, psz_variable, VLC_VAR_FREELIST,
-                    &val, NULL );
+                    &val, &text );
         printf( "+----[ end of %s ]\n", val_name.psz_string );
 
         if( val_name.psz_string ) free( val_name.psz_string );
index 85e019a..058a5da 100644 (file)
@@ -2,7 +2,7 @@
  * a52sys.c : A/52 input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: a52sys.c,v 1.2 2003/02/27 13:19:43 gbazin Exp $
+ * $Id: a52sys.c,v 1.3 2003/05/05 22:23:34 gbazin Exp $
  *
  * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
  *
@@ -103,10 +103,10 @@ static int Init( vlc_object_t * p_this )
     input_AddProgram( p_input, 0, 0 );
     p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
     vlc_mutex_lock( &p_input->stream.stream_lock );
-    p_es = input_AddES( p_input, p_input->stream.p_selected_program, 0xBD, 0 );
+    p_es = input_AddES( p_input, p_input->stream.p_selected_program, 0xBD,
+                        AUDIO_ES, NULL, 0 );
     p_es->i_stream_id = 0xBD;
     p_es->i_fourcc = VLC_FOURCC('a','5','2',' ');
-    p_es->i_cat = AUDIO_ES;
     input_SelectES( p_input, p_es );
     p_input->stream.p_selected_area->i_tell = 0;
     p_input->stream.p_selected_program->b_is_ok = 1;
index 52a44ef..08d5ae2 100644 (file)
@@ -2,7 +2,7 @@
  * demux.c : Raw aac Stream input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: demux.c,v 1.7 2003/03/30 18:14:37 gbazin Exp $
+ * $Id: demux.c,v 1.8 2003/05/05 22:23:34 gbazin Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -489,10 +489,8 @@ static int Activate( vlc_object_t * p_this )
     p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
 
     /* create our ES */
-    p_aac->p_es = input_AddES( p_input,
-                               p_input->stream.p_selected_program, 
-                               1, /* id */
-                               0 );
+    p_aac->p_es = input_AddES( p_input, p_input->stream.p_selected_program, 
+                               1 /* id */, AUDIO_ES, NULL, 0 );
     if( !p_aac->p_es )
     {
         vlc_mutex_unlock( &p_input->stream.stream_lock );
@@ -502,7 +500,6 @@ static int Activate( vlc_object_t * p_this )
 
     p_aac->p_es->i_stream_id = 1;
     p_aac->p_es->i_fourcc = VLC_FOURCC( 'm', 'p', '4', 'a' );
-    p_aac->p_es->i_cat = AUDIO_ES;
     input_SelectES( p_input, p_aac->p_es );
 
     p_input->stream.p_selected_program->b_is_ok = 1;
index 5ab00d6..9e84c27 100644 (file)
@@ -2,7 +2,7 @@
  * asf.c : ASFv01 file input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: asf.c,v 1.27 2003/04/24 20:26:32 fenrir Exp $
+ * $Id: asf.c,v 1.28 2003/05/05 22:23:35 gbazin Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -205,11 +205,7 @@ static int Activate( vlc_object_t * p_this )
         p_stream->p_sp = p_sp;
 
         vlc_mutex_lock( &p_input->stream.stream_lock );
-        p_stream->p_es =
-            input_AddES( p_input,
-                         p_input->stream.p_selected_program,
-                         p_sp->i_stream_number,
-                         0 );
+        p_stream->p_es = NULL;
 
         vlc_mutex_unlock( &p_input->stream.stream_lock );
         if( CmpGUID( &p_sp->i_stream_type, &asf_object_stream_type_audio ) )
@@ -225,6 +221,10 @@ static int Activate( vlc_object_t * p_this )
             }
 
             p_stream->i_cat = AUDIO_ES;
+            p_stream->p_es = input_AddES( p_input,
+                         p_input->stream.p_selected_program,
+                         p_sp->i_stream_number, AUDIO_ES, NULL, 0 );
+
             input_AddInfo( p_cat, _("Type"), _("Audio") );
             msg_Dbg( p_input,
                     "adding new audio stream(codec:0x%x,ID:%d)",
@@ -295,10 +295,13 @@ static int Activate( vlc_object_t * p_this )
         if( CmpGUID( &p_sp->i_stream_type, &asf_object_stream_type_video ) )
         {
             p_stream->i_cat = VIDEO_ES;
+            p_stream->p_es = input_AddES( p_input,
+                         p_input->stream.p_selected_program,
+                         p_sp->i_stream_number, VIDEO_ES, NULL, 0 );
+
             input_AddInfo( p_cat, _("Type"), _("Video") );
-            msg_Dbg( p_input,
-                    "adding new video stream(ID:%d)",
-                    p_sp->i_stream_number );
+            msg_Dbg( p_input, "adding new video stream(ID:%d)",
+                     p_sp->i_stream_number );
             if( p_sp->p_type_specific_data )
             {
                 p_stream->p_es->i_fourcc =
@@ -356,15 +359,12 @@ static int Activate( vlc_object_t * p_this )
         else
         {
             p_stream->i_cat = UNKNOWN_ES;
-            msg_Dbg( p_input,
-                    "ignoring unknown stream(ID:%d)",
-                    p_sp->i_stream_number );
-            p_stream->p_es->i_fourcc = VLC_FOURCC( 'u','n','d','f' );
+            msg_Dbg( p_input, "ignoring unknown stream(ID:%d)",
+                     p_sp->i_stream_number );
         }
-        p_stream->p_es->i_cat = p_stream->i_cat;
 
         vlc_mutex_lock( &p_input->stream.stream_lock );
-        if( p_stream->p_es->i_fourcc != VLC_FOURCC( 'u','n','d','f' ) )
+        if( p_stream->p_es )
         {
             input_SelectES( p_input, p_stream->p_es );
         }
index 254332a..c0892f7 100644 (file)
@@ -2,7 +2,7 @@
  * au.c : au file input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: au.c,v 1.1 2003/03/11 07:03:16 fenrir Exp $
+ * $Id: au.c,v 1.2 2003/05/05 22:23:34 gbazin Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -406,13 +406,10 @@ static int AUInit( vlc_object_t * p_this )
     p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
     p_input->stream.i_mux_rate =  wf.nAvgBytesPerSec / 50;
 
-    p_es = input_AddES( p_input,
-                        p_input->stream.p_selected_program,
-                        0x01,
-                        0 );
+    p_es = input_AddES( p_input, p_input->stream.p_selected_program,
+                        0x01, AUDIO_ES, NULL, 0 );
 
     p_es->i_stream_id   = 0x01;
-    p_es->i_cat         = AUDIO_ES;
     p_es->i_fourcc      = i_codec;
     p_es->p_waveformatex= malloc( sizeof( WAVEFORMATEX ) );
     memcpy( p_es->p_waveformatex,
index da5200a..337c957 100644 (file)
@@ -2,7 +2,7 @@
  * avi.c : AVI file Stream input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: avi.c,v 1.46 2003/05/03 01:12:13 fenrir Exp $
+ * $Id: avi.c,v 1.47 2003/05/05 22:23:35 gbazin Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -1239,13 +1239,11 @@ static int AVIInit( vlc_object_t * p_this )
         /* add one ES */
         vlc_mutex_lock( &p_input->stream.stream_lock );
         p_info->p_es =
-            p_es = input_AddES( p_input,
-                                p_input->stream.p_selected_program, 1+i,
-                                0 );
+            p_es = input_AddES( p_input, p_input->stream.p_selected_program,
+                                1+i, p_info->i_cat, NULL, 0 );
         vlc_mutex_unlock( &p_input->stream.stream_lock );
         p_es->i_stream_id =i; /* XXX: i don't use it */
         p_es->i_fourcc = p_info->i_fourcc;
-        p_es->i_cat = p_info->i_cat;
         if( p_es->i_cat == AUDIO_ES )
         {
             if( i_init_size < sizeof( WAVEFORMATEX ) )
index ae62958..535f700 100644 (file)
@@ -2,7 +2,7 @@
  * a52sys.c : A/52 input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: flac.c,v 1.2 2003/02/27 13:19:43 gbazin Exp $
+ * $Id: flac.c,v 1.3 2003/05/05 22:23:34 gbazin Exp $
  *
  * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
  *
@@ -104,10 +104,10 @@ static int Init( vlc_object_t * p_this )
     input_AddProgram( p_input, 0, 0 );
     p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
     vlc_mutex_lock( &p_input->stream.stream_lock );
-    p_es = input_AddES( p_input, p_input->stream.p_selected_program, 0xBD, 0 );
+    p_es = input_AddES( p_input, p_input->stream.p_selected_program, 0xBD,
+                        AUDIO_ES, NULL, 0 );
     p_es->i_stream_id = 0xBD;
     p_es->i_fourcc = VLC_FOURCC('f','l','a','c');
-    p_es->i_cat = AUDIO_ES;
     input_SelectES( p_input, p_es );
     p_input->stream.p_selected_area->i_tell = 0;
     p_input->stream.p_selected_program->b_is_ok = 1;
index 94066dd..f4c1323 100644 (file)
@@ -2,7 +2,7 @@
  * mp4.c : MP4 file input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: mp4.c,v 1.27 2003/04/30 21:45:52 fenrir Exp $
+ * $Id: mp4.c,v 1.28 2003/05/05 22:23:36 gbazin Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -882,6 +882,7 @@ static int  TrackCreateES   ( input_thread_t   *p_input,
 {
     MP4_Box_t *  p_sample;
     unsigned int i;
+    char psz_lang[4];
 
     unsigned int i_decoder_specific_info_len;
     uint8_t *    p_decoder_specific_info;
@@ -940,19 +941,17 @@ static int  TrackCreateES   ( input_thread_t   *p_input,
         }
     }
 
-
-    vlc_mutex_lock( &p_input->stream.stream_lock );
-    p_es = input_AddES( p_input,
-                        p_input->stream.p_selected_program,
-                        p_track->i_track_ID,
-                        0 );
-    vlc_mutex_unlock( &p_input->stream.stream_lock );
     /* Initialise ES, first language as description */
     for( i = 0; i < 3; i++ )
     {
-        p_es->psz_desc[i] = p_track->i_language[i];
+        psz_lang[i] = p_track->i_language[i];
     }
-    p_es->psz_desc[3] = '\0';
+    psz_lang[3] = '\0';
+
+    vlc_mutex_lock( &p_input->stream.stream_lock );
+    p_es = input_AddES( p_input, p_input->stream.p_selected_program,
+                        p_track->i_track_ID, p_track->i_cat, psz_lang, 0 );
+    vlc_mutex_unlock( &p_input->stream.stream_lock );
 
     p_es->i_stream_id = p_track->i_track_ID;
 
@@ -971,8 +970,6 @@ static int  TrackCreateES   ( input_thread_t   *p_input,
             break;
     }
 
-    p_es->i_cat = p_track->i_cat;
-
     i_decoder_specific_info_len = 0;
     p_decoder_specific_info = NULL;
     p_pes_init = NULL;
index 3071e4b..cf6f508 100644 (file)
@@ -2,7 +2,7 @@
  * audio.c : mpeg audio Stream input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: audio.c,v 1.17 2003/04/26 20:51:54 fenrir Exp $
+ * $Id: audio.c,v 1.18 2003/05/05 22:23:36 gbazin Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -583,10 +583,8 @@ static int Activate( vlc_object_t * p_this )
     p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
 
     /* create our ES */
-    p_demux->p_es = input_AddES( p_input,
-                                 p_input->stream.p_selected_program,
-                                 1, /* id */
-                                 0 );
+    p_demux->p_es = input_AddES( p_input, p_input->stream.p_selected_program,
+                                 1 /* id */, AUDIO_ES, NULL, 0 );
     if( !p_demux->p_es )
     {
         vlc_mutex_unlock( &p_input->stream.stream_lock );
@@ -596,7 +594,6 @@ static int Activate( vlc_object_t * p_this )
     }
     p_demux->p_es->i_stream_id = 1;
     p_demux->p_es->i_fourcc = VLC_FOURCC('m','p','g','a');
-    p_demux->p_es->i_cat = AUDIO_ES;
 
     input_SelectES( p_input, p_demux->p_es );
 
index 32afbf5..80c1991 100644 (file)
@@ -2,7 +2,7 @@
  * mpeg_es.c : Elementary Stream input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: es.c,v 1.2 2002/11/20 13:37:36 sam Exp $
+ * $Id: es.c,v 1.3 2003/05/05 22:23:36 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -117,10 +117,10 @@ static int Activate( vlc_object_t * p_this )
     input_AddProgram( p_input, 0, 0 );
     p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
     vlc_mutex_lock( &p_input->stream.stream_lock );
-    p_es = input_AddES( p_input, p_input->stream.p_selected_program, 0xE0, 0 );
+    p_es = input_AddES( p_input, p_input->stream.p_selected_program, 0xE0,
+                        VIDEO_ES, NULL, 0 );
     p_es->i_stream_id = 0xE0;
     p_es->i_fourcc = VLC_FOURCC('m','p','g','v');
-    p_es->i_cat = VIDEO_ES;
     input_SelectES( p_input, p_es );
     p_input->stream.p_selected_area->i_tell = 0;
     p_input->stream.p_selected_program->b_is_ok = 1;
index d09b2c0..5edf1a4 100644 (file)
@@ -2,7 +2,7 @@
  * m4v.c : MPEG-4 video Stream input module for vlc
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: m4v.c,v 1.4 2003/03/30 18:14:37 gbazin Exp $
+ * $Id: m4v.c,v 1.5 2003/05/05 22:23:36 gbazin Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -129,8 +129,7 @@ static int Activate( vlc_object_t * p_this )
     /* create our ES */
     p_demux->p_es = input_AddES( p_input,
                                  p_input->stream.p_selected_program,
-                                 1, /* id */
-                                 0 );
+                                 1 /* id */, VIDEO_ES, NULL, 0 );
     if( !p_demux->p_es )
     {
         vlc_mutex_unlock( &p_input->stream.stream_lock );
@@ -140,7 +139,6 @@ static int Activate( vlc_object_t * p_this )
     }
     p_demux->p_es->i_stream_id = 1;
     p_demux->p_es->i_fourcc = VLC_FOURCC('m','p','4','v');
-    p_demux->p_es->i_cat = VIDEO_ES;
 
     input_SelectES( p_input, p_demux->p_es );
 
index 69b0b15..49bafcb 100644 (file)
@@ -2,7 +2,7 @@
  * system.c: helper module for TS, PS and PES management
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: system.c,v 1.13 2003/04/01 10:46:35 massiot Exp $
+ * $Id: system.c,v 1.14 2003/05/05 22:23:36 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Michel Lespinasse <walken@via.ecp.fr>
@@ -645,39 +645,44 @@ static void DecodePSM( input_thread_t * p_input, data_packet_t * p_data )
          * so that we can close them more easily at the end. */
         if( p_es == NULL )
         {
-            p_es = input_AddES( p_input, p_input->stream.pp_programs[0],
-                                i_stream_id, 0 );
+            int i_fourcc, i_cat;
+
             switch( p_byte[0] )
             {
             case MPEG1_VIDEO_ES:
             case MPEG2_VIDEO_ES:
             case MPEG2_MOTO_VIDEO_ES:
-                p_es->i_fourcc = VLC_FOURCC('m','p','g','v');
-                p_es->i_cat = VIDEO_ES;
+                i_fourcc = VLC_FOURCC('m','p','g','v');
+                i_cat = VIDEO_ES;
                 break;
             case DVD_SPU_ES:
-                p_es->i_fourcc = VLC_FOURCC('s','p','u','b');
-                p_es->i_cat = SPU_ES;
+                i_fourcc = VLC_FOURCC('s','p','u','b');
+                i_cat = SPU_ES;
                 break;
             case MPEG1_AUDIO_ES:
             case MPEG2_AUDIO_ES:
-                p_es->i_fourcc = VLC_FOURCC('m','p','g','a');
-                p_es->i_cat = AUDIO_ES;
+                i_fourcc = VLC_FOURCC('m','p','g','a');
+                i_cat = AUDIO_ES;
                 break;
             case A52_AUDIO_ES:
             case A52DVB_AUDIO_ES:
-                p_es->i_fourcc = VLC_FOURCC('a','5','2','b');
-                p_es->i_cat = AUDIO_ES;
+                i_fourcc = VLC_FOURCC('a','5','2','b');
+                i_cat = AUDIO_ES;
                 break;
             case LPCM_AUDIO_ES:
-                p_es->i_fourcc = VLC_FOURCC('l','p','c','b');
-                p_es->i_cat = AUDIO_ES;
+                i_fourcc = VLC_FOURCC('l','p','c','b');
+                i_cat = AUDIO_ES;
                 break;
             default:
-                p_es->i_fourcc = 0;
+                i_cat = UNKNOWN_ES;
+                i_fourcc = 0;
                 break;
             }
 
+            p_es = input_AddES( p_input, p_input->stream.pp_programs[0],
+                                i_stream_id, i_cat, NULL, 0 );
+            p_es->i_fourcc = i_fourcc;
+
             /* input_AddES has inserted the new element at the end. */
             p_input->stream.pp_programs[0]->pp_es[
                 p_input->stream.pp_programs[0]->i_es_number ]
@@ -844,6 +849,7 @@ static es_descriptor_t * ParsePS( input_thread_t * p_input,
         }
         else
         {
+            vlc_bool_t b_auto_spawn = VLC_FALSE;
             stream_ps_data_t * p_demux =
               (stream_ps_data_t *)p_input->stream.pp_programs[0]->p_demux_data;
 
@@ -852,105 +858,108 @@ static es_descriptor_t * ParsePS( input_thread_t * p_input,
 
             if( p_es == NULL && !p_demux->b_has_PSM )
             {
-                p_es = input_AddES( p_input, p_input->stream.pp_programs[0],
-                                    i_id, 0 );
-                if( p_es != NULL )
-                {
-                    p_es->i_stream_id = p_data->p_demux_start[3];
+                int i_fourcc, i_cat;
 
-                    /* Set stream type and auto-spawn. */
-                    if( (i_id & 0xF0) == 0xE0 )
-                    {
-                        /* MPEG video */
-                        p_es->i_fourcc = VLC_FOURCC('m','p','g','v');
-                        p_es->i_cat = VIDEO_ES;
+                /* Set stream type and auto-spawn. */
+                if( (i_id & 0xF0) == 0xE0 )
+                {
+                    /* MPEG video */
+                    i_fourcc = VLC_FOURCC('m','p','g','v');
+                    i_cat = VIDEO_ES;
 #ifdef AUTO_SPAWN
-                        if( !p_input->stream.b_seekable )
-                            input_SelectES( p_input, p_es );
+                    if( !p_input->stream.b_seekable ) b_auto_spawn = VLC_TRUE;
 #endif
-                    }
-                    else if( (i_id & 0xE0) == 0xC0 )
-                    {
-                        /* MPEG audio */
-                        p_es->i_fourcc = VLC_FOURCC('m','p','g','a');
-                        p_es->i_cat = AUDIO_ES;
+                }
+                else if( (i_id & 0xE0) == 0xC0 )
+                {
+                    /* MPEG audio */
+                    i_fourcc = VLC_FOURCC('m','p','g','a');
+                    i_cat = AUDIO_ES;
 #ifdef AUTO_SPAWN
-                        if( !p_input->stream.b_seekable )
-                        if( config_GetInt( p_input, "audio-channel" )
-                                == (p_es->i_id & 0x1F) ||
-                            ( config_GetInt( p_input, "audio-channel" ) < 0
-                              && !(p_es->i_id & 0x1F) ) )
-                        switch( config_GetInt( p_input, "audio-type" ) )
-                        {
-                        case -1:
-                        case REQUESTED_MPEG:
-                            input_SelectES( p_input, p_es );
-                        }
-#endif
-                    }
-                    else if( (i_id & 0xF8FF) == 0x88BD )
+                    if( !p_input->stream.b_seekable )
+                    if( config_GetInt( p_input, "audio-channel" )
+                            == (i_id & 0x1F) ||
+                        ( config_GetInt( p_input, "audio-channel" ) < 0
+                          && !(i_id & 0x1F) ) )
+                    switch( config_GetInt( p_input, "audio-type" ) )
                     {
-                        p_es->i_fourcc = VLC_FOURCC('d','t','s','b');
-                        p_es->i_cat = AUDIO_ES;
-#ifdef AUTO_SPAWN
-                        if( !p_input->stream.b_seekable )
-                        if( config_GetInt( p_input, "audio-channel" )
-                                == ((p_es->i_id & 0x700) >> 8) ||
-                            ( config_GetInt( p_input, "audio-channel" ) < 0
-                              && !((p_es->i_id & 0x700) >> 8)) )
-                        switch( config_GetInt( p_input, "audio-type" ) )
-                        {
-                        case -1:
-                        case REQUESTED_DTS:
-                            input_SelectES( p_input, p_es );
-                        }
-#endif
+                    case -1:
+                    case REQUESTED_MPEG:
+                        b_auto_spawn = VLC_TRUE;
                     }
-                    else if( (i_id & 0xF0FF) == 0x80BD )
-                    {
-                        /* A52 audio (0x80->0x8F) */
-                        p_es->i_fourcc = VLC_FOURCC('a','5','2','b');
-                        p_es->i_cat = AUDIO_ES;
-#ifdef AUTO_SPAWN
-                        if( !p_input->stream.b_seekable )
-                        if( config_GetInt( p_input, "audio-channel" )
-                                == ((p_es->i_id & 0xF00) >> 8) ||
-                            ( config_GetInt( p_input, "audio-channel" ) < 0
-                              && !((p_es->i_id & 0xF00) >> 8)) )
-                        switch( config_GetInt( p_input, "audio-type" ) )
-                        {
-                        case -1:
-                        case REQUESTED_A52:
-                            input_SelectES( p_input, p_es );
-                        }
 #endif
-                    }
-                    else if( (i_id & 0xE0FF) == 0x20BD )
-                    {
-                        /* Subtitles video (0x20->0x3F) */
-                        p_es->i_fourcc = VLC_FOURCC('s','p','u','b');
-                        p_es->i_cat = SPU_ES;
+                }
+                else if( (i_id & 0xF8FF) == 0x88BD )
+                {
+                    i_fourcc = VLC_FOURCC('d','t','s','b');
+                    i_cat = AUDIO_ES;
 #ifdef AUTO_SPAWN
-                        if( config_GetInt( p_input, "spu-channel" )
-                                == ((p_es->i_id & 0x1F00) >> 8) )
-                        {
-                            if( !p_input->stream.b_seekable )
-                                input_SelectES( p_input, p_es );
-                        }
-#endif
+                    if( !p_input->stream.b_seekable )
+                    if( config_GetInt( p_input, "audio-channel" )
+                            == ((i_id & 0x700) >> 8) ||
+                        ( config_GetInt( p_input, "audio-channel" ) < 0
+                          && !((i_id & 0x700) >> 8)) )
+                    switch( config_GetInt( p_input, "audio-type" ) )
+                    {
+                    case -1:
+                    case REQUESTED_DTS:
+                        b_auto_spawn = VLC_TRUE;
                     }
-                    else if( (i_id & 0xF0FF) == 0xA0BD )
+#endif
+                }
+                else if( (i_id & 0xF0FF) == 0x80BD )
+                {
+                    /* A52 audio (0x80->0x8F) */
+                    i_fourcc = VLC_FOURCC('a','5','2','b');
+                    i_cat = AUDIO_ES;
+#ifdef AUTO_SPAWN
+                    if( !p_input->stream.b_seekable )
+                    if( config_GetInt( p_input, "audio-channel" )
+                            == ((i_id & 0xF00) >> 8) ||
+                        ( config_GetInt( p_input, "audio-channel" ) < 0
+                          && !((i_id & 0xF00) >> 8)) )
+                    switch( config_GetInt( p_input, "audio-type" ) )
                     {
-                        /* LPCM audio (0xA0->0xAF) */
-                        p_es->i_fourcc = VLC_FOURCC('l','p','c','b');
-                        p_es->i_cat = AUDIO_ES;
+                    case -1:
+                    case REQUESTED_A52:
+                        b_auto_spawn = VLC_TRUE;
                     }
-                    else
+#endif
+                }
+                else if( (i_id & 0xE0FF) == 0x20BD )
+                {
+                    /* Subtitles video (0x20->0x3F) */
+                    i_fourcc = VLC_FOURCC('s','p','u','b');
+                    i_cat = SPU_ES;
+#ifdef AUTO_SPAWN
+                    if( !p_input->stream.b_seekable )
+                    if( config_GetInt( p_input, "spu-channel" )
+                           == ((i_id & 0x1F00) >> 8) )
                     {
-                        p_es->i_fourcc = 0;
+                        b_auto_spawn = VLC_TRUE;
                     }
+#endif
+                }
+                else if( (i_id & 0xF0FF) == 0xA0BD )
+                {
+                    /* LPCM audio (0xA0->0xAF) */
+                    i_fourcc = VLC_FOURCC('l','p','c','b');
+                    i_cat = AUDIO_ES;
+                }
+                else
+                {
+                    i_cat = UNKNOWN_ES;
+                    i_fourcc = 0;
                 }
 
+                p_es = input_AddES( p_input, p_input->stream.pp_programs[0],
+                                    i_id, i_cat, NULL, 0 );
+
+                p_es->i_stream_id = p_data->p_demux_start[3];
+                p_es->i_fourcc = i_fourcc;
+
+                if( b_auto_spawn ) input_SelectES( p_input, p_es );
+
                 /* Tell the interface the stream has changed */
                 p_input->stream.b_changed = 1;
             }
@@ -1425,4 +1434,3 @@ static void DemuxTS( input_thread_t * p_input, data_packet_t * p_data,
 #undef p
 
 }
-
index 3b146e6..2855463 100644 (file)
@@ -2,7 +2,7 @@
  * mpeg_ts.c : Transport Stream input module for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: ts.c,v 1.20 2003/03/18 23:59:07 massiot Exp $
+ * $Id: ts.c,v 1.21 2003/05/05 22:23:36 gbazin Exp $
  *
  * Authors: Henri Fallon <henri@via.ecp.fr>
  *          Johan Bilien <jobi@via.ecp.fr>
@@ -216,8 +216,8 @@ static int Activate( vlc_object_t * p_this )
     /* We'll have to catch the PAT in order to continue
      * Then the input will catch the PMT and then the others ES
      * The PAT es is indepedent of any program. */
-    p_pat_es = input_AddES( p_input, NULL,
-                            0x00, sizeof( es_ts_data_t ) );
+    p_pat_es = input_AddES( p_input, NULL, 0x00,
+                            UNKNOWN_ES, NULL, sizeof( es_ts_data_t ) );
     p_demux_data = (es_ts_data_t *)p_pat_es->p_demux_data;
     p_demux_data->b_psi = 1;
     p_demux_data->i_psi_type = PSI_IS_PAT;
@@ -532,7 +532,7 @@ static void TSDecodePAT( input_thread_t * p_input, es_descriptor_t * p_es )
 
                     /* Add the PMT ES to this program */
                     p_current_es = input_AddES( p_input, p_pgrm,(u16)i_pmt_pid,
-                                        sizeof( es_ts_data_t) );
+                        UNKNOWN_ES, NULL, sizeof( es_ts_data_t) );
                     p_es_demux = (es_ts_data_t *)p_current_es->p_demux_data;
                     p_es_demux->b_psi = 1;
                     p_es_demux->i_psi_type = PSI_IS_PMT;
@@ -629,14 +629,11 @@ static void TSDecodePMT( input_thread_t * p_input, es_descriptor_t * p_es )
                 i_es_info_length = ( ((u32)*(p_current_data + 3) & 0xF) << 8 ) |
                                       *(p_current_data + 4);
 
-                /* Add this ES to the program */
-                p_new_es = input_AddES( p_input, p_es->p_pgrm,
-                                        (u16)i_pid, sizeof( es_ts_data_t ) );
-                ((es_ts_data_t *)p_new_es->p_demux_data)->i_continuity_counter = 0xFF;
-
                 /* Tell the interface what kind of stream it is and select
                  * the required ones */
                 {
+                    int i_fourcc, i_cat, i_stream_id;
+
                     switch( i_stream_type )
                     {
                         case MPEG1_VIDEO_ES:
@@ -644,72 +641,83 @@ static void TSDecodePMT( input_thread_t * p_input, es_descriptor_t * p_es )
                         case MPEG2_MOTO_VIDEO_ES:
                             /* This isn't real, but we don't actually use
                              * it. */
-                            p_new_es->i_stream_id = 0xE0;
-                            p_new_es->i_fourcc = VLC_FOURCC('m','p','g','v');
-                            p_new_es->i_cat = VIDEO_ES;
+                            i_stream_id = 0xE0;
+                            i_fourcc = VLC_FOURCC('m','p','g','v');
+                            i_cat = VIDEO_ES;
                             break;
                         case MPEG1_AUDIO_ES:
                         case MPEG2_AUDIO_ES:
                             /* This isn't real, but we don't actually use
                              * it. */
-                            p_new_es->i_stream_id = 0xC0;
-                            p_new_es->i_fourcc = VLC_FOURCC('m','p','g','a');
-                            p_new_es->i_cat = AUDIO_ES;
+                            i_stream_id = 0xC0;
+                            i_fourcc = VLC_FOURCC('m','p','g','a');
+                            i_cat = AUDIO_ES;
                             break;
                         case A52_AUDIO_ES:
                         case A52DVB_AUDIO_ES:
                             if ( !b_vls_compat )
-                                p_new_es->i_fourcc = VLC_FOURCC('a','5','2',' ');
+                                i_fourcc = VLC_FOURCC('a','5','2',' ');
                             else
-                                p_new_es->i_fourcc = VLC_FOURCC('a','5','2','b');
-                            p_new_es->i_stream_id = 0xBD;
-                            p_new_es->i_cat = AUDIO_ES;
+                                i_fourcc = VLC_FOURCC('a','5','2','b');
+                            i_stream_id = 0xBD;
+                            i_cat = AUDIO_ES;
                             break;
                         case LPCM_AUDIO_ES:
-                            p_new_es->i_fourcc = VLC_FOURCC('l','p','c','m');
-                            p_new_es->i_stream_id = 0xBD;
-                            p_new_es->i_cat = AUDIO_ES;
+                            i_fourcc = VLC_FOURCC('l','p','c','m');
+                            i_stream_id = 0xBD;
+                            i_cat = AUDIO_ES;
                             break;
                         case DVD_SPU_ES:
                             if ( !b_vls_compat )
-                                p_new_es->i_fourcc = VLC_FOURCC('s','p','u',' ');
+                                i_fourcc = VLC_FOURCC('s','p','u',' ');
                             else
-                                p_new_es->i_fourcc = VLC_FOURCC('s','p','u','b');
-                            p_new_es->i_stream_id = 0xBD;
-                            p_new_es->i_cat = SPU_ES;
+                                i_fourcc = VLC_FOURCC('s','p','u','b');
+                            i_stream_id = 0xBD;
+                            i_cat = SPU_ES;
                             break;
                         case SDDS_AUDIO_ES:
-                            p_new_es->i_fourcc = VLC_FOURCC('s','d','d','s');
-                            p_new_es->i_stream_id = 0xBD;
-                            p_new_es->i_cat = AUDIO_ES;
+                            i_fourcc = VLC_FOURCC('s','d','d','s');
+                            i_stream_id = 0xBD;
+                            i_cat = AUDIO_ES;
                             break;
                         case DTS_AUDIO_ES:
-                            p_new_es->i_fourcc = VLC_FOURCC('d','t','s',' ');
-                            p_new_es->i_stream_id = 0xBD;
-                            p_new_es->i_cat = AUDIO_ES;
+                            i_fourcc = VLC_FOURCC('d','t','s',' ');
+                            i_stream_id = 0xBD;
+                            i_cat = AUDIO_ES;
                             break;
                         /* 'b' stands for 'buggy' */
                         case A52B_AUDIO_ES:
-                            p_new_es->i_fourcc = VLC_FOURCC('a','5','2','b');
-                            p_new_es->i_stream_id = 0xBD;
-                            p_new_es->i_cat = AUDIO_ES;
+                            i_fourcc = VLC_FOURCC('a','5','2','b');
+                            i_stream_id = 0xBD;
+                            i_cat = AUDIO_ES;
                             break;
                         case LPCMB_AUDIO_ES:
-                            p_new_es->i_fourcc = VLC_FOURCC('l','p','c','b');
-                            p_new_es->i_stream_id = 0xBD;
-                            p_new_es->i_cat = AUDIO_ES;
+                            i_fourcc = VLC_FOURCC('l','p','c','b');
+                            i_stream_id = 0xBD;
+                            i_cat = AUDIO_ES;
                             break;
                         case DVDB_SPU_ES:
-                            p_new_es->i_fourcc = VLC_FOURCC('s','p','u','b');
-                            p_new_es->i_stream_id = 0xBD;
-                            p_new_es->i_cat = SPU_ES;
+                            i_fourcc = VLC_FOURCC('s','p','u','b');
+                            i_stream_id = 0xBD;
+                            i_cat = SPU_ES;
                             break;
 
                         default :
-                            p_new_es->i_fourcc = 0;
-                            p_new_es->i_cat = UNKNOWN_ES;
+                            i_stream_id = 0;
+                            i_fourcc = 0;
+                            i_cat = UNKNOWN_ES;
                             break;
                     }
+
+                    /* Add this ES to the program */
+                    p_new_es = input_AddES( p_input, p_es->p_pgrm, (u16)i_pid,
+                                   i_cat, NULL, sizeof( es_ts_data_t ) );
+
+                    ((es_ts_data_t *)p_new_es->p_demux_data)->i_continuity_counter = 0xFF;
+
+                    p_new_es->i_stream_id = i_stream_id;
+                    p_new_es->i_fourcc = i_fourcc;
+
                 }
 
                 p_current_data += 5 + i_es_info_length;
@@ -1200,8 +1208,8 @@ static void TS_DVBPSI_HandlePAT( input_thread_t * p_input,
 
                 /* Add the PMT ES to this program */
                 p_current_es = input_AddES( p_input, p_new_pgrm,
-                                            (u16) p_pgrm->i_pid,
-                                            sizeof( es_ts_data_t) );
+                                            (u16)p_pgrm->i_pid, UNKNOWN_ES,
+                                            NULL, sizeof(es_ts_data_t) );
                 p_es_demux = (es_ts_data_t *)p_current_es->p_demux_data;
                 p_es_demux->b_psi = 1;
                 p_es_demux->i_psi_type = PSI_IS_PMT;
@@ -1281,96 +1289,101 @@ static void TS_DVBPSI_HandlePMT( input_thread_t * p_input,
         p_es = p_new_pmt->p_first_es;
         while( p_es )
         {
-            /* Add this ES */
-            p_new_es = input_AddES( p_input, p_pgrm,
-                            (u16)p_es->i_pid, sizeof( es_ts_data_t ) );
-            if( p_new_es == NULL )
-            {
-                msg_Err( p_input, "could not add ES %d", p_es->i_pid );
-                p_input->b_error = 1;
-                return;
-            }
-            ((es_ts_data_t *)p_new_es->p_demux_data)->i_continuity_counter = 0xFF;
+            int i_fourcc, i_cat, i_stream_id;
 
             switch( p_es->i_type )
             {
                 case MPEG1_VIDEO_ES:
                 case MPEG2_VIDEO_ES:
                 case MPEG2_MOTO_VIDEO_ES:
-                    p_new_es->i_fourcc = VLC_FOURCC('m','p','g','v');
-                    p_new_es->i_cat = VIDEO_ES;
+                    i_fourcc = VLC_FOURCC('m','p','g','v');
+                    i_cat = VIDEO_ES;
                     break;
                 case MPEG1_AUDIO_ES:
                 case MPEG2_AUDIO_ES:
-                    p_new_es->i_fourcc = VLC_FOURCC('m','p','g','a');
-                    p_new_es->i_cat = AUDIO_ES;
+                    i_fourcc = VLC_FOURCC('m','p','g','a');
+                    i_cat = AUDIO_ES;
                     break;
                 case A52_AUDIO_ES:
                 case A52DVB_AUDIO_ES:
                     if ( !b_vls_compat )
-                        p_new_es->i_fourcc = VLC_FOURCC('a','5','2',' ');
+                        i_fourcc = VLC_FOURCC('a','5','2',' ');
                     else
-                        p_new_es->i_fourcc = VLC_FOURCC('a','5','2','b');
-                    p_new_es->i_cat = AUDIO_ES;
-                    p_new_es->i_stream_id = 0xBD;
+                        i_fourcc = VLC_FOURCC('a','5','2','b');
+                    i_cat = AUDIO_ES;
+                    i_stream_id = 0xBD;
                     break;
                 case DVD_SPU_ES:
                     if ( !b_vls_compat )
-                        p_new_es->i_fourcc = VLC_FOURCC('s','p','u',' ');
+                        i_fourcc = VLC_FOURCC('s','p','u',' ');
                     else
-                        p_new_es->i_fourcc = VLC_FOURCC('s','p','u','b');
-                    p_new_es->i_cat = SPU_ES;
-                    p_new_es->i_stream_id = 0xBD;
+                        i_fourcc = VLC_FOURCC('s','p','u','b');
+                    i_cat = SPU_ES;
+                    i_stream_id = 0xBD;
                     break;
                 case LPCM_AUDIO_ES:
-                    p_new_es->i_fourcc = VLC_FOURCC('l','p','c','m');
-                    p_new_es->i_cat = AUDIO_ES;
-                    p_new_es->i_stream_id = 0xBD;
+                    i_fourcc = VLC_FOURCC('l','p','c','m');
+                    i_cat = AUDIO_ES;
+                    i_stream_id = 0xBD;
                     break;
                 case SDDS_AUDIO_ES:
-                    p_new_es->i_fourcc = VLC_FOURCC('s','d','d','s');
-                    p_new_es->i_stream_id = 0xBD;
-                    p_new_es->i_cat = AUDIO_ES;
+                    i_fourcc = VLC_FOURCC('s','d','d','s');
+                    i_stream_id = 0xBD;
+                    i_cat = AUDIO_ES;
                     break;
                 case DTS_AUDIO_ES:
-                    p_new_es->i_fourcc = VLC_FOURCC('d','t','s',' ');
-                    p_new_es->i_stream_id = 0xBD;
-                    p_new_es->i_cat = AUDIO_ES;
+                    i_fourcc = VLC_FOURCC('d','t','s',' ');
+                    i_stream_id = 0xBD;
+                    i_cat = AUDIO_ES;
                     break;
                 case A52B_AUDIO_ES:
-                    p_new_es->i_fourcc = VLC_FOURCC('a','5','2','b');
-                    p_new_es->i_cat = AUDIO_ES;
-                    p_new_es->i_stream_id = 0xBD;
+                    i_fourcc = VLC_FOURCC('a','5','2','b');
+                    i_cat = AUDIO_ES;
+                    i_stream_id = 0xBD;
                     break;
                 case DVDB_SPU_ES:
-                    p_new_es->i_fourcc = VLC_FOURCC('s','p','u','b');
-                    p_new_es->i_cat = SPU_ES;
-                    p_new_es->i_stream_id = 0xBD;
+                    i_fourcc = VLC_FOURCC('s','p','u','b');
+                    i_cat = SPU_ES;
+                    i_stream_id = 0xBD;
                     break;
                 case LPCMB_AUDIO_ES:
-                    p_new_es->i_fourcc = VLC_FOURCC('l','p','c','b');
-                    p_new_es->i_cat = AUDIO_ES;
-                    p_new_es->i_stream_id = 0xBD;
+                    i_fourcc = VLC_FOURCC('l','p','c','b');
+                    i_cat = AUDIO_ES;
+                    i_stream_id = 0xBD;
                     break;
                 case MPEG4_VIDEO_ES:
-                    p_new_es->i_fourcc = VLC_FOURCC('m','p','4','v');
-                    p_new_es->i_cat = VIDEO_ES;
-                    p_new_es->i_stream_id = 0xfa;
+                    i_fourcc = VLC_FOURCC('m','p','4','v');
+                    i_cat = VIDEO_ES;
+                    i_stream_id = 0xfa;
                     break;
                 case MPEG4_AUDIO_ES:
-                    p_new_es->i_fourcc = VLC_FOURCC('m','p','4','a');
-                    p_new_es->i_cat = AUDIO_ES;
-                    p_new_es->i_stream_id = 0xfa;
+                    i_fourcc = VLC_FOURCC('m','p','4','a');
+                    i_cat = AUDIO_ES;
+                    i_stream_id = 0xfa;
                     break;
                 case MSCODEC_VIDEO_ES:
-                    p_new_es->i_fourcc = VLC_FOURCC(0,0,0,0);   // fixed later
-                    p_new_es->i_cat = VIDEO_ES;
-                    p_new_es->i_stream_id = 0xa0;
+                    i_fourcc = VLC_FOURCC(0,0,0,0);   // fixed later
+                    i_cat = VIDEO_ES;
+                    i_stream_id = 0xa0;
                     break;
                 default:
-                    p_new_es->i_fourcc = 0;
-                    p_new_es->i_cat = UNKNOWN_ES;
+                    i_fourcc = 0;
+                    i_cat = UNKNOWN_ES;
+            }
+
+            /* Add this ES */
+            p_new_es = input_AddES( p_input, p_pgrm, (u16)p_es->i_pid,
+                                    i_cat, NULL, sizeof( es_ts_data_t ) );
+            if( p_new_es == NULL )
+            {
+                msg_Err( p_input, "could not add ES %d", p_es->i_pid );
+                p_input->b_error = 1;
+                return;
             }
+            p_new_es->i_fourcc = i_fourcc;
+            p_new_es->i_stream_id = i_stream_id;
+
+            ((es_ts_data_t *)p_new_es->p_demux_data)->i_continuity_counter = 0xFF;
 
             if( p_es->i_type == MPEG4_VIDEO_ES || p_es->i_type == MPEG4_AUDIO_ES )
             {
index 3b3bc64..e5a78aa 100644 (file)
@@ -2,7 +2,7 @@
  * ogg.c : ogg stream input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: ogg.c,v 1.24 2003/04/14 03:23:30 fenrir Exp $
+ * $Id: ogg.c,v 1.25 2003/05/05 22:23:34 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  * 
@@ -1123,12 +1123,12 @@ static int Activate( vlc_object_t * p_this )
         vlc_mutex_lock( &p_input->stream.stream_lock );
         p_stream->p_es = input_AddES( p_input,
                                       p_input->stream.p_selected_program,
-                                      p_ogg->i_streams + 1, 0 );
+                                      i_stream,
+                                      p_stream->i_cat, NULL, 0 );
         p_input->stream.i_mux_rate += (p_stream->i_bitrate / ( 8 * 50 ));
         vlc_mutex_unlock( &p_input->stream.stream_lock );
-        p_stream->p_es->i_stream_id = p_stream->p_es->i_id = i_stream;
+        p_stream->p_es->i_stream_id = i_stream;
         p_stream->p_es->i_fourcc = p_stream->i_fourcc;
-        p_stream->p_es->i_cat = p_stream->i_cat;
         p_stream->p_es->p_waveformatex      = (void*)p_stream->p_wf;
         p_stream->p_es->p_bitmapinfoheader  = (void*)p_stream->p_bih;
 #undef p_stream
index 2b2fb89..f8350e1 100644 (file)
@@ -2,7 +2,7 @@
  * rawdv.c : raw dv input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: rawdv.c,v 1.7 2003/04/27 15:25:11 gbazin Exp $
+ * $Id: rawdv.c,v 1.8 2003/05/05 22:23:34 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -292,10 +292,9 @@ static int Activate( vlc_object_t * p_this )
     vlc_mutex_lock( &p_input->stream.stream_lock );
     p_rawdv->p_video_es = input_AddES( p_input,
                                        p_input->stream.p_selected_program,
-                                       1, 0 );
+                                       1, VIDEO_ES, NULL, 0 );
     p_rawdv->p_video_es->i_stream_id = 0;
     p_rawdv->p_video_es->i_fourcc = VLC_FOURCC( 'd','v','s','d' );
-    p_rawdv->p_video_es->i_cat = VIDEO_ES;
     p_rawdv->p_video_es->p_bitmapinfoheader = (void *)p_rawdv->p_bih;
     input_SelectES( p_input, p_rawdv->p_video_es );
     vlc_mutex_unlock( &p_input->stream.stream_lock );
@@ -304,10 +303,9 @@ static int Activate( vlc_object_t * p_this )
     vlc_mutex_lock( &p_input->stream.stream_lock );
     p_rawdv->p_audio_es = input_AddES( p_input,
                                        p_input->stream.p_selected_program,
-                                       2, 0 );
+                                       2, AUDIO_ES, NULL, 0 );
     p_rawdv->p_audio_es->i_stream_id = 1;
     p_rawdv->p_audio_es->i_fourcc = VLC_FOURCC( 'd','v','a','u' );
-    p_rawdv->p_audio_es->i_cat = AUDIO_ES;
     p_rawdv->p_audio_es->p_waveformatex = (void *)p_rawdv->p_wf;
     input_SelectES( p_input, p_rawdv->p_audio_es );
     vlc_mutex_unlock( &p_input->stream.stream_lock );
index d0d0504..4b31674 100644 (file)
@@ -2,7 +2,7 @@
  * sub.c
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: sub.c,v 1.12 2003/04/14 03:23:30 fenrir Exp $
+ * $Id: sub.c,v 1.13 2003/05/05 22:23:37 gbazin Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -425,15 +425,13 @@ static int  sub_open ( subtitle_demux_t *p_sub,
 
     /* *** add subtitle ES *** */
     vlc_mutex_lock( &p_input->stream.stream_lock );
-    p_sub->p_es = input_AddES( p_input,
-                               p_input->stream.p_selected_program,
+    p_sub->p_es = input_AddES( p_input, p_input->stream.p_selected_program,
                                0xff,    // FIXME
-                               0 );
+                               SPU_ES, NULL, 0 );
     vlc_mutex_unlock( &p_input->stream.stream_lock );
 
     p_sub->p_es->i_stream_id = 0xff;    // FIXME
     p_sub->p_es->i_fourcc    = VLC_FOURCC( 's','u','b','t' );
-    p_sub->p_es->i_cat       = SPU_ES;
 
     p_sub->i_previously_selected = 0;
     return VLC_SUCCESS;
index 86a9dde..bdbf20a 100644 (file)
@@ -2,7 +2,7 @@
  * wav.c : wav file input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: wav.c,v 1.14 2003/03/11 06:45:59 fenrir Exp $
+ * $Id: wav.c,v 1.15 2003/05/05 22:23:37 gbazin Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -527,11 +527,10 @@ static int WAVInit( vlc_object_t * p_this )
         p_input->stream.i_mux_rate = 0 ; /* FIXME */
 
         p_demux->p_es = input_AddES( p_input,
-                                     p_input->stream.p_selected_program, 1,
-                                     0 );
+                                     p_input->stream.p_selected_program,
+                                     1, AUDIO_ES, NULL, 0 );
         p_demux->p_es->i_stream_id = 1;
         p_demux->p_es->i_fourcc = p_demux->i_fourcc;
-        p_demux->p_es->i_cat = AUDIO_ES;
         p_demux->p_es->p_waveformatex = malloc( p_demux->i_wf );
         memcpy( p_demux->p_es->p_waveformatex, p_demux->p_wf, p_demux->i_wf );
 
index eb87845..8f14943 100644 (file)
@@ -2,7 +2,7 @@
  * VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port)
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: VlcWrapper.cpp,v 1.28 2003/04/23 15:18:24 titer Exp $
+ * $Id: VlcWrapper.cpp,v 1.29 2003/05/05 22:23:38 gbazin Exp $
  *
  * Authors: Florian G. Pflug <fgp@phlo.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -193,10 +193,11 @@ BList * VlcWrapper::GetChannels( int i_cat )
             {
                 message = new BMessage( what );
                 message->AddInt32( fieldName, i );
-                if( strlen( p_input->stream.pp_es[i]->psz_desc ) )
-                    trackName = strdup( p_input->stream.pp_es[i]->psz_desc );
-                else
+                if( !p_input->stream.pp_es[i]->psz_desc ||
+                    !*p_input->stream.pp_es[i]->psz_desc )
                     trackName = _("<unknown>");
+                else
+                    trackName = strdup( p_input->stream.pp_es[i]->psz_desc );
                 menuItem = new BMenuItem( trackName, message );
                 if( p_input->stream.pp_es[i] == p_es )
                     menuItem->SetMarked( true );
index 06cb3d0..c2e5cfe 100644 (file)
@@ -2,7 +2,7 @@
  * menu.c : functions to handle menu items.
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: menu.c,v 1.9 2003/05/04 22:42:15 gbazin Exp $
+ * $Id: menu.c,v 1.10 2003/05/05 22:23:38 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -764,14 +764,18 @@ static gint GtkLanguageMenus( gpointer          p_data,
                  p_intf->p_sys->p_input->stream.p_selected_program ) )
         {
             i_item++;
-            strcpy( psz_name,
-                    p_intf->p_sys->p_input->stream.pp_es[i]->psz_desc );
-            if( psz_name[0] == '\0' )
+            if( !p_intf->p_sys->p_input->stream.pp_es[i]->psz_desc ||
+                !*p_intf->p_sys->p_input->stream.pp_es[i]->psz_desc )
             {
                 snprintf( psz_name, GTK_MENU_LABEL_SIZE,
                           "Language %d", i_item );
                 psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
             }
+            else
+            {
+                strcpy( psz_name,
+                        p_intf->p_sys->p_input->stream.pp_es[i]->psz_desc );
+            }
 
             p_item = gtk_radio_menu_item_new_with_label( p_group, psz_name );
             p_group =
index 35e0f1d..f64393d 100644 (file)
@@ -2,7 +2,7 @@
  * intf.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: intf.m,v 1.73 2003/05/05 22:04:11 hartman Exp $
+ * $Id: intf.m,v 1.74 2003/05/05 22:23:39 gbazin Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -1272,11 +1272,7 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
             NSMenuItem * o_lmi;
             NSString * o_title;
 
-            if( *ES->psz_desc )
-            {
-                o_title = [NSApp localizedString: ES->psz_desc];
-            }
-            else
+            if( !ES->psz_desc || !*ES->psz_desc )
             {
                 char psz_title[ 256 ];
 
@@ -1286,6 +1282,10 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
 
                 o_title = [NSApp localizedString: psz_title];
             }
+            else
+            {
+                o_title = [NSApp localizedString: ES->psz_desc];
+            }
 
             o_lmi = [o_menu addItemWithTitle: o_title
                 action: pf_callback keyEquivalent: @""];
index 08c741b..9d9bd55 100644 (file)
@@ -2,7 +2,7 @@
  * menu.cpp: functions to handle menu items\r
  *****************************************************************************\r
  * Copyright (C) 2002-2003 VideoLAN\r
- * $Id: menu.cpp,v 1.15 2003/05/04 22:42:16 gbazin Exp $\r
+ * $Id: menu.cpp,v 1.16 2003/05/05 22:23:39 gbazin Exp $\r
  *\r
  * Authors: Olivier Teuliere <ipkiss@via.ecp.fr>\r
  *\r
@@ -867,7 +867,8 @@ void __fastcall TMenusGen::LanguageMenu( TMenuItem *Root, es_descriptor_t *p_es,
                 p_intf->p_sys->p_input->stream.p_selected_program ) )\r
         {\r
             i_item++;\r
-            Name = p_intf->p_sys->p_input->stream.pp_es[i]->psz_desc;\r
+            if( p_intf->p_sys->p_input->stream.pp_es[i]->psz_desc )\r
+                Name = p_intf->p_sys->p_input->stream.pp_es[i]->psz_desc;\r
             if( Name.IsEmpty() )\r
                 Name.sprintf( "Language %d", i_item );\r
 \r
index b12017f..de16235 100644 (file)
@@ -2,7 +2,7 @@
  * menus.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: menus.cpp,v 1.1 2003/05/04 22:42:16 gbazin Exp $
+ * $Id: menus.cpp,v 1.2 2003/05/05 22:23:40 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -92,12 +92,12 @@ END_EVENT_TABLE()
 void PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface )
 {
     vlc_object_t *p_object;
-    char *ppsz_varnames[16];
-    int pi_objects[16];
+    char *ppsz_varnames[19];
+    int pi_objects[19];
     int i = 0;
 
     /* Initializations */
-    memset( pi_objects, 0, 16 * sizeof(int) );
+    memset( pi_objects, 0, 19 * sizeof(int) );
 
     /* Audio menu */
     ppsz_varnames[i++] = _("Audio menu");
@@ -143,6 +143,14 @@ void PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface )
         pi_objects[i++] = p_object->i_object_id;
         ppsz_varnames[i] = "navigation";
         pi_objects[i++] = p_object->i_object_id;
+
+        ppsz_varnames[i] = "video-es";
+        pi_objects[i++] = p_object->i_object_id;
+        ppsz_varnames[i] = "audio-es";
+        pi_objects[i++] = p_object->i_object_id;
+        ppsz_varnames[i] = "spu-es";
+        pi_objects[i++] = p_object->i_object_id;
+
         vlc_object_release( p_object );
     }
 
@@ -165,12 +173,12 @@ void PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface )
 wxMenu *AudioMenu( intf_thread_t *_p_intf, Interface *_p_main_interface )
 {
     vlc_object_t *p_object;
-    char *ppsz_varnames[4];
-    int pi_objects[4];
+    char *ppsz_varnames[5];
+    int pi_objects[5];
     int i = 0;
 
     /* Initializations */
-    memset( pi_objects, 0, 4 * sizeof(int) );
+    memset( pi_objects, 0, 5 * sizeof(int) );
 
     /* Audio menu */
     ppsz_varnames[i++] = NULL; /* Separator */
@@ -187,6 +195,15 @@ wxMenu *AudioMenu( intf_thread_t *_p_intf, Interface *_p_main_interface )
         vlc_object_release( p_object );
     }
 
+    p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT,
+                                                FIND_ANYWHERE );
+    if( p_object != NULL )
+    {
+        ppsz_varnames[i] = "audio-es";
+        pi_objects[i++] = p_object->i_object_id;
+        vlc_object_release( p_object );
+    }
+
     /* Build menu */
     return new Menu( _p_intf, _p_main_interface, i,
                      ppsz_varnames, pi_objects );
@@ -213,6 +230,17 @@ wxMenu *VideoMenu( intf_thread_t *_p_intf, Interface *_p_main_interface )
         vlc_object_release( p_object );
     }
 
+    p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT,
+                                                FIND_ANYWHERE );
+    if( p_object != NULL )
+    {
+        ppsz_varnames[i] = "video-es";
+        pi_objects[i++] = p_object->i_object_id;
+        ppsz_varnames[i] = "spu-es";
+        pi_objects[i++] = p_object->i_object_id;
+        vlc_object_release( p_object );
+    }
+
     /* Build menu */
     return new Menu( _p_intf, _p_main_interface, i,
                      ppsz_varnames, pi_objects );
index a9b3823..85a87ff 100644 (file)
@@ -2,7 +2,7 @@
  * display.c
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: display.c,v 1.3 2003/04/29 22:44:08 fenrir Exp $
+ * $Id: display.c,v 1.4 2003/05/05 22:23:40 gbazin Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -142,6 +142,8 @@ static sout_stream_id_t * Add      ( sout_stream_t *p_stream, sout_format_t *p_f
     id->p_es = input_AddES( p_sys->p_input,
                             NULL,           /* no program */
                             12,             /* es_id */
+       /* p_fmt->i_cat; */  UNKNOWN_ES,     /* es category */
+                            NULL,           /* description */
                             0 );            /* no extra data */
 
     if( !id->p_es )
@@ -153,7 +155,6 @@ static sout_stream_id_t * Add      ( sout_stream_t *p_stream, sout_format_t *p_f
         return NULL;
     }
     id->p_es->i_stream_id   = 1;
-    id->p_es->i_cat         = UNKNOWN_ES; /* p_fmt->i_cat; */
     id->p_es->i_fourcc      = p_fmt->i_fourcc;
     id->p_es->b_force_decoder = VLC_TRUE;
     switch( p_fmt->i_cat )
index c4e0a71..9dd31a8 100644 (file)
@@ -1,9 +1,10 @@
 # libvlc
+include/interface.h
+src/audio_output/output.c
+src/input/input_programs.c
 src/libvlc.c
 src/libvlc.h
 src/misc/configuration.c
-src/audio_output/output.c
-include/interface.h
 
 # access modules
 modules/access/directory.c
index 44787ab..3fac781 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.105 2003/05/04 22:42:17 gbazin Exp $
+ * $Id: input_programs.c,v 1.106 2003/05/05 22:23:42 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -48,12 +48,15 @@ static int ChapterCallback( vlc_object_t *, char const *,
                             vlc_value_t, vlc_value_t, void * );
 static int NavigationCallback( vlc_object_t *, char const *,
                                vlc_value_t, vlc_value_t, void * );
+static int ESCallback( vlc_object_t *, char const *,
+                       vlc_value_t, vlc_value_t, void * );
 
 /*****************************************************************************
  * input_InitStream: init the stream descriptor of the given input
  *****************************************************************************/
 int input_InitStream( input_thread_t * p_input, size_t i_data_len )
 {
+    vlc_value_t text;
 
     p_input->stream.i_stream_id = 0;
 
@@ -84,12 +87,33 @@ int input_InitStream( input_thread_t * p_input, size_t i_data_len )
 
     /* Create a few object variables used for navigation in the interfaces */
     var_Create( p_input, "program", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
+    text.psz_string = _("Program");
+    var_Change( p_input, "program", VLC_VAR_SETTEXT, &text, NULL );
     var_Create( p_input, "title", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
+    text.psz_string = _("Title");
+    var_Change( p_input, "title", VLC_VAR_SETTEXT, &text, NULL );
     var_Create( p_input, "chapter", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
+    text.psz_string = _("Chapter");
+    var_Change( p_input, "chapter", VLC_VAR_SETTEXT, &text, NULL );
     var_Create( p_input, "navigation", VLC_VAR_VARIABLE | VLC_VAR_HASCHOICE );
+    text.psz_string = _("Navigation");
+    var_Change( p_input, "navigation", VLC_VAR_SETTEXT, &text, NULL );
+    var_Create( p_input, "video-es", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
+    text.psz_string = _("Video track");
+    var_Change( p_input, "video-es", VLC_VAR_SETTEXT, &text, NULL );
+    var_Create( p_input, "audio-es", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
+    text.psz_string = _("Audio track");
+    var_Change( p_input, "audio-es", VLC_VAR_SETTEXT, &text, NULL );
+    var_Create( p_input, "spu-es", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
+    text.psz_string = _("Subtitle track");
+    var_Change( p_input, "spu-es", VLC_VAR_SETTEXT, &text, NULL );
+
     var_AddCallback( p_input, "program", ProgramCallback, NULL );
     var_AddCallback( p_input, "title", TitleCallback, NULL );
     var_AddCallback( p_input, "chapter", ChapterCallback, NULL );
+    var_AddCallback( p_input, "video-es", ESCallback, NULL );
+    var_AddCallback( p_input, "audio-es", ESCallback, NULL );
+    var_AddCallback( p_input, "spu-es", ESCallback, NULL );
 
     return 0;
 }
@@ -99,11 +123,6 @@ int input_InitStream( input_thread_t * p_input, size_t i_data_len )
  *****************************************************************************/
 void input_EndStream( input_thread_t * p_input )
 {
-    /* Free navigation variables */
-    var_Destroy( p_input, "program" );
-    var_Destroy( p_input, "title" );
-    var_Destroy( p_input, "chapter" );
-
     /* Free all programs and associated ES, and associated decoders. */
     while( p_input->stream.i_pgrm_number )
     {
@@ -132,6 +151,14 @@ void input_EndStream( input_thread_t * p_input )
     {
         free( p_input->stream.p_demux_data );
     }
+
+    /* Free navigation variables */
+    var_Destroy( p_input, "program" );
+    var_Destroy( p_input, "title" );
+    var_Destroy( p_input, "chapter" );
+    var_Destroy( p_input, "video-es" );
+    var_Destroy( p_input, "audio-es" );
+    var_Destroy( p_input, "spu-es" );
 }
 
 /*****************************************************************************
@@ -500,9 +527,12 @@ es_descriptor_t * input_FindES( input_thread_t * p_input, uint16_t i_es_id )
  *****************************************************************************/
 es_descriptor_t * input_AddES( input_thread_t * p_input,
                                pgrm_descriptor_t * p_pgrm, u16 i_es_id,
+                               int i_category, char const *psz_desc,
                                size_t i_data_len )
 {
     es_descriptor_t * p_es;
+    vlc_value_t val, text;
+    char *psz_var = NULL;
 
     p_es = (es_descriptor_t *)malloc( sizeof(es_descriptor_t) );
     if( p_es == NULL )
@@ -518,10 +548,10 @@ es_descriptor_t * input_AddES( input_thread_t * p_input,
 
     /* Init its values */
     p_es->i_id = i_es_id;
-    p_es->psz_desc[0] = '\0';
+    p_es->psz_desc = psz_desc ? strdup( psz_desc ) : NULL;
     p_es->p_pes = NULL;
     p_es->p_decoder_fifo = NULL;
-    p_es->i_cat = UNKNOWN_ES;
+    p_es->i_cat = i_category;
     p_es->i_demux_fd = 0;
     p_es->c_packets = 0;
     p_es->c_invalid_packets = 0;
@@ -558,6 +588,26 @@ es_descriptor_t * input_AddES( input_thread_t * p_input,
         p_es->p_pgrm = NULL;
     }
 
+    switch( i_category )
+    {
+    case AUDIO_ES:
+        psz_var = "audio-es";
+        break;
+    case SPU_ES:
+        psz_var = "spu-es";
+        break;
+    case VIDEO_ES:
+        psz_var = "video-es";
+        break;
+    }
+
+    if( psz_var )
+    {
+        val.i_int = p_es->i_id;
+        text.psz_string = (char *)psz_desc;
+        var_Change( p_input, psz_var, VLC_VAR_ADDCHOICE, &val, &text );
+    }
+
     return p_es;
 }
 
@@ -568,6 +618,8 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es )
 {
     unsigned int            i_index, i_es_index;
     pgrm_descriptor_t *     p_pgrm;
+    char *                  psz_var;
+    vlc_value_t             val;
 
     /* Find the ES in the ES table */
     for( i_es_index = 0; i_es_index < p_input->stream.i_es_number;
@@ -584,7 +636,22 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es )
         return;
     }
 
-    p_pgrm = p_es->p_pgrm;
+    /* Remove es from its associated variable */
+    switch( p_es->i_cat )
+    {
+    case AUDIO_ES:
+        psz_var = "audio-es";
+       break;
+    case SPU_ES:
+        psz_var = "spu-es";
+       break;
+    case VIDEO_ES:
+    default:
+        psz_var = "video-es";
+       break;
+    }
+    val.i_int = p_es->i_id;
+    var_Change( p_input, psz_var, VLC_VAR_DELCHOICE, &val, NULL );
 
     /* Kill associated decoder, if any. */
     if( p_es->p_decoder_fifo != NULL )
@@ -592,8 +659,9 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es )
         input_EndDecoder( p_input, p_es );
     }
 
-    /* Remove this ES from the description of the program if it is associated to
-     * one */
+    /* Remove this ES from the description of the program if it is associated
+     * to one */
+    p_pgrm = p_es->p_pgrm;
     if( p_pgrm )
     {
         for( i_index = 0; i_index < p_pgrm->i_es_number; i_index++ )
@@ -622,6 +690,12 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es )
         free( p_es->p_bitmapinfoheader );
     }
 
+    /* Free the description string */
+    if( p_es->psz_desc != NULL )
+    {
+        free( p_es->psz_desc );
+    }
+
     /* Find the ES in the ES table */
     for( i_es_index = 0; i_es_index < p_input->stream.i_es_number;
          i_es_index++ )
@@ -647,6 +721,8 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es )
  *****************************************************************************/
 int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es )
 {
+    vlc_value_t val;
+
     if( p_es == NULL )
     {
         msg_Err( p_input, "nothing to do in input_SelectES" );
@@ -687,6 +763,10 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es )
         return -1;
     }
 
+    /* Update the es variable without triggering a callback */
+    val.i_int = p_es->i_id;
+    var_Change( p_input, "audio-es", VLC_VAR_SETVALUE, &val, NULL );
+
     return 0;
 }
 
@@ -836,3 +916,36 @@ static int NavigationCallback( vlc_object_t *p_this, char const *psz_cmd,
 
     return VLC_SUCCESS;
 }
+
+static int ESCallback( vlc_object_t *p_this, char const *psz_cmd,
+                       vlc_value_t oldval, vlc_value_t newval, void *p_data )
+{
+    input_thread_t *p_input = (input_thread_t *)p_this;
+    unsigned int i;
+
+    vlc_mutex_lock( &p_input->stream.stream_lock );
+
+    /* Unselect old ES */
+    for( i = 0 ; i < p_input->stream.i_es_number ; i++ )
+    {
+        if( p_input->stream.pp_es[i]->i_id == oldval.i_int &&
+            p_input->stream.pp_es[i]->p_decoder_fifo != NULL )
+        {
+            input_UnselectES( p_input, p_input->stream.pp_es[i] );
+        }
+    }
+
+    /* Select new ES */
+    for( i = 0 ; i < p_input->stream.i_es_number ; i++ )
+    {
+        if( p_input->stream.pp_es[i]->i_id == newval.i_int &&
+            p_input->stream.pp_es[i]->p_decoder_fifo == NULL )
+        {
+            input_SelectES( p_input, p_input->stream.pp_es[i] );
+        }
+    }
+
+    vlc_mutex_unlock( &p_input->stream.stream_lock );
+
+    return VLC_SUCCESS;
+}
index 5e5295e..fcd1678 100644 (file)
@@ -2,7 +2,7 @@
  * libvlc.h: main libvlc header
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: libvlc.h,v 1.59 2003/05/05 16:09:35 gbazin Exp $
+ * $Id: libvlc.h,v 1.60 2003/05/05 22:23:41 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -156,7 +156,7 @@ static char *ppsz_sout_vcodec[] = { "", "mpeg1", "mpeg2", "mpeg4", NULL };
 #define ZOOM_LONGTEXT N_( \
     "You can zoom the video by the specified factor.")
 
-#define GRAYSCALE_TEXT N_("gGayscale video output")
+#define GRAYSCALE_TEXT N_("Gayscale video output")
 #define GRAYSCALE_LONGTEXT N_( \
     "When enabled, the color information from the video won't be decoded " \
     "(this can also allow you to save some processing power).")