Commit fa68d1ae authored by Alexis Ballier's avatar Alexis Ballier Committed by Derk-Jan Hartman

ffmpeg: API change

Fix build with libavcodec 52: few renamings, the way to specify trellis quantization has changed. error_resilience has been renamed to error_recognition; I've left the option named ffmpeg-error-resilience since I am not sure if it is worth renaming the option here.
Signed-off-by: default avatarDerk-Jan Hartman <hartman@videolan.org>
parent bf49ec23
......@@ -125,7 +125,11 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
p_sys->p_context->block_align = p_dec->fmt_in.audio.i_blockalign;
p_sys->p_context->bit_rate = p_dec->fmt_in.i_bitrate;
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
p_sys->p_context->bits_per_sample = p_dec->fmt_in.audio.i_bitspersample;
#else
p_sys->p_context->bits_per_coded_sample = p_dec->fmt_in.audio.i_bitspersample;
#endif
if( p_dec->fmt_in.i_extra > 0 )
{
......
......@@ -510,8 +510,12 @@ int OpenEncoder( vlc_object_t *p_this )
}
}
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
if ( p_sys->b_trellis )
p_context->flags |= CODEC_FLAG_TRELLIS_QUANT;
#else
p_context->trellis = p_sys->b_trellis;
#endif
if ( p_sys->i_qmin > 0 && p_sys->i_qmin == p_sys->i_qmax )
p_context->flags |= CODEC_FLAG_QSCALE;
......@@ -840,7 +844,11 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
if ( current_date + HURRY_UP_GUARD3 > frame.pts )
{
p_sys->p_context->mb_decision = FF_MB_DECISION_SIMPLE;
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
p_sys->p_context->flags &= ~CODEC_FLAG_TRELLIS_QUANT;
#else
p_sys->p_context->trellis = 0;
#endif
msg_Dbg( p_enc, "hurry up mode 3" );
}
else
......@@ -849,15 +857,23 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
if ( current_date + HURRY_UP_GUARD2 > frame.pts )
{
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
p_sys->p_context->flags &= ~CODEC_FLAG_TRELLIS_QUANT;
#else
p_sys->p_context->trellis = 0;
#endif
p_sys->p_context->noise_reduction = p_sys->i_noise_reduction
+ (HURRY_UP_GUARD2 + current_date - frame.pts) / 500;
msg_Dbg( p_enc, "hurry up mode 2" );
}
else
{
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
if ( p_sys->b_trellis )
p_sys->p_context->flags |= CODEC_FLAG_TRELLIS_QUANT;
#else
p_sys->p_context->trellis = p_sys->b_trellis;
#endif
p_sys->p_context->noise_reduction =
p_sys->i_noise_reduction;
......
......@@ -202,13 +202,22 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
p_sys->p_context->codec_tag = ffmpeg_CodecTag( p_dec->fmt_in.i_codec );
p_sys->p_context->width = p_dec->fmt_in.video.i_width;
p_sys->p_context->height = p_dec->fmt_in.video.i_height;
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
p_sys->p_context->bits_per_sample = p_dec->fmt_in.video.i_bits_per_pixel;
#else
p_sys->p_context->bits_per_coded_sample = p_dec->fmt_in.video.i_bits_per_pixel;
#endif
/* ***** Get configuration of ffmpeg plugin ***** */
p_sys->p_context->workaround_bugs =
config_GetInt( p_dec, "ffmpeg-workaround-bugs" );
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
p_sys->p_context->error_resilience =
config_GetInt( p_dec, "ffmpeg-error-resilience" );
#else
p_sys->p_context->error_recognition =
config_GetInt( p_dec, "ffmpeg-error-resilience" );
#endif
var_Create( p_dec, "grayscale", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Get( p_dec, "grayscale", &val );
......
......@@ -215,7 +215,11 @@ int OpenDemux( vlc_object_t *p_this )
es_format_Init( &fmt, AUDIO_ES, fcc );
fmt.audio.i_channels = cc->channels;
fmt.audio.i_rate = cc->sample_rate;
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
fmt.audio.i_bitspersample = cc->bits_per_sample;
#else
fmt.audio.i_bitspersample = cc->bits_per_coded_sample;
#endif
fmt.audio.i_blockalign = cc->block_align;
psz_type = "audio";
break;
......
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