How to manage events in DirectShow

matiasworld
09-01-2004, 05:09 PM
I'm making a sound player and I'm using DirectShow, and for what I read, the way to manage events related to the player is using IMediaEvent, but I don't know how to use that.

These are the objects I use:

Private m_objBasicAudio As QuartzTypeLib.IBasicAudio
Private m_objMediaControl As QuartzTypeLib.FilgraphManager
Private m_objMediaPosition As QuartzTypeLib.IMediaPosition
Private m_objMediaEvent As QuartzTypeLib.IMediaEvent

I want to catch, for example, the "end of file" event.

I'm looking everywhere but I can't find a sample code or something that explain how to use it. Please help!!! :huh:

MKoslof
09-02-2004, 08:57 AM
MSDN has a complete KI on this:

You can start here and chain down:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcedshow/html/_dxce_dshow_learning_when_an_event_occurs.asp

matiasworld
09-02-2004, 05:51 PM
I went to http://msdn.microsoft.com/library/d...vent_occurs.asp
but all the code is in C++, and I don't understand it very well at the moment :rolleyes:

And I still don't understan how to catch the events, it seems that you need to redirect it to the WndProc Sub of a Form, but I want to redirect to a function of a class instead (the class where is all the DirectShow code). I'm lost, please help!!.

Thanks any way. :)

mjackson
10-11-2004, 12:05 PM
I went to http://msdn.microsoft.com/library/d...vent_occurs.asp
but all the code is in C++, and I don't understand it very well at the moment :rolleyes:

And I still don't understan how to catch the events, it seems that you need to redirect it to the WndProc Sub of a Form, but I want to redirect to a function of a class instead (the class where is all the DirectShow code). I'm lost, please help!!.

Thanks any way. :)

Not trying to promote another site or anything, but this helped me lear more about direct show and should assist you in gettin what you need...

http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=42862&lngWId=1

Hope it helped...
mjackson

matiasworld
10-13-2004, 09:54 AM
Thanks, but this example doesn't show how to catch the events of IMediaEvent, it only use IMediaEvent for checking errors at an especific moment.
The idea is that IMediaEvent trigger an event handler (function) when an event occurs, so you don't need to check for errors.
Thanks anyway.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum