yading@10: /* yading@10: * The Video Decode and Presentation API for UNIX (VDPAU) is used for yading@10: * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1. yading@10: * yading@10: * Copyright (C) 2008 NVIDIA yading@10: * yading@10: * This file is part of FFmpeg. yading@10: * yading@10: * FFmpeg is free software; you can redistribute it and/or yading@10: * modify it under the terms of the GNU Lesser General Public yading@10: * License as published by the Free Software Foundation; either yading@10: * version 2.1 of the License, or (at your option) any later version. yading@10: * yading@10: * FFmpeg is distributed in the hope that it will be useful, yading@10: * but WITHOUT ANY WARRANTY; without even the implied warranty of yading@10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU yading@10: * Lesser General Public License for more details. yading@10: * yading@10: * You should have received a copy of the GNU Lesser General Public yading@10: * License along with FFmpeg; if not, write to the Free Software yading@10: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA yading@10: */ yading@10: yading@10: #ifndef AVCODEC_VDPAU_H yading@10: #define AVCODEC_VDPAU_H yading@10: yading@10: /** yading@10: * @file yading@10: * @ingroup lavc_codec_hwaccel_vdpau yading@10: * Public libavcodec VDPAU header. yading@10: */ yading@10: yading@10: yading@10: /** yading@10: * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer yading@10: * @ingroup lavc_codec_hwaccel yading@10: * yading@10: * VDPAU hardware acceleration has two modules yading@10: * - VDPAU decoding yading@10: * - VDPAU presentation yading@10: * yading@10: * The VDPAU decoding module parses all headers using FFmpeg yading@10: * parsing mechanisms and uses VDPAU for the actual decoding. yading@10: * yading@10: * As per the current implementation, the actual decoding yading@10: * and rendering (API calls) are done as part of the VDPAU yading@10: * presentation (vo_vdpau.c) module. yading@10: * yading@10: * @{ yading@10: */ yading@10: yading@10: #include yading@10: #include yading@10: #include "libavutil/avconfig.h" yading@10: yading@10: union FFVdpPictureInfo { yading@10: VdpPictureInfoH264 h264; yading@10: VdpPictureInfoMPEG1Or2 mpeg; yading@10: VdpPictureInfoVC1 vc1; yading@10: VdpPictureInfoMPEG4Part2 mpeg4; yading@10: }; yading@10: yading@10: /** yading@10: * This structure is used to share data between the libavcodec library and yading@10: * the client video application. yading@10: * The user shall zero-allocate the structure and make it available as yading@10: * AVCodecContext.hwaccel_context. Members can be set by the user once yading@10: * during initialization or through each AVCodecContext.get_buffer() yading@10: * function call. In any case, they must be valid prior to calling yading@10: * decoding functions. yading@10: */ yading@10: typedef struct AVVDPAUContext { yading@10: /** yading@10: * VDPAU decoder handle yading@10: * yading@10: * Set by user. yading@10: */ yading@10: VdpDecoder decoder; yading@10: yading@10: /** yading@10: * VDPAU decoder render callback yading@10: * yading@10: * Set by the user. yading@10: */ yading@10: VdpDecoderRender *render; yading@10: yading@10: /** yading@10: * VDPAU picture information yading@10: * yading@10: * Set by libavcodec. yading@10: */ yading@10: union FFVdpPictureInfo info; yading@10: yading@10: /** yading@10: * Allocated size of the bitstream_buffers table. yading@10: * yading@10: * Set by libavcodec. yading@10: */ yading@10: int bitstream_buffers_allocated; yading@10: yading@10: /** yading@10: * Useful bitstream buffers in the bitstream buffers table. yading@10: * yading@10: * Set by libavcodec. yading@10: */ yading@10: int bitstream_buffers_used; yading@10: yading@10: /** yading@10: * Table of bitstream buffers. yading@10: * The user is responsible for freeing this buffer using av_freep(). yading@10: * yading@10: * Set by libavcodec. yading@10: */ yading@10: VdpBitstreamBuffer *bitstream_buffers; yading@10: } AVVDPAUContext; yading@10: yading@10: yading@10: /** @brief The videoSurface is used for rendering. */ yading@10: #define FF_VDPAU_STATE_USED_FOR_RENDER 1 yading@10: yading@10: /** yading@10: * @brief The videoSurface is needed for reference/prediction. yading@10: * The codec manipulates this. yading@10: */ yading@10: #define FF_VDPAU_STATE_USED_FOR_REFERENCE 2 yading@10: yading@10: /** yading@10: * @brief This structure is used as a callback between the FFmpeg yading@10: * decoder (vd_) and presentation (vo_) module. yading@10: * This is used for defining a video frame containing surface, yading@10: * picture parameter, bitstream information etc which are passed yading@10: * between the FFmpeg decoder and its clients. yading@10: */ yading@10: struct vdpau_render_state { yading@10: VdpVideoSurface surface; ///< Used as rendered surface, never changed. yading@10: yading@10: int state; ///< Holds FF_VDPAU_STATE_* values. yading@10: yading@10: #if AV_HAVE_INCOMPATIBLE_FORK_ABI yading@10: /** picture parameter information for all supported codecs */ yading@10: union FFVdpPictureInfo info; yading@10: #endif yading@10: yading@10: /** Describe size/location of the compressed video data. yading@10: Set to 0 when freeing bitstream_buffers. */ yading@10: int bitstream_buffers_allocated; yading@10: int bitstream_buffers_used; yading@10: /** The user is responsible for freeing this buffer using av_freep(). */ yading@10: VdpBitstreamBuffer *bitstream_buffers; yading@10: yading@10: #if !AV_HAVE_INCOMPATIBLE_FORK_ABI yading@10: /** picture parameter information for all supported codecs */ yading@10: union FFVdpPictureInfo info; yading@10: #endif yading@10: }; yading@10: yading@10: /* @}*/ yading@10: yading@10: #endif /* AVCODEC_VDPAU_H */