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.
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 < 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;
-#endif
if( p_dec->fmt_in.i_extra > 0 )
{
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,
(int16_t*)p_sys->p_output, &i_output,
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 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] =
{
{ CH_FRONT_LEFT, AOUT_CHAN_LEFT },
{ CH_STEREO_LEFT, 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 )
{
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 )
{
case SAMPLE_FMT_U8:
p_dec->fmt_out.audio.i_bitspersample = 16;
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;
/* */
-#if defined(LIBAVCODEC_AUDIO_LAYOUT)
if( p_sys->i_previous_channels == p_sys->p_context->channels &&
p_sys->i_previous_layout == p_sys->p_context->channel_layout )
return;
-#else
- if( p_sys->i_previous_channels == p_sys->p_context->channels )
- return;
-#endif
if( b_trust )
{
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;
-#endif
}
/* Specified order
* 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);
-#else
- const unsigned i_order_max = 64;
-#endif
uint32_t pi_order_src[i_order_max];
int i_channels_src = 0;
-#if defined(LIBAVCODEC_AUDIO_LAYOUT)
if( p_sys->p_context->channel_layout )
{
for( unsigned i = 0; i < sizeof(pi_channels_map)/sizeof(*pi_channels_map); i++ )
}
}
else
-#endif
{
/* Create default order */
if( b_trust )
#include "avcodec.h"
#include "avutil.h"
-#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 51, 48, 0 )
-# error You must update libavcodec to a version >= 51.48.0
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 52, 2, 0 )
+# error You must update libavcodec to a version >= 52.2.0
#elif LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 52, 25, 0 )
# warning You should update libavcodec to get subtitle support
#endif
}
}
-#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;
-#endif
if ( p_sys->i_qmin > 0 && p_sys->i_qmin == p_sys->i_qmax )
p_context->flags |= CODEC_FLAG_QSCALE;
if ( current_date + HURRY_UP_GUARD3 > frame.pts )
{
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;
-#endif
msg_Dbg( p_enc, "hurry up mode 3" );
}
else
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;
-#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 < 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;
-#endif
p_sys->p_context->noise_reduction =
p_sys->i_noise_reduction;
{ VLC_CODEC_DNXHD, CODEC_ID_DNXHD, 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 },
-#endif
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 55, 0 )
{ VLC_CODEC_DIRAC, CODEC_ID_DIRAC, VIDEO_ES },
-#endif
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 29, 0 )
{ VLC_CODEC_V210, CODEC_ID_V210, VIDEO_ES },
{ VLC_CODEC_RA_288, CODEC_ID_RA_288, 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 },
-#endif
{ VLC_CODEC_DTS, CODEC_ID_DTS, AUDIO_ES },
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 6, 0 )
{ VLC_CODEC_QCELP, CODEC_ID_QCELP, AUDIO_ES },
#endif
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 50, 1 )
{ VLC_CODEC_SPEEX, CODEC_ID_SPEEX, AUDIO_ES },
-#endif
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 34, 0 )
{ VLC_CODEC_TWINVQ, CODEC_ID_TWINVQ, AUDIO_ES },
#endif
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 22, 0 )
{ VLC_CODEC_TRUEHD, CODEC_ID_TRUEHD, AUDIO_ES },
#endif
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 58, 0 )
{ VLC_CODEC_MLP, CODEC_ID_MLP, AUDIO_ES },
-#endif
/* PCM */
{ VLC_CODEC_ALAW, CODEC_ID_PCM_ALAW, AUDIO_ES },
{ VLC_CODEC_MULAW, CODEC_ID_PCM_MULAW, 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 ) )
{ VLC_CODEC_FL32, CODEC_ID_PCM_F32LE, AUDIO_ES },
{ VLC_CODEC_FL64, CODEC_ID_PCM_F64LE, AUDIO_ES },
#else
{ VLC_CODEC_FL32, CODEC_ID_PCM_F32BE, AUDIO_ES },
{ VLC_CODEC_FL64, CODEC_ID_PCM_F64BE, AUDIO_ES },
-#endif
#endif
/* Subtitle streams */
{ VLC_CODEC_DVBS, CODEC_ID_DVB_SUBTITLE, SPU_ES },
{ VLC_CODEC_SUBT, CODEC_ID_TEXT, 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 },
-#endif
{ 0, 0, UNKNOWN_ES }
};
/* ***** Get configuration of ffmpeg plugin ***** */
p_sys->p_context->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 =
var_InheritInteger( p_dec, "ffmpeg-error-resilience" );
-#endif
if( var_CreateGetBool( p_dec, "grayscale" ) )
p_sys->p_context->flags |= CODEC_FLAG_GRAY;
}
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 < 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;
-#endif
int ret;
vlc_avcodec_lock();