21 #include <vdpau/vdpau.h>
22 #include <vdpau/vdpau_x11.h>
45 #if 1 // for ffmpegs older vdpau API, not the oldest though
80 XCloseDisplay(ctx->
dpy);
90 VdpVideoSurface surface = *(VdpVideoSurface*)data;
101 VdpVideoSurface *surface;
103 VdpChromaType chroma;
118 if (!frame->
buf[0]) {
128 if (err != VDP_STATUS_OK) {
142 VdpVideoSurface surface = (VdpVideoSurface)(uintptr_t)frame->
data[3];
146 int ret, chroma_type;
151 if (err != VDP_STATUS_OK) {
168 if (err != VDP_STATUS_OK) {
204 const char *display, *vendor;
223 av_log(
NULL, loglevel,
"Cannot open the X11 display %s.\n",
227 display = XDisplayString(ctx->
dpy);
229 err = vdp_device_create_x11(ctx->
dpy, XDefaultScreen(ctx->
dpy), &ctx->
device,
231 if (err != VDP_STATUS_OK) {
232 av_log(
NULL, loglevel,
"VDPAU device creation on X11 display %s failed.\n",
237 #define GET_CALLBACK(id, result) \
240 err = ctx->get_proc_address(ctx->device, id, &tmp); \
241 if (err != VDP_STATUS_OK) { \
242 av_log(NULL, loglevel, "Error getting the " #id " callback.\n"); \
248 GET_CALLBACK(VDP_FUNC_ID_GET_ERROR_STRING, get_error_string);
249 GET_CALLBACK(VDP_FUNC_ID_GET_INFORMATION_STRING, get_information_string);
250 GET_CALLBACK(VDP_FUNC_ID_DEVICE_DESTROY, device_destroy);
252 GET_CALLBACK(VDP_FUNC_ID_DECODER_CREATE, decoder_create);
254 GET_CALLBACK(VDP_FUNC_ID_DECODER_RENDER, decoder_render);
256 GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_CREATE, video_surface_create);
257 GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, video_surface_destroy);
258 GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR, video_surface_get_bits);
259 GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS, video_surface_get_parameters);
260 GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES,
261 video_surface_query);
267 if (err != VDP_STATUS_OK) {
269 "Error querying VDPAU surface capabilities: %s\n",
278 "No supported VDPAU format for retrieving the data.\n");
297 "to decode input stream #%d:%d.\n", vendor,
303 av_log(
NULL, loglevel,
"VDPAU init failed for stream #%d:%d.\n",
328 av_log(
NULL, loglevel,
"No known VDPAU decoder profile for this stream.\n");
338 if (err != VDP_STATUS_OK) {
339 av_log(
NULL, loglevel,
"Error creating the VDPAU decoder: %s\n",