Go to the documentation of this file.
24 #include <vdpau/vdpau.h>
43 #ifdef VDP_YCBCR_FORMAT_P016
59 #ifdef VDP_YCBCR_FORMAT_Y_U_V_444
62 #ifdef VDP_YCBCR_FORMAT_P016
76 #ifdef VDP_YCBCR_FORMAT_P016
141 if (err == VDP_STATUS_OK && supported)
152 #define GET_CALLBACK(id, result) \
155 err = hwctx->get_proc_address(hwctx->device, id, &tmp); \
156 if (err != VDP_STATUS_OK) { \
157 av_log(ctx, AV_LOG_ERROR, "Error getting the " #id " callback.\n"); \
158 return AVERROR_UNKNOWN; \
170 GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES,
196 const void *hwconfig,
200 int nb_sw_formats = 0;
228 VdpVideoSurface surf = (VdpVideoSurface)(uintptr_t)
data;
241 VdpVideoSurface surf;
245 ctx->width,
ctx->height, &surf);
246 if (err != VDP_STATUS_OK) {
321 "No target formats are supported for this chroma type\n");
339 VdpVideoSurface surf = (VdpVideoSurface)(uintptr_t)
src->data[3];
342 uint32_t linesize[3];
345 VdpYCbCrFormat vdpau_format;
353 "The linesize %d cannot be represented as uint32\n",
369 "Unsupported target pixel format: %s\n",
374 if ((vdpau_format == VDP_YCBCR_FORMAT_YV12)
375 #ifdef VDP_YCBCR_FORMAT_Y_U_V_444
376 || (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444)
378 #ifdef VDP_YCBCR_FORMAT_P016
379 || (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444_16)
384 err = priv->
get_data(surf, vdpau_format,
data, linesize);
385 if (err != VDP_STATUS_OK) {
397 VdpVideoSurface surf = (VdpVideoSurface)(uintptr_t)dst->
data[3];
400 uint32_t linesize[3];
403 VdpYCbCrFormat vdpau_format;
409 if (
src->linesize[
i] < 0 ||
src->linesize[
i] > UINT32_MAX) {
411 "The linesize %d cannot be represented as uint32\n",
415 linesize[
i] =
src->linesize[
i];
427 "Unsupported source pixel format: %s\n",
432 if ((vdpau_format == VDP_YCBCR_FORMAT_YV12)
433 #ifdef VDP_YCBCR_FORMAT_Y_U_V_444
434 || (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444)
439 err = priv->
put_data(surf, vdpau_format,
data, linesize);
440 if (err != VDP_STATUS_OK) {
449 #include <vdpau/vdpau_x11.h>
450 #include <X11/Xlib.h>
452 typedef struct VDPAUDevicePriv {
453 VdpDeviceDestroy *device_destroy;
460 VDPAUDevicePriv *priv =
ctx->user_opaque;
462 if (priv->device_destroy)
463 priv->device_destroy(hwctx->
device);
465 XCloseDisplay(priv->dpy);
474 VDPAUDevicePriv *priv;
476 VdpGetInformationString *get_information_string;
477 const char *display, *vendor;
483 ctx->user_opaque = priv;
484 ctx->free = vdpau_device_free;
486 priv->dpy = XOpenDisplay(device);
489 XDisplayName(device));
492 display = XDisplayString(priv->dpy);
494 err = vdp_device_create_x11(priv->dpy, XDefaultScreen(priv->dpy),
496 if (err != VDP_STATUS_OK) {
502 GET_CALLBACK(VDP_FUNC_ID_GET_INFORMATION_STRING, get_information_string);
503 GET_CALLBACK(VDP_FUNC_ID_DEVICE_DESTROY, priv->device_destroy);
505 get_information_string(&vendor);
507 "X11 display %s\n", vendor, display);
521 .device_create = vdpau_device_create,
AVBufferPool * pool_internal
AVPixelFormat
Pixel format.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
uint8_t * data
The data buffer.
static int vdpau_frames_init(AVHWFramesContext *ctx)
enum AVPixelFormat pix_fmt
This structure describes decoded (raw) audio or video data.
enum AVPixelFormat * pix_fmts
#define AV_PIX_FMT_YUV420P10
VdpGetProcAddress * get_proc_address
enum AVPixelFormat * pix_fmts[FF_ARRAY_ELEMS(vdpau_pix_fmts)]
This struct is allocated as AVHWDeviceContext.hwctx.
#define AV_LOG_VERBOSE
Detailed information.
VdpChromaType chroma_type
enum AVPixelFormat * valid_hw_formats
A list of possible values for format in the hw_frames_ctx, terminated by AV_PIX_FMT_NONE.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
This struct describes the constraints on hardware frames attached to a given device with a hardware-s...
static void vdpau_buffer_free(void *opaque, uint8_t *data)
static const VDPAUPixFmtMap pix_fmts_422[]
VdpVideoSurfaceGetBitsYCbCr * get_data
AVBufferPool * av_buffer_pool_init2(size_t size, void *opaque, AVBufferRef *(*alloc)(void *opaque, size_t size), void(*pool_free)(void *opaque))
Allocate and initialize a buffer pool with a more complex allocator.
static const struct @373 vdpau_pix_fmts[]
VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities * get_transfer_caps
static int count_pixfmts(const VDPAUPixFmtMap *map)
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
#define AV_PIX_FMT_YUV444P10
static FFHWFramesContext * ffhwframesctx(AVHWFramesContext *ctx)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
enum AVPixelFormat * valid_sw_formats
A list of possible values for sw_format in the hw_frames_ctx, terminated by AV_PIX_FMT_NONE.
AVBufferRef * av_buffer_pool_get(AVBufferPool *pool)
Allocate a new AVBuffer, reusing an old buffer from the pool when available.
#define AV_PIX_FMT_YUV444P16
#define AV_BUFFER_FLAG_READONLY
Always treat the buffer as read-only, even when it has only one reference.
static enum AVPixelFormat pix_fmt
static AVBufferRef * vdpau_pool_alloc(void *opaque, size_t size)
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
enum AVPixelFormat frames_sw_format
static const VDPAUPixFmtMap pix_fmts_420[]
static int vdpau_frames_get_constraints(AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints)
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
const HWContextType ff_hwcontext_type_vdpau
#define AV_PIX_FMT_YUV422P10
AVBufferRef * av_buffer_create(uint8_t *data, size_t size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
VdpVideoSurfaceDestroy * surf_destroy
static void vdpau_device_uninit(AVHWDeviceContext *ctx)
#define AV_PIX_FMT_YUV444P12
AVVDPAUDeviceContext p
The public AVVDPAUDeviceContext.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
@ AV_PIX_FMT_NV16
interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
VdpVideoSurfacePutBitsYCbCr * put_data
VdpChromaType chroma_type
@ AV_PIX_FMT_VDPAU
HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface.
#define i(width, name, range_min, range_max)
#define av_malloc_array(a, b)
static int vdpau_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static int vdpau_transfer_get_formats(AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats)
AVHWFrameTransferDirection
This struct describes a set or pool of "hardware" frames (i.e.
static const VDPAUPixFmtMap pix_fmts_444[]
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
#define FFSWAP(type, a, b)
#define AV_PIX_FMT_YUV420P12
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
static int vdpau_init_pixmfts(AVHWDeviceContext *ctx)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static int vdpau_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
VdpVideoSurfaceGetBitsYCbCr * get_data
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
A reference to a data buffer.
static int vdpau_device_init(AVHWDeviceContext *ctx)
const VDPAUPixFmtMap * map
int nb_pix_fmts[FF_ARRAY_ELEMS(vdpau_pix_fmts)]
static int vdpau_get_buffer(AVHWFramesContext *ctx, AVFrame *frame)
VdpVideoSurfaceCreate * surf_create
#define flags(name, subs,...)
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
VdpVideoSurfacePutBitsYCbCr * put_data
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
#define GET_CALLBACK(id, result)