#include <vlc_common.h>
#include <vlc_codec.h>
#include <vlc_vout.h>
-#include <vlc_input.h> /* hmmm, just for INPUT_RATE_DEFAULT */
#include <vlc_codecs.h> /* BITMAPINFOHEADER */
/* ffmpeg header */
static int ffmpeg_GetFrameBuf ( struct AVCodecContext *, AVFrame * );
static int ffmpeg_ReGetFrameBuf( struct AVCodecContext *, AVFrame * );
static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *, AVFrame * );
-static void ffmpeg_NextPts( decoder_t *, int i_block_rate );
+static void ffmpeg_NextPts( decoder_t * );
static uint32_t ffmpeg_CodecTag( vlc_fourcc_t fcc )
{
}
/* ***** Open the codec ***** */
- vlc_mutex_t *lock = var_AcquireMutex( "avcodec" );
- if( lock == NULL )
- {
- free( p_sys->p_buffer_orig );
- free( p_sys );
- return VLC_ENOMEM;
- }
-
+ vlc_mutex_lock( &avcodec_lock );
if( avcodec_open( p_sys->p_context, p_sys->p_codec ) < 0 )
{
- vlc_mutex_unlock( lock );
+ vlc_mutex_unlock( &avcodec_lock );
msg_Err( p_dec, "cannot open codec (%s)", p_sys->psz_namecodec );
free( p_sys->p_buffer_orig );
free( p_sys );
return VLC_EGENERIC;
}
- vlc_mutex_unlock( lock );
+ vlc_mutex_unlock( &avcodec_lock );
msg_Dbg( p_dec, "ffmpeg codec (%s) started", p_sys->psz_namecodec );
if( !b_drawpicture && p_pic )
p_dec->pf_vout_buffer_del( p_dec, p_pic );
- ffmpeg_NextPts( p_dec, p_block->i_rate );
+ ffmpeg_NextPts( p_dec );
continue;
}
int i;
p_pic->date = p_sys->i_pts;
- ffmpeg_NextPts( p_dec, p_block->i_rate );
+ ffmpeg_NextPts( p_dec );
if( p_sys->b_first_frame )
{
}
}
-static void ffmpeg_NextPts( decoder_t *p_dec, int i_block_rate )
+static void ffmpeg_NextPts( decoder_t *p_dec )
{
decoder_sys_t *p_sys = p_dec->p_sys;
{
p_sys->i_pts += INT64_C(1000000) *
(2 + p_sys->p_ff_pic->repeat_pict) *
- p_dec->fmt_in.video.i_frame_rate_base *
- i_block_rate / INPUT_RATE_DEFAULT /
+ p_dec->fmt_in.video.i_frame_rate_base /
(2 * p_dec->fmt_in.video.i_frame_rate);
}
else if( p_sys->p_context->time_base.den > 0 )
{
p_sys->i_pts += INT64_C(1000000) *
(2 + p_sys->p_ff_pic->repeat_pict) *
- p_sys->p_context->time_base.num *
- i_block_rate / INPUT_RATE_DEFAULT /
+ p_sys->p_context->time_base.num /
(2 * p_sys->p_context->time_base.den);
}
}