diff options
author | RĂ©mi Denis-Courmont <remi@remlab.net> | 2014-10-14 12:59:54 +0300 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2014-10-15 06:21:56 +0000 |
commit | d565fef1b83b6c5f8afb32229260b79f67c68109 (patch) | |
tree | 41e5ec95bdd57b55a43c4f73b2c2f2b4145e4f24 /libavcodec | |
parent | c1724623ce0433c6a9ee72133b1fd4db75ec7193 (diff) | |
download | ffmpeg-d565fef1b83b6c5f8afb32229260b79f67c68109.tar.gz |
vdpau: add AV_HWACCEL_FLAG_IGNORE_LEVEL to skip the codec level check
Decoding acceleration may work even if the codec level is higher than
the stated limit of the VDPAU driver. Or the problem may be considered
acceptable by the user. This flag allows skipping the codec level
capability checks and proceed with decoding.
Applications should obviously not set this flag by default, but only if
the user explicitly requested this behavior (and presumably knows how
to turn it back off if it fails).
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/avcodec.h | 14 | ||||
-rw-r--r-- | libavcodec/vdpau.c | 7 | ||||
-rw-r--r-- | libavcodec/vdpau.h | 2 | ||||
-rw-r--r-- | libavcodec/vdpau_internal.h | 1 | ||||
-rw-r--r-- | libavcodec/version.h | 2 |
5 files changed, 21 insertions, 5 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index a24ce407c9..8e6c019b62 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2900,7 +2900,8 @@ typedef struct AVCodec { } AVCodec; /** - * AVHWAccel. + * @defgroup lavc_hwaccel AVHWAccel + * @{ */ typedef struct AVHWAccel { /** @@ -3025,6 +3026,17 @@ typedef struct AVHWAccel { } AVHWAccel; /** + * Hardware acceleration should be used for decoding even if the codec level + * used is unknown or higher than the maximum supported level reported by the + * hardware driver. + */ +#define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 << 0) + +/** + * @} + */ + +/** * @defgroup lavc_picture AVPicture * * Functions for working with AVPicture diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 9805a8d0b1..1d68e70b47 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -94,7 +94,9 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, vdctx->device = hwctx->device; vdctx->get_proc_address = hwctx->get_proc_address; - if (level < 0) + if (hwctx->flags & AV_HWACCEL_FLAG_IGNORE_LEVEL) + level = 0; + else if (level < 0) return AVERROR(ENOTSUP); status = vdctx->get_proc_address(vdctx->device, @@ -313,7 +315,7 @@ int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device, { VDPAUHWContext *hwctx; - if (flags != 0) + if (flags & ~AV_HWACCEL_FLAG_IGNORE_LEVEL) return AVERROR(EINVAL); if (av_reallocp(&avctx->hwaccel_context, sizeof(*hwctx))) @@ -325,6 +327,7 @@ int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device, hwctx->context.decoder = VDP_INVALID_HANDLE; hwctx->device = device; hwctx->get_proc_address = get_proc; + hwctx->flags = flags; hwctx->reset = 1; return 0; } diff --git a/libavcodec/vdpau.h b/libavcodec/vdpau.h index 1714b1e1fb..24c3b02c02 100644 --- a/libavcodec/vdpau.h +++ b/libavcodec/vdpau.h @@ -143,7 +143,7 @@ typedef struct AVVDPAUContext { * @param avctx decoding context whose get_format() callback is invoked * @param device VDPAU device handle to use for hardware acceleration * @param get_proc_address VDPAU device driver - * @param flags for future use, must be zero + * @param flags zero of more OR'd AV_HWACCEL_FLAG_* flags * * @return 0 on success, an AVERROR code on failure. */ diff --git a/libavcodec/vdpau_internal.h b/libavcodec/vdpau_internal.h index 69cd455160..16493b0741 100644 --- a/libavcodec/vdpau_internal.h +++ b/libavcodec/vdpau_internal.h @@ -53,6 +53,7 @@ typedef struct VDPAUHWContext { VdpDevice device; VdpGetProcAddress *get_proc_address; char reset; + unsigned char flags; } VDPAUHWContext; typedef struct VDPAUContext { diff --git a/libavcodec/version.h b/libavcodec/version.h index c44686d6ec..097dee392b 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 56 -#define LIBAVCODEC_VERSION_MINOR 3 +#define LIBAVCODEC_VERSION_MINOR 4 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |