summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2013-11-05 08:16:31 +0100
committerDiego Biurrun <diego@biurrun.de>2013-11-13 21:07:45 +0100
commit19e30a58fc8ee6187a0bc14aff7f566a13c81421 (patch)
treefaf20ff671c7a6e7f6984f30b058b22b59ca8c73 /libavcodec
parentc7f7bfc9e3a3150ba72bc34366c13fb2210c66ac (diff)
Deprecate obsolete XvMC hardware decoding support
XvMC has long ago been superseded by newer acceleration APIs, such as VDPAU, and few downstreams still support it. Furthermore XvMC is not implemented within the hwaccel framework, but requires its own specific code in the MPEG-1/2 decoder, which is a maintenance burden.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/allcodecs.c5
-rw-r--r--libavcodec/avcodec.h9
-rw-r--r--libavcodec/codec_desc.c6
-rw-r--r--libavcodec/error_resilience.c10
-rw-r--r--libavcodec/mpeg12.c1
-rw-r--r--libavcodec/mpeg12dec.c65
-rw-r--r--libavcodec/mpegvideo.c58
-rw-r--r--libavcodec/mpegvideo_xvmc.c5
-rw-r--r--libavcodec/options_table.h2
-rw-r--r--libavcodec/version.h3
-rw-r--r--libavcodec/x86/dsputil_init.c8
-rw-r--r--libavcodec/xvmc.h8
-rw-r--r--libavcodec/xvmc_internal.h5
13 files changed, 141 insertions, 44 deletions
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 6172466d45..faa94b1ecb 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -24,8 +24,9 @@
* Provide registration of all codecs, parsers and bitstream filters for libavcodec.
*/
-#include "avcodec.h"
#include "config.h"
+#include "avcodec.h"
+#include "version.h"
#define REGISTER_HWACCEL(X, x) \
{ \
@@ -178,7 +179,9 @@ void avcodec_register_all(void)
REGISTER_DECODER(MJPEGB, mjpegb);
REGISTER_DECODER(MMVIDEO, mmvideo);
REGISTER_DECODER(MOTIONPIXELS, motionpixels);
+#if FF_API_XVMC
REGISTER_DECODER(MPEG_XVMC, mpeg_xvmc);
+#endif /* FF_API_XVMC */
REGISTER_ENCDEC (MPEG1VIDEO, mpeg1video);
REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video);
REGISTER_ENCDEC (MPEG4, mpeg4);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 0548f7169f..831d28e705 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -103,7 +103,9 @@ enum AVCodecID {
/* video codecs */
AV_CODEC_ID_MPEG1VIDEO,
AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
+#if FF_API_XVMC
AV_CODEC_ID_MPEG2VIDEO_XVMC,
+#endif /* FF_API_XVMC */
AV_CODEC_ID_H261,
AV_CODEC_ID_H263,
AV_CODEC_ID_RV10,
@@ -691,8 +693,10 @@ typedef struct RcOverride{
*/
#define CODEC_CAP_DR1 0x0002
#define CODEC_CAP_TRUNCATED 0x0008
+#if FF_API_XVMC
/* Codec can export data for HW decoding (XvMC). */
#define CODEC_CAP_HWACCEL 0x0010
+#endif /* FF_API_XVMC */
/**
* Encoder or decoder requires flushing with NULL input at the end in order to
* give the complete and correct output.
@@ -1526,12 +1530,15 @@ typedef struct AVCodecContext {
#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
+#if FF_API_XVMC
/**
* XVideo Motion Acceleration
* - encoding: forbidden
* - decoding: set by decoder
+ * @deprecated XvMC support is slated for removal.
*/
- int xvmc_acceleration;
+ attribute_deprecated int xvmc_acceleration;
+#endif /* FF_API_XVMC */
/**
* macroblock decision mode
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 73e8f6ddd6..68c895dd44 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -18,10 +18,10 @@
#include <string.h>
-#include "avcodec.h"
-
#include "libavutil/common.h"
#include "libavutil/internal.h"
+#include "avcodec.h"
+#include "version.h"
static const AVCodecDescriptor codec_descriptors[] = {
/* video codecs */
@@ -39,6 +39,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"),
.props = AV_CODEC_PROP_LOSSY,
},
+#if FF_API_XVMC
{
.id = AV_CODEC_ID_MPEG2VIDEO_XVMC,
.type = AVMEDIA_TYPE_VIDEO,
@@ -46,6 +47,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("MPEG-1/2 video XvMC (X-Video Motion Compensation)"),
.props = AV_CODEC_PROP_LOSSY,
},
+#endif /* FF_API_XVMC */
{
.id = AV_CODEC_ID_H261,
.type = AVMEDIA_TYPE_VIDEO,
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index 1769d2b839..51ebc04628 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -27,11 +27,13 @@
#include <limits.h>
+#include "libavutil/internal.h"
#include "avcodec.h"
#include "error_resilience.h"
#include "mpegvideo.h"
#include "rectangle.h"
#include "thread.h"
+#include "version.h"
/**
* @param stride the number of MVs to get to the next row
@@ -672,11 +674,15 @@ static int is_intra_more_likely(ERContext *s)
if (undamaged_count < 5)
return 0; // almost all MBs damaged -> use temporal prediction
+#if FF_API_XVMC
+FF_DISABLE_DEPRECATION_WARNINGS
// prevent dsp.sad() check, that requires access to the image
if (CONFIG_MPEG_XVMC_DECODER &&
s->avctx->xvmc_acceleration &&
s->cur_pic->f.pict_type == AV_PICTURE_TYPE_I)
return 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif /* FF_API_XVMC */
skip_amount = FFMAX(undamaged_count / 50, 1); // check only up to 50 MBs
is_intra_likely = 0;
@@ -1105,9 +1111,13 @@ void ff_er_frame_end(ERContext *s)
} else
guess_mv(s);
+#if FF_API_XVMC
+FF_DISABLE_DEPRECATION_WARNINGS
/* the filters below are not XvMC compatible, skip them */
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
goto ec_clean;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif /* FF_API_XVMC */
/* fill DC for inter blocks */
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 5724cc857e..5797d27a80 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -34,7 +34,6 @@
#include "mpeg12.h"
#include "mpeg12data.h"
#include "bytestream.h"
-#include "xvmc_internal.h"
#include "thread.h"
uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 1713cfb0af..2e95c6443b 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -37,6 +37,7 @@
#include "bytestream.h"
#include "xvmc_internal.h"
#include "thread.h"
+#include "version.h"
typedef struct Mpeg1Context {
MpegEncContext mpeg_enc_ctx;
@@ -756,6 +757,8 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
} else
memset(s->last_mv, 0, sizeof(s->last_mv)); /* reset mv prediction */
s->mb_intra = 1;
+#if FF_API_XVMC
+FF_DISABLE_DEPRECATION_WARNINGS
// if 1, we memcpy blocks in xvmcvideo
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1) {
ff_xvmc_pack_pblocks(s, -1); // inter are always full blocks
@@ -763,6 +766,8 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
exchange_uv(s);
}
}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif /* FF_API_XVMC */
if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
if (s->flags2 & CODEC_FLAG2_FAST) {
@@ -969,6 +974,8 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
return -1;
}
+#if FF_API_XVMC
+FF_DISABLE_DEPRECATION_WARNINGS
//if 1, we memcpy blocks in xvmcvideo
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1) {
ff_xvmc_pack_pblocks(s, cbp);
@@ -976,6 +983,8 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
exchange_uv(s);
}
}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif /* FF_API_XVMC */
if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
if (s->flags2 & CODEC_FLAG2_FAST) {
@@ -1098,10 +1107,12 @@ static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm,
}
}
+#if FF_API_XVMC
static const enum AVPixelFormat pixfmt_xvmc_mpg2_420[] = {
AV_PIX_FMT_XVMC_MPEG2_IDCT,
AV_PIX_FMT_XVMC_MPEG2_MC,
AV_PIX_FMT_NONE };
+#endif /* FF_API_XVMC */
static const enum AVPixelFormat mpeg12_hwaccel_pixfmt_list_420[] = {
#if CONFIG_MPEG2_DXVA2_HWACCEL
@@ -1122,16 +1133,19 @@ static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
Mpeg1Context *s1 = avctx->priv_data;
MpegEncContext *s = &s1->mpeg_enc_ctx;
+#if FF_API_XVMC
+FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->xvmc_acceleration)
return avctx->get_format(avctx, pixfmt_xvmc_mpg2_420);
- else {
- if (s->chroma_format < 2)
- return avctx->get_format(avctx, mpeg12_hwaccel_pixfmt_list_420);
- else if (s->chroma_format == 2)
- return AV_PIX_FMT_YUV422P;
- else
- return AV_PIX_FMT_YUV444P;
- }
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif /* FF_API_XVMC */
+
+ if (s->chroma_format < 2)
+ return avctx->get_format(avctx, mpeg12_hwaccel_pixfmt_list_420);
+ else if (s->chroma_format == 2)
+ return AV_PIX_FMT_YUV422P;
+ else
+ return AV_PIX_FMT_YUV444P;
}
/* Call this function when we know all parameters.
@@ -1229,10 +1243,13 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
avctx->pix_fmt = mpeg_get_pixelformat(avctx);
avctx->hwaccel = ff_find_hwaccel(avctx);
// until then pix_fmt may be changed right after codec init
- if (avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT ||
- avctx->hwaccel)
- if (avctx->idct_algo == FF_IDCT_AUTO)
- avctx->idct_algo = FF_IDCT_SIMPLE;
+#if FF_API_XVMC
+ if ((avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT ||
+ avctx->hwaccel) && avctx->idct_algo == FF_IDCT_AUTO)
+#else
+ if (avctx->hwaccel && avctx->idct_algo == FF_IDCT_AUTO)
+#endif /* FF_API_XVMC */
+ avctx->idct_algo = FF_IDCT_SIMPLE;
/* Quantization matrices may need reordering
* if DCT permutation is changed. */
@@ -1557,11 +1574,15 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
return -1;
}
+#if FF_API_XVMC
+FF_DISABLE_DEPRECATION_WARNINGS
// MPV_frame_start will call this function too,
// but we need to call it on every field
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
if (ff_xvmc_field_start(s, avctx) < 0)
return -1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif /* FF_API_XVMC */
return 0;
}
@@ -1662,9 +1683,13 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
}
for (;;) {
+#if FF_API_XVMC
+FF_DISABLE_DEPRECATION_WARNINGS
// If 1, we memcpy blocks in xvmcvideo.
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1)
ff_xvmc_init_block(s); // set s->block
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif /* FF_API_XVMC */
if (mpeg_decode_mb(s, s->block) < 0)
return -1;
@@ -1854,8 +1879,12 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict)
av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n");
}
+#if FF_API_XVMC
+FF_DISABLE_DEPRECATION_WARNINGS
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
ff_xvmc_field_end(s);
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif /* FF_API_XVMC */
/* end of slice reached */
if (/*s->mb_y << field_pic == s->mb_height &&*/ !s->first_field) {
@@ -1990,9 +2019,13 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
avctx->pix_fmt = mpeg_get_pixelformat(avctx);
avctx->hwaccel = ff_find_hwaccel(avctx);
- if (avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT || avctx->hwaccel)
- if (avctx->idct_algo == FF_IDCT_AUTO)
- avctx->idct_algo = FF_IDCT_SIMPLE;
+#if FF_API_XVMC
+ if ((avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT || avctx->hwaccel) &&
+ avctx->idct_algo == FF_IDCT_AUTO)
+#else
+ if (avctx->hwaccel && avctx->idct_algo == FF_IDCT_AUTO)
+#endif /* FF_API_XVMC */
+ avctx->idct_algo = FF_IDCT_SIMPLE;
if (ff_MPV_common_init(s) < 0)
return -1;
@@ -2436,6 +2469,7 @@ AVCodec ff_mpeg2video_decoder = {
.profiles = NULL_IF_CONFIG_SMALL(mpeg2_video_profiles),
};
+#if FF_API_XVMC
#if CONFIG_MPEG_XVMC_DECODER
static av_cold int mpeg_mc_decode_init(AVCodecContext *avctx)
{
@@ -2469,3 +2503,4 @@ AVCodec ff_mpeg_xvmc_decoder = {
};
#endif
+#endif /* FF_API_XVMC */
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index d609b54782..48a7320a24 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -30,6 +30,7 @@
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
+#include "libavutil/internal.h"
#include "avcodec.h"
#include "dsputil.h"
#include "internal.h"
@@ -1671,8 +1672,12 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
update_noise_reduction(s);
}
+#if FF_API_XVMC
+FF_DISABLE_DEPRECATION_WARNINGS
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
return ff_xvmc_field_start(s, avctx);
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif /* FF_API_XVMC */
return 0;
}
@@ -1682,31 +1687,37 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
void ff_MPV_frame_end(MpegEncContext *s)
{
int i;
+
+#if FF_API_XVMC
+FF_DISABLE_DEPRECATION_WARNINGS
/* redraw edges for the frame if decoding didn't complete */
// just to make sure that all data is rendered.
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) {
ff_xvmc_field_end(s);
- } else if ((s->er.error_count || s->encoding) &&
- !s->avctx->hwaccel &&
- s->unrestricted_mv &&
- s->current_picture.reference &&
- !s->intra_only &&
- !(s->flags & CODEC_FLAG_EMU_EDGE)) {
- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
- int hshift = desc->log2_chroma_w;
- int vshift = desc->log2_chroma_h;
- s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize,
- s->h_edge_pos, s->v_edge_pos,
- EDGE_WIDTH, EDGE_WIDTH,
- EDGE_TOP | EDGE_BOTTOM);
- s->dsp.draw_edges(s->current_picture.f.data[1], s->uvlinesize,
- s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,
- EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
- EDGE_TOP | EDGE_BOTTOM);
- s->dsp.draw_edges(s->current_picture.f.data[2], s->uvlinesize,
- s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,
- EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
- EDGE_TOP | EDGE_BOTTOM);
+ } else
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif /* FF_API_XVMC */
+ if ((s->er.error_count || s->encoding) &&
+ !s->avctx->hwaccel &&
+ s->unrestricted_mv &&
+ s->current_picture.reference &&
+ !s->intra_only &&
+ !(s->flags & CODEC_FLAG_EMU_EDGE)) {
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
+ int hshift = desc->log2_chroma_w;
+ int vshift = desc->log2_chroma_h;
+ s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize,
+ s->h_edge_pos, s->v_edge_pos,
+ EDGE_WIDTH, EDGE_WIDTH,
+ EDGE_TOP | EDGE_BOTTOM);
+ s->dsp.draw_edges(s->current_picture.f.data[1], s->uvlinesize,
+ s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,
+ EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
+ EDGE_TOP | EDGE_BOTTOM);
+ s->dsp.draw_edges(s->current_picture.f.data[2], s->uvlinesize,
+ s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,
+ EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
+ EDGE_TOP | EDGE_BOTTOM);
}
emms_c();
@@ -1959,10 +1970,15 @@ void MPV_decode_mb_internal(MpegEncContext *s, int16_t block[12][64],
int is_mpeg12)
{
const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
+
+#if FF_API_XVMC
+FF_DISABLE_DEPRECATION_WARNINGS
if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){
ff_xvmc_decode_mb(s);//xvmc uses pblocks
return;
}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif /* FF_API_XVMC */
if(s->avctx->debug&FF_DEBUG_DCT_COEFF) {
/* print DCT coefficients */
diff --git a/libavcodec/mpegvideo_xvmc.c b/libavcodec/mpegvideo_xvmc.c
index e95c91ff3a..ec218c2cbd 100644
--- a/libavcodec/mpegvideo_xvmc.c
+++ b/libavcodec/mpegvideo_xvmc.c
@@ -30,6 +30,9 @@
#include "xvmc.h"
#include "xvmc_internal.h"
+#include "version.h"
+
+#if FF_API_XVMC
/**
* Initialize the block field of the MpegEncContext pointer passed as
@@ -329,3 +332,5 @@ void ff_xvmc_decode_mb(MpegEncContext *s)
if (render->filled_mv_blocks_num == render->allocated_mv_blocks)
ff_mpeg_draw_horiz_band(s, 0, 0);
}
+
+#endif /* FF_API_XVMC */
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 99105e3ff7..3554113e22 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -273,7 +273,9 @@ static const AVOption avcodec_options[] = {
{"deflate", "deflate-based coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_DEFLATE }, INT_MIN, INT_MAX, V|E, "coder"},
{"context", "context model", OFFSET(context_model), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
{"slice_flags", NULL, OFFSET(slice_flags), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+#if FF_API_XVMC
{"xvmc_acceleration", NULL, OFFSET(xvmc_acceleration), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+#endif /* FF_API_XVMC */
{"mbd", "macroblock decision algorithm (high quality mode)", OFFSET(mb_decision), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "mbd"},
{"simple", "use mbcmp (default)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MB_DECISION_SIMPLE }, INT_MIN, INT_MAX, V|E, "mbd"},
{"bits", "use fewest bits", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MB_DECISION_BITS }, INT_MIN, INT_MAX, V|E, "mbd"},
diff --git a/libavcodec/version.h b/libavcodec/version.h
index c36efce239..993d57ac9c 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -97,5 +97,8 @@
#ifndef FF_API_ARCH_ALPHA
#define FF_API_ARCH_ALPHA (LIBAVCODEC_VERSION_MAJOR < 56)
#endif
+#ifndef FF_API_XVMC
+#define FF_API_XVMC (LIBAVCODEC_VERSION_MAJOR < 56)
+#endif
#endif /* AVCODEC_VERSION_H */
diff --git a/libavcodec/x86/dsputil_init.c b/libavcodec/x86/dsputil_init.c
index cc35d240a0..aa4e37bf2f 100644
--- a/libavcodec/x86/dsputil_init.c
+++ b/libavcodec/x86/dsputil_init.c
@@ -611,11 +611,15 @@ static av_cold void dsputil_init_sse(DSPContext *c, AVCodecContext *avctx,
const int high_bit_depth = avctx->bits_per_raw_sample > 8;
if (!high_bit_depth) {
+#if FF_API_XVMC
if (!(CONFIG_MPEG_XVMC_DECODER && avctx->xvmc_acceleration > 1)) {
/* XvMCCreateBlocks() may not allocate 16-byte aligned blocks */
- c->clear_block = ff_clear_block_sse;
- c->clear_blocks = ff_clear_blocks_sse;
+#endif /* FF_API_XVMC */
+ c->clear_block = ff_clear_block_sse;
+ c->clear_blocks = ff_clear_blocks_sse;
+#if FF_API_XVMC
}
+#endif /* FF_API_XVMC */
}
c->vector_clipf = ff_vector_clipf_sse;
diff --git a/libavcodec/xvmc.h b/libavcodec/xvmc.h
index 1f77e4efca..950ed18276 100644
--- a/libavcodec/xvmc.h
+++ b/libavcodec/xvmc.h
@@ -29,8 +29,12 @@
#include <X11/extensions/XvMC.h>
+#include "libavutil/attributes.h"
+#include "version.h"
#include "avcodec.h"
+#if FF_API_XVMC
+
/**
* @defgroup lavc_codec_hwaccel_xvmc XvMC
* @ingroup lavc_codec_hwaccel
@@ -41,7 +45,7 @@
#define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct
the number is 1337 speak for the letters IDCT MCo (motion compensation) */
-struct xvmc_pix_fmt {
+attribute_deprecated struct xvmc_pix_fmt {
/** The field contains the special constant value AV_XVMC_ID.
It is used as a test that the application correctly uses the API,
and that there is no corruption caused by pixel routines.
@@ -165,4 +169,6 @@ struct xvmc_pix_fmt {
* @}
*/
+#endif /* FF_API_XVMC */
+
#endif /* AVCODEC_XVMC_H */
diff --git a/libavcodec/xvmc_internal.h b/libavcodec/xvmc_internal.h
index 3c6aed8361..9018e4a40a 100644
--- a/libavcodec/xvmc_internal.h
+++ b/libavcodec/xvmc_internal.h
@@ -23,6 +23,9 @@
#include "avcodec.h"
#include "mpegvideo.h"
+#include "version.h"
+
+#if FF_API_XVMC
void ff_xvmc_init_block(MpegEncContext *s);
void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp);
@@ -30,4 +33,6 @@ int ff_xvmc_field_start(MpegEncContext*s, AVCodecContext *avctx);
void ff_xvmc_field_end(MpegEncContext *s);
void ff_xvmc_decode_mb(MpegEncContext *s);
+#endif /* FF_API_XVMC */
+
#endif /* AVCODEC_XVMC_INTERNAL_H */