* ac3_decoder_thread.c: ac3 decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: ac3_decoder_thread.c,v 1.19 2000/12/21 13:25:50 massiot Exp $
+ * $Id: ac3_decoder_thread.c,v 1.20 2000/12/21 14:18:15 massiot Exp $
*
* Authors:
*
}
/* Destroy descriptor */
- free (p_ac3dec);
+ free( p_ac3dec->p_config );
+ free( p_ac3dec );
intf_DbgMsg ("ac3dec debug: ac3 decoder thread %p destroyed\n", p_ac3dec);
}
* audio_decoder.c: MPEG audio decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: audio_decoder.c,v 1.40 2000/12/21 13:25:50 massiot Exp $
+ * $Id: audio_decoder.c,v 1.41 2000/12/21 14:18:15 massiot Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
vlc_mutex_unlock (&(p_adec->p_aout_fifo->data_lock));
}
/* Destroy descriptor */
- free (p_adec);
+ free( p_adec->p_config );
+ free( p_adec );
intf_DbgMsg ("adec debug: audio decoder thread %p destroyed\n", p_adec);
}
* decoders.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input.c,v 1.61 2000/12/21 13:54:15 massiot Exp $
+ * $Id: input.c,v 1.62 2000/12/21 14:18:15 massiot Exp $
*
* Authors:
*
for( i_es_loop = 0; i_es_loop < p_input->i_selected_es_number;
i_es_loop++ )
{
- p_input->pp_selected_es[i_es_loop]->p_decoder_fifo->b_die = 1;
- /* Make sure the thread leaves the GetByte() function */
- vlc_mutex_lock( &p_input->pp_selected_es[i_es_loop]->p_decoder_fifo->data_lock);
- vlc_cond_signal( &p_input->pp_selected_es[i_es_loop]->p_decoder_fifo->data_wait );
- vlc_mutex_unlock( &p_input->pp_selected_es[i_es_loop]->p_decoder_fifo->data_lock );
+ decoder_fifo_t * p_decoder_fifo;
+
+ p_decoder_fifo = p_input->pp_selected_es[i_es_loop]->p_decoder_fifo;
+ p_decoder_fifo->b_die = 1;
+
+ /* Make sure the thread leaves the NextDataPacket() function */
+ vlc_mutex_lock( &p_decoder_fifo->data_lock);
+ vlc_cond_signal( &p_decoder_fifo->data_wait );
+ vlc_mutex_unlock( &p_decoder_fifo->data_lock );
/* Waiting for the thread to exit */
vlc_thread_join( p_input->pp_selected_es[i_es_loop]->thread_id );
+
+ /* Freeing all packets still in the decoder fifo. */
+ while( !DECODER_FIFO_ISEMPTY( *p_decoder_fifo ) )
+ {
+ p_decoder_fifo->pf_delete_pes( p_decoder_fifo->p_packets_mgt,
+ DECODER_FIFO_START( *p_decoder_fifo ) );
+ DECODER_FIFO_INCSTART( *p_decoder_fifo );
+ }
free( p_input->pp_selected_es[i_es_loop]->p_decoder_fifo );
}
/* Free demultiplexer's data */
+ p_input->p_plugin->pf_end( p_input );
+ free( p_input->p_plugin );
+
+ /* Free input structures */
+ input_EndStream( p_input );
+ free( p_input->pp_es );
+ free( p_input->pp_selected_es );
+ free( p_input );
/* Update status */
*pi_status = THREAD_OVER;
* input.h: structures of the input not exported to other modules
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: input.h,v 1.4 2000/12/20 16:04:31 massiot Exp $
+ * $Id: input.h,v 1.5 2000/12/21 14:18:15 massiot Exp $
*
* Authors:
*
* Prototypes from input_programs.c
*****************************************************************************/
void input_InitStream( struct input_thread_s *, size_t );
+void input_EndStream( struct input_thread_s * );
struct pgrm_descriptor_s * input_AddProgram( struct input_thread_s *,
u16, size_t );
void input_DelProgram( struct input_thread_s *, u16 );
* FIXME : check the return value of realloc() and malloc() !
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_programs.c,v 1.11 2000/12/21 13:54:15 massiot Exp $
+ * $Id: input_programs.c,v 1.12 2000/12/21 14:18:15 massiot Exp $
*
* Authors:
*
}
}
+/*****************************************************************************
+ * input_EndStream: free all stream descriptors
+ *****************************************************************************/
+void input_EndStream( input_thread_t * p_input )
+{
+ int i, j;
+
+ for( i = 0; i < p_input->stream.i_pgrm_number; i++ )
+ {
+ for( j = 0; j < p_input->stream.pp_programs[i]->i_es_number; j++ )
+ {
+ if( p_input->stream.pp_programs[i]->pp_es[j]->p_demux_data != NULL )
+ {
+ free( p_input->stream.pp_programs[i]->pp_es[j]->p_demux_data );
+ }
+ free( p_input->stream.pp_programs[i]->pp_es[j] );
+ }
+
+ if( p_input->stream.pp_programs[i]->p_demux_data != NULL )
+ {
+ free( p_input->stream.pp_programs[i]->p_demux_data );
+ }
+ free( p_input->stream.pp_programs[i] );
+ }
+}
+
/*****************************************************************************
* input_AddProgram: add and init a program descriptor
*****************************************************************************
* input_ps.c: PS demux and packet management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input_ps.c,v 1.8 2000/12/20 18:45:43 massiot Exp $
+ * $Id: input_ps.c,v 1.9 2000/12/21 14:18:15 massiot Exp $
*
* Authors:
*
p_plugin = (input_capabilities_t *)malloc( sizeof(input_capabilities_t) );
p_plugin->pf_init = PSInit;
+ p_plugin->pf_end = PSEnd;
p_plugin->pf_read = PSRead;
p_plugin->pf_demux = input_DemuxPS; /* FIXME: use i_p_config_t ! */
p_plugin->pf_new_packet = NewPacket;
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
-/* repompé sur video_decoder.c
- * FIXME: passer en terminate/destroy avec les signaux supplémentaires ?? */
-
/*****************************************************************************
* Preamble
*****************************************************************************/
static void EndThread( spudec_thread_t *p_spudec )
{
intf_DbgMsg( "spudec debug: destroying spu decoder thread %p\n", p_spudec );
+ free( p_spudec->p_config );
free( p_spudec );
intf_DbgMsg( "spudec debug: spu decoder thread %p destroyed\n", p_spudec);
}
* video_parser.c : video parser thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_parser.c,v 1.55 2000/12/21 13:25:51 massiot Exp $
+ * $Id: video_parser.c,v 1.56 2000/12/21 14:18:15 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
intf_DbgMsg("vpar debug: destroying video parser thread %p\n", p_vpar);
-#ifdef DEBUG
- /* Check for remaining PES packets */
- /* XXX?? */
-#endif
-
#ifdef STATS
intf_Msg("vpar stats: %d loops among %d sequence(s)\n",
p_vpar->c_loops, p_vpar->c_sequences);
S.i_matrix_coefficients);
#endif
- /* Destroy thread structures allocated by InitThread */
-// vout_DestroyStream( p_vpar->p_vout, p_vpar->i_stream );
- /* XXX?? */
-
/* Dispose of matrices if they have been allocated. */
if( p_vpar->sequence.intra_quant.b_allocated )
{
free( p_vpar->pp_vdec[0] );
#endif
+ free( p_vpar->p_config );
free( p_vpar );
intf_DbgMsg("vpar debug: EndThread(%p)\n", p_vpar);