Commit 67bc00c9 authored by Christophe Massiot's avatar Christophe Massiot

* Cleaned up program and ES management by using input_programs.c whenever

necessary.
* Cleaned up decoder spawning.
parent 4d26594b
...@@ -188,6 +188,7 @@ INTERFACE = src/interface/main.o \ ...@@ -188,6 +188,7 @@ INTERFACE = src/interface/main.o \
INPUT = src/input/input_ps.o \ INPUT = src/input/input_ps.o \
src/input/mpeg_system.o \ src/input/mpeg_system.o \
src/input/input_ext-dec.o \ src/input/input_ext-dec.o \
src/input/input_programs.o \
src/input/input.o src/input/input.o
AUDIO_OUTPUT = src/audio_output/audio_output.o AUDIO_OUTPUT = src/audio_output/audio_output.o
......
...@@ -46,3 +46,17 @@ typedef struct input_capabilities_s ...@@ -46,3 +46,17 @@ typedef struct input_capabilities_s
*****************************************************************************/ *****************************************************************************/
void InitBitstream ( struct bit_stream_s *, struct decoder_fifo_s * ); void InitBitstream ( struct bit_stream_s *, struct decoder_fifo_s * );
void NextDataPacket ( struct bit_stream_s * ); void NextDataPacket ( struct bit_stream_s * );
/*****************************************************************************
* Prototypes from input_programs.c
*****************************************************************************/
void input_InitStream( struct input_thread_s *, size_t );
struct pgrm_descriptor_s * input_AddProgram( struct input_thread_s *,
u16, size_t );
void input_DelProgram( struct input_thread_s *, u16 );
struct es_descriptor_s * input_AddES( struct input_thread_s *,
struct pgrm_descriptor_s *, u16,
size_t );
void input_DelES( struct input_thread_s *, u16 );
int input_SelectES( struct input_thread_s *, struct es_descriptor_s * );
This diff is collapsed.
...@@ -80,7 +80,6 @@ static int PSProbe( input_thread_t * p_input ) ...@@ -80,7 +80,6 @@ static int PSProbe( input_thread_t * p_input )
static void PSInit( input_thread_t * p_input ) static void PSInit( input_thread_t * p_input )
{ {
thread_ps_data_t * p_method; thread_ps_data_t * p_method;
stream_ps_data_t * p_demux;
if( (p_method = if( (p_method =
(thread_ps_data_t *)malloc( sizeof(thread_ps_data_t) )) == NULL ) (thread_ps_data_t *)malloc( sizeof(thread_ps_data_t) )) == NULL )
...@@ -103,19 +102,8 @@ static void PSInit( input_thread_t * p_input ) ...@@ -103,19 +102,8 @@ static void PSInit( input_thread_t * p_input )
/* Pre-parse the stream to gather stream_descriptor_t. */ /* Pre-parse the stream to gather stream_descriptor_t. */
/* FIXME */ input_InitStream( p_input, 0 );
p_input->stream.pp_programs = input_AddProgram( p_input, 0, sizeof( stream_ps_data_t ) );
(pgrm_descriptor_t **)malloc( sizeof(pgrm_descriptor_t *) );
p_input->stream.pp_programs[0] =
(pgrm_descriptor_t *)malloc( sizeof(pgrm_descriptor_t) );
p_input->stream.pp_programs[0]->i_synchro_state = SYNCHRO_START;
p_input->stream.pp_programs[0]->delta_cr = 0;
p_input->stream.pp_programs[0]->last_cr = 0;
p_input->stream.pp_programs[0]->c_average_count = 0;
p_demux = (stream_ps_data_t *)malloc( sizeof( stream_ps_data_t) );
p_input->stream.p_demux_data = (void *)p_demux;
p_demux->b_is_PSM_complete = 0;
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -806,11 +806,12 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data ) ...@@ -806,11 +806,12 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data )
i_id = p_data->p_buffer[3]; /* ID of the stream. */ i_id = p_data->p_buffer[3]; /* ID of the stream. */
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
for( i_dummy = 0; i_dummy < INPUT_MAX_ES; i_dummy++ ) for( i_dummy = 0; i_dummy < INPUT_MAX_SELECTED_ES; i_dummy++ )
{ {
if( p_input->p_es[i_dummy].i_id == i_id ) if( p_input->pp_selected_es[i_dummy] != NULL
&& p_input->pp_selected_es[i_dummy]->i_id == i_id )
{ {
p_es = &p_input->p_es[i_dummy]; p_es = p_input->pp_selected_es[i_dummy];
break; break;
} }
} }
...@@ -822,106 +823,36 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data ) ...@@ -822,106 +823,36 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data )
/* FIXME ! */ /* FIXME ! */
if( (i_id & 0xC0L) == 0xC0L ) if( (i_id & 0xC0L) == 0xC0L )
{ {
vlc_mutex_lock( &p_input->stream.stream_lock );
/* MPEG video and audio */ /* MPEG video and audio */
for( i_dummy = 0; i_dummy < INPUT_MAX_ES; i_dummy++ ) p_es = input_AddES( p_input, p_input->stream.pp_programs[0],
{ i_id, 0 );
if( p_input->p_es[i_dummy].i_id == EMPTY_ID )
{
p_es = &p_input->p_es[i_dummy];
break;
}
}
if( p_es != NULL && (i_id & 0xF0L) == 0xE0L ) if( p_es != NULL && (i_id & 0xF0L) == 0xE0L )
{ {
/* MPEG video */ /* MPEG video */
vdec_config_t * p_config; p_es->i_stream_id = i_id;
p_es->i_id = p_es->i_stream_id = i_id;
p_es->i_type = MPEG2_VIDEO_ES; p_es->i_type = MPEG2_VIDEO_ES;
p_es->p_pgrm = p_input->stream.pp_programs[0];
p_es->p_pes = NULL;
#ifdef AUTO_SPAWN #ifdef AUTO_SPAWN
p_config = (vdec_config_t *)malloc( sizeof(vdec_config_t) ); input_SelectES( p_input, p_es );
p_config->p_vout = p_input->p_default_vout;
/* FIXME ! */
p_config->decoder_config.i_stream_id = i_id;
p_config->decoder_config.i_type = MPEG2_VIDEO_ES;
p_config->decoder_config.p_stream_ctrl =
&p_input->stream.control;
p_config->decoder_config.p_decoder_fifo =
(decoder_fifo_t *)malloc( sizeof(decoder_fifo_t) );
vlc_mutex_init(&p_config->decoder_config.p_decoder_fifo->data_lock);
vlc_cond_init(&p_config->decoder_config.p_decoder_fifo->data_wait);
p_config->decoder_config.p_decoder_fifo->i_start =
p_config->decoder_config.p_decoder_fifo->i_end = 0;
p_config->decoder_config.p_decoder_fifo->b_die = 0;
p_config->decoder_config.p_decoder_fifo->p_packets_mgt =
p_input->p_method_data;
p_config->decoder_config.p_decoder_fifo->pf_delete_pes =
p_input->p_plugin->pf_delete_pes;
p_es->p_decoder_fifo = p_config->decoder_config.p_decoder_fifo;
p_config->decoder_config.pf_init_bit_stream =
InitBitstream;
for( i_dummy = 0; i_dummy < INPUT_MAX_SELECTED_ES; i_dummy++ )
{
if( p_input->pp_selected_es[i_dummy] == NULL )
{
p_input->pp_selected_es[i_dummy] = p_es;
break;
}
}
p_es->thread_id = vpar_CreateThread( p_config );
#endif #endif
} }
else if( p_es != NULL && (i_id & 0xE0) == 0xC0 ) else if( p_es != NULL && (i_id & 0xE0) == 0xC0 )
{ {
/* MPEG audio */ /* MPEG audio */
adec_config_t * p_config; p_es->i_stream_id = i_id;
p_es->i_id = p_es->i_stream_id = i_id;
p_es->i_type = MPEG2_AUDIO_ES; p_es->i_type = MPEG2_AUDIO_ES;
p_es->p_pgrm = p_input->stream.pp_programs[0];
p_es->p_pes = NULL;
#ifdef AUTO_SPAWN #ifdef AUTO_SPAWN
p_config = (adec_config_t *)malloc( sizeof(adec_config_t) ); input_SelectES( p_input, p_es );
p_config->p_aout = p_input->p_default_aout;
/* FIXME ! */
p_config->decoder_config.i_stream_id = i_id;
p_config->decoder_config.i_type = MPEG2_AUDIO_ES;
p_config->decoder_config.p_stream_ctrl =
&p_input->stream.control;
p_config->decoder_config.p_decoder_fifo =
(decoder_fifo_t *)malloc( sizeof(decoder_fifo_t) );
vlc_mutex_init(&p_config->decoder_config.p_decoder_fifo->data_lock);
vlc_cond_init(&p_config->decoder_config.p_decoder_fifo->data_wait);
p_config->decoder_config.p_decoder_fifo->i_start =
p_config->decoder_config.p_decoder_fifo->i_end = 0;
p_config->decoder_config.p_decoder_fifo->b_die = 0;
p_config->decoder_config.p_decoder_fifo->p_packets_mgt =
p_input->p_method_data;
p_config->decoder_config.p_decoder_fifo->pf_delete_pes =
p_input->p_plugin->pf_delete_pes;
p_es->p_decoder_fifo = p_config->decoder_config.p_decoder_fifo;
p_config->decoder_config.pf_init_bit_stream =
InitBitstream;
for( i_dummy = 0; i_dummy < INPUT_MAX_SELECTED_ES; i_dummy++ )
{
if( p_input->pp_selected_es[i_dummy] == NULL )
{
p_input->pp_selected_es[i_dummy] = p_es;
break;
}
}
p_es->thread_id = adec_CreateThread( p_config );
#endif #endif
} }
else else
{ {
b_trash = 1; b_trash = 1;
} }
vlc_mutex_unlock( &p_input->stream.stream_lock );
} }
else else
b_trash = 1; b_trash = 1;
......
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