Commit 26df56c2 authored by Laurent Aimar's avatar Laurent Aimar

* all: do not export input_NullPacket

 * input_dec.c: fixed a (big) memory leak.
parent 58cd81bf
......@@ -3,7 +3,7 @@
* but exported to plug-ins
*****************************************************************************
* Copyright (C) 1999-2002 VideoLAN
* $Id: input_ext-plugins.h,v 1.43 2003/11/24 00:39:00 fenrir Exp $
* $Id: input_ext-plugins.h,v 1.44 2003/11/24 03:30:38 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -63,7 +63,6 @@ void input_DecodeBlock( decoder_t *, block_t * );
void input_EscapeDiscontinuity( input_thread_t * );
void input_EscapeAudioDiscontinuity( input_thread_t * );
VLC_EXPORT( void, input_NullPacket, ( input_thread_t *, es_descriptor_t * ) );
/*****************************************************************************
* Prototypes from input_clock.c
......@@ -99,9 +98,6 @@ VLC_EXPORT( int, input_AccessInit, ( input_thread_t * ) );
VLC_EXPORT( void, input_AccessReinit, ( input_thread_t * ) );
VLC_EXPORT( void, input_AccessEnd, ( input_thread_t * ) );
/* no need to export this one */
data_packet_t *input_NewPacketForce( input_buffers_t *, size_t );
/*
* Optional standard file descriptor operations (input_ext-plugins.h)
*/
......
......@@ -2,7 +2,7 @@
* system.c: helper module for TS, PS and PES management
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: system.c,v 1.20 2003/11/24 00:39:01 fenrir Exp $
* $Id: system.c,v 1.21 2003/11/24 03:30:38 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
......@@ -464,12 +464,9 @@ static void GatherPES( input_thread_t * p_input, data_packet_t * p_data,
{
#define p_pes (p_es->p_pes)
/* If we lost data, insert a NULL data packet (philosophy : 0 is quite
* often an escape sequence in decoders, so that should make them wait
* for the next start code). */
if( b_packet_lost && !((es_ts_data_t*)p_es->p_demux_data)->b_dvbsub)
if( b_packet_lost && p_pes != NULL )
{
input_NullPacket( p_input, p_es );
p_pes->b_discontinuity = 1;
}
if( b_unit_start && p_pes != NULL )
......
......@@ -2,7 +2,7 @@
* input_dec.c: Functions for the management of decoders
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_dec.c,v 1.77 2003/11/24 02:35:50 fenrir Exp $
* $Id: input_dec.c,v 1.78 2003/11/24 03:30:38 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -39,6 +39,8 @@
#include "codecs.h"
static void input_NullPacket( input_thread_t *, es_descriptor_t * );
static decoder_t * CreateDecoder( input_thread_t *, es_descriptor_t *, int );
static int DecoderThread( decoder_t * );
static void DeleteDecoder( decoder_t * );
......@@ -68,6 +70,9 @@ struct decoder_owner_sys_t
/* fifo */
block_fifo_t *p_fifo;
/* */
input_buffers_t *p_method_data;
};
......@@ -247,6 +252,8 @@ void input_DecodePES( decoder_t * p_dec, pes_packet_t * p_pes )
block_FifoPut( p_dec->p_owner->p_fifo, p_block );
}
}
input_DeletePES( p_dec->p_owner->p_method_data, p_pes );
}
/*****************************************************************************
* input_DecodeBlock
......@@ -261,45 +268,17 @@ void input_DecodeBlock( decoder_t * p_dec, block_t *p_block )
/*****************************************************************************
* Create a NULL packet for padding in case of a data loss
*****************************************************************************/
void input_NullPacket( input_thread_t * p_input,
es_descriptor_t * p_es )
static void input_NullPacket( input_thread_t * p_input,
es_descriptor_t * p_es )
{
data_packet_t * p_pad_data;
pes_packet_t * p_pes;
if( (p_pad_data = input_NewPacketForce( p_input->p_method_data,
PADDING_PACKET_SIZE)) == NULL )
{
msg_Err( p_input, "no new packet" );
p_input->b_error = 1;
return;
}
block_t *p_block = block_New( p_input, PADDING_PACKET_SIZE );
memset( p_pad_data->p_payload_start, 0, PADDING_PACKET_SIZE );
p_pad_data->b_discard_payload = 1;
p_pes = p_es->p_pes;
if( p_pes != NULL )
{
p_pes->b_discontinuity = 1;
p_pes->p_last->p_next = p_pad_data;
p_pes->p_last = p_pad_data;
p_pes->i_nb_data++;
}
else
if( p_block )
{
if( (p_pes = input_NewPES( p_input->p_method_data )) == NULL )
{
msg_Err( p_input, "no PES packet" );
p_input->b_error = 1;
return;
}
memset( p_block->p_buffer, 0, PADDING_PACKET_SIZE );
p_block->b_discontinuity = 1;
p_pes->i_rate = p_input->stream.control.i_rate;
p_pes->p_first = p_pes->p_last = p_pad_data;
p_pes->i_nb_data = 1;
p_pes->b_discontinuity = 1;
input_DecodePES( p_es->p_dec, p_pes );
block_FifoPut( p_es->p_dec->p_owner->p_fifo, p_block );
}
}
......@@ -450,6 +429,7 @@ static decoder_t * CreateDecoder( input_thread_t * p_input,
msg_Err( p_dec, "out of memory" );
return NULL;
}
p_dec->p_owner->p_method_data = p_input->p_method_data;
/* Set buffers allocation callbacks for the decoders */
p_dec->pf_aout_buffer_new = aout_new_buffer;
......
......@@ -2,7 +2,7 @@
* input_ext-plugins.c: useful functions for access and demux plug-ins
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: input_ext-plugins.c,v 1.37 2003/08/13 13:54:02 jpsaman Exp $
* $Id: input_ext-plugins.c,v 1.38 2003/11/24 03:30:38 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -158,13 +158,12 @@ void input_BuffersEnd( input_thread_t * p_input, input_buffers_t * p_buffers )
* input_NewBuffer: return a pointer to a data buffer of the appropriate size
*****************************************************************************/
static inline data_buffer_t * NewBuffer( input_buffers_t * p_buffers,
size_t i_size,
vlc_bool_t b_forced )
size_t i_size )
{
data_buffer_t * p_buf;
/* Safety check */
if( !b_forced && p_buffers->i_allocated > INPUT_MAX_ALLOCATION )
if( p_buffers->i_allocated > INPUT_MAX_ALLOCATION )
{
return NULL;
}
......@@ -214,7 +213,7 @@ data_buffer_t * input_NewBuffer( input_buffers_t * p_buffers, size_t i_size )
data_buffer_t * p_buf;
vlc_mutex_lock( &p_buffers->lock );
p_buf = NewBuffer( p_buffers, i_size, VLC_FALSE );
p_buf = NewBuffer( p_buffers, i_size );
vlc_mutex_unlock( &p_buffers->lock );
return p_buf;
......@@ -305,13 +304,12 @@ data_packet_t * input_ShareBuffer( input_buffers_t * p_buffers,
* input_NewPacket: allocate a packet along with a buffer
*****************************************************************************/
static inline data_packet_t * NewPacket( input_buffers_t * p_buffers,
size_t i_size,
vlc_bool_t b_forced )
size_t i_size )
{
data_buffer_t * p_buf;
data_packet_t * p_data;
p_buf = NewBuffer( p_buffers, i_size, b_forced );
p_buf = NewBuffer( p_buffers, i_size );
if( p_buf == NULL )
{
......@@ -331,18 +329,7 @@ data_packet_t * input_NewPacket( input_buffers_t * p_buffers, size_t i_size )
data_packet_t * p_data;
vlc_mutex_lock( &p_buffers->lock );
p_data = NewPacket( p_buffers, i_size, VLC_FALSE );
vlc_mutex_unlock( &p_buffers->lock );
return p_data;
}
data_packet_t * input_NewPacketForce( input_buffers_t * p_buffers, size_t i_size )
{
data_packet_t * p_data;
vlc_mutex_lock( &p_buffers->lock );
p_data = NewPacket( p_buffers, i_size, VLC_TRUE);
p_data = NewPacket( p_buffers, i_size );
vlc_mutex_unlock( &p_buffers->lock );
return p_data;
......@@ -491,7 +478,7 @@ ssize_t input_FillBuffer( input_thread_t * p_input )
while( p_buf == NULL )
{
p_buf = NewBuffer( p_input->p_method_data,
i_remains + p_input->i_bufsize, VLC_FALSE );
i_remains + p_input->i_bufsize );
if( p_buf == NULL )
{
vlc_mutex_unlock( &p_input->p_method_data->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