Commit 95b4a56a authored by Gildas Bazin's avatar Gildas Bazin

* ALL: changed the prototype of input_AddES() to include enough information so we can build an "video-es", "audio-es" and "spu-es" object variable. These variables can be used by the interfaces to navigate between the elementary streams.
* modules/gui/wxwindows/menus.cpp: use the "foo-es" object variables.
parent 45d50b96
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* control the pace of reading. * control the pace of reading.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -52,7 +52,7 @@ struct es_descriptor_t ...@@ -52,7 +52,7 @@ struct es_descriptor_t
uint8_t i_cat; /* stream category (audio, video, spu) */ uint8_t i_cat; /* stream category (audio, video, spu) */
int i_demux_fd; /* used to store demux device int i_demux_fd; /* used to store demux device
file handle */ file handle */
char psz_desc[20]; /* description of ES: audio language char *psz_desc; /* description of ES: audio language
* for instance ; NULL if not * for instance ; NULL if not
* available */ * available */
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* but exported to plug-ins * but exported to plug-ins
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2002 VideoLAN * 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> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -47,7 +47,7 @@ VLC_EXPORT( int, input_SetProgram,( input_thread_t *, pgrm_descriptor_t * ) ); ...@@ -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( 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( 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_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( void, input_DelES, ( input_thread_t *, es_descriptor_t * ) );
VLC_EXPORT( int, input_SelectES, ( 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 * ) ); VLC_EXPORT( int, input_UnselectES,( input_thread_t *, es_descriptor_t * ) );
......
/* es.c: functions to find and select ES /* es.c: functions to find and select ES
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * 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: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -64,16 +64,20 @@ void DVDLaunchDecoders( input_thread_t * p_input ); ...@@ -64,16 +64,20 @@ void DVDLaunchDecoders( input_thread_t * p_input );
#define vmg p_dvd->p_ifo->vmg #define vmg p_dvd->p_ifo->vmg
#define vts p_dvd->p_ifo->vts #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); \ 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 ) ...@@ -94,12 +98,13 @@ void DVDReadVideo( input_thread_t * p_input )
if( i_ratio ) 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; *(int*)(p_es->p_demux_data) = i_ratio;
} }
else 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 ) ...@@ -137,27 +142,27 @@ void DVDReadAudio( input_thread_t * p_input )
{ {
case 0x00: /* A52 */ case 0x00: /* A52 */
ADDES( 0xbd, 0x80 + audio_status.i_position, ADDES( 0xbd, 0x80 + audio_status.i_position,
VLC_FOURCC('a','5','2','b'), AUDIO_ES, i_lang, 0 ); VLC_FOURCC('a','5','2','b'), AUDIO_ES, i_lang,
strcat( p_es->psz_desc, " (A52)" ); " (A52)", 0 );
break; break;
case 0x02: case 0x02:
case 0x03: /* MPEG audio */ case 0x03: /* MPEG audio */
ADDES( 0xc0 + audio_status.i_position, 0, ADDES( 0xc0 + audio_status.i_position, 0,
VLC_FOURCC('m','p','g','a'), AUDIO_ES, i_lang, 0 ); VLC_FOURCC('m','p','g','a'), AUDIO_ES, i_lang,
strcat( p_es->psz_desc, " (mpeg)" ); " (mpeg)", 0 );
break; break;
case 0x04: /* LPCM */ case 0x04: /* LPCM */
ADDES( 0xbd, 0xa0 + audio_status.i_position, ADDES( 0xbd, 0xa0 + audio_status.i_position,
VLC_FOURCC('l','p','c','b'), AUDIO_ES, i_lang, 0 ); VLC_FOURCC('l','p','c','b'), AUDIO_ES, i_lang,
strcat( p_es->psz_desc, " (lpcm)" ); " (lpcm)", 0 );
break; break;
case 0x06: /* DTS */ case 0x06: /* DTS */
ADDES( 0xbd, 0x88 + audio_status.i_position, ADDES( 0xbd, 0x88 + audio_status.i_position,
VLC_FOURCC('d','t','s','b'), AUDIO_ES, i_lang, 0 ); VLC_FOURCC('d','t','s','b'), AUDIO_ES, i_lang,
strcat( p_es->psz_desc, " (dts)" ); " (dts)", 0 );
break; break;
default: default:
...@@ -222,7 +227,7 @@ void DVDReadSPU( input_thread_t * p_input ) ...@@ -222,7 +227,7 @@ void DVDReadSPU( input_thread_t * p_input )
if( vmg.title.pi_yuv_color ) if( vmg.title.pi_yuv_color )
{ {
ADDES( 0xbd, 0x20 + i_id, VLC_FOURCC('s','p','u','b'), SPU_ES, 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) ); sizeof(int) + 16*sizeof(u32) );
*(int*)p_es->p_demux_data = 0xBeeF; *(int*)p_es->p_demux_data = 0xBeeF;
memcpy( (char*)p_es->p_demux_data + sizeof(int), memcpy( (char*)p_es->p_demux_data + sizeof(int),
...@@ -231,7 +236,7 @@ void DVDReadSPU( input_thread_t * p_input ) ...@@ -231,7 +236,7 @@ void DVDReadSPU( input_thread_t * p_input )
else else
{ {
ADDES( 0xbd, 0x20 + i_id, VLC_FOURCC('s','p','u','b'), SPU_ES, 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 );
} }
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* es.c: functions to handle elementary streams. * es.c: functions to handle elementary streams.
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -71,16 +71,20 @@ void dvdplay_DeleteES( input_thread_t* p_input ) ...@@ -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 ); \ 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 * dvdplay_Video: read video ES
...@@ -100,12 +104,13 @@ void dvdplay_Video( input_thread_t * p_input ) ...@@ -100,12 +104,13 @@ void dvdplay_Video( input_thread_t * p_input )
if( p_attr->display_aspect_ratio ) 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; *(int*)(p_es->p_demux_data) = p_attr->display_aspect_ratio;
} }
else 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 ) ...@@ -143,29 +148,29 @@ void dvdplay_Audio( input_thread_t * p_input )
switch( p_attr->audio_format ) switch( p_attr->audio_format )
{ {
case 0x00: /* A52 */ case 0x00: /* A52 */
ADDES( i_id, VLC_FOURCC('a','5','2','b'), AUDIO_ES, i_lang, 0 ); ADDES( i_id, VLC_FOURCC('a','5','2','b'), AUDIO_ES, i_lang,
strcat( p_es->psz_desc, " (A52)" ); " (A52)", 0 );
break; break;
case 0x02: case 0x02:
case 0x03: /* MPEG audio */ case 0x03: /* MPEG audio */
ADDES( i_id, VLC_FOURCC('m','p','g','a'), AUDIO_ES, i_lang, 0 ); ADDES( i_id, VLC_FOURCC('m','p','g','a'), AUDIO_ES, i_lang,
strcat( p_es->psz_desc, " (mpeg)" ); " (mpeg)", 0 );
break; break;
case 0x04: /* LPCM */ case 0x04: /* LPCM */
ADDES( i_id, VLC_FOURCC('l','p','c','b'), AUDIO_ES, i_lang, 0 ); ADDES( i_id, VLC_FOURCC('l','p','c','b'), AUDIO_ES, i_lang,
strcat( p_es->psz_desc, " (lpcm)" ); " (lpcm)", 0 );
break; break;
case 0x05: /* SDDS */ case 0x05: /* SDDS */
ADDES( i_id, VLC_FOURCC('s','d','d','b'), AUDIO_ES, i_lang, 0 ); ADDES( i_id, VLC_FOURCC('s','d','d','b'), AUDIO_ES, i_lang,
strcat( p_es->psz_desc, " (sdds)" ); " (sdds)", 0 );
break; break;
case 0x06: /* DTS */ case 0x06: /* DTS */
ADDES( i_id, VLC_FOURCC('d','t','s','b'), AUDIO_ES, i_lang, 0 ); ADDES( i_id, VLC_FOURCC('d','t','s','b'), AUDIO_ES, i_lang,
strcat( p_es->psz_desc, " (dts)" ); " (dts)", 0 );
break; break;
default: default:
...@@ -207,7 +212,7 @@ void dvdplay_Subp( input_thread_t * p_input ) ...@@ -207,7 +212,7 @@ void dvdplay_Subp( input_thread_t * p_input )
if( pi_palette ) if( pi_palette )
{ {
ADDES( i_id, VLC_FOURCC('s','p','u','b'), SPU_ES, 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; *(int*)p_es->p_demux_data = 0xBeeF;
memcpy( (void*)p_es->p_demux_data + sizeof(int), memcpy( (void*)p_es->p_demux_data + sizeof(int),
pi_palette, 16*sizeof(u32) ); pi_palette, 16*sizeof(u32) );
...@@ -215,7 +220,7 @@ void dvdplay_Subp( input_thread_t * p_input ) ...@@ -215,7 +220,7 @@ void dvdplay_Subp( input_thread_t * p_input )
else else
{ {
ADDES( i_id, VLC_FOURCC('s','p','u','b'), SPU_ES, ADDES( i_id, VLC_FOURCC('s','p','u','b'), SPU_ES,
p_attr->lang_code, 0 ); p_attr->lang_code, "", 0 );
} }
} }
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* It depends on: libdvdread for ifo files and block reading. * It depends on: libdvdread for ifo files and block reading.
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2003 VideoLAN * 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: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -666,10 +666,9 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -666,10 +666,9 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area )
/* ES 0 -> video MPEG2 */ /* ES 0 -> video MPEG2 */
// IfoPrintVideo( p_dvd ); // 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_stream_id = 0xe0;
p_es->i_fourcc = VLC_FOURCC('m','p','g','v'); p_es->i_fourcc = VLC_FOURCC('m','p','g','v');
p_es->i_cat = VIDEO_ES;
#define audio_control \ #define audio_control \
p_dvd->p_vts_file->vts_pgcit->pgci_srp[pgc_id-1].pgc->audio_control[i-1] 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 ) ...@@ -687,42 +686,36 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area )
i_audio_nb++; i_audio_nb++;
i_position = ( audio_control & 0x7F00 ) >> 8; 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 ) switch( p_vts->vtsi_mat->vts_audio_attr[i-1].audio_format )
{ {
case 0x00: /* A52 */ case 0x00: /* A52 */
i_id = ( ( 0x80 + i_position ) << 8 ) | 0xbd; 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_stream_id = 0xbd;
p_es->i_fourcc = VLC_FOURCC('a','5','2','b'); 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; break;
case 0x02: case 0x02:
case 0x03: /* MPEG audio */ case 0x03: /* MPEG audio */
i_id = 0xc0 + i_position; 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_stream_id = i_id;
p_es->i_fourcc = VLC_FOURCC('m','p','g','a'); 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; break;
case 0x04: /* LPCM */ case 0x04: /* LPCM */
i_id = ( ( 0xa0 + i_position ) << 8 ) | 0xbd; 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_stream_id = i_id;
p_es->i_fourcc = VLC_FOURCC('l','p','c','b'); 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; break;
case 0x06: /* DTS */ case 0x06: /* DTS */
...@@ -779,12 +772,11 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -779,12 +772,11 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area )
} }
i_id = ( ( 0x20 + i_position ) << 8 ) | 0xbd; 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_stream_id = 0xbd;
p_es->i_fourcc = VLC_FOURCC('s','p','u','b'); 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 #undef spu_control
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* v4l.c : Video4Linux input module for vlc * v4l.c : Video4Linux input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * 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> * Author: Samuel Hocevar <sam@zoy.org>
* *
...@@ -1191,13 +1191,12 @@ static int DemuxOpen( vlc_object_t *p_this ) ...@@ -1191,13 +1191,12 @@ static int DemuxOpen( vlc_object_t *p_this )
{ {
es_descriptor_t *p_es; 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 ) ) if( !strncmp( p_peek, "auds", 4 ) )
{ {
#define wf ((WAVEFORMATEX*)p_es->p_waveformatex) #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 = p_es->i_fourcc =
VLC_FOURCC( p_peek[4], p_peek[5], p_peek[6], p_peek[7] ); 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 ) ...@@ -1220,7 +1219,9 @@ static int DemuxOpen( vlc_object_t *p_this )
else if( !strncmp( p_peek, "vids", 4 ) ) else if( !strncmp( p_peek, "vids", 4 ) )
{ {
#define bih ((BITMAPINFOHEADER*)p_es->p_bitmapinfoheader) #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 = p_es->i_fourcc =
VLC_FOURCC( p_peek[4], p_peek[5], p_peek[6], p_peek[7] ); VLC_FOURCC( p_peek[4], p_peek[5], p_peek[6], p_peek[7] );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* rc.c : remote control stdin/stdout plugin for vlc * rc.c : remote control stdin/stdout plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Peter Surda <shurdeek@panorama.sth.ac.at>
* *
...@@ -845,7 +845,7 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd, ...@@ -845,7 +845,7 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd,
text.p_list->p_values[i].psz_string ); text.p_list->p_values[i].psz_string );
} }
var_Change( (vlc_object_t *)p_aout, psz_variable, VLC_VAR_FREELIST, 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 ); printf( "+----[ end of %s ]\n", val_name.psz_string );
if( val_name.psz_string ) free( val_name.psz_string ); if( val_name.psz_string ) free( val_name.psz_string );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* a52sys.c : A/52 input module for vlc * a52sys.c : A/52 input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* *
...@@ -103,10 +103,10 @@ static int Init( vlc_object_t * p_this ) ...@@ -103,10 +103,10 @@ static int Init( vlc_object_t * p_this )
input_AddProgram( p_input, 0, 0 ); input_AddProgram( p_input, 0, 0 );
p_input->stream.p_selected_program = p_input->stream.pp_programs[0]; p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
vlc_mutex_lock( &p_input->stream.stream_lock ); 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_stream_id = 0xBD;
p_es->i_fourcc = VLC_FOURCC('a','5','2',' '); p_es->i_fourcc = VLC_FOURCC('a','5','2',' ');
p_es->i_cat = AUDIO_ES;
input_SelectES( p_input, p_es ); input_SelectES( p_input, p_es );
p_input->stream.p_selected_area->i_tell = 0; p_input->stream.p_selected_area->i_tell = 0;
p_input->stream.p_selected_program->b_is_ok = 1; p_input->stream.p_selected_program->b_is_ok = 1;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* demux.c : Raw aac Stream input module for vlc * demux.c : Raw aac Stream input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -489,10 +489,8 @@ static int Activate( vlc_object_t * p_this ) ...@@ -489,10 +489,8 @@ static int Activate( vlc_object_t * p_this )
p_input->stream.p_selected_program = p_input->stream.pp_programs[0]; p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
/* create our ES */ /* create our ES */
p_aac->p_es = input_AddES( p_input, p_aac->p_es = input_AddES( p_input, p_input->stream.p_selected_program,
p_input->stream.p_selected_program, 1 /* id */, AUDIO_ES, NULL, 0 );
1, /* id */
0 );
if( !p_aac->p_es ) if( !p_aac->p_es )
{ {
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
...@@ -502,7 +500,6 @@ static int Activate( vlc_object_t * p_this ) ...@@ -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_stream_id = 1;
p_aac->p_es->i_fourcc = VLC_FOURCC( 'm', 'p', '4', 'a' ); 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 ); input_SelectES( p_input, p_aac->p_es );
p_input->stream.p_selected_program->b_is_ok = 1; p_input->stream.p_selected_program->b_is_ok = 1;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* asf.c : ASFv01 file input module for vlc * asf.c : ASFv01 file input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -205,11 +205,7 @@ static int Activate( vlc_object_t * p_this ) ...@@ -205,11 +205,7 @@ static int Activate( vlc_object_t * p_this )
p_stream->p_sp = p_sp; p_stream->p_sp = p_sp;
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
p_stream->p_es = p_stream->p_es = NULL;
input_AddES( p_input,
p_input->stream.p_selected_program,
p_sp->i_stream_number,
0 );
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
if( CmpGUID( &p_sp->i_stream_type, &asf_object_stream_type_audio ) ) if( CmpGUID( &p_sp->i_stream_type, &asf_object_stream_type_audio ) )
...@@ -225,6 +221,10 @@ static int Activate( vlc_object_t * p_this ) ...@@ -225,6 +221,10 @@ static int Activate( vlc_object_t * p_this )
} }
p_stream->i_cat = AUDIO_ES; 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") ); input_AddInfo( p_cat, _("Type"), _("Audio") );
msg_Dbg( p_input, msg_Dbg( p_input,
"adding new audio stream(codec:0x%x,ID:%d)", "adding new audio stream(codec:0x%x,ID:%d)",
...@@ -295,10 +295,13 @@ static int Activate( vlc_object_t * p_this ) ...@@ -295,10 +295,13 @@ static int Activate( vlc_object_t * p_this )
if( CmpGUID( &p_sp->i_stream_type, &asf_object_stream_type_video ) ) if( CmpGUID( &p_sp->i_stream_type, &asf_object_stream_type_video ) )
{ {
p_stream->i_cat = VIDEO_ES; 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") ); input_AddInfo( p_cat, _("Type"), _("Video") );
msg_Dbg( p_input, msg_Dbg( p_input, "adding new video stream(ID:%d)",
"adding new video stream(ID:%d)", p_sp->i_stream_number );
p_sp->i_stream_number );
if( p_sp->p_type_specific_data ) if( p_sp->p_type_specific_data )
{ {
p_stream->p_es->i_fourcc = p_stream->p_es->i_fourcc =
...@@ -356,15 +359,12 @@ static int Activate( vlc_object_t * p_this ) ...@@ -356,15 +359,12 @@ static int Activate( vlc_object_t * p_this )
else else
{ {
p_stream->i_cat = UNKNOWN_ES; p_stream->i_cat = UNKNOWN_ES;
msg_Dbg( p_input, msg_Dbg( p_input, "ignoring unknown stream(ID:%d)",
"ignoring unknown stream(ID:%d)", p_sp->i_stream_number );
p_sp->i_stream_number );
p_stream->p_es->i_fourcc = VLC_FOURCC( 'u','n','d','f' );
} }
p_stream->p_es->i_cat = p_stream->i_cat;
vlc_mutex_lock( &p_input->stream.stream_lock ); 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 ); input_SelectES( p_input, p_stream->p_es );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* au.c : au file input module for vlc * au.c : au file input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -406,13 +406,10 @@ static int AUInit( vlc_object_t * p_this ) ...@@ -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.p_selected_program = p_input->stream.pp_programs[0];
p_input->stream.i_mux_rate = wf.nAvgBytesPerSec / 50; p_input->stream.i_mux_rate = wf.nAvgBytesPerSec / 50;
p_es = input_AddES( p_input, p_es = input_AddES( p_input, p_input->stream.p_selected_program,
p_input->stream.p_selected_program, 0x01, AUDIO_ES, NULL, 0 );
0x01,
0 );
p_es->i_stream_id = 0x01; p_es->i_stream_id = 0x01;
p_es->i_cat = AUDIO_ES;
p_es->i_fourcc = i_codec; p_es->i_fourcc = i_codec;
p_es->p_waveformatex= malloc( sizeof( WAVEFORMATEX ) ); p_es->p_waveformatex= malloc( sizeof( WAVEFORMATEX ) );
memcpy( p_es->p_waveformatex, memcpy( p_es->p_waveformatex,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc * avi.c : AVI file Stream input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -1239,13 +1239,11 @@ static int AVIInit( vlc_object_t * p_this ) ...@@ -1239,13 +1239,11 @@ static int AVIInit( vlc_object_t * p_this )
/* add one ES */ /* add one ES */
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
p_info->p_es = p_info->p_es =
p_es = input_AddES( p_input, p_es = input_AddES( p_input, p_input->stream.p_selected_program,
p_input->stream.p_selected_program, 1+i, 1+i, p_info->i_cat, NULL, 0 );
0 );
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
p_es->i_stream_id =i; /* XXX: i don't use it */ p_es->i_stream_id =i; /* XXX: i don't use it */
p_es->i_fourcc = p_info->i_fourcc; p_es->i_fourcc = p_info->i_fourcc;
p_es->i_cat = p_info->i_cat;
if( p_es->i_cat == AUDIO_ES ) if( p_es->i_cat == AUDIO_ES )
{ {
if( i_init_size < sizeof( WAVEFORMATEX ) ) if( i_init_size < sizeof( WAVEFORMATEX ) )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* a52sys.c : A/52 input module for vlc * a52sys.c : A/52 input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* *
...@@ -104,10 +104,10 @@ static int Init( vlc_object_t * p_this ) ...@@ -104,10 +104,10 @@ static int Init( vlc_object_t * p_this )
input_AddProgram( p_input, 0, 0 ); input_AddProgram( p_input, 0, 0 );
p_input->stream.p_selected_program = p_input->stream.pp_programs[0]; p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
vlc_mutex_lock( &p_input->stream.stream_lock ); 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_stream_id = 0xBD;
p_es->i_fourcc = VLC_FOURCC('f','l','a','c'); p_es->i_fourcc = VLC_FOURCC('f','l','a','c');
p_es->i_cat = AUDIO_ES;
input_SelectES( p_input, p_es ); input_SelectES( p_input, p_es );
p_input->stream.p_selected_area->i_tell = 0; p_input->stream.p_selected_area->i_tell = 0;
p_input->stream.p_selected_program->b_is_ok = 1; p_input->stream.p_selected_program->b_is_ok = 1;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mp4.c : MP4 file input module for vlc * mp4.c : MP4 file input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -882,6 +882,7 @@ static int TrackCreateES ( input_thread_t *p_input, ...@@ -882,6 +882,7 @@ static int TrackCreateES ( input_thread_t *p_input,
{ {
MP4_Box_t * p_sample; MP4_Box_t * p_sample;
unsigned int i; unsigned int i;
char psz_lang[4];
unsigned int i_decoder_specific_info_len; unsigned int i_decoder_specific_info_len;
uint8_t * p_decoder_specific_info; uint8_t * p_decoder_specific_info;
...@@ -940,19 +941,17 @@ static int TrackCreateES ( input_thread_t *p_input, ...@@ -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 */ /* Initialise ES, first language as description */
for( i = 0; i < 3; i++ ) 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; p_es->i_stream_id = p_track->i_track_ID;
...@@ -971,8 +970,6 @@ static int TrackCreateES ( input_thread_t *p_input, ...@@ -971,8 +970,6 @@ static int TrackCreateES ( input_thread_t *p_input,
break; break;
} }
p_es->i_cat = p_track->i_cat;
i_decoder_specific_info_len = 0; i_decoder_specific_info_len = 0;
p_decoder_specific_info = NULL; p_decoder_specific_info = NULL;
p_pes_init = NULL; p_pes_init = NULL;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* audio.c : mpeg audio Stream input module for vlc * audio.c : mpeg audio Stream input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -583,10 +583,8 @@ static int Activate( vlc_object_t * p_this ) ...@@ -583,10 +583,8 @@ static int Activate( vlc_object_t * p_this )
p_input->stream.p_selected_program = p_input->stream.pp_programs[0]; p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
/* create our ES */ /* create our ES */
p_demux->p_es = input_AddES( p_input, p_demux->p_es = input_AddES( p_input, p_input->stream.p_selected_program,
p_input->stream.p_selected_program, 1 /* id */, AUDIO_ES, NULL, 0 );
1, /* id */
0 );
if( !p_demux->p_es ) if( !p_demux->p_es )
{ {
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
...@@ -596,7 +594,6 @@ static int Activate( vlc_object_t * p_this ) ...@@ -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_stream_id = 1;
p_demux->p_es->i_fourcc = VLC_FOURCC('m','p','g','a'); 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 ); input_SelectES( p_input, p_demux->p_es );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mpeg_es.c : Elementary Stream input module for vlc * mpeg_es.c : Elementary Stream input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -117,10 +117,10 @@ static int Activate( vlc_object_t * p_this ) ...@@ -117,10 +117,10 @@ static int Activate( vlc_object_t * p_this )
input_AddProgram( p_input, 0, 0 ); input_AddProgram( p_input, 0, 0 );
p_input->stream.p_selected_program = p_input->stream.pp_programs[0]; p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
vlc_mutex_lock( &p_input->stream.stream_lock ); 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_stream_id = 0xE0;
p_es->i_fourcc = VLC_FOURCC('m','p','g','v'); p_es->i_fourcc = VLC_FOURCC('m','p','g','v');
p_es->i_cat = VIDEO_ES;
input_SelectES( p_input, p_es ); input_SelectES( p_input, p_es );
p_input->stream.p_selected_area->i_tell = 0; p_input->stream.p_selected_area->i_tell = 0;
p_input->stream.p_selected_program->b_is_ok = 1; p_input->stream.p_selected_program->b_is_ok = 1;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* m4v.c : MPEG-4 video Stream input module for vlc * m4v.c : MPEG-4 video Stream input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -129,8 +129,7 @@ static int Activate( vlc_object_t * p_this ) ...@@ -129,8 +129,7 @@ static int Activate( vlc_object_t * p_this )
/* create our ES */ /* create our ES */
p_demux->p_es = input_AddES( p_input, p_demux->p_es = input_AddES( p_input,
p_input->stream.p_selected_program, p_input->stream.p_selected_program,
1, /* id */ 1 /* id */, VIDEO_ES, NULL, 0 );
0 );
if( !p_demux->p_es ) if( !p_demux->p_es )
{ {
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
...@@ -140,7 +139,6 @@ static int Activate( vlc_object_t * p_this ) ...@@ -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_stream_id = 1;
p_demux->p_es->i_fourcc = VLC_FOURCC('m','p','4','v'); 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 ); input_SelectES( p_input, p_demux->p_es );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* system.c: helper module for TS, PS and PES management * system.c: helper module for TS, PS and PES management
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * 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> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Lespinasse <walken@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 ) ...@@ -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. */ * so that we can close them more easily at the end. */
if( p_es == NULL ) if( p_es == NULL )
{ {
p_es = input_AddES( p_input, p_input->stream.pp_programs[0], int i_fourcc, i_cat;
i_stream_id, 0 );
switch( p_byte[0] ) switch( p_byte[0] )
{ {
case MPEG1_VIDEO_ES: case MPEG1_VIDEO_ES:
case MPEG2_VIDEO_ES: case MPEG2_VIDEO_ES:
case MPEG2_MOTO_VIDEO_ES: case MPEG2_MOTO_VIDEO_ES:
p_es->i_fourcc = VLC_FOURCC('m','p','g','v'); i_fourcc = VLC_FOURCC('m','p','g','v');
p_es->i_cat = VIDEO_ES; i_cat = VIDEO_ES;
break; break;
case DVD_SPU_ES: case DVD_SPU_ES:
p_es->i_fourcc = VLC_FOURCC('s','p','u','b'); i_fourcc = VLC_FOURCC('s','p','u','b');
p_es->i_cat = SPU_ES; i_cat = SPU_ES;
break; break;
case MPEG1_AUDIO_ES: case MPEG1_AUDIO_ES:
case MPEG2_AUDIO_ES: case MPEG2_AUDIO_ES:
p_es->i_fourcc = VLC_FOURCC('m','p','g','a'); i_fourcc = VLC_FOURCC('m','p','g','a');
p_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
break; break;
case A52_AUDIO_ES: case A52_AUDIO_ES:
case A52DVB_AUDIO_ES: case A52DVB_AUDIO_ES:
p_es->i_fourcc = VLC_FOURCC('a','5','2','b'); i_fourcc = VLC_FOURCC('a','5','2','b');
p_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
break; break;
case LPCM_AUDIO_ES: case LPCM_AUDIO_ES:
p_es->i_fourcc = VLC_FOURCC('l','p','c','b'); i_fourcc = VLC_FOURCC('l','p','c','b');
p_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
break; break;
default: default:
p_es->i_fourcc = 0; i_cat = UNKNOWN_ES;
i_fourcc = 0;
break; 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. */ /* input_AddES has inserted the new element at the end. */
p_input->stream.pp_programs[0]->pp_es[ p_input->stream.pp_programs[0]->pp_es[
p_input->stream.pp_programs[0]->i_es_number ] p_input->stream.pp_programs[0]->i_es_number ]
...@@ -844,6 +849,7 @@ static es_descriptor_t * ParsePS( input_thread_t * p_input, ...@@ -844,6 +849,7 @@ static es_descriptor_t * ParsePS( input_thread_t * p_input,
} }
else else
{ {
vlc_bool_t b_auto_spawn = VLC_FALSE;
stream_ps_data_t * p_demux = stream_ps_data_t * p_demux =
(stream_ps_data_t *)p_input->stream.pp_programs[0]->p_demux_data; (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, ...@@ -852,105 +858,108 @@ static es_descriptor_t * ParsePS( input_thread_t * p_input,
if( p_es == NULL && !p_demux->b_has_PSM ) if( p_es == NULL && !p_demux->b_has_PSM )
{ {
p_es = input_AddES( p_input, p_input->stream.pp_programs[0], int i_fourcc, i_cat;
i_id, 0 );
if( p_es != NULL )
{
p_es->i_stream_id = p_data->p_demux_start[3];
/* Set stream type and auto-spawn. */ /* Set stream type and auto-spawn. */
if( (i_id & 0xF0) == 0xE0 ) if( (i_id & 0xF0) == 0xE0 )
{ {
/* MPEG video */ /* MPEG video */
p_es->i_fourcc = VLC_FOURCC('m','p','g','v'); i_fourcc = VLC_FOURCC('m','p','g','v');
p_es->i_cat = VIDEO_ES; i_cat = VIDEO_ES;
#ifdef AUTO_SPAWN #ifdef AUTO_SPAWN
if( !p_input->stream.b_seekable ) if( !p_input->stream.b_seekable ) b_auto_spawn = VLC_TRUE;
input_SelectES( p_input, p_es );
#endif #endif
} }
else if( (i_id & 0xE0) == 0xC0 ) else if( (i_id & 0xE0) == 0xC0 )
{ {
/* MPEG audio */ /* MPEG audio */
p_es->i_fourcc = VLC_FOURCC('m','p','g','a'); i_fourcc = VLC_FOURCC('m','p','g','a');
p_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
#ifdef AUTO_SPAWN #ifdef AUTO_SPAWN
if( !p_input->stream.b_seekable ) if( !p_input->stream.b_seekable )
if( config_GetInt( p_input, "audio-channel" ) if( config_GetInt( p_input, "audio-channel" )
== (p_es->i_id & 0x1F) || == (i_id & 0x1F) ||
( config_GetInt( p_input, "audio-channel" ) < 0 ( config_GetInt( p_input, "audio-channel" ) < 0
&& !(p_es->i_id & 0x1F) ) ) && !(i_id & 0x1F) ) )
switch( config_GetInt( p_input, "audio-type" ) ) 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 )
{ {
p_es->i_fourcc = VLC_FOURCC('d','t','s','b'); case -1:
p_es->i_cat = AUDIO_ES; case REQUESTED_MPEG:
#ifdef AUTO_SPAWN b_auto_spawn = VLC_TRUE;
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
} }
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 #endif
} }
else if( (i_id & 0xE0FF) == 0x20BD ) else if( (i_id & 0xF8FF) == 0x88BD )
{ {
/* Subtitles video (0x20->0x3F) */ i_fourcc = VLC_FOURCC('d','t','s','b');
p_es->i_fourcc = VLC_FOURCC('s','p','u','b'); i_cat = AUDIO_ES;
p_es->i_cat = SPU_ES;
#ifdef AUTO_SPAWN #ifdef AUTO_SPAWN
if( config_GetInt( p_input, "spu-channel" ) if( !p_input->stream.b_seekable )
== ((p_es->i_id & 0x1F00) >> 8) ) if( config_GetInt( p_input, "audio-channel" )
{ == ((i_id & 0x700) >> 8) ||
if( !p_input->stream.b_seekable ) ( config_GetInt( p_input, "audio-channel" ) < 0
input_SelectES( p_input, p_es ); && !((i_id & 0x700) >> 8)) )
} switch( config_GetInt( p_input, "audio-type" ) )
#endif {
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) */ case -1:
p_es->i_fourcc = VLC_FOURCC('l','p','c','b'); case REQUESTED_A52:
p_es->i_cat = AUDIO_ES; 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 */ /* Tell the interface the stream has changed */
p_input->stream.b_changed = 1; p_input->stream.b_changed = 1;
} }
...@@ -1425,4 +1434,3 @@ static void DemuxTS( input_thread_t * p_input, data_packet_t * p_data, ...@@ -1425,4 +1434,3 @@ static void DemuxTS( input_thread_t * p_input, data_packet_t * p_data,
#undef p #undef p
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mpeg_ts.c : Transport Stream input module for vlc * mpeg_ts.c : Transport Stream input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * 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> * Authors: Henri Fallon <henri@via.ecp.fr>
* Johan Bilien <jobi@via.ecp.fr> * Johan Bilien <jobi@via.ecp.fr>
...@@ -216,8 +216,8 @@ static int Activate( vlc_object_t * p_this ) ...@@ -216,8 +216,8 @@ static int Activate( vlc_object_t * p_this )
/* We'll have to catch the PAT in order to continue /* We'll have to catch the PAT in order to continue
* Then the input will catch the PMT and then the others ES * Then the input will catch the PMT and then the others ES
* The PAT es is indepedent of any program. */ * The PAT es is indepedent of any program. */
p_pat_es = input_AddES( p_input, NULL, p_pat_es = input_AddES( p_input, NULL, 0x00,
0x00, sizeof( es_ts_data_t ) ); UNKNOWN_ES, NULL, sizeof( es_ts_data_t ) );
p_demux_data = (es_ts_data_t *)p_pat_es->p_demux_data; p_demux_data = (es_ts_data_t *)p_pat_es->p_demux_data;
p_demux_data->b_psi = 1; p_demux_data->b_psi = 1;
p_demux_data->i_psi_type = PSI_IS_PAT; 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 ) ...@@ -532,7 +532,7 @@ static void TSDecodePAT( input_thread_t * p_input, es_descriptor_t * p_es )
/* Add the PMT ES to this program */ /* Add the PMT ES to this program */
p_current_es = input_AddES( p_input, p_pgrm,(u16)i_pmt_pid, 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 = (es_ts_data_t *)p_current_es->p_demux_data;
p_es_demux->b_psi = 1; p_es_demux->b_psi = 1;
p_es_demux->i_psi_type = PSI_IS_PMT; 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 ) ...@@ -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 ) | i_es_info_length = ( ((u32)*(p_current_data + 3) & 0xF) << 8 ) |
*(p_current_data + 4); *(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 /* Tell the interface what kind of stream it is and select
* the required ones */ * the required ones */
{ {
int i_fourcc, i_cat, i_stream_id;
switch( i_stream_type ) switch( i_stream_type )
{ {
case MPEG1_VIDEO_ES: case MPEG1_VIDEO_ES:
...@@ -644,72 +641,83 @@ static void TSDecodePMT( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -644,72 +641,83 @@ static void TSDecodePMT( input_thread_t * p_input, es_descriptor_t * p_es )
case MPEG2_MOTO_VIDEO_ES: case MPEG2_MOTO_VIDEO_ES:
/* This isn't real, but we don't actually use /* This isn't real, but we don't actually use
* it. */ * it. */
p_new_es->i_stream_id = 0xE0; i_stream_id = 0xE0;
p_new_es->i_fourcc = VLC_FOURCC('m','p','g','v'); i_fourcc = VLC_FOURCC('m','p','g','v');
p_new_es->i_cat = VIDEO_ES; i_cat = VIDEO_ES;
break; break;
case MPEG1_AUDIO_ES: case MPEG1_AUDIO_ES:
case MPEG2_AUDIO_ES: case MPEG2_AUDIO_ES:
/* This isn't real, but we don't actually use /* This isn't real, but we don't actually use
* it. */ * it. */
p_new_es->i_stream_id = 0xC0; i_stream_id = 0xC0;
p_new_es->i_fourcc = VLC_FOURCC('m','p','g','a'); i_fourcc = VLC_FOURCC('m','p','g','a');
p_new_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
break; break;
case A52_AUDIO_ES: case A52_AUDIO_ES:
case A52DVB_AUDIO_ES: case A52DVB_AUDIO_ES:
if ( !b_vls_compat ) if ( !b_vls_compat )
p_new_es->i_fourcc = VLC_FOURCC('a','5','2',' '); i_fourcc = VLC_FOURCC('a','5','2',' ');
else else
p_new_es->i_fourcc = VLC_FOURCC('a','5','2','b'); i_fourcc = VLC_FOURCC('a','5','2','b');
p_new_es->i_stream_id = 0xBD; i_stream_id = 0xBD;
p_new_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
break; break;
case LPCM_AUDIO_ES: case LPCM_AUDIO_ES:
p_new_es->i_fourcc = VLC_FOURCC('l','p','c','m'); i_fourcc = VLC_FOURCC('l','p','c','m');
p_new_es->i_stream_id = 0xBD; i_stream_id = 0xBD;
p_new_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
break; break;
case DVD_SPU_ES: case DVD_SPU_ES:
if ( !b_vls_compat ) if ( !b_vls_compat )
p_new_es->i_fourcc = VLC_FOURCC('s','p','u',' '); i_fourcc = VLC_FOURCC('s','p','u',' ');
else else
p_new_es->i_fourcc = VLC_FOURCC('s','p','u','b'); i_fourcc = VLC_FOURCC('s','p','u','b');
p_new_es->i_stream_id = 0xBD; i_stream_id = 0xBD;
p_new_es->i_cat = SPU_ES; i_cat = SPU_ES;
break; break;
case SDDS_AUDIO_ES: case SDDS_AUDIO_ES:
p_new_es->i_fourcc = VLC_FOURCC('s','d','d','s'); i_fourcc = VLC_FOURCC('s','d','d','s');
p_new_es->i_stream_id = 0xBD; i_stream_id = 0xBD;
p_new_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
break; break;
case DTS_AUDIO_ES: case DTS_AUDIO_ES:
p_new_es->i_fourcc = VLC_FOURCC('d','t','s',' '); i_fourcc = VLC_FOURCC('d','t','s',' ');
p_new_es->i_stream_id = 0xBD; i_stream_id = 0xBD;
p_new_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
break; break;
/* 'b' stands for 'buggy' */ /* 'b' stands for 'buggy' */
case A52B_AUDIO_ES: case A52B_AUDIO_ES:
p_new_es->i_fourcc = VLC_FOURCC('a','5','2','b'); i_fourcc = VLC_FOURCC('a','5','2','b');
p_new_es->i_stream_id = 0xBD; i_stream_id = 0xBD;
p_new_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
break; break;
case LPCMB_AUDIO_ES: case LPCMB_AUDIO_ES:
p_new_es->i_fourcc = VLC_FOURCC('l','p','c','b'); i_fourcc = VLC_FOURCC('l','p','c','b');
p_new_es->i_stream_id = 0xBD; i_stream_id = 0xBD;
p_new_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
break; break;
case DVDB_SPU_ES: case DVDB_SPU_ES:
p_new_es->i_fourcc = VLC_FOURCC('s','p','u','b'); i_fourcc = VLC_FOURCC('s','p','u','b');
p_new_es->i_stream_id = 0xBD; i_stream_id = 0xBD;
p_new_es->i_cat = SPU_ES; i_cat = SPU_ES;
break; break;
default : default :
p_new_es->i_fourcc = 0; i_stream_id = 0;
p_new_es->i_cat = UNKNOWN_ES; i_fourcc = 0;
i_cat = UNKNOWN_ES;
break; 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; p_current_data += 5 + i_es_info_length;
...@@ -1200,8 +1208,8 @@ static void TS_DVBPSI_HandlePAT( input_thread_t * p_input, ...@@ -1200,8 +1208,8 @@ static void TS_DVBPSI_HandlePAT( input_thread_t * p_input,
/* Add the PMT ES to this program */ /* Add the PMT ES to this program */
p_current_es = input_AddES( p_input, p_new_pgrm, p_current_es = input_AddES( p_input, p_new_pgrm,
(u16) p_pgrm->i_pid, (u16)p_pgrm->i_pid, UNKNOWN_ES,
sizeof( es_ts_data_t) ); NULL, sizeof(es_ts_data_t) );
p_es_demux = (es_ts_data_t *)p_current_es->p_demux_data; p_es_demux = (es_ts_data_t *)p_current_es->p_demux_data;
p_es_demux->b_psi = 1; p_es_demux->b_psi = 1;
p_es_demux->i_psi_type = PSI_IS_PMT; p_es_demux->i_psi_type = PSI_IS_PMT;
...@@ -1281,96 +1289,101 @@ static void TS_DVBPSI_HandlePMT( input_thread_t * p_input, ...@@ -1281,96 +1289,101 @@ static void TS_DVBPSI_HandlePMT( input_thread_t * p_input,
p_es = p_new_pmt->p_first_es; p_es = p_new_pmt->p_first_es;
while( p_es ) while( p_es )
{ {
/* Add this ES */ int i_fourcc, i_cat, i_stream_id;
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;
switch( p_es->i_type ) switch( p_es->i_type )
{ {
case MPEG1_VIDEO_ES: case MPEG1_VIDEO_ES:
case MPEG2_VIDEO_ES: case MPEG2_VIDEO_ES:
case MPEG2_MOTO_VIDEO_ES: case MPEG2_MOTO_VIDEO_ES:
p_new_es->i_fourcc = VLC_FOURCC('m','p','g','v'); i_fourcc = VLC_FOURCC('m','p','g','v');
p_new_es->i_cat = VIDEO_ES; i_cat = VIDEO_ES;
break; break;
case MPEG1_AUDIO_ES: case MPEG1_AUDIO_ES:
case MPEG2_AUDIO_ES: case MPEG2_AUDIO_ES:
p_new_es->i_fourcc = VLC_FOURCC('m','p','g','a'); i_fourcc = VLC_FOURCC('m','p','g','a');
p_new_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
break; break;
case A52_AUDIO_ES: case A52_AUDIO_ES:
case A52DVB_AUDIO_ES: case A52DVB_AUDIO_ES:
if ( !b_vls_compat ) if ( !b_vls_compat )
p_new_es->i_fourcc = VLC_FOURCC('a','5','2',' '); i_fourcc = VLC_FOURCC('a','5','2',' ');
else else
p_new_es->i_fourcc = VLC_FOURCC('a','5','2','b'); i_fourcc = VLC_FOURCC('a','5','2','b');
p_new_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
p_new_es->i_stream_id = 0xBD; i_stream_id = 0xBD;
break; break;
case DVD_SPU_ES: case DVD_SPU_ES:
if ( !b_vls_compat ) if ( !b_vls_compat )
p_new_es->i_fourcc = VLC_FOURCC('s','p','u',' '); i_fourcc = VLC_FOURCC('s','p','u',' ');
else else
p_new_es->i_fourcc = VLC_FOURCC('s','p','u','b'); i_fourcc = VLC_FOURCC('s','p','u','b');
p_new_es->i_cat = SPU_ES; i_cat = SPU_ES;
p_new_es->i_stream_id = 0xBD; i_stream_id = 0xBD;
break; break;
case LPCM_AUDIO_ES: case LPCM_AUDIO_ES:
p_new_es->i_fourcc = VLC_FOURCC('l','p','c','m'); i_fourcc = VLC_FOURCC('l','p','c','m');
p_new_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
p_new_es->i_stream_id = 0xBD; i_stream_id = 0xBD;
break; break;
case SDDS_AUDIO_ES: case SDDS_AUDIO_ES:
p_new_es->i_fourcc = VLC_FOURCC('s','d','d','s'); i_fourcc = VLC_FOURCC('s','d','d','s');
p_new_es->i_stream_id = 0xBD; i_stream_id = 0xBD;
p_new_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
break; break;
case DTS_AUDIO_ES: case DTS_AUDIO_ES:
p_new_es->i_fourcc = VLC_FOURCC('d','t','s',' '); i_fourcc = VLC_FOURCC('d','t','s',' ');
p_new_es->i_stream_id = 0xBD; i_stream_id = 0xBD;
p_new_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
break; break;
case A52B_AUDIO_ES: case A52B_AUDIO_ES:
p_new_es->i_fourcc = VLC_FOURCC('a','5','2','b'); i_fourcc = VLC_FOURCC('a','5','2','b');
p_new_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
p_new_es->i_stream_id = 0xBD; i_stream_id = 0xBD;
break; break;
case DVDB_SPU_ES: case DVDB_SPU_ES:
p_new_es->i_fourcc = VLC_FOURCC('s','p','u','b'); i_fourcc = VLC_FOURCC('s','p','u','b');
p_new_es->i_cat = SPU_ES; i_cat = SPU_ES;
p_new_es->i_stream_id = 0xBD; i_stream_id = 0xBD;
break; break;
case LPCMB_AUDIO_ES: case LPCMB_AUDIO_ES:
p_new_es->i_fourcc = VLC_FOURCC('l','p','c','b'); i_fourcc = VLC_FOURCC('l','p','c','b');
p_new_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
p_new_es->i_stream_id = 0xBD; i_stream_id = 0xBD;
break; break;
case MPEG4_VIDEO_ES: case MPEG4_VIDEO_ES:
p_new_es->i_fourcc = VLC_FOURCC('m','p','4','v'); i_fourcc = VLC_FOURCC('m','p','4','v');
p_new_es->i_cat = VIDEO_ES; i_cat = VIDEO_ES;
p_new_es->i_stream_id = 0xfa; i_stream_id = 0xfa;
break; break;
case MPEG4_AUDIO_ES: case MPEG4_AUDIO_ES:
p_new_es->i_fourcc = VLC_FOURCC('m','p','4','a'); i_fourcc = VLC_FOURCC('m','p','4','a');
p_new_es->i_cat = AUDIO_ES; i_cat = AUDIO_ES;
p_new_es->i_stream_id = 0xfa; i_stream_id = 0xfa;
break; break;
case MSCODEC_VIDEO_ES: case MSCODEC_VIDEO_ES:
p_new_es->i_fourcc = VLC_FOURCC(0,0,0,0); // fixed later i_fourcc = VLC_FOURCC(0,0,0,0); // fixed later
p_new_es->i_cat = VIDEO_ES; i_cat = VIDEO_ES;
p_new_es->i_stream_id = 0xa0; i_stream_id = 0xa0;
break; break;
default: default:
p_new_es->i_fourcc = 0; i_fourcc = 0;
p_new_es->i_cat = UNKNOWN_ES; 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 ) if( p_es->i_type == MPEG4_VIDEO_ES || p_es->i_type == MPEG4_AUDIO_ES )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ogg.c : ogg stream input module for vlc * ogg.c : ogg stream input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -1123,12 +1123,12 @@ static int Activate( vlc_object_t * p_this ) ...@@ -1123,12 +1123,12 @@ static int Activate( vlc_object_t * p_this )
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
p_stream->p_es = input_AddES( p_input, p_stream->p_es = input_AddES( p_input,
p_input->stream.p_selected_program, 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 )); p_input->stream.i_mux_rate += (p_stream->i_bitrate / ( 8 * 50 ));
vlc_mutex_unlock( &p_input->stream.stream_lock ); 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_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_waveformatex = (void*)p_stream->p_wf;
p_stream->p_es->p_bitmapinfoheader = (void*)p_stream->p_bih; p_stream->p_es->p_bitmapinfoheader = (void*)p_stream->p_bih;
#undef p_stream #undef p_stream
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* rawdv.c : raw dv input module for vlc * rawdv.c : raw dv input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -292,10 +292,9 @@ static int Activate( vlc_object_t * p_this ) ...@@ -292,10 +292,9 @@ static int Activate( vlc_object_t * p_this )
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
p_rawdv->p_video_es = input_AddES( p_input, p_rawdv->p_video_es = input_AddES( p_input,
p_input->stream.p_selected_program, 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_stream_id = 0;
p_rawdv->p_video_es->i_fourcc = VLC_FOURCC( 'd','v','s','d' ); 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; p_rawdv->p_video_es->p_bitmapinfoheader = (void *)p_rawdv->p_bih;
input_SelectES( p_input, p_rawdv->p_video_es ); input_SelectES( p_input, p_rawdv->p_video_es );
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
...@@ -304,10 +303,9 @@ static int Activate( vlc_object_t * p_this ) ...@@ -304,10 +303,9 @@ static int Activate( vlc_object_t * p_this )
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
p_rawdv->p_audio_es = input_AddES( p_input, p_rawdv->p_audio_es = input_AddES( p_input,
p_input->stream.p_selected_program, 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_stream_id = 1;
p_rawdv->p_audio_es->i_fourcc = VLC_FOURCC( 'd','v','a','u' ); 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; p_rawdv->p_audio_es->p_waveformatex = (void *)p_rawdv->p_wf;
input_SelectES( p_input, p_rawdv->p_audio_es ); input_SelectES( p_input, p_rawdv->p_audio_es );
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* sub.c * sub.c
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -425,15 +425,13 @@ static int sub_open ( subtitle_demux_t *p_sub, ...@@ -425,15 +425,13 @@ static int sub_open ( subtitle_demux_t *p_sub,
/* *** add subtitle ES *** */ /* *** add subtitle ES *** */
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
p_sub->p_es = input_AddES( p_input, p_sub->p_es = input_AddES( p_input, p_input->stream.p_selected_program,
p_input->stream.p_selected_program,
0xff, // FIXME 0xff, // FIXME
0 ); SPU_ES, NULL, 0 );
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
p_sub->p_es->i_stream_id = 0xff; // FIXME 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_fourcc = VLC_FOURCC( 's','u','b','t' );
p_sub->p_es->i_cat = SPU_ES;
p_sub->i_previously_selected = 0; p_sub->i_previously_selected = 0;
return VLC_SUCCESS; return VLC_SUCCESS;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wav.c : wav file input module for vlc * wav.c : wav file input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -527,11 +527,10 @@ static int WAVInit( vlc_object_t * p_this ) ...@@ -527,11 +527,10 @@ static int WAVInit( vlc_object_t * p_this )
p_input->stream.i_mux_rate = 0 ; /* FIXME */ p_input->stream.i_mux_rate = 0 ; /* FIXME */
p_demux->p_es = input_AddES( p_input, p_demux->p_es = input_AddES( p_input,
p_input->stream.p_selected_program, 1, p_input->stream.p_selected_program,
0 ); 1, AUDIO_ES, NULL, 0 );
p_demux->p_es->i_stream_id = 1; p_demux->p_es->i_stream_id = 1;
p_demux->p_es->i_fourcc = p_demux->i_fourcc; 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 ); 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 ); memcpy( p_demux->p_es->p_waveformatex, p_demux->p_wf, p_demux->i_wf );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port) * VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port)
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net> * Jon Lech Johansen <jon-vl@nanocrew.net>
...@@ -193,10 +193,11 @@ BList * VlcWrapper::GetChannels( int i_cat ) ...@@ -193,10 +193,11 @@ BList * VlcWrapper::GetChannels( int i_cat )
{ {
message = new BMessage( what ); message = new BMessage( what );
message->AddInt32( fieldName, i ); message->AddInt32( fieldName, i );
if( strlen( p_input->stream.pp_es[i]->psz_desc ) ) if( !p_input->stream.pp_es[i]->psz_desc ||
trackName = strdup( p_input->stream.pp_es[i]->psz_desc ); !*p_input->stream.pp_es[i]->psz_desc )
else
trackName = _("<unknown>"); trackName = _("<unknown>");
else
trackName = strdup( p_input->stream.pp_es[i]->psz_desc );
menuItem = new BMenuItem( trackName, message ); menuItem = new BMenuItem( trackName, message );
if( p_input->stream.pp_es[i] == p_es ) if( p_input->stream.pp_es[i] == p_es )
menuItem->SetMarked( true ); menuItem->SetMarked( true );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* menu.c : functions to handle menu items. * menu.c : functions to handle menu items.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * 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> * Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -764,14 +764,18 @@ static gint GtkLanguageMenus( gpointer p_data, ...@@ -764,14 +764,18 @@ static gint GtkLanguageMenus( gpointer p_data,
p_intf->p_sys->p_input->stream.p_selected_program ) ) p_intf->p_sys->p_input->stream.p_selected_program ) )
{ {
i_item++; i_item++;
strcpy( psz_name, 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 ); !*p_intf->p_sys->p_input->stream.pp_es[i]->psz_desc )
if( psz_name[0] == '\0' )
{ {
snprintf( psz_name, GTK_MENU_LABEL_SIZE, snprintf( psz_name, GTK_MENU_LABEL_SIZE,
"Language %d", i_item ); "Language %d", i_item );
psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0'; 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_item = gtk_radio_menu_item_new_with_label( p_group, psz_name );
p_group = p_group =
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin * intf.m: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * 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> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -1272,11 +1272,7 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg ) ...@@ -1272,11 +1272,7 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
NSMenuItem * o_lmi; NSMenuItem * o_lmi;
NSString * o_title; NSString * o_title;
if( *ES->psz_desc ) if( !ES->psz_desc || !*ES->psz_desc )
{
o_title = [NSApp localizedString: ES->psz_desc];
}
else
{ {
char psz_title[ 256 ]; char psz_title[ 256 ];
...@@ -1286,6 +1282,10 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg ) ...@@ -1286,6 +1282,10 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
o_title = [NSApp localizedString: psz_title]; o_title = [NSApp localizedString: psz_title];
} }
else
{
o_title = [NSApp localizedString: ES->psz_desc];
}
o_lmi = [o_menu addItemWithTitle: o_title o_lmi = [o_menu addItemWithTitle: o_title
action: pf_callback keyEquivalent: @""]; action: pf_callback keyEquivalent: @""];
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* menu.cpp: functions to handle menu items * menu.cpp: functions to handle menu items
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * Copyright (C) 2002-2003 VideoLAN
* $Id: menu.cpp,v 1.15 2003/05/04 22:42:16 gbazin Exp $ * $Id: menu.cpp,v 1.16 2003/05/05 22:23:39 gbazin Exp $
* *
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr> * Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
* *
...@@ -867,7 +867,8 @@ void __fastcall TMenusGen::LanguageMenu( TMenuItem *Root, es_descriptor_t *p_es, ...@@ -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 ) ) p_intf->p_sys->p_input->stream.p_selected_program ) )
{ {
i_item++; i_item++;
Name = p_intf->p_sys->p_input->stream.pp_es[i]->psz_desc; if( p_intf->p_sys->p_input->stream.pp_es[i]->psz_desc )
Name = p_intf->p_sys->p_input->stream.pp_es[i]->psz_desc;
if( Name.IsEmpty() ) if( Name.IsEmpty() )
Name.sprintf( "Language %d", i_item ); Name.sprintf( "Language %d", i_item );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* menus.cpp : wxWindows plugin for vlc * menus.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * 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> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -92,12 +92,12 @@ END_EVENT_TABLE() ...@@ -92,12 +92,12 @@ END_EVENT_TABLE()
void PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface ) void PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface )
{ {
vlc_object_t *p_object; vlc_object_t *p_object;
char *ppsz_varnames[16]; char *ppsz_varnames[19];
int pi_objects[16]; int pi_objects[19];
int i = 0; int i = 0;
/* Initializations */ /* Initializations */
memset( pi_objects, 0, 16 * sizeof(int) ); memset( pi_objects, 0, 19 * sizeof(int) );
/* Audio menu */ /* Audio menu */
ppsz_varnames[i++] = _("Audio menu"); ppsz_varnames[i++] = _("Audio menu");
...@@ -143,6 +143,14 @@ void PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface ) ...@@ -143,6 +143,14 @@ void PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface )
pi_objects[i++] = p_object->i_object_id; pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "navigation"; ppsz_varnames[i] = "navigation";
pi_objects[i++] = p_object->i_object_id; 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 ); vlc_object_release( p_object );
} }
...@@ -165,12 +173,12 @@ void PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface ) ...@@ -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 ) wxMenu *AudioMenu( intf_thread_t *_p_intf, Interface *_p_main_interface )
{ {
vlc_object_t *p_object; vlc_object_t *p_object;
char *ppsz_varnames[4]; char *ppsz_varnames[5];
int pi_objects[4]; int pi_objects[5];
int i = 0; int i = 0;
/* Initializations */ /* Initializations */
memset( pi_objects, 0, 4 * sizeof(int) ); memset( pi_objects, 0, 5 * sizeof(int) );
/* Audio menu */ /* Audio menu */
ppsz_varnames[i++] = NULL; /* Separator */ ppsz_varnames[i++] = NULL; /* Separator */
...@@ -187,6 +195,15 @@ wxMenu *AudioMenu( intf_thread_t *_p_intf, Interface *_p_main_interface ) ...@@ -187,6 +195,15 @@ wxMenu *AudioMenu( intf_thread_t *_p_intf, Interface *_p_main_interface )
vlc_object_release( p_object ); 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 */ /* Build menu */
return new Menu( _p_intf, _p_main_interface, i, return new Menu( _p_intf, _p_main_interface, i,
ppsz_varnames, pi_objects ); ppsz_varnames, pi_objects );
...@@ -213,6 +230,17 @@ wxMenu *VideoMenu( intf_thread_t *_p_intf, Interface *_p_main_interface ) ...@@ -213,6 +230,17 @@ wxMenu *VideoMenu( intf_thread_t *_p_intf, Interface *_p_main_interface )
vlc_object_release( p_object ); 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 */ /* Build menu */
return new Menu( _p_intf, _p_main_interface, i, return new Menu( _p_intf, _p_main_interface, i,
ppsz_varnames, pi_objects ); ppsz_varnames, pi_objects );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* display.c * display.c
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * 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> * 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 ...@@ -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, id->p_es = input_AddES( p_sys->p_input,
NULL, /* no program */ NULL, /* no program */
12, /* es_id */ 12, /* es_id */
/* p_fmt->i_cat; */ UNKNOWN_ES, /* es category */
NULL, /* description */
0 ); /* no extra data */ 0 ); /* no extra data */
if( !id->p_es ) if( !id->p_es )
...@@ -153,7 +155,6 @@ static sout_stream_id_t * Add ( sout_stream_t *p_stream, sout_format_t *p_f ...@@ -153,7 +155,6 @@ static sout_stream_id_t * Add ( sout_stream_t *p_stream, sout_format_t *p_f
return NULL; return NULL;
} }
id->p_es->i_stream_id = 1; 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->i_fourcc = p_fmt->i_fourcc;
id->p_es->b_force_decoder = VLC_TRUE; id->p_es->b_force_decoder = VLC_TRUE;
switch( p_fmt->i_cat ) switch( p_fmt->i_cat )
......
# libvlc # libvlc
include/interface.h
src/audio_output/output.c
src/input/input_programs.c
src/libvlc.c src/libvlc.c
src/libvlc.h src/libvlc.h
src/misc/configuration.c src/misc/configuration.c
src/audio_output/output.c
include/interface.h
# access modules # access modules
modules/access/directory.c modules/access/directory.c
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management * input_programs.c: es_descriptor_t, pgrm_descriptor_t management
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2002 VideoLAN * 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> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -48,12 +48,15 @@ static int ChapterCallback( vlc_object_t *, char const *, ...@@ -48,12 +48,15 @@ static int ChapterCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * ); vlc_value_t, vlc_value_t, void * );
static int NavigationCallback( vlc_object_t *, char const *, static int NavigationCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * ); 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 * input_InitStream: init the stream descriptor of the given input
*****************************************************************************/ *****************************************************************************/
int input_InitStream( input_thread_t * p_input, size_t i_data_len ) int input_InitStream( input_thread_t * p_input, size_t i_data_len )
{ {
vlc_value_t text;
p_input->stream.i_stream_id = 0; p_input->stream.i_stream_id = 0;
...@@ -84,12 +87,33 @@ int input_InitStream( input_thread_t * p_input, size_t i_data_len ) ...@@ -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 */ /* Create a few object variables used for navigation in the interfaces */
var_Create( p_input, "program", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE ); 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 ); 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 ); 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 ); 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, "program", ProgramCallback, NULL );
var_AddCallback( p_input, "title", TitleCallback, NULL ); var_AddCallback( p_input, "title", TitleCallback, NULL );
var_AddCallback( p_input, "chapter", ChapterCallback, 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; return 0;
} }
...@@ -99,11 +123,6 @@ int input_InitStream( input_thread_t * p_input, size_t i_data_len ) ...@@ -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 ) 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. */ /* Free all programs and associated ES, and associated decoders. */
while( p_input->stream.i_pgrm_number ) while( p_input->stream.i_pgrm_number )
{ {
...@@ -132,6 +151,14 @@ void input_EndStream( input_thread_t * p_input ) ...@@ -132,6 +151,14 @@ void input_EndStream( input_thread_t * p_input )
{ {
free( p_input->stream.p_demux_data ); 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 ) ...@@ -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, es_descriptor_t * input_AddES( input_thread_t * p_input,
pgrm_descriptor_t * p_pgrm, u16 i_es_id, pgrm_descriptor_t * p_pgrm, u16 i_es_id,
int i_category, char const *psz_desc,
size_t i_data_len ) size_t i_data_len )
{ {
es_descriptor_t * p_es; es_descriptor_t * p_es;
vlc_value_t val, text;
char *psz_var = NULL;
p_es = (es_descriptor_t *)malloc( sizeof(es_descriptor_t) ); p_es = (es_descriptor_t *)malloc( sizeof(es_descriptor_t) );
if( p_es == NULL ) if( p_es == NULL )
...@@ -518,10 +548,10 @@ es_descriptor_t * input_AddES( input_thread_t * p_input, ...@@ -518,10 +548,10 @@ es_descriptor_t * input_AddES( input_thread_t * p_input,
/* Init its values */ /* Init its values */
p_es->i_id = i_es_id; 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_pes = NULL;
p_es->p_decoder_fifo = 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->i_demux_fd = 0;
p_es->c_packets = 0; p_es->c_packets = 0;
p_es->c_invalid_packets = 0; p_es->c_invalid_packets = 0;
...@@ -558,6 +588,26 @@ es_descriptor_t * input_AddES( input_thread_t * p_input, ...@@ -558,6 +588,26 @@ es_descriptor_t * input_AddES( input_thread_t * p_input,
p_es->p_pgrm = NULL; 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; return p_es;
} }
...@@ -568,6 +618,8 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * 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; unsigned int i_index, i_es_index;
pgrm_descriptor_t * p_pgrm; pgrm_descriptor_t * p_pgrm;
char * psz_var;
vlc_value_t val;
/* Find the ES in the ES table */ /* Find the ES in the ES table */
for( i_es_index = 0; i_es_index < p_input->stream.i_es_number; 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 ) ...@@ -584,7 +636,22 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es )
return; 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. */ /* Kill associated decoder, if any. */
if( p_es->p_decoder_fifo != NULL ) if( p_es->p_decoder_fifo != NULL )
...@@ -592,8 +659,9 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -592,8 +659,9 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es )
input_EndDecoder( p_input, p_es ); input_EndDecoder( p_input, p_es );
} }
/* Remove this ES from the description of the program if it is associated to /* Remove this ES from the description of the program if it is associated
* one */ * to one */
p_pgrm = p_es->p_pgrm;
if( p_pgrm ) if( p_pgrm )
{ {
for( i_index = 0; i_index < p_pgrm->i_es_number; i_index++ ) 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 ) ...@@ -622,6 +690,12 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es )
free( p_es->p_bitmapinfoheader ); 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 */ /* Find the ES in the ES table */
for( i_es_index = 0; i_es_index < p_input->stream.i_es_number; for( i_es_index = 0; i_es_index < p_input->stream.i_es_number;
i_es_index++ ) i_es_index++ )
...@@ -647,6 +721,8 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -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 ) int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es )
{ {
vlc_value_t val;
if( p_es == NULL ) if( p_es == NULL )
{ {
msg_Err( p_input, "nothing to do in input_SelectES" ); 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 ) ...@@ -687,6 +763,10 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es )
return -1; 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; return 0;
} }
...@@ -836,3 +916,36 @@ static int NavigationCallback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -836,3 +916,36 @@ static int NavigationCallback( vlc_object_t *p_this, char const *psz_cmd,
return VLC_SUCCESS; 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;
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libvlc.h: main libvlc header * libvlc.h: main libvlc header
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * 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> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -156,7 +156,7 @@ static char *ppsz_sout_vcodec[] = { "", "mpeg1", "mpeg2", "mpeg4", NULL }; ...@@ -156,7 +156,7 @@ static char *ppsz_sout_vcodec[] = { "", "mpeg1", "mpeg2", "mpeg4", NULL };
#define ZOOM_LONGTEXT N_( \ #define ZOOM_LONGTEXT N_( \
"You can zoom the video by the specified factor.") "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_( \ #define GRAYSCALE_LONGTEXT N_( \
"When enabled, the color information from the video won't be decoded " \ "When enabled, the color information from the video won't be decoded " \
"(this can also allow you to save some processing power).") "(this can also allow you to save some processing power).")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment