44 case VDP_STATUS_NO_IMPLEMENTATION:
46 case VDP_STATUS_DISPLAY_PREEMPTED:
48 case VDP_STATUS_INVALID_HANDLE:
50 case VDP_STATUS_INVALID_POINTER:
52 case VDP_STATUS_RESOURCES:
54 case VDP_STATUS_HANDLE_DEVICE_MISMATCH:
56 case VDP_STATUS_ERROR:
75 t = VDP_CHROMA_TYPE_420;
81 t = VDP_CHROMA_TYPE_422;
87 t = VDP_CHROMA_TYPE_444;
108 VdpVideoSurfaceQueryCapabilities *surface_query_caps;
109 VdpDecoderQueryCapabilities *decoder_query_caps;
110 VdpDecoderCreate *create;
114 uint32_t max_level, max_mb, max_width, max_height;
119 vdctx->
width = UINT32_MAX;
120 vdctx->
height = UINT32_MAX;
126 vdctx->
device = VDP_INVALID_HANDLE;
142 type != VDP_CHROMA_TYPE_420)
146 VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES,
148 if (status != VDP_STATUS_OK)
151 surface_query_caps =
func;
153 status = surface_query_caps(vdctx->
device, type, &supported,
154 &max_width, &max_height);
155 if (status != VDP_STATUS_OK)
157 if (supported != VDP_TRUE ||
158 max_width < width || max_height < height)
162 VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES,
164 if (status != VDP_STATUS_OK)
167 decoder_query_caps =
func;
169 status = decoder_query_caps(vdctx->
device, profile, &supported, &max_level,
170 &max_mb, &max_width, &max_height);
171 #ifdef VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE 172 if ((status != VDP_STATUS_OK || supported != VDP_TRUE) && profile == VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE) {
173 profile = VDP_DECODER_PROFILE_H264_MAIN;
174 status = decoder_query_caps(vdctx->
device, profile, &supported,
176 &max_width, &max_height);
179 if (status != VDP_STATUS_OK)
182 if (supported != VDP_TRUE || max_level < level ||
183 max_width < width || max_height < height)
188 if (status != VDP_STATUS_OK)
195 if (status != VDP_STATUS_OK)
200 status = create(vdctx->
device, profile, width, height, avctx->
refs,
202 if (status == VDP_STATUS_OK) {
213 VdpDecoderDestroy *destroy;
217 if (vdctx->
device == VDP_INVALID_HANDLE)
219 if (vdctx->
width == UINT32_MAX && vdctx->
height == UINT32_MAX)
223 VDP_FUNC_ID_DECODER_DESTROY, &func);
224 if (status != VDP_STATUS_OK)
229 status = destroy(vdctx->
decoder);
238 if (vdctx->
device == VDP_INVALID_HANDLE)
278 #if CONFIG_MPEG1_VDPAU_HWACCEL || \ 279 CONFIG_MPEG2_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL || \ 280 CONFIG_VC1_VDPAU_HWACCEL || CONFIG_WMV3_VDPAU_HWACCEL 310 buffers->struct_version = VDP_BITSTREAM_BUFFER_VERSION;
311 buffers->bitstream = buf;
312 buffers->bitstream_bytes =
size;
316 #if FF_API_VDPAU_PROFILE 319 #define PROFILE(prof) \ 321 *profile = VDP_DECODER_PROFILE_##prof; \ 331 default:
return AVERROR(EINVAL);
338 default:
return AVERROR(EINVAL);
346 #ifdef VDP_DECODER_PROFILE_H264_EXTENDED 349 default:
return AVERROR(EINVAL);
357 default:
return AVERROR(EINVAL);
371 VdpGetProcAddress *get_proc,
unsigned flags)
383 memset(hwctx, 0,
sizeof(*hwctx));
#define FF_PROFILE_H264_MAIN
#define FF_PROFILE_MPEG4_SIMPLE
#define FF_PROFILE_MPEG2_MAIN
This structure describes decoded (raw) audio or video data.
VdpDevice device
VDPAU device handle.
int coded_width
Bitstream width / height, may be different from width/height e.g.
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
VdpGetProcAddress * get_proc_address
VdpDecoder decoder
VDPAU decoder handle.
int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic_ctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
#define FF_PROFILE_H264_INTRA
int bitstream_buffers_used
Useful bitstream buffers in the bitstream buffers table.
Public libavcodec VDPAU header.
AVVDPAUContext * av_vdpau_alloc_context(void)
Allocate an AVVDPAUContext.
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
int(* uninit)(AVCodecContext *avctx)
Uninitialize the hwaccel private data.
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...
struct AVHWAccel * hwaccel
Hardware accelerator in use.
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
VdpBitstreamBuffer * bitstream_buffers
Table of bitstream buffers.
#define FF_PROFILE_H264_BASELINE
int ff_vdpau_common_uninit(AVCodecContext *avctx)
void * hwaccel_context
Hardware accelerator context.
VdpGetProcAddress * get_proc_address
VDPAU device driver.
int av_reallocp(void *ptr, size_t size)
Allocate or reallocate a block of memory.
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
VdpDecoder decoder
VDPAU decoder handle.
#define FF_PROFILE_H264_EXTENDED
int(* init)(AVCodecContext *avctx)
Initialize the hwaccel private data.
int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile)
Get a decoder profile that should be used for initializing a VDPAU decoder.
#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_HIGH_DEPTH
Hardware acceleration can output YUV pixel formats with a different chroma sampling than 4:2:0 and/or...
int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, int level)
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given block if it is not large enough, otherwise do nothing.
This structure is used to share data between the libavcodec library and the client video application...
#define FF_PROFILE_H264_HIGH
int bitstream_buffers_allocated
Allocated size of the bitstream_buffers table.
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int refs
number of reference frames
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
#define FF_PROFILE_VC1_MAIN
Picture * current_picture_ptr
pointer to the current picture
void * hwaccel_picture_private
Hardware accelerator private data.
static int vdpau_error(VdpStatus status)
H.264 / AVC / MPEG-4 part10 codec.
#define FF_PROFILE_VC1_SIMPLE
preferred ID for MPEG-1/2 video decoding
Libavcodec external API header.
int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx)
main external API structure.
#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE
VdpDecoderRender * render
VDPAU decoder render callback.
VdpDecoderRender * render
VDPAU decoder render callback.
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.
struct AVCodecContext * avctx
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal api header.
int ff_vdpau_add_buffer(struct vdpau_picture_context *pic_ctx, const uint8_t *buf, uint32_t size)
void * hwaccel_priv_data
hwaccel-specific private data
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame, struct vdpau_picture_context *pic_ctx)
#define FF_PROFILE_VC1_ADVANCED
struct AVCodecInternal * internal
Private context used for internal data.
union VDPAUPictureInfo info
VDPAU picture information.
#define FF_PROFILE_MPEG2_SIMPLE
#define FF_PROFILE_H264_CONSTRAINED_BASELINE
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static int ff_vdpau_common_reinit(AVCodecContext *avctx)
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
static uintptr_t ff_vdpau_get_surface_id(AVFrame *pic)
Extract VdpVideoSurface from an AVFrame.