how to handle chroma == "dx11" ?

This forum is about all development around libVLC.
roc1
New Cone
New Cone
Posts: 5
Joined: 13 Feb 2019 09:56

how to handle chroma == "dx11" ?

Postby roc1 » 13 Feb 2019 10:09

With libVLC 2.2.8, I was handling I420, but with version 3.0.x a new "dx11" format is provided first. I have been unable to find a way to handle it. In my app I ultimately need to copy the decoded video to a standard D3D11 texture.

Things I tried:

- return 1 from video_format_cb() when chroma is "dx11", but this is immediately followed by a callback to the same with a different format.
- passing a shared dx11 surface as **planes in video_lock_cb(), which is seemingly never touched by the library.
- return 0 for all formats except I420 (fall back to system memory copies), but even though this appears to work on the surface, the buffers I provide at video_lock_cb() are not modified. I verified the logic by swapping the 2.2.8 libVLC dll, and playback worked.

Please suggest the right approach here. Some sample code would be very helpful. I am targeting Windows 7+ with recent GPUs.

Thanks for providing and improving the library.

User avatar
John Aeliya
New Cone
New Cone
Posts: 4
Joined: 14 Feb 2019 09:52

Re: how to handle chroma == "dx11" ?

Postby John Aeliya » 15 Feb 2019 07:47

you can try with Keying (DX11.TextureFX)Chromakey DX11 for guest.v4p 7 (26.0 KB)

roc1
New Cone
New Cone
Posts: 5
Joined: 13 Feb 2019 09:56

Re: how to handle chroma == "dx11" ?

Postby roc1 » 16 Feb 2019 20:46

Sorry, I don't understand, please elaborate.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: how to handle chroma == "dx11" ?

Postby Jean-Baptiste Kempf » 16 Feb 2019 23:32

Sorry, I don't understand, please elaborate.

dx11 is an opaque format, representing the D3D11 hardware surface.

How are you getting this ?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

roc1
New Cone
New Cone
Posts: 5
Joined: 13 Feb 2019 09:56

Re: how to handle chroma == "dx11" ?

Postby roc1 » 17 Feb 2019 10:10

I get this in the libvlc_video_format_cb callback, as the text in the first char* argument. I actually would like to get the internal surface so I can skip the copy from video memory to CPU memory and then back to video memory. Is that possible? The other issue is that regardless of what I return or set the chroma to, with VLC 3.0.x, the surfaces are not modified when the unlock callback is called. The same identical code works fine in 2.2.8. Why could that be?

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: how to handle chroma == "dx11" ?

Postby Jean-Baptiste Kempf » 17 Feb 2019 17:52

Yes, but you need to read the code of the direct3d11 video output, to know what data is in: this is opaque.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

roc1
New Cone
New Cone
Posts: 5
Joined: 13 Feb 2019 09:56

Re: how to handle chroma == "dx11" ?

Postby roc1 » 18 Feb 2019 00:30

Okay, thanks, I presume you are pointing me to:

modules\video_output\win32\direct3d11.c

but the API there is quite different from the library interface. If I can get a hold of the DX11 surface, I will play with until I figure out the opaque format. But for now, I am stuck on what to do in video_format_cb, video_lock_cb and video_unlock_cb, so I get this DX11 surface in the first place.

roc1
New Cone
New Cone
Posts: 5
Joined: 13 Feb 2019 09:56

Re: how to handle chroma == "dx11" ?

Postby roc1 » 18 Feb 2019 01:05

Also when trying to accept the DX11 by returning 1, I get this as debug spew:

Code: Select all

unsigned video_format_cb(char *chroma, unsigned *width, unsigned *height, unsigned *pitches, unsigned *lines) { const DWORD dx11 = MAKEFOURCC('D', 'X', '1', '1'); if (*(DWORD *)chroma == dx11) { return 1; } }

Code: Select all

main vout display debug: A filter to adapt decoder DX11 to display DX11 is needed A filter to adapt decoder DX11 to display DX11 is needed main filter debug: looking for video converter module matching "any": 24 candidates looking for video converter module matching "any": 24 candidates main filter debug: no video converter modules matched no video converter modules matched main vout display error: Failed to create video converter Failed to create video converter main vout display error: Failed to adapt decoder format to display Failed to adapt decoder format to display main vout display debug: removing module "vmem" removing module "vmem" main video output error: video output creation failed video output creation failed

Rémi Denis-Courmont
Developer
Developer
Posts: 15258
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: how to handle chroma == "dx11" ?

Postby Rémi Denis-Courmont » 18 Feb 2019 17:25

NEVER return a format that you do not know or understand. Either fail or override with a known format.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 7 guests