Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Displaying a video in DirectX

What is the best/easiest way to display a video (with sound!) in an application using XAudio2 and Direct3D9/10?

At the very least it needs to be able to stream potentially larger videos, and take care of the fact that the windows aspect ratio may differ from the videos (eg by adding letter boxes), although ideally Id like the ability to embed the video into a 3D scene.

I could of course work out a way to load each frame into a texture, discarding/reusing the textures once rendered, and playing the audio separately through XAudio2, however as well as writing a loader for at least one format, ive also got to deal with stuff like synchronising the video and audio components, so hopefully there is an eaier solution available or even a ready made free one with a suitable lisence (commercial distribution in binary form, dynamic linking is fine in the case of say LGPL).

like image 360
Fire Lancer Avatar asked Jul 17 '09 17:07

Fire Lancer


1 Answers

In Windows SDK, there is a DirectShow example for rendering video to texture. It handles audio output too.

But there are limitations and I can't honestly call it easy.

like image 197
Virne Avatar answered Oct 13 '22 00:10

Virne