Go to the documentation of this file.
24 #include <vdpau/vdpau.h>
76 #ifdef VDP_YCBCR_FORMAT_Y_U_V_444
122 if (err == VDP_STATUS_OK && supported)
133 #define GET_CALLBACK(id, result) \
136 err = hwctx->get_proc_address(hwctx->device, id, &tmp); \
137 if (err != VDP_STATUS_OK) { \
138 av_log(ctx, AV_LOG_ERROR, "Error getting the " #id " callback.\n"); \
139 return AVERROR_UNKNOWN; \
151 GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES,
177 const void *hwconfig,
181 int nb_sw_formats = 0;
209 VdpVideoSurface surf = (VdpVideoSurface)(uintptr_t)
data;
222 VdpVideoSurface surf;
226 ctx->width,
ctx->height, &surf);
227 if (err != VDP_STATUS_OK) {
301 "No target formats are supported for this chroma type\n");
319 VdpVideoSurface surf = (VdpVideoSurface)(uintptr_t)
src->data[3];
322 uint32_t linesize[3];
325 VdpYCbCrFormat vdpau_format;
333 "The linesize %d cannot be represented as uint32\n",
349 "Unsupported target pixel format: %s\n",
354 if ((vdpau_format == VDP_YCBCR_FORMAT_YV12)
355 #ifdef VDP_YCBCR_FORMAT_Y_U_V_444
356 || (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444)
361 err = priv->
get_data(surf, vdpau_format,
data, linesize);
362 if (err != VDP_STATUS_OK) {
374 VdpVideoSurface surf = (VdpVideoSurface)(uintptr_t)dst->
data[3];
377 uint32_t linesize[3];
380 VdpYCbCrFormat vdpau_format;
386 if (
src->linesize[
i] < 0 ||
src->linesize[
i] > UINT32_MAX) {
388 "The linesize %d cannot be represented as uint32\n",
392 linesize[
i] =
src->linesize[
i];
404 "Unsupported source pixel format: %s\n",
409 if ((vdpau_format == VDP_YCBCR_FORMAT_YV12)
410 #ifdef VDP_YCBCR_FORMAT_Y_U_V_444
411 || (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444)
416 err = priv->
put_data(surf, vdpau_format,
data, linesize);
417 if (err != VDP_STATUS_OK) {
426 #include <vdpau/vdpau_x11.h>
427 #include <X11/Xlib.h>
429 typedef struct VDPAUDevicePriv {
430 VdpDeviceDestroy *device_destroy;
437 VDPAUDevicePriv *priv =
ctx->user_opaque;
439 if (priv->device_destroy)
440 priv->device_destroy(hwctx->
device);
442 XCloseDisplay(priv->dpy);
451 VDPAUDevicePriv *priv;
453 VdpGetInformationString *get_information_string;
454 const char *display, *vendor;
460 ctx->user_opaque = priv;
461 ctx->free = vdpau_device_free;
463 priv->dpy = XOpenDisplay(device);
466 XDisplayName(device));
469 display = XDisplayString(priv->dpy);
471 err = vdp_device_create_x11(priv->dpy, XDefaultScreen(priv->dpy),
473 if (err != VDP_STATUS_OK) {
479 GET_CALLBACK(VDP_FUNC_ID_GET_INFORMATION_STRING, get_information_string);
480 GET_CALLBACK(VDP_FUNC_ID_DEVICE_DESTROY, priv->device_destroy);
482 get_information_string(&vendor);
484 "X11 display %s\n", vendor, display);
499 .device_create = vdpau_device_create,
enum AVPixelFormat * pix_fmts[3]
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
#define FFSWAP(type, a, b)
static int vdpau_frames_init(AVHWFramesContext *ctx)
enum AVPixelFormat pix_fmt
This structure describes decoded (raw) audio or video data.
enum AVPixelFormat * pix_fmts
VdpGetProcAddress * get_proc_address
This struct is allocated as AVHWDeviceContext.hwctx.
#define AV_LOG_VERBOSE
Detailed information.
AVBufferRef * av_buffer_create(uint8_t *data, int size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
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.
AVFormatInternal * internal
An opaque field for libavformat internal usage.
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 const struct @301 vdpau_pix_fmts[]
static void vdpau_buffer_free(void *opaque, uint8_t *data)
static const VDPAUPixFmtMap pix_fmts_422[]
VdpVideoSurfaceGetBitsYCbCr * get_data
static AVBufferRef * vdpau_pool_alloc(void *opaque, int size)
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_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int device_init(AVFormatContext *ctx, int *width, int *height, uint32_t pixelformat)
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_BUFFER_FLAG_READONLY
Always treat the buffer as read-only, even when it has only one reference.
static enum AVPixelFormat pix_fmts[]
static enum AVPixelFormat pix_fmt
@ 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
VdpVideoSurfaceDestroy * surf_destroy
static void vdpau_device_uninit(AVHWDeviceContext *ctx)
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...
AVBufferPool * av_buffer_pool_init2(int size, void *opaque, AVBufferRef *(*alloc)(void *opaque, int size), void(*pool_free)(void *opaque))
Allocate and initialize a buffer pool with a more complex allocator.
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...
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
#define FF_ARRAY_ELEMS(a)
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
static int vdpau_get_buffer(AVHWFramesContext *ctx, AVFrame *frame)
VdpVideoSurfaceCreate * surf_create
#define flags(name, subs,...)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
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)