Skip to main content

 none
Class implements IMFMediaEventGenerator to listen for events in its queue and call its own callback to handle events. RRS feed

  • Question

  • I have a DeviceMFT for video capture in my project. Within DMFT, I have various classes I want to send custom events (like RAW_FRAME_READY etc.. ) between classes . Say ,

    - I have ClassA that initiates ClassB and ClassC.

    - ClassB wants to send custom event to classA.

    - Based on the event, classA calls a method in ClassC.

    Am thinking to use ClassA as Media event generator, thereby ClassB , ClassC can queue events. 

    ClassA also implements IMFAsyncCallback and whenever any class queues event, ClassA::Invoke() handles the events and calls methods of other interfaces accordingly.

    class ClassA: public IMFMediaEventGenerator , public IMFAsyncCallback

    ClassA::ClassA

    {

     MFCreateEventQueue(&iQueue);

    BeginGetEvent(this,NULL); //>>> I want the same interface to listen for events in its queue

    }

    ClassA::BeginGetEvent()

    {

    <assume we have a working code here>

    }

    ClassA::EndGetEvent()

    {

    <assume we have a working code here>

    }

    ClassA::QueueEvent()

    {

    <assume we have a working code here>

    }

    ClassA::Invoke()

    {

    // Get callback for events in the queue

    HandleEvent();

    ....

    }

    Here are my queries 

    1) Can i use IMFMediaEventGenerator to queue custom events ? I see that MediaEventType is of DWORD type and I can define my own events.

    2) even though ClassB, ClassC generates events, they do not implement IMFMediaEventGenerator. Instead they use ClassA event queue. Is this an acceptable design ?

    3) As ClassA implements IMFMediaEventGenerator and IMFAsyncCallback , Can i call BeginGetevent(this,...) in ClassA i.e ClassA will be listening for any events in queue and then call its ::Invoke()



    Monday, October 7, 2019 1:20 AM

All replies