Commit ad0b21e0 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Avcodec: bump required version to 52.2.0

This removes outdated code.
It isn't nice to FFmpeg programmers to allow people to keep such old versions of lavc
52.2.0 allows the Audio Channel Layout to be defined.
parent 027f68c3
...@@ -113,11 +113,7 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -113,11 +113,7 @@ 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->block_align = p_dec->fmt_in.audio.i_blockalign;
p_sys->p_context->bit_rate = p_dec->fmt_in.i_bitrate; p_sys->p_context->bit_rate = p_dec->fmt_in.i_bitrate;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 52, 0, 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; p_sys->p_context->bits_per_coded_sample = p_dec->fmt_in.audio.i_bitspersample;
#endif
if( p_dec->fmt_in.i_extra > 0 ) if( p_dec->fmt_in.i_extra > 0 )
{ {
...@@ -330,15 +326,9 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block ) ...@@ -330,15 +326,9 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
p_sys->p_output = av_realloc( p_sys->p_output, i_output ); p_sys->p_output = av_realloc( p_sys->p_output, i_output );
} }
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 0, 0 )
i_used = avcodec_decode_audio2( p_sys->p_context, i_used = avcodec_decode_audio2( p_sys->p_context,
(int16_t*)p_sys->p_output, &i_output, (int16_t*)p_sys->p_output, &i_output,
p_block->p_buffer, p_block->i_buffer ); p_block->p_buffer, p_block->i_buffer );
#else
i_used = avcodec_decode_audio( p_sys->p_context,
(int16_t*)p_sys->p_output, &i_output,
p_block->p_buffer, p_block->i_buffer );
#endif
if( i_used < 0 || i_output < 0 ) if( i_used < 0 || i_output < 0 )
{ {
...@@ -413,13 +403,7 @@ void EndAudioDec( decoder_t *p_dec ) ...@@ -413,13 +403,7 @@ void EndAudioDec( decoder_t *p_dec )
/***************************************************************************** /*****************************************************************************
* *
*****************************************************************************/ *****************************************************************************/
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 2, 0 )
# define LIBAVCODEC_AUDIO_LAYOUT
#else
# warning "Audio channel layout is unsupported by your avcodec version."
#endif
#if defined(LIBAVCODEC_AUDIO_LAYOUT)
static const uint64_t pi_channels_map[][2] = static const uint64_t pi_channels_map[][2] =
{ {
{ CH_FRONT_LEFT, AOUT_CHAN_LEFT }, { CH_FRONT_LEFT, AOUT_CHAN_LEFT },
...@@ -443,37 +427,11 @@ static const uint64_t pi_channels_map[][2] = ...@@ -443,37 +427,11 @@ static const uint64_t pi_channels_map[][2] =
{ CH_STEREO_LEFT, 0 }, { CH_STEREO_LEFT, 0 },
{ CH_STEREO_RIGHT, 0 }, { CH_STEREO_RIGHT, 0 },
}; };
#else
static const uint64_t pi_channels_map[][2] =
{
{ 0, AOUT_CHAN_LEFT },
{ 0, AOUT_CHAN_RIGHT },
{ 0, AOUT_CHAN_CENTER },
{ 0, AOUT_CHAN_LFE },
{ 0, AOUT_CHAN_REARLEFT },
{ 0, AOUT_CHAN_REARRIGHT },
{ 0, 0 },
{ 0, 0 },
{ 0, AOUT_CHAN_REARCENTER },
{ 0, AOUT_CHAN_MIDDLELEFT },
{ 0, AOUT_CHAN_MIDDLERIGHT },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
};
#endif
static void SetupOutputFormat( decoder_t *p_dec, bool b_trust ) static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
{ {
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 65, 0 )
switch( p_sys->p_context->sample_fmt ) switch( p_sys->p_context->sample_fmt )
{ {
case SAMPLE_FMT_U8: case SAMPLE_FMT_U8:
...@@ -499,41 +457,25 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust ) ...@@ -499,41 +457,25 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
p_dec->fmt_out.audio.i_bitspersample = 16; p_dec->fmt_out.audio.i_bitspersample = 16;
break; break;
} }
#else
p_dec->fmt_out.i_codec = VLC_CODEC_S16N;
p_dec->fmt_out.audio.i_bitspersample = 16;
#endif
p_dec->fmt_out.audio.i_rate = p_sys->p_context->sample_rate; p_dec->fmt_out.audio.i_rate = p_sys->p_context->sample_rate;
/* */ /* */
#if defined(LIBAVCODEC_AUDIO_LAYOUT)
if( p_sys->i_previous_channels == p_sys->p_context->channels && if( p_sys->i_previous_channels == p_sys->p_context->channels &&
p_sys->i_previous_layout == p_sys->p_context->channel_layout ) p_sys->i_previous_layout == p_sys->p_context->channel_layout )
return; return;
#else
if( p_sys->i_previous_channels == p_sys->p_context->channels )
return;
#endif
if( b_trust ) if( b_trust )
{ {
p_sys->i_previous_channels = p_sys->p_context->channels; p_sys->i_previous_channels = p_sys->p_context->channels;
#if defined(LIBAVCODEC_AUDIO_LAYOUT)
p_sys->i_previous_layout = p_sys->p_context->channel_layout; p_sys->i_previous_layout = p_sys->p_context->channel_layout;
#endif
} }
/* Specified order /* Specified order
* FIXME should we use fmt_in.audio.i_physical_channels or not ? * FIXME should we use fmt_in.audio.i_physical_channels or not ?
*/ */
#if defined(LIBAVCODEC_AUDIO_LAYOUT)
const unsigned i_order_max = 8 * sizeof(p_sys->p_context->channel_layout); const unsigned i_order_max = 8 * sizeof(p_sys->p_context->channel_layout);
#else
const unsigned i_order_max = 64;
#endif
uint32_t pi_order_src[i_order_max]; uint32_t pi_order_src[i_order_max];
int i_channels_src = 0; int i_channels_src = 0;
#if defined(LIBAVCODEC_AUDIO_LAYOUT)
if( p_sys->p_context->channel_layout ) if( p_sys->p_context->channel_layout )
{ {
for( unsigned i = 0; i < sizeof(pi_channels_map)/sizeof(*pi_channels_map); i++ ) for( unsigned i = 0; i < sizeof(pi_channels_map)/sizeof(*pi_channels_map); i++ )
...@@ -543,7 +485,6 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust ) ...@@ -543,7 +485,6 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
} }
} }
else else
#endif
{ {
/* Create default order */ /* Create default order */
if( b_trust ) if( b_trust )
......
...@@ -48,8 +48,8 @@ ...@@ -48,8 +48,8 @@
#include "avcodec.h" #include "avcodec.h"
#include "avutil.h" #include "avutil.h"
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 51, 48, 0 ) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 52, 2, 0 )
# error You must update libavcodec to a version >= 51.48.0 # error You must update libavcodec to a version >= 52.2.0
#elif LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 52, 25, 0 ) #elif LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 52, 25, 0 )
# warning You should update libavcodec to get subtitle support # warning You should update libavcodec to get subtitle support
#endif #endif
......
...@@ -492,12 +492,7 @@ int OpenEncoder( vlc_object_t *p_this ) ...@@ -492,12 +492,7 @@ int OpenEncoder( vlc_object_t *p_this )
} }
} }
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 52, 0, 0 )
if ( p_sys->b_trellis )
p_context->flags |= CODEC_FLAG_TRELLIS_QUANT;
#else
p_context->trellis = p_sys->b_trellis; p_context->trellis = p_sys->b_trellis;
#endif
if ( p_sys->i_qmin > 0 && p_sys->i_qmin == p_sys->i_qmax ) if ( p_sys->i_qmin > 0 && p_sys->i_qmin == p_sys->i_qmax )
p_context->flags |= CODEC_FLAG_QSCALE; p_context->flags |= CODEC_FLAG_QSCALE;
...@@ -748,11 +743,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict ) ...@@ -748,11 +743,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
if ( current_date + HURRY_UP_GUARD3 > frame.pts ) if ( current_date + HURRY_UP_GUARD3 > frame.pts )
{ {
p_sys->p_context->mb_decision = FF_MB_DECISION_SIMPLE; p_sys->p_context->mb_decision = FF_MB_DECISION_SIMPLE;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 52, 0, 0 )
p_sys->p_context->flags &= ~CODEC_FLAG_TRELLIS_QUANT;
#else
p_sys->p_context->trellis = 0; p_sys->p_context->trellis = 0;
#endif
msg_Dbg( p_enc, "hurry up mode 3" ); msg_Dbg( p_enc, "hurry up mode 3" );
} }
else else
...@@ -761,23 +752,14 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict ) ...@@ -761,23 +752,14 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
if ( current_date + HURRY_UP_GUARD2 > frame.pts ) if ( current_date + HURRY_UP_GUARD2 > frame.pts )
{ {
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 52, 0, 0 )
p_sys->p_context->flags &= ~CODEC_FLAG_TRELLIS_QUANT;
#else
p_sys->p_context->trellis = 0; p_sys->p_context->trellis = 0;
#endif
p_sys->p_context->noise_reduction = p_sys->i_noise_reduction p_sys->p_context->noise_reduction = p_sys->i_noise_reduction
+ (HURRY_UP_GUARD2 + current_date - frame.pts) / 500; + (HURRY_UP_GUARD2 + current_date - frame.pts) / 500;
msg_Dbg( p_enc, "hurry up mode 2" ); msg_Dbg( p_enc, "hurry up mode 2" );
} }
else else
{ {
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 52, 0, 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; p_sys->p_context->trellis = p_sys->b_trellis;
#endif
p_sys->p_context->noise_reduction = p_sys->p_context->noise_reduction =
p_sys->i_noise_reduction; p_sys->i_noise_reduction;
......
...@@ -184,13 +184,9 @@ static const struct ...@@ -184,13 +184,9 @@ static const struct
{ VLC_CODEC_DNXHD, CODEC_ID_DNXHD, VIDEO_ES }, { VLC_CODEC_DNXHD, CODEC_ID_DNXHD, VIDEO_ES },
{ VLC_CODEC_8BPS, CODEC_ID_8BPS, VIDEO_ES }, { VLC_CODEC_8BPS, CODEC_ID_8BPS, VIDEO_ES },
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 52, 0 )
{ VLC_CODEC_MIMIC, CODEC_ID_MIMIC, VIDEO_ES }, { VLC_CODEC_MIMIC, CODEC_ID_MIMIC, VIDEO_ES },
#endif
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 55, 0 )
{ VLC_CODEC_DIRAC, CODEC_ID_DIRAC, VIDEO_ES }, { VLC_CODEC_DIRAC, CODEC_ID_DIRAC, VIDEO_ES },
#endif
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 29, 0 ) #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 29, 0 )
{ VLC_CODEC_V210, CODEC_ID_V210, VIDEO_ES }, { VLC_CODEC_V210, CODEC_ID_V210, VIDEO_ES },
...@@ -287,9 +283,7 @@ static const struct ...@@ -287,9 +283,7 @@ static const struct
{ VLC_CODEC_RA_288, CODEC_ID_RA_288, AUDIO_ES }, { VLC_CODEC_RA_288, CODEC_ID_RA_288, AUDIO_ES },
{ VLC_CODEC_A52, CODEC_ID_AC3, AUDIO_ES }, { VLC_CODEC_A52, CODEC_ID_AC3, AUDIO_ES },
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 0, 0 )
{ VLC_CODEC_EAC3, CODEC_ID_EAC3, AUDIO_ES }, { VLC_CODEC_EAC3, CODEC_ID_EAC3, AUDIO_ES },
#endif
{ VLC_CODEC_DTS, CODEC_ID_DTS, AUDIO_ES }, { VLC_CODEC_DTS, CODEC_ID_DTS, AUDIO_ES },
...@@ -349,9 +343,7 @@ static const struct ...@@ -349,9 +343,7 @@ static const struct
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 6, 0 ) #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 6, 0 )
{ VLC_CODEC_QCELP, CODEC_ID_QCELP, AUDIO_ES }, { VLC_CODEC_QCELP, CODEC_ID_QCELP, AUDIO_ES },
#endif #endif
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 50, 1 )
{ VLC_CODEC_SPEEX, CODEC_ID_SPEEX, AUDIO_ES }, { VLC_CODEC_SPEEX, CODEC_ID_SPEEX, AUDIO_ES },
#endif
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 34, 0 ) #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 34, 0 )
{ VLC_CODEC_TWINVQ, CODEC_ID_TWINVQ, AUDIO_ES }, { VLC_CODEC_TWINVQ, CODEC_ID_TWINVQ, AUDIO_ES },
#endif #endif
...@@ -374,9 +366,7 @@ static const struct ...@@ -374,9 +366,7 @@ static const struct
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 22, 0 ) #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 22, 0 )
{ VLC_CODEC_TRUEHD, CODEC_ID_TRUEHD, AUDIO_ES }, { VLC_CODEC_TRUEHD, CODEC_ID_TRUEHD, AUDIO_ES },
#endif #endif
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 58, 0 )
{ VLC_CODEC_MLP, CODEC_ID_MLP, AUDIO_ES }, { VLC_CODEC_MLP, CODEC_ID_MLP, AUDIO_ES },
#endif
/* PCM */ /* PCM */
...@@ -397,14 +387,12 @@ static const struct ...@@ -397,14 +387,12 @@ static const struct
{ VLC_CODEC_ALAW, CODEC_ID_PCM_ALAW, AUDIO_ES }, { VLC_CODEC_ALAW, CODEC_ID_PCM_ALAW, AUDIO_ES },
{ VLC_CODEC_MULAW, CODEC_ID_PCM_MULAW, AUDIO_ES }, { VLC_CODEC_MULAW, CODEC_ID_PCM_MULAW, AUDIO_ES },
{ VLC_CODEC_S24DAUD, CODEC_ID_PCM_S24DAUD, AUDIO_ES }, { VLC_CODEC_S24DAUD, CODEC_ID_PCM_S24DAUD, AUDIO_ES },
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 66, 0 )
#if ( !defined( WORDS_BIGENDIAN ) ) #if ( !defined( WORDS_BIGENDIAN ) )
{ VLC_CODEC_FL32, CODEC_ID_PCM_F32LE, AUDIO_ES }, { VLC_CODEC_FL32, CODEC_ID_PCM_F32LE, AUDIO_ES },
{ VLC_CODEC_FL64, CODEC_ID_PCM_F64LE, AUDIO_ES }, { VLC_CODEC_FL64, CODEC_ID_PCM_F64LE, AUDIO_ES },
#else #else
{ VLC_CODEC_FL32, CODEC_ID_PCM_F32BE, AUDIO_ES }, { VLC_CODEC_FL32, CODEC_ID_PCM_F32BE, AUDIO_ES },
{ VLC_CODEC_FL64, CODEC_ID_PCM_F64BE, AUDIO_ES }, { VLC_CODEC_FL64, CODEC_ID_PCM_F64BE, AUDIO_ES },
#endif
#endif #endif
/* Subtitle streams */ /* Subtitle streams */
...@@ -415,9 +403,7 @@ static const struct ...@@ -415,9 +403,7 @@ static const struct
{ VLC_CODEC_DVBS, CODEC_ID_DVB_SUBTITLE, SPU_ES }, { VLC_CODEC_DVBS, CODEC_ID_DVB_SUBTITLE, SPU_ES },
{ VLC_CODEC_SUBT, CODEC_ID_TEXT, SPU_ES }, { VLC_CODEC_SUBT, CODEC_ID_TEXT, SPU_ES },
{ VLC_CODEC_XSUB, CODEC_ID_XSUB, SPU_ES }, { VLC_CODEC_XSUB, CODEC_ID_XSUB, SPU_ES },
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 50, 0 )
{ VLC_CODEC_SSA, CODEC_ID_SSA, SPU_ES }, { VLC_CODEC_SSA, CODEC_ID_SSA, SPU_ES },
#endif
{ 0, 0, UNKNOWN_ES } { 0, 0, UNKNOWN_ES }
}; };
......
...@@ -217,13 +217,8 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -217,13 +217,8 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
/* ***** Get configuration of ffmpeg plugin ***** */ /* ***** Get configuration of ffmpeg plugin ***** */
p_sys->p_context->workaround_bugs = p_sys->p_context->workaround_bugs =
var_InheritInteger( p_dec, "ffmpeg-workaround-bugs" ); var_InheritInteger( p_dec, "ffmpeg-workaround-bugs" );
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 52, 0, 0 )
p_sys->p_context->error_resilience =
var_InheritInteger( p_dec, "ffmpeg-error-resilience" );
#else
p_sys->p_context->error_recognition = p_sys->p_context->error_recognition =
var_InheritInteger( p_dec, "ffmpeg-error-resilience" ); var_InheritInteger( p_dec, "ffmpeg-error-resilience" );
#endif
if( var_CreateGetBool( p_dec, "grayscale" ) ) if( var_CreateGetBool( p_dec, "grayscale" ) )
p_sys->p_context->flags |= CODEC_FLAG_GRAY; p_sys->p_context->flags |= CODEC_FLAG_GRAY;
...@@ -810,11 +805,7 @@ static int ffmpeg_OpenCodec( decoder_t *p_dec ) ...@@ -810,11 +805,7 @@ static int ffmpeg_OpenCodec( decoder_t *p_dec )
} }
p_sys->p_context->width = p_dec->fmt_in.video.i_width; p_sys->p_context->width = p_dec->fmt_in.video.i_width;
p_sys->p_context->height = p_dec->fmt_in.video.i_height; p_sys->p_context->height = p_dec->fmt_in.video.i_height;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 0, 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; p_sys->p_context->bits_per_coded_sample = p_dec->fmt_in.video.i_bits_per_pixel;
#endif
int ret; int ret;
vlc_avcodec_lock(); vlc_avcodec_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