Well, I would like to utilize Windows Media Player to run .exe applications in it’s video-window. The application would be for example a full screen DirectX or OpenGL application, which you can execute on the OS.
I would like to know if there is such a codec so I can tweak it for my needs? Or maybe there is one which has very good tweaking abilities but is not (fully) open-source?
(I am asking this question because of this question: https://superuser.com/questions/533730/how-to-run-an-directx-or-opengl-application-as-desktop-background)
This is probably the weirdest request I’ve read in a long time. First the bad news: No, there’s no open-source codec to play the output generated by a “.exe” in the video window of Windows Media Player. “.exe”s or more accurately PE files (Portable Executables) contain program code, i.e. data that is interpreted as program by your CPU. Videos however are not programs, but image data.
A video codec is a program that translates video data between formats. For example it can decode compressed h.264 into raw RGB data suitable for displaying. There are certain constraints on video codecs, for example that they decode a sequence of frames.
Now the good news: Technically it is possible to write such a codec. I won’t be possible to open a .exe with WMP, though, as those don’t can’t be interpreted by WMP. But you could introduce a new FOURCC, a 4 character code identifying a particular video encoding format, and register a special purpose codes with that FOURCC. Then you create a special AVI file using that FOURCC and containing a reference to your target .exe instead of video data in the frames. When WMP tries to play this file it will launch this “codec”, which in turn can launch the .exe. You need to establish a communication protocol between the launched application and the “codec”. An off-screen rendering surface must be created, and I’d say a PBuffer DC shared between the processes serves this best, i.e. the “codec” creates the PBuffer and the .exe creates a OpenGL context on top of it. Then the codec passes the contents of the PBuffer as the decoded video frames to WMP.
So yes, such a hack can be done. But it’d be ugly and weird.
Why not simply write a visualization plugin for WMP? Those run in the video window as well, but it doesn’t require such an ugly hack.