aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-14 03:13:39 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-11-14 03:26:35 +0100
commit5231eecdafff38d0b604c028be08f8fb78d55e53 (patch)
tree325e3398888cbae2afcef0f3c91dc8a347f53168
parente25ed2608c960302d6f4832a5435c9672d78e282 (diff)
parent19e30a58fc8ee6187a0bc14aff7f566a13c81421 (diff)
downloadffmpeg-5231eecdafff38d0b604c028be08f8fb78d55e53.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: Deprecate obsolete XvMC hardware decoding support Conflicts: libavcodec/mpeg12.c libavcodec/mpeg12dec.c libavcodec/mpegvideo.c libavcodec/options_table.h libavutil/pixdesc.c libavutil/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--doc/general.texi1
-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.c35
-rw-r--r--libavcodec/mpegvideo.c33
-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
-rw-r--r--libavutil/old_pix_fmts.h2
-rw-r--r--libavutil/pixdesc.c3
-rw-r--r--libavutil/pixfmt.h2
-rw-r--r--libavutil/version.h3
18 files changed, 123 insertions, 18 deletions
diff --git a/doc/general.texi b/doc/general.texi
index 775e437d00..3aecb1250a 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -663,7 +663,6 @@ following image formats are supported:
@item Mobotix MxPEG video @tab @tab X
@item Motion Pixels video @tab @tab X
@item MPEG-1 video @tab X @tab X
-@item MPEG-1/2 video XvMC (X-Video Motion Compensation) @tab @tab X
@item MPEG-2 video @tab X @tab X
@item MPEG-4 part 2 @tab X @tab X
@tab libxvidcore can be used alternatively for encoding.
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 3bf59c67e2..2507eeeaf8 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) \
{ \
@@ -189,7 +190,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 b3d99b0074..f2a3c69de2 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -105,7 +105,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,
@@ -754,8 +756,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.
@@ -1665,12 +1669,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 4cf30fc03d..c62734f69d 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -21,10 +21,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 */
@@ -42,6 +42,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"),
.props = AV_CODEC_PROP_LOSSY,
},
+#if FF_API_XVMC
{
.id = AV_CODEC_ID_MPEG2VIDEO_XVMC,
.type = AVMEDIA_TYPE_VIDEO,
@@ -49,6 +50,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 23180dc273..55c68a5901 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
@@ -697,11 +699,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;
@@ -1173,9 +1179,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 dad3d4c276..09b1f19e48 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -40,7 +40,6 @@
#include "mpeg12data.h"
#include "bytestream.h"
#include "vdpau_internal.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 372d18f083..913a400a68 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -38,6 +38,7 @@
#include "vdpau_internal.h"
#include "xvmc_internal.h"
#include "thread.h"
+#include "version.h"
typedef struct Mpeg1Context {
MpegEncContext mpeg_enc_ctx;
@@ -773,6 +774,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
@@ -780,6 +783,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) {
@@ -992,6 +997,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);
@@ -999,6 +1006,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) {
@@ -1122,10 +1131,12 @@ static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm,
}
static const enum AVPixelFormat mpeg1_hwaccel_pixfmt_list_420[] = {
+#if FF_API_XVMC
#if CONFIG_MPEG_XVMC_DECODER
AV_PIX_FMT_XVMC_MPEG2_IDCT,
AV_PIX_FMT_XVMC_MPEG2_MC,
#endif
+#endif /* FF_API_XVMC */
#if CONFIG_MPEG1_VDPAU_HWACCEL
AV_PIX_FMT_VDPAU_MPEG1,
AV_PIX_FMT_VDPAU,
@@ -1135,10 +1146,12 @@ static const enum AVPixelFormat mpeg1_hwaccel_pixfmt_list_420[] = {
};
static const enum AVPixelFormat mpeg2_hwaccel_pixfmt_list_420[] = {
+#if FF_API_XVMC
#if CONFIG_MPEG_XVMC_DECODER
AV_PIX_FMT_XVMC_MPEG2_IDCT,
AV_PIX_FMT_XVMC_MPEG2_MC,
#endif
+#endif /* FF_API_XVMC */
#if CONFIG_MPEG2_VDPAU_HWACCEL
AV_PIX_FMT_VDPAU_MPEG2,
AV_PIX_FMT_VDPAU,
@@ -1175,14 +1188,22 @@ static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
static void setup_hwaccel_for_pixfmt(AVCodecContext *avctx)
{
+#if FF_API_XVMC
+FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->pix_fmt != AV_PIX_FMT_XVMC_MPEG2_IDCT && avctx->pix_fmt != AV_PIX_FMT_XVMC_MPEG2_MC) {
avctx->xvmc_acceleration = 0;
} else if (!avctx->xvmc_acceleration) {
avctx->xvmc_acceleration = 2;
}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif /* FF_API_XVMC */
avctx->hwaccel = ff_find_hwaccel(avctx);
// until then pix_fmt may be changed right after codec init
+#if FF_API_XVMC
if (avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT ||
+#else
+ if (
+#endif
avctx->hwaccel || uses_vdpau(avctx))
if (avctx->idct_algo == FF_IDCT_AUTO)
avctx->idct_algo = FF_IDCT_SIMPLE;
@@ -1598,11 +1619,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;
}
@@ -1705,9 +1730,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;
@@ -1909,8 +1938,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 && !s->first_slice) {
@@ -2598,6 +2631,7 @@ AVCodec ff_mpegvideo_decoder = {
.max_lowres = 3,
};
+#if FF_API_XVMC
#if CONFIG_MPEG_XVMC_DECODER
static av_cold int mpeg_mc_decode_init(AVCodecContext *avctx)
{
@@ -2631,6 +2665,7 @@ AVCodec ff_mpeg_xvmc_decoder = {
};
#endif
+#endif /* FF_API_XVMC */
#if CONFIG_MPEG_VDPAU_DECODER
AVCodec ff_mpeg_vdpau_decoder = {
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 6f3e38d3e3..d343166b9a 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 "h264chroma.h"
@@ -1710,8 +1711,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;
}
@@ -1720,19 +1725,24 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
* frame has been coded/decoded. */
void ff_MPV_frame_end(MpegEncContext *s)
{
+#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->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) &&
- !s->avctx->hwaccel &&
- !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&
- s->unrestricted_mv &&
- s->current_picture.reference &&
- !s->intra_only &&
- !(s->flags & CODEC_FLAG_EMU_EDGE) &&
- !s->avctx->lowres
- ) {
+ } else
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif /* FF_API_XVMC */
+ if ((s->er.error_count || s->encoding || !(s->avctx->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) &&
+ !s->avctx->hwaccel &&
+ !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&
+ s->unrestricted_mv &&
+ s->current_picture.reference &&
+ !s->intra_only &&
+ !(s->flags & CODEC_FLAG_EMU_EDGE) &&
+ !s->avctx->lowres
+ ) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
int hshift = desc->log2_chroma_w;
int vshift = desc->log2_chroma_h;
@@ -2667,10 +2677,15 @@ void MPV_decode_mb_internal(MpegEncContext *s, int16_t block[12][64],
int lowres_flag, 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 6b0c6acbd9..664c0089a1 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 39c25d1ad9..ee2b2ffe80 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -281,7 +281,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 }, 0, 2, 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 3ce9ad4f08..0d18626935 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -117,5 +117,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 e5e756615a..89f4068462 100644
--- a/libavcodec/x86/dsputil_init.c
+++ b/libavcodec/x86/dsputil_init.c
@@ -601,11 +601,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 b2bf518d0c..efd69fc913 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 04197cefae..6a60add965 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 */
diff --git a/libavutil/old_pix_fmts.h b/libavutil/old_pix_fmts.h
index 3ee8aec145..cd1ed7c19f 100644
--- a/libavutil/old_pix_fmts.h
+++ b/libavutil/old_pix_fmts.h
@@ -44,8 +44,10 @@
PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range
PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range
PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range
+#if FF_API_XVMC
PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
PIX_FMT_XVMC_MPEG2_IDCT,
+#endif /* FF_API_XVMC */
PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 9a33000e61..0cb2f34f57 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -29,6 +29,7 @@
#include "internal.h"
#include "intreadwrite.h"
#include "avstring.h"
+#include "version.h"
void av_read_image_line(uint16_t *dst,
const uint8_t *data[4], const int linesize[4],
@@ -313,6 +314,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
},
.flags = AV_PIX_FMT_FLAG_PLANAR,
},
+#if FF_API_XVMC
[AV_PIX_FMT_XVMC_MPEG2_MC] = {
.name = "xvmcmc",
.flags = AV_PIX_FMT_FLAG_HWACCEL,
@@ -321,6 +323,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
.name = "xvmcidct",
.flags = AV_PIX_FMT_FLAG_HWACCEL,
},
+#endif /* FF_API_XVMC */
[AV_PIX_FMT_UYVY422] = {
.name = "uyvy422",
.nb_components = 3,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 7b17a4f0c4..3d32d3eec9 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -80,8 +80,10 @@ enum AVPixelFormat {
AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range
AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range
AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range
+#if FF_API_XVMC
AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
AV_PIX_FMT_XVMC_MPEG2_IDCT,
+#endif /* FF_API_XVMC */
AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
diff --git a/libavutil/version.h b/libavutil/version.h
index 2e2f5710ba..bd5e7b88e3 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -144,6 +144,9 @@
#ifndef FF_API_OLD_OPENCL
#define FF_API_OLD_OPENCL (LIBAVUTIL_VERSION_MAJOR < 53)
#endif
+#ifndef FF_API_XVMC
+#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
/**
* @}