diff options
author | Anton Khirnov <anton@khirnov.net> | 2014-03-24 01:59:02 +0100 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2014-05-11 15:00:03 +0200 |
commit | 67afcefb35932b420998f6f3fda46c7c85848a3f (patch) | |
tree | e69ca44ea9510ddd96112d9f2b3ecc20b06b07a2 /libavcodec/vda.h | |
parent | 31a46750c7eafe6bce6a3e4f09853cd0a585292b (diff) | |
download | ffmpeg-67afcefb35932b420998f6f3fda46c7c85848a3f.tar.gz |
lavc: Add new VDA hwaccel
It leverages the new hwaccel 1.2 features:
- get_buffer2 is never called
- the internal context is automatically initialized/deinitialized
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec/vda.h')
-rw-r--r-- | libavcodec/vda.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/libavcodec/vda.h b/libavcodec/vda.h index 1189e41fb5..9aa5d297fb 100644 --- a/libavcodec/vda.h +++ b/libavcodec/vda.h @@ -29,6 +29,7 @@ * Public libavcodec VDA header. */ +#include "libavcodec/avcodec.h" #include "libavcodec/version.h" #include <stdint.h> @@ -136,6 +137,58 @@ int ff_vda_create_decoder(struct vda_context *vda_ctx, int ff_vda_destroy_decoder(struct vda_context *vda_ctx); /** + * This struct holds all the information that needs to be passed + * between the caller and libavcodec for initializing VDA decoding. + * Its size is not a part of the public ABI, it must be allocated with + * av_vda_alloc_context() and freed with av_free(). + */ +typedef struct AVVDAContext { + /** + * VDA decoder object. Created and freed by the caller. + */ + VDADecoder decoder; + + /** + * The output callback that must be passed to VDADecoderCreate. + * Set by av_vda_alloc_context(). + */ + VDADecoderOutputCallback output_callback; +} AVVDAContext; + +/** + * Allocate and initialize a VDA context. + * + * This function should be called from the get_format() callback when the caller + * selects the AV_PIX_FMT_VDA format. The caller must then create the decoder + * object (using the output callback provided by libavcodec) that will be used + * for VDA-accelerated decoding. + * + * When decoding with VDA is finished, the caller must destroy the decoder + * object and free the VDA context using av_free(). + * + * @return the newly allocated context or NULL on failure + */ +AVVDAContext *av_vda_alloc_context(void); + +/** + * This is a convenience function that creates and sets up the VDA context using + * an internal implementation. + * + * @param avctx the corresponding codec context + * + * @return >= 0 on success, a negative AVERROR code on failure + */ +int av_vda_default_init(AVCodecContext *avctx); + +/** + * This function must be called to free the VDA context initialized with + * av_vda_default_init(). + * + * @param avctx the corresponding codec context + */ +void av_vda_default_free(AVCodecContext *avctx); + +/** * @} */ |