From 44e065d56c87d6a9d0effccec5f31517f72924ec Mon Sep 17 00:00:00 2001 From: RĂ©mi Denis-Courmont Date: Sat, 12 Jan 2013 17:53:43 +0200 Subject: vdpau: Add context and common helpers for hwaccel support Signed-off-by: Diego Biurrun --- libavcodec/vdpau.h | 69 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 6 deletions(-) (limited to 'libavcodec/vdpau.h') diff --git a/libavcodec/vdpau.h b/libavcodec/vdpau.h index 241ff19051..7e692f767b 100644 --- a/libavcodec/vdpau.h +++ b/libavcodec/vdpau.h @@ -52,6 +52,68 @@ #include #include +union VdpPictureInfo { + VdpPictureInfoH264 h264; + VdpPictureInfoMPEG1Or2 mpeg; + VdpPictureInfoVC1 vc1; + VdpPictureInfoMPEG4Part2 mpeg4; +}; + +/** + * This structure is used to share data between the libavcodec library and + * the client video application. + * The user shall zero-allocate the structure and make it available as + * AVCodecContext.hwaccel_context. Members can be set by the user once + * during initialization or through each AVCodecContext.get_buffer() + * function call. In any case, they must be valid prior to calling + * decoding functions. + */ +typedef struct AVVDPAUContext { + /** + * VDPAU decoder handle + * + * Set by user. + */ + VdpDecoder decoder; + + /** + * VDPAU decoder render callback + * + * Set by the user. + */ + VdpDecoderRender *render; + + /** + * VDPAU picture information + * + * Set by libavcodec. + */ + union VdpPictureInfo info; + + /** + * Allocated size of the bitstream_buffers table. + * + * Set by libavcodec. + */ + int bitstream_buffers_allocated; + + /** + * Useful bitstream buffers in the bitstream buffers table. + * + * Set by libavcodec. + */ + int bitstream_buffers_used; + + /** + * Table of bitstream buffers. + * The user is responsible for freeing this buffer using av_freep(). + * + * Set by libavcodec. + */ + VdpBitstreamBuffer *bitstream_buffers; +} AVVDPAUContext; + + /** @brief The videoSurface is used for rendering. */ #define FF_VDPAU_STATE_USED_FOR_RENDER 1 @@ -74,12 +136,7 @@ struct vdpau_render_state { int state; ///< Holds FF_VDPAU_STATE_* values. /** picture parameter information for all supported codecs */ - union VdpPictureInfo { - VdpPictureInfoH264 h264; - VdpPictureInfoMPEG1Or2 mpeg; - VdpPictureInfoVC1 vc1; - VdpPictureInfoMPEG4Part2 mpeg4; - } info; + union VdpPictureInfo info; /** Describe size/location of the compressed video data. Set to 0 when freeing bitstream_buffers. */ -- cgit v1.2.3