Intel-Media-SDK / MediaSDK

The Intel® Media SDK
MIT License
926 stars 457 forks source link

How to share the OpenGL texture from MSDK output buffer? #2990

Open dyang23 opened 1 year ago

dyang23 commented 1 year ago

System information

Feature Information

Describe the feature and expected behavior

I am working on a windows project, which will use OpenGL as renderer, I will call MSDK to decode video streams, by default the MSDK output DXVA output surface, I need copy it to system buffer, then load to OpenGL texture, it take times, so I am wondering how to make the MSDK output to the OpenGL texture directly? It can save more source if we can make it.

Customer usage and impact for this feature

Android Customers.

Additional context Add any other context or screenshots about the feature request here.

dmitryermilov commented 1 year ago

Hi Dong, Long time no see:) I can advise a direction how to implement this on application side. Please look at https://github.com/Microsoft/angle/wiki/Interop-with-other-DirectX-code . Generally the idea is we need to create d3d11 texture with "shared" attributes, extract a native handle from it, create OGL surfaces from the native handle. In MSDK surfaces creattion is done on app side, so it's in app control with which flags surfaces are created. Please also note that OGL renderer most likely operates with RGB but decoders usually (except jpeg) outputs NV12/P010 etc. So after decoder you'll need a VPP to make color conversion.