- GET_CALLBACK(VDP_FUNC_ID_GET_ERROR_STRING, get_error_string);
- GET_CALLBACK(VDP_FUNC_ID_GET_INFORMATION_STRING, get_information_string);
- GET_CALLBACK(VDP_FUNC_ID_DEVICE_DESTROY, device_destroy);
- if (vdpau_api_ver == 1) {
- GET_CALLBACK(VDP_FUNC_ID_DECODER_CREATE, decoder_create);
- GET_CALLBACK(VDP_FUNC_ID_DECODER_DESTROY, decoder_destroy);
- GET_CALLBACK(VDP_FUNC_ID_DECODER_RENDER, decoder_render);
- }
- GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_CREATE, video_surface_create);
- GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, video_surface_destroy);
- GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR, video_surface_get_bits);
- GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS, video_surface_get_parameters);
- GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES,
- video_surface_query);
-
- for (i = 0; i < FF_ARRAY_ELEMS(vdpau_formats); i++) {
- VdpBool supported;
- err = ctx->video_surface_query(ctx->device, VDP_CHROMA_TYPE_420,
- vdpau_formats[i][0], &supported);
- if (err != VDP_STATUS_OK) {
- av_log(NULL, loglevel,
- "Error querying VDPAU surface capabilities: %s\n",
- ctx->get_error_string(err));
- goto fail;
- }
- if (supported)
- break;
- }
- if (i == FF_ARRAY_ELEMS(vdpau_formats)) {
- av_log(NULL, loglevel,
- "No supported VDPAU format for retrieving the data.\n");
- return AVERROR(EINVAL);
- }
- ctx->vdpau_format = vdpau_formats[i][0];
- ctx->pix_fmt = vdpau_formats[i][1];
-
- if (vdpau_api_ver == 1) {
- vdpau_ctx = av_vdpau_alloc_context();
- if (!vdpau_ctx)
- goto fail;
- vdpau_ctx->render = ctx->decoder_render;
-
- s->hwaccel_context = vdpau_ctx;
- } else
- if (av_vdpau_bind_context(s, ctx->device, ctx->get_proc_address,
- AV_HWACCEL_FLAG_IGNORE_LEVEL))
+ 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);
+ if (ret < 0)