* audio.c: audio decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: audio.c,v 1.18 2003/04/25 18:57:41 fenrir Exp $
+ * $Id: audio.c,v 1.19 2003/07/10 01:33:41 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
if( ( p_adec->p_context->extradata_size = p_wf->cbSize ) > 0 )
{
- p_adec->p_context->extradata =
- malloc( p_wf->cbSize );
+ p_adec->p_context->extradata = malloc( p_wf->cbSize + FF_INPUT_BUFFER_PADDING_SIZE );
- memcpy( p_adec->p_context->extradata,
- &p_wf[1],
- p_wf->cbSize);
+ memcpy( p_adec->p_context->extradata, &p_wf[1], p_wf->cbSize);
+ memset( &((uint8_t*)p_adec->p_context->extradata)[p_wf->cbSize], 0, FF_INPUT_BUFFER_PADDING_SIZE );
}
/* ***** Open the codec ***** */
if( i_frame_size > 0 )
{
- uint8_t *p_last;
int i_need;
- i_need = i_frame_size + 16 + p_adec->i_buffer;
+ i_need = i_frame_size + FF_INPUT_BUFFER_PADDING_SIZE + p_adec->i_buffer;
if( p_adec->i_buffer_size < i_need )
{
- p_last = p_adec->p_buffer;
+ uint8_t *p_last = p_adec->p_buffer;
+
p_adec->p_buffer = malloc( i_need );
p_adec->i_buffer_size = i_need;
if( p_adec->i_buffer > 0 )
i_frame_size,
p_pes );
/* make ffmpeg happier but I'm not sure it's needed for audio */
- memset( p_adec->p_buffer + p_adec->i_buffer + i_frame_size,
- 0,
- 16 );
+ memset( p_adec->p_buffer + p_adec->i_buffer + i_frame_size, 0, FF_INPUT_BUFFER_PADDING_SIZE );
}
input_DeletePES( p_adec->p_fifo->p_packets_mgt, p_pes );
} while( i_frame_size <= 0 );
i_frame_size -= i_used;
-// msg_Dbg( p_adec->p_fifo, "frame size:%d buffer used:%d", i_frame_size, i_used );
+ //msg_Dbg( p_adec->p_fifo, "frame size:%d buffer used:%d", i_frame_size, i_used );
if( i_output_size <= 0 )
{
msg_Warn( p_adec->p_fifo,
* ffmpeg.c: video decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: ffmpeg.c,v 1.44 2003/06/16 20:23:41 gbazin Exp $
+ * $Id: ffmpeg.c,v 1.45 2003/07/10 01:33:41 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
set_callbacks( E_(OpenChroma), NULL );
set_description( _("ffmpeg chroma conversion") );
+ var_Create( p_module->p_libvlc, "avcodec", VLC_VAR_MUTEX );
vlc_module_end();
/*****************************************************************************
static int InitThread( generic_thread_t *p_decoder )
{
int i_result;
+ vlc_value_t lockval;
+
+
+ var_Get( p_decoder->p_fifo->p_libvlc, "avcodec", &lockval );
+ vlc_mutex_lock( lockval.p_address );
/* *** init ffmpeg library (libavcodec) *** */
if( !b_ffmpeginit )
{
+
avcodec_init();
avcodec_register_all();
b_ffmpeginit = 1;
{
msg_Dbg( p_decoder->p_fifo, "libavcodec already initialized" );
}
+ vlc_mutex_unlock( lockval.p_address );
/* *** determine codec type *** */
ffmpeg_GetFfmpegCodec( p_decoder->p_fifo->i_fourcc,
* video.c: video decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: video.c,v 1.34 2003/06/28 23:56:31 fenrir Exp $
+ * $Id: video.c,v 1.35 2003/07/10 01:33:41 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
else
{
p_vdec->p_context->extradata_size = i_size;
- p_vdec->p_context->extradata = malloc( i_size );
+ p_vdec->p_context->extradata = malloc( i_size + FF_INPUT_BUFFER_PADDING_SIZE );
memcpy( p_vdec->p_context->extradata,
&p_vdec->p_format[1],
i_size );
+ memset( &((uint8_t*)p_vdec->p_context->extradata)[i_size], 0, FF_INPUT_BUFFER_PADDING_SIZE );
}
}
p_vdec->p_vout = NULL;
int i_need;
/* XXX Don't forget that ffmpeg required a little more bytes
* that the real frame size */
- i_need = i_frame_size + 16 + p_vdec->i_buffer;
+ i_need = i_frame_size + FF_INPUT_BUFFER_PADDING_SIZE + p_vdec->i_buffer;
if( p_vdec->i_buffer_size < i_need)
{
p_last = p_vdec->p_buffer;
E_( GetPESData )( p_vdec->p_buffer + p_vdec->i_buffer,
i_frame_size ,
p_pes );
- memset( p_vdec->p_buffer + p_vdec->i_buffer + i_frame_size,
- 0,
- 16 );
+ memset( p_vdec->p_buffer + p_vdec->i_buffer + i_frame_size, 0, FF_INPUT_BUFFER_PADDING_SIZE );
}
input_DeletePES( p_vdec->p_fifo->p_packets_mgt, p_pes );
} while( i_frame_size <= 0 );