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

Upgrade requirements for libavcodec and libavutil

parent ee5be2d0
......@@ -2309,7 +2309,7 @@ dnl
AC_ARG_ENABLE(avcodec,
[ --enable-avcodec libavcodec codec (default enabled)])
AS_IF([test "${enable_avcodec}" != "no"], [
PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 53.34.0 libavutil >= 51.22.0], [
PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 54.25.0 libavutil >= 52.0.0], [
dnl PKG_CHECK_EXISTS([libavcodec < 56],, [
dnl AC_MSG_ERROR([libavcodec versions 56 and later are not supported yet.])
dnl ])
......
......@@ -42,12 +42,6 @@
#include "chroma.h"
#include "avcommon.h"
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 53, 34, 0 )
# error You must update libavcodec to a version >= 53.34.0
#elif LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 54, 25, 0 )
# warning You should update libavcodec to a version >= 54.25.0
#endif
/*****************************************************************************
* decoder_sys_t: decoder descriptor
*****************************************************************************/
......
......@@ -109,9 +109,6 @@ static inline void vlc_init_avcodec(vlc_object_t *obj)
vlc_init_avutil(obj);
#if LIBAVCODEC_VERSION_MAJOR < 54
avcodec_init();
#endif
avcodec_register_all();
vlc_avcodec_unlock();
......
This diff is collapsed.
......@@ -86,17 +86,13 @@ static const struct
{VLC_CODEC_I420_9B, PIX_FMT_YUV420P9BE, 0, 0, 0 },
{VLC_CODEC_I420_10L, PIX_FMT_YUV420P10LE, 0, 0, 0 },
{VLC_CODEC_I420_10B, PIX_FMT_YUV420P10BE, 0, 0, 0 },
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,13,0)
{VLC_CODEC_I422_9L, PIX_FMT_YUV422P9LE, 0, 0, 0 },
{VLC_CODEC_I422_9B, PIX_FMT_YUV422P9BE, 0, 0, 0 },
#endif
{VLC_CODEC_I422_10L, PIX_FMT_YUV422P10LE, 0, 0, 0 },
{VLC_CODEC_I422_10B, PIX_FMT_YUV422P10BE, 0, 0, 0 },
{VLC_CODEC_YUV420A, PIX_FMT_YUVA420P, 0, 0, 0 },
#if LIBAVUTIL_VERSION_CHECK( 51, 45, 0, 74, 100 )
{VLC_CODEC_YUV422A, AV_PIX_FMT_YUVA422P, 0, 0, 0 },
#endif
{VLC_CODEC_I444_9L, PIX_FMT_YUV444P9LE, 0, 0, 0 },
{VLC_CODEC_I444_9B, PIX_FMT_YUV444P9BE, 0, 0, 0 },
......@@ -134,9 +130,7 @@ static const struct
/* Paletized RGB */
{VLC_CODEC_RGBP, PIX_FMT_PAL8, 0, 0, 0},
#if LIBAVUTIL_VERSION_CHECK(51, 42, 0, 74,100)
{VLC_CODEC_GBR_PLANAR, AV_PIX_FMT_GBRP, 0, 0, 0 },
#endif
/* XYZ */
#if LIBAVUTIL_VERSION_CHECK(52, 10, 0, 25, 100)
......
......@@ -236,11 +236,7 @@ static const uint16_t mpeg4_default_non_intra_matrix[64] = {
23, 24, 25, 27, 28, 30, 31, 33,
};
#if LIBAVUTIL_VERSION_CHECK( 51, 27, 2, 46, 100 )
static const int DEFAULT_ALIGN = 0;
#else
static const int DEFAULT_ALIGN = 1;
#endif
/*****************************************************************************
......@@ -1112,7 +1108,6 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
frame->quality = p_sys->i_quality;
}
#if (LIBAVCODEC_VERSION_MAJOR >= 54)
AVPacket av_pkt;
int is_data;
......@@ -1134,63 +1129,6 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
if( unlikely( av_pkt.flags & AV_PKT_FLAG_CORRUPT ) )
p_block->i_flags |= BLOCK_FLAG_CORRUPTED;
#else
int i_out = avcodec_encode_video( p_sys->p_context, p_block->p_buffer,
p_block->i_buffer, frame );
if( i_out <= 0 )
{
block_Release( p_block );
return NULL;
}
p_block->i_buffer = i_out;
/* FIXME, 3-2 pulldown is not handled correctly */
p_block->i_length = INT64_C(1000000) *
p_enc->fmt_in.video.i_frame_rate_base /
p_enc->fmt_in.video.i_frame_rate;
if( !p_sys->p_context->max_b_frames || !p_sys->p_context->delay )
{
/* No delay -> output pts == input pts */
if( p_pict )
p_block->i_dts = p_pict->date;
p_block->i_pts = p_block->i_dts;
}
else if( p_sys->p_context->coded_frame->pts != AV_NOPTS_VALUE &&
p_sys->p_context->coded_frame->pts != 0 &&
p_sys->i_buggy_pts_detect != p_sys->p_context->coded_frame->pts )
{
p_sys->i_buggy_pts_detect = p_sys->p_context->coded_frame->pts;
p_block->i_pts = p_sys->p_context->coded_frame->pts;
if( p_sys->p_context->coded_frame->pict_type != AV_PICTURE_TYPE_I &&
p_sys->p_context->coded_frame->pict_type != AV_PICTURE_TYPE_P )
{
p_block->i_dts = p_block->i_pts;
}
else
{
if( p_sys->i_last_ref_pts )
{
p_block->i_dts = p_sys->i_last_ref_pts;
}
else
{
/* Let's put something sensible */
p_block->i_dts = p_block->i_pts;
}
p_sys->i_last_ref_pts = p_block->i_pts;
}
}
else if( p_pict )
{
/* Buggy libavcodec which doesn't update coded_frame->pts
* correctly */
p_block->i_dts = p_block->i_pts = p_pict->date;
}
#endif
switch ( p_sys->p_context->coded_frame->pict_type )
{
......
......@@ -189,9 +189,7 @@ static const struct
/* AV_CODEC_ID_CDGRAPHICS */
/* AV_CODEC_ID_R210 */
/* AV_CODEC_ID_ANM */
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 55, 0 )
{ VLC_CODEC_BINKVIDEO, AV_CODEC_ID_BINKVIDEO, VIDEO_ES },
#endif
/* AV_CODEC_ID_IFF_ILBM */
/* AV_CODEC_ID_IFF_BYTERUN1 */
{ VLC_CODEC_KGV1, AV_CODEC_ID_KGV1, VIDEO_ES },
......@@ -212,14 +210,10 @@ static const struct
{ VLC_CODEC_UTVIDEO, AV_CODEC_ID_UTVIDEO, VIDEO_ES },
{ VLC_CODEC_BMVVIDEO, AV_CODEC_ID_BMV_VIDEO, VIDEO_ES },
{ VLC_CODEC_VBLE, AV_CODEC_ID_VBLE, VIDEO_ES },
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 53, 42, 0 )
{ VLC_CODEC_DXTORY, AV_CODEC_ID_DXTORY, VIDEO_ES },
#endif
/* AV_CODEC_ID_V410 */
/* AV_CODEC_ID_XWD */
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 54, 1, 0 )
{ VLC_CODEC_CDXL, AV_CODEC_ID_CDXL, VIDEO_ES },
#endif
/* AV_CODEC_ID_XBM */
/* AV_CODEC_ID_ZEROCODEC */
#if LIBAVCODEC_VERSION_CHECK( 54, 16, 0, 27, 100 )
......@@ -417,9 +411,7 @@ static const struct
{ VLC_CODEC_SPEEX, AV_CODEC_ID_SPEEX, AUDIO_ES },
{ VLC_CODEC_WMAS, AV_CODEC_ID_WMAVOICE, AUDIO_ES },
{ VLC_CODEC_WMAP, AV_CODEC_ID_WMAPRO, AUDIO_ES },
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 54, 5, 0 )
{ VLC_CODEC_WMAL, AV_CODEC_ID_WMALOSSLESS, AUDIO_ES },
#endif
#if LIBAVCODEC_VERSION_CHECK( 55, 32, 0, 47, 100 )
{ VLC_CODEC_ATRAC3P, AV_CODEC_ID_ATRAC3P, AUDIO_ES },
#endif
......@@ -430,10 +422,8 @@ static const struct
{ VLC_CODEC_TRUEHD, AV_CODEC_ID_TRUEHD, AUDIO_ES },
{ VLC_CODEC_ALS, AV_CODEC_ID_MP4ALS, AUDIO_ES },
{ VLC_CODEC_ATRAC1, AV_CODEC_ID_ATRAC1, AUDIO_ES },
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 55, 0 )
{ VLC_CODEC_BINKAUDIO_DCT, AV_CODEC_ID_BINKAUDIO_DCT, AUDIO_ES },
{ VLC_CODEC_BINKAUDIO_RDFT, AV_CODEC_ID_BINKAUDIO_RDFT, AUDIO_ES },
#endif
{ VLC_CODEC_MP4A, AV_CODEC_ID_AAC_LATM, AUDIO_ES },
/* AV_CODEC_ID_QDMC */
/* AV_CODEC_ID_CELT */
......@@ -442,9 +432,7 @@ static const struct
/* AV_CODEC_ID_8SVX_EXP */
/* AV_CODEC_ID_8SVX_FIB */
{ VLC_CODEC_BMVAUDIO, AV_CODEC_ID_BMV_AUDIO, AUDIO_ES },
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 54, 12, 0 )
{ VLC_CODEC_RALF, AV_CODEC_ID_RALF, AUDIO_ES },
#endif
#if LIBAVCODEC_VERSION_CHECK( 54, 14, 0, 26, 100 )
{ VLC_CODEC_INDEO_AUDIO, AV_CODEC_ID_IAC, AUDIO_ES },
#endif
......
......@@ -74,11 +74,7 @@ struct decoder_sys_t
/* */
#if LIBAVCODEC_VERSION_MAJOR < 54
AVPaletteControl palette;
#else
bool palette_sent;
#endif
/* */
bool b_flush;
......@@ -373,37 +369,6 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
p_dec->fmt_out.video.orientation = p_dec->fmt_in.video.orientation;
#if LIBAVCODEC_VERSION_MAJOR < 54
/* Setup palette */
memset( &p_sys->palette, 0, sizeof(p_sys->palette) );
if( p_dec->fmt_in.video.p_palette )
{
p_sys->palette.palette_changed = 1;
for( int i = 0; i < __MIN( AVPALETTE_COUNT, p_dec->fmt_in.video.p_palette->i_entries ); i++ )
{
union {
uint32_t u;
uint8_t a[4];
} c;
c.a[0] = p_dec->fmt_in.video.p_palette->palette[i][0];
c.a[1] = p_dec->fmt_in.video.p_palette->palette[i][1];
c.a[2] = p_dec->fmt_in.video.p_palette->palette[i][2];
c.a[3] = p_dec->fmt_in.video.p_palette->palette[i][3];
p_sys->palette.palette[i] = c.u;
}
p_sys->p_context->palctrl = &p_sys->palette;
p_dec->fmt_out.video.p_palette = malloc( sizeof(video_palette_t) );
if( p_dec->fmt_out.video.p_palette )
*p_dec->fmt_out.video.p_palette = *p_dec->fmt_in.video.p_palette;
}
else if( p_sys->i_codec_id != CODEC_ID_MSVIDEO1 && p_sys->i_codec_id != CODEC_ID_CINEPAK )
{
p_sys->p_context->palctrl = &p_sys->palette;
}
#else
if( p_dec->fmt_in.video.p_palette ) {
p_sys->palette_sent = false;
p_dec->fmt_out.video.p_palette = malloc( sizeof(video_palette_t) );
......@@ -411,7 +376,6 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
*p_dec->fmt_out.video.p_palette = *p_dec->fmt_in.video.p_palette;
} else
p_sys->palette_sent = true;
#endif
/* ***** init this codec with special data ***** */
ffmpeg_InitCodec( p_dec );
......@@ -595,7 +559,6 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
pkt.size = 0;
}
#if LIBAVCODEC_VERSION_MAJOR >= 54
if( !p_sys->palette_sent )
{
uint8_t *pal = av_packet_new_side_data(&pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
......@@ -604,7 +567,6 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
p_sys->palette_sent = true;
}
}
#endif
/* Make sure we don't reuse the same timestamps twice */
if( p_block )
......@@ -1213,9 +1175,6 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
#if ! LIBAVCODEC_VERSION_CHECK(54, 34, 0, 79, 101)
p_ff_pic->pkt_pts = p_context->pkt ? p_context->pkt->pts : AV_NOPTS_VALUE;
#endif
#if LIBAVCODEC_VERSION_MAJOR < 54
p_ff_pic->age = 256*256*256*64;
#endif
if( p_sys->p_va )
return ffmpeg_va_GetFrameBuf(p_context, p_ff_pic);
......
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