Skip to main content
gamedev.net
🔒 Locked

DirectShow Beginner

Started by xuwen Feb 2, 2003 at 3:35 PM 10 replies 750+ views
Original Post
xuwen
xuwen
Hi. I''ve been attempting to figure out how to use DirectShow for a while now, and then I realized that I really don''t need to know the real nitty gritty of it. I''m basically trying to learn how to use the sound and movie playing capabilities of the DirectX API and the graphics capabilities of the OpenGL API. I''ve gotten the sound and graphics part ok, but that''s with some major handholding from the book OpenGL Game Programming. However, that only really goes over how to play .WAV and .MID files. I''d like to use .MP3 files but it seems I need to know DirectShow to do this. Well, I''ve been reading around and I really don''t understand much of it. I vaguely understand making a graph and so forth, but many tutorials give me theory. So, I was wondering if someone could maybe give me some sample code? Say I had a file called "nomorewords.mp3" that I want to play in the background of a game. Say I have a file called "intro.avi" that I''d like to play at the opening of the game. Could someone maybe write some sample code to explicitly load these? If I see it in action and maybe some commenting, I might be able to make it more OO. Thanks in advance.
xuwen
xuwen
Thanks. This code would work for any file format that directX supports?
xuwen
xuwen
Thanks for the code from both of you. Maybe a small explanation could be given for some of the syntax? The code for the second example is much simpler and I''m able to understand. But I''m not sure how the WaitForCompletion method works. Could that be elaborated a little? And what other enumerations are there other than INFINITE?
micepick
micepick
Both examples boil down to pretty much the same thing. You would probably not usually use WaitForCompletion in a game; that function stalls everything until the file is finished playing.

Here is a well-explained DirectShow MP3 player for use in a game. Have fun.





[edited by - micepick on February 2, 2003 6:31:31 PM]
xuwen
xuwen
Hmmm, I''m thinking I''m missing a link library. I need dxguid.lib and do i need like..dshow8.lib as well?
micepick
micepick
strmiids.lib
xuwen
xuwen
Ah. As you can see, I''m a complete and utter newbie at this. Thanks!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.