[Libav-user] customize d3d11va decoder

Benjamin de la Fuente Ranea bfuente at nebula-ent.com
Fri Dec 14 23:31:24 EET 2018


I'm using ffmpeg to decode mp4 videos in hwaccel mode with d3d11va and I'm
trying to draw the decoded surface (NV12 format) to the screen using DX11,
without copying the surface to CPU and upload again to another texture. For
this I need to add D3D11_BIND_SHADER_RESOURCE to
hw_frames_ctx->hwctx->BindFlags. These flags are used to create the
internal Texture2DArray with all the surfaces needed to decode by ffmpeg,
but I can't find a way to do it without modifying ffmpeg source code.

The way I modify ffmpeg is removing the const qualifier to the declaration
and definition of the ff_hwcontext_type_d3d11va struct in
hwcontext_d3d11va.c and hwcontext_internal.h, so in my user code I can
change all the hooks, in particular "frames_init" function pointer to a
custom function that add the D3D11_BIND_SHADER_RESOURCE to the BindFlags
and then calls the original d3d11va_frames_init function.

I'm not sure if there is any other better way to do this. Does anyone knows
something that can be useful?

Thank you in advance, have a nice weekend.

*Benjamín de la Fuente *• *3D Senior Programmer*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20181214/8b94661d/attachment.html>

More information about the Libav-user mailing list