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).
---
doc/APIchanges | 3 +++
libavcodec/vdpau.c | 7 +++++--
libavcodec/vdpau.h | 11 +++++++++--
libavcodec/version.h | 2 +-
4 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index 3df116e..6348b9a 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2014-08-09
API changes, most recent first:
+2014-09-xx - xxxxxxx - lavc 56.3.0 - vdpau.h
+ Add AV_VDPAU_FLAG_IGNORE_LEVEL flag to av_vdpau_bind_context().
+
2014-09-xx - xxxxxxx - lavc 56.2.0 - vdpau.h
Add av_vdpau_bind_context(). This function should now be used for creating
(or resetting) a AVVDPAUContext instead of av_vdpau_alloc_context().
diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
index 722f053..ae06d7d 100644
--- a/libavcodec/vdpau.c
+++ b/libavcodec/vdpau.c
@@ -92,7 +92,9 @@ int ff_vdpau_common_init(AVCodecContext *avctx,
VdpDecoderProfile profile,
return 0; /* Decoder created by user */
}
- if (level < 0)
+ if (hwctx->flags & AV_VDPAU_FLAG_IGNORE_LEVEL)
+ level = 0;
+ else if (level < 0)
return AVERROR(ENOTSUP);
status = vdctx->get_proc_address(vdctx->device,
@@ -124,7 +126,7 @@ int ff_vdpau_common_init(AVCodecContext *avctx,
VdpDecoderProfile profile,
if (status != VDP_STATUS_OK)
return vdpau_error(status);
- if (supported != VDP_TRUE || max_level < level ||
+ if (supported != VDP_TRUE ||max_level < level ||
max_width < width || max_height < height)
return AVERROR(ENOTSUP);
@@ -321,6 +323,7 @@ int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice
device,
memset(hwctx, 0, sizeof(*hwctx));
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 fea2856..e19f3c8 100644
--- a/libavcodec/vdpau.h
+++ b/libavcodec/vdpau.h
@@ -137,7 +137,8 @@ typedef struct AVVDPAUContext {
*/
VdpDevice device;
VdpGetProcAddress *get_proc_address;
- int reset;
+ unsigned char flags;
+ char reset;
} AVVDPAUContext;
/**
@@ -153,7 +154,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_VDPAU_FLAG_* flags
*
* @return 0 on success, an AVERROR code on failure.
*/
@@ -161,6 +162,12 @@ int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice
device,
VdpGetProcAddress *get_proc_address, unsigned flags);
/**
+ * VDPAU should be used for decoding even if the codec level used is unknown
+ * or higher than the maximum supported level reported by the VDPAU driver.
+ */
+#define AV_VDPAU_FLAG_IGNORE_LEVEL (1 << 0)
+
+/**
* Allocate an AVVDPAUContext.
*
* @return Newly-allocated AVVDPAUContext or NULL on failure.
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 849c4b2..d9c4500 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 2
+#define LIBAVCODEC_VERSION_MINOR 3
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
--
1.8.1.5
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel