I have a C++ DLL which uses ffmepg to read a video. When it gets a picture, I transmit AVFrame (and put it to RGB24 format with sws_scale) to C# code thanks to a callback.
I try to display this picture with DirectX (Texture texture = Texture.FromMemory(..) ). When I convert the AVFrame to bmp, it's working but the image loses alpha canal. I would like use directly AVFrame->data but DirectX do not know how manage it !
Is someone knowning how to display an AVFrame in DirectX ?
I would like to display keyframe and the others frame.
2 replies to this topic
Crossbones+ - Reputation: 6989
Posted 13 March 2012 - 12:27 PM
It's hard to tell you what you're doing wrong without seeing any code. What's the code you're using for converting it to a bmp, and what code are you using to try and create a texture? Are you getting error codes back or just funny looking textures?
[ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
Members - Reputation: 112
Posted 13 March 2012 - 03:37 PM
Converting to PNG would do the job, but you will end up having performance issues. Instead of using Texture.FromMemory() which requires the texture already being in a right format, you should try to lock the texture and fill it with the raw data. You could take a look at my Direct3D rendering implementation which is at Github.