summaryrefslogtreecommitdiff
path: root/libavcodec/decode.h
diff options
context:
space:
mode:
authorwm4 <nfxjfg@googlemail.com>2017-10-19 16:38:20 +0200
committerAnton Khirnov <anton@khirnov.net>2017-10-19 17:10:59 +0200
commitb46a77f19ddc4b2b5fa3187835ceb602a5244e24 (patch)
tree7ed4627e4115b6c3e588527779e459dd24623ffb /libavcodec/decode.h
parentec0f4fa17ce29cf01d4def21041b0b87f7e3105d (diff)
lavc: external hardware frame pool initialization
This adds a new API, which allows the API user to query the required AVHWFramesContext parameters. This also reduces code duplication across the hwaccels by introducing ff_decode_get_hw_frames_ctx(), which uses the new API function. It takes care of initializing the hw_frames_ctx if needed, and does additional error handling and API usage checking. Support for VDA and Cuvid missing. Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec/decode.h')
-rw-r--r--libavcodec/decode.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/decode.h b/libavcodec/decode.h
index 235f355f82..37b2e45c63 100644
--- a/libavcodec/decode.h
+++ b/libavcodec/decode.h
@@ -23,6 +23,7 @@
#include "libavutil/buffer.h"
#include "libavutil/frame.h"
+#include "libavutil/hwcontext.h"
#include "avcodec.h"
@@ -70,4 +71,12 @@ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt);
void ff_decode_bsfs_uninit(AVCodecContext *avctx);
+/**
+ * Make sure avctx.hw_frames_ctx is set. If it's not set, the function will
+ * try to allocate it from hw_device_ctx. If that is not possible, an error
+ * message is printed, and an error code is returned.
+ */
+int ff_decode_get_hw_frames_ctx(AVCodecContext *avctx,
+ enum AVHWDeviceType dev_type);
+
#endif /* AVCODEC_DECODE_H */