24#include "config_components.h"
45 case VDP_STATUS_NO_IMPLEMENTATION:
47 case VDP_STATUS_DISPLAY_PREEMPTED:
49 case VDP_STATUS_INVALID_HANDLE:
51 case VDP_STATUS_INVALID_POINTER:
53 case VDP_STATUS_RESOURCES:
55 case VDP_STATUS_HANDLE_DEVICE_MISMATCH:
57 case VDP_STATUS_ERROR:
78 t = VDP_CHROMA_TYPE_420;
84 t = VDP_CHROMA_TYPE_422;
92 t = VDP_CHROMA_TYPE_444;
132 VdpVideoSurfaceQueryCapabilities *surface_query_caps;
133 VdpDecoderQueryCapabilities *decoder_query_caps;
135 VdpGetInformationString *info;
136 const char *info_string;
140 uint32_t max_level, max_mb, max_width, max_height;
146 vdctx->
width = UINT32_MAX;
147 vdctx->
height = UINT32_MAX;
158 vdctx->
device = VDP_INVALID_HANDLE;
169 type != VDP_CHROMA_TYPE_420)
193 VDP_FUNC_ID_GET_INFORMATION_STRING,
195 if (status != VDP_STATUS_OK)
200 status = info(&info_string);
201 if (status != VDP_STATUS_OK)
205 int driver_version = 0;
206 sscanf(info_string,
"NVIDIA VDPAU Driver Shared Library %d", &driver_version);
207 if (driver_version < 410) {
214 VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES,
216 if (status != VDP_STATUS_OK)
219 surface_query_caps =
func;
221 status = surface_query_caps(vdctx->
device,
type, &supported,
222 &max_width, &max_height);
223 if (status != VDP_STATUS_OK)
225 if (supported != VDP_TRUE ||
230 VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES,
232 if (status != VDP_STATUS_OK)
235 decoder_query_caps =
func;
237 status = decoder_query_caps(vdctx->
device,
profile, &supported, &max_level,
238 &max_mb, &max_width, &max_height);
239#ifdef VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE
240 if ((status != VDP_STATUS_OK || supported != VDP_TRUE) &&
profile == VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE) {
241 profile = VDP_DECODER_PROFILE_H264_MAIN;
242 status = decoder_query_caps(vdctx->
device,
profile, &supported,
244 &max_width, &max_height);
247 if (status != VDP_STATUS_OK)
250 if (supported != VDP_TRUE || max_level <
level ||
256 if (status != VDP_STATUS_OK)
263 if (status != VDP_STATUS_OK)
270 if (status == VDP_STATUS_OK) {
285 if (vdctx->
device == VDP_INVALID_HANDLE)
287 if (vdctx->
width == UINT32_MAX && vdctx->
height == UINT32_MAX)
291 VDP_FUNC_ID_DECODER_DESTROY, &
func);
292 if (status != VDP_STATUS_OK)
306 if (vdctx->
device == VDP_INVALID_HANDLE)
352#if CONFIG_MPEG1_VDPAU_HWACCEL || \
353 CONFIG_MPEG2_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL || \
354 CONFIG_VC1_VDPAU_HWACCEL || CONFIG_WMV3_VDPAU_HWACCEL
374 const uint8_t *buf, uint32_t
size)
386 buffers->struct_version = VDP_BITSTREAM_BUFFER_VERSION;
387 buffers->bitstream = buf;
388 buffers->bitstream_bytes =
size;
393 VdpGetProcAddress *get_proc,
unsigned flags)
405 memset(hwctx, 0,
sizeof(*hwctx));
static double val(void *priv, double ch)
Libavcodec external API header.
#define flags(name, subs,...)
int ff_decode_get_hw_frames_ctx(AVCodecContext *avctx, enum AVHWDeviceType dev_type)
Make sure avctx.hw_frames_ctx is set.
int(* init)(AVBSFContext *ctx)
av_cold int ff_vdpau_common_uninit(AVCodecContext *avctx)
int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic_ctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device, VdpGetProcAddress *get_proc, unsigned flags)
Associate a VDPAU device with a codec context for hardware acceleration.
av_cold int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, int level)
int ff_vdpau_add_buffer(struct vdpau_picture_context *pic_ctx, const uint8_t *buf, uint32_t size)
static int vdpau_error(VdpStatus status)
static int ff_vdpau_common_reinit(AVCodecContext *avctx)
int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame, struct vdpau_picture_context *pic_ctx)
int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type, uint32_t *width, uint32_t *height)
Gets the parameters to create an adequate VDPAU video surface for the codec context using VDPAU hardw...
int ff_vdpau_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
#define AV_HWACCEL_FLAG_IGNORE_LEVEL
Hardware acceleration should be used for decoding even if the codec level used is unknown or higher t...
#define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH
Hardware acceleration should still be attempted for decoding when the codec profile does not match th...
#define AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH
Hardware acceleration can output YUV pixel formats with a different chroma sampling than 4:2:0 and/or...
#define AV_LOG_VERBOSE
Detailed information.
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing.
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
#define FF_HW_SIMPLE_CALL(avctx, function)
static av_cold void uninit(AVBitStreamFilterContext *ctx)
common internal api header.
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Memory handling functions.
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
mpegvideo decoder header.
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P12
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
@ AV_PIX_FMT_VDPAU
HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface.
#define AV_PIX_FMT_YUV444P10
static struct ResampleContext * create(struct ResampleContext *c, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff, enum AVSampleFormat format, enum SwrFilterType filter_type, double kaiser_beta, double precision, int cheby, int exact_rational)
static void destroy(struct ResampleContext **c)
A reference to a data buffer.
uint8_t * data
The data buffer.
main external API structure.
int hwaccel_flags
Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated decoding (if active).
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
AVBufferRef * hw_frames_ctx
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames.
int refs
number of reference frames
void * hwaccel_context
Legacy hardware accelerator context.
int coded_width
Bitstream width / height, may be different from width/height e.g.
struct AVCodecInternal * internal
Private context used for internal data.
void * hwaccel_priv_data
hwaccel-specific private data
This structure describes decoded (raw) audio or video data.
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
This struct describes a set or pool of "hardware" frames (i.e.
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
int width
The allocated dimensions of the frames in this pool.
AVHWDeviceContext * device_ctx
The parent AVHWDeviceContext.
This structure is used to share data between the libavcodec library and the client video application.
VdpDecoder decoder
VDPAU decoder handle.
VdpDecoderRender * render
VDPAU decoder render callback.
This struct is allocated as AVHWDeviceContext.hwctx.
VdpGetProcAddress * get_proc_address
void * hwaccel_picture_private
RefStruct reference for hardware accelerator private data.
VdpDecoder decoder
VDPAU decoder handle.
VdpDevice device
VDPAU device handle.
VdpGetProcAddress * get_proc_address
VDPAU device driver.
VdpDecoderRender * render
VDPAU decoder render callback.
VdpGetProcAddress * get_proc_address
union VDPAUPictureInfo info
VDPAU picture information.
VdpBitstreamBuffer * bitstream_buffers
Table of bitstream buffers.
int bitstream_buffers_allocated
Allocated size of the bitstream_buffers table.
int bitstream_buffers_used
Useful bitstream buffers in the bitstream buffers table.
Public libavcodec VDPAU header.
int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx)
static uintptr_t ff_vdpau_get_surface_id(AVFrame *pic)
Extract VdpVideoSurface from an AVFrame.