Commit f9a96b8e authored by Christophe Massiot's avatar Christophe Massiot

Fixed numerous bugs in ES selection.

parent d95b9235
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ps.c: PS demux and packet management * input_ps.c: PS demux and packet management
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: input_ps.c,v 1.39 2001/11/28 15:08:05 massiot Exp $ * $Id: input_ps.c,v 1.40 2001/12/03 11:49:04 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr> * Cyril Deguet <asmax@via.ecp.fr>
...@@ -291,78 +291,7 @@ static void PSInit( input_thread_t * p_input ) ...@@ -291,78 +291,7 @@ static void PSInit( input_thread_t * p_input )
/* (The PSM decoder will care about spawning the decoders) */ /* (The PSM decoder will care about spawning the decoders) */
p_input->stream.pp_programs[0]->b_is_ok = 1; p_input->stream.pp_programs[0]->b_is_ok = 1;
} }
#ifdef AUTO_SPAWN
else
{
/* (We have to do it ourselves) */
int i_es;
/* FIXME: we should do multiple passes in case an audio type
* is not present */
for( i_es = 0;
i_es < p_input->stream.pp_programs[0]->i_es_number;
i_es++ )
{
#define p_es p_input->stream.pp_programs[0]->pp_es[i_es]
switch( p_es->i_type )
{
case MPEG1_VIDEO_ES:
case MPEG2_VIDEO_ES:
input_SelectES( p_input, p_es );
break;
case MPEG1_AUDIO_ES:
case MPEG2_AUDIO_ES:
if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
== (p_es->i_id & 0x1F) )
switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
{
case 0:
main_PutIntVariable( INPUT_AUDIO_VAR,
REQUESTED_MPEG );
case REQUESTED_MPEG:
input_SelectES( p_input, p_es );
}
break;
case AC3_AUDIO_ES:
if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
== ((p_es->i_id & 0xF00) >> 8) )
switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
{
case 0:
main_PutIntVariable( INPUT_AUDIO_VAR,
REQUESTED_AC3 );
case REQUESTED_AC3:
input_SelectES( p_input, p_es );
}
break;
case DVD_SPU_ES:
if( main_GetIntVariable( INPUT_SUBTITLE_VAR, -1 )
== ((p_es->i_id & 0x1F00) >> 8) )
{
input_SelectES( p_input, p_es );
}
break;
case LPCM_AUDIO_ES:
if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
== ((p_es->i_id & 0x1F00) >> 8) )
switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
{
case 0:
main_PutIntVariable( INPUT_AUDIO_VAR,
REQUESTED_LPCM );
case REQUESTED_LPCM:
input_SelectES( p_input, p_es );
}
break;
}
}
}
#endif
if( p_main->b_stats ) if( p_main->b_stats )
{ {
input_DumpStream( p_input ); input_DumpStream( p_input );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mpeg_system.c: TS, PS and PES management * mpeg_system.c: TS, PS and PES management
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: mpeg_system.c,v 1.65 2001/11/28 15:08:06 massiot Exp $ * $Id: mpeg_system.c,v 1.66 2001/12/03 11:49:04 massiot 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>
...@@ -708,8 +708,10 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input, ...@@ -708,8 +708,10 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
p_es->i_type = MPEG2_VIDEO_ES; p_es->i_type = MPEG2_VIDEO_ES;
p_es->i_cat = VIDEO_ES; p_es->i_cat = VIDEO_ES;
#ifdef AUTO_SPAWN #ifdef AUTO_SPAWN
if( !p_input->stream.b_seekable ) if( p_main->b_video )
{
input_SelectES( p_input, p_es ); input_SelectES( p_input, p_es );
}
#endif #endif
} }
else if( (i_id & 0xE0) == 0xC0 ) else if( (i_id & 0xE0) == 0xC0 )
...@@ -719,16 +721,18 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input, ...@@ -719,16 +721,18 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
p_es->b_audio = 1; p_es->b_audio = 1;
p_es->i_cat = AUDIO_ES; p_es->i_cat = AUDIO_ES;
#ifdef AUTO_SPAWN #ifdef AUTO_SPAWN
if( !p_input->stream.b_seekable ) if( p_main->b_audio )
if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
== (p_es->i_id & 0x1F) )
switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
{ {
case 0: if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
main_PutIntVariable( INPUT_CHANNEL_VAR, == (p_es->i_id & 0x1F) )
REQUESTED_MPEG ); switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
case REQUESTED_MPEG: {
input_SelectES( p_input, p_es ); case 0:
main_PutIntVariable( INPUT_CHANNEL_VAR,
REQUESTED_MPEG );
case REQUESTED_MPEG:
input_SelectES( p_input, p_es );
}
} }
#endif #endif
} }
...@@ -739,16 +743,18 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input, ...@@ -739,16 +743,18 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
p_es->b_audio = 1; p_es->b_audio = 1;
p_es->i_cat = AUDIO_ES; p_es->i_cat = AUDIO_ES;
#ifdef AUTO_SPAWN #ifdef AUTO_SPAWN
if( !p_input->stream.b_seekable ) if( p_main->b_audio )
if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
== ((p_es->i_id & 0xF00) >> 8) )
switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
{ {
case 0: if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
main_PutIntVariable( INPUT_CHANNEL_VAR, == ((p_es->i_id & 0xF00) >> 8) )
REQUESTED_AC3 ); switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
case REQUESTED_AC3: {
input_SelectES( p_input, p_es ); case 0:
main_PutIntVariable( INPUT_CHANNEL_VAR,
REQUESTED_AC3 );
case REQUESTED_AC3:
input_SelectES( p_input, p_es );
}
} }
#endif #endif
} }
...@@ -758,11 +764,13 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input, ...@@ -758,11 +764,13 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
p_es->i_type = DVD_SPU_ES; p_es->i_type = DVD_SPU_ES;
p_es->i_cat = SPU_ES; p_es->i_cat = SPU_ES;
#ifdef AUTO_SPAWN #ifdef AUTO_SPAWN
if( main_GetIntVariable( INPUT_SUBTITLE_VAR, -1 ) if( p_main->b_video )
== ((p_es->i_id & 0x1F00) >> 8) )
{ {
if( !p_input->stream.b_seekable ) if( main_GetIntVariable( INPUT_SUBTITLE_VAR, -1 )
== ((p_es->i_id & 0x1F00) >> 8) )
{
input_SelectES( p_input, p_es ); input_SelectES( p_input, p_es );
}
} }
#endif #endif
} }
...@@ -773,12 +781,30 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input, ...@@ -773,12 +781,30 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
p_es->b_audio = 1; p_es->b_audio = 1;
p_es->i_cat = AUDIO_ES; p_es->i_cat = AUDIO_ES;
/* FIXME : write the decoder */ /* FIXME : write the decoder */
#ifdef AUTO_SPAWN
if( p_main->b_audio )
{
if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
== ((p_es->i_id & 0x1F00) >> 8) )
switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
{
case 0:
main_PutIntVariable( INPUT_CHANNEL_VAR,
REQUESTED_LPCM );
case REQUESTED_LPCM:
input_SelectES( p_input, p_es );
}
}
#endif
} }
else else
{ {
p_es->i_type = UNKNOWN_ES; p_es->i_type = UNKNOWN_ES;
} }
} }
/* Inform the interface that the stream has changed */
p_input->stream.b_changed = 1;
} }
} /* stream.b_is_ok */ } /* stream.b_is_ok */
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
......
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