From c220a60f92dde9c7c118fc4deddff5c1f617cda9 Mon Sep 17 00:00:00 2001 From: Rémi Denis-Courmont Date: Fri, 19 Dec 2014 19:15:09 +0200 Subject: vdpau: add helper for surface chroma type and size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the VDPAU pixel format does not distinguish between different VDPAU video surface chroma types, we need another way to pass this data to the application. Originally VDPAU in libavcodec only supported decoding to 8-bits YUV with 4:2:0 chroma sampling. Correspondingly, applications assumed that libavcodec expected VDP_CHROMA_TYPE_420 video surfaces for output. However some of the new HEVC profiles proposed for addition to VDPAU would require different depth and/or sampling: http://lists.freedesktop.org/archives/vdpau/2014-July/000167.html ...as would lossless AVC profiles: http://lists.freedesktop.org/archives/vdpau/2014-November/000241.html To preserve backward binary compatibility with existing applications, a new av_vdpau_bind_context() flag is introduced in a further change. Signed-off-by: Rémi Denis-Courmont Signed-off-by: Anton Khirnov --- libavcodec/vdpau.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'libavcodec/vdpau.h') diff --git a/libavcodec/vdpau.h b/libavcodec/vdpau.h index 24c3b02c02..4e5c3518e3 100644 --- a/libavcodec/vdpau.h +++ b/libavcodec/vdpau.h @@ -150,6 +150,26 @@ typedef struct AVVDPAUContext { int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device, VdpGetProcAddress *get_proc_address, unsigned flags); +/** + * Gets the parameters to create an adequate VDPAU video surface for the codec + * context using VDPAU hardware decoding acceleration. + * + * @note Behavior is undefined if the context was not successfully bound to a + * VDPAU device using av_vdpau_bind_context(). + * + * @param avctx the codec context being used for decoding the stream + * @param type storage space for the VDPAU video surface chroma type + * (or NULL to ignore) + * @param width storage space for the VDPAU video surface pixel width + * (or NULL to ignore) + * @param height storage space for the VDPAU video surface pixel height + * (or NULL to ignore) + * + * @return 0 on success, a negative AVERROR code on failure. + */ +int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type, + uint32_t *width, uint32_t *height); + /** * Allocate an AVVDPAUContext. * -- cgit v1.2.3