Wrote a simple media player using COM interfaces. It's a lot simpler than I had thought after looking through the examples in the masm package.

Credits go to bazik for his media player done in mci which got me started and to Adam Blaszczyk who I ripped the COM stuff from. I didn't use the masm macros since I wanted to understand what I was doing :)

There's still two bugs that I know of. One, it pagefaults once in a while due to recursive calls (no I don't know how to fix it yet). And two, it will play mp3 files on win2000, but just exits under win98. If I debug it under win2000 w/ ollydbg it hangs the debugger on the call to RenderFile.

Anyway, the code should be fairly straightforward. Bugs, suggestions welcome.
Posted on 2002-05-21 14:06:13 by grv575
Still can't figure out why mp3s crash in win98.

Also, a lot of mp3s have tons of clicks & pops when played with DirectShow. Videos don't have buffering problems. Neither does windows media player either and I would assume that microsoft uses the directx apis in it.

From msdn

DirectShow is:

Modular?filters are truly reusable.
Autonomous?filters have embedded threads that transfer and operate on data. Buffering is also automatic, requiring no application code.

So if buffering is automatic, is there a way to change how much audio is buffered in advance?
Posted on 2002-05-21 15:09:58 by grv575
Here's a version with a poor man's playlist.
Posted on 2002-05-22 12:53:47 by grv575
I modified the directshow player to correctly handle wm_size and wm_move.  Now it repaints properly when resizing or moving.  Here's the updated source:


There's also an MCI version based on bazik's zplayer.  I still can't figure out how to repaint properly on wm_move though when the player is paused.  Don't like how windows handles this (only likes to update or receive notification when playing).

It's also worth checking out the directx sdk playwnd sample for this type of stuff.
Posted on 2005-07-11 05:53:52 by grv575