- device_priv->dpy = XOpenDisplay(ist->hwaccel_device);
- if (!device_priv->dpy) {
- av_log(NULL, loglevel, "Cannot open the X11 display %s.\n",
- XDisplayName(ist->hwaccel_device));
- goto fail;
- }
- display = XDisplayString(device_priv->dpy);
-
- err = vdp_device_create_x11(device_priv->dpy, XDefaultScreen(device_priv->dpy),
- &device, &get_proc_address);
- if (err != VDP_STATUS_OK) {
- av_log(NULL, loglevel, "VDPAU device creation on X11 display %s failed.\n",
- display);
- goto fail;
- }
-
-#define GET_CALLBACK(id, result) \
-do { \
- void *tmp; \
- err = get_proc_address(device, id, &tmp); \
- if (err != VDP_STATUS_OK) { \
- av_log(NULL, loglevel, "Error getting the " #id " callback.\n"); \
- goto fail; \
- } \
- result = tmp; \
-} while (0)
-
- GET_CALLBACK(VDP_FUNC_ID_GET_INFORMATION_STRING, get_information_string);
- GET_CALLBACK(VDP_FUNC_ID_DEVICE_DESTROY, device_priv->device_destroy);
-
- device_ref = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_VDPAU);
- if (!device_ref)
- goto fail;
- device_ctx = (AVHWDeviceContext*)device_ref->data;
- device_hwctx = device_ctx->hwctx;
- device_ctx->user_opaque = device_priv;
- device_ctx->free = device_free;
- device_hwctx->device = device;
- device_hwctx->get_proc_address = get_proc_address;
-
- device_priv = NULL;
-
- ret = av_hwdevice_ctx_init(device_ref);