locked
Simple Audio Playback RRS feed

  • Question

  • I've read through msdn: http://msdn.microsoft.com/en-us/library/windows/desktop/dd317914%28v=vs.85%29.aspx

    Also studied the very helpful sample: http://msdn.microsoft.com/en-us/library/windows/desktop/ff728866%28v=vs.85%29.aspx

    (p.s. though to be honest, I think the code would be a lot easier to study if the author hadn't separated everything into so many functions... I haven't gone through any other official samples, so is this like a MS official coding practice? anyway...)


    Now, the sample does some things I find strange though.

    1) Do I need to create a new IMFMediaSession whenever I want to change file?

    I'd think I just could use the same one for the duration of the applications life-time, right?


    2) Do I ever need to recreate the IMFTopologyNode for output?

    If I'm, say, only dealing with audio, I can create it once at startup:

    call  MFCreateTopologyNode to create the output

    call MFCreateAudioRendererActivate to create the activate

    Set the IActivate to the output pNode->SetObject(pRendererActivate)

    and then use the same topology node for the duration of the applications life-time.


    3) Is there any point in listening to the MESessionTopologyStatus event?

    Is it possible for the topology of a mediaSession to change by itself? The MF_BasicPlayback sample listens to this event and starts playing whenever there is a change in topology, but if that can't happen without the user requesting a different URI then one might as well just start the media Session in the same function, and not bother with this particular event.


    4) Switching Files.

    Now, whenever I want to play a new file, I have to create a new IMFMediaSource.

    Now, if I'm already playing a file, I must release its IMFMediaSource, otherwise I'll have a memory leak, right?

    But I should not call ShutDown, as that should only be done when I close the application.

    I also guess I shouldn't ever call stop on the IMFMediaSource, cause I can't get any other file to play after i do so (for some reason, any ideas why?).

    -Thanks

    p.s. this is on Win7.







    • Edited by JohnDoeGames Wednesday, February 5, 2014 11:51 AM
    Wednesday, February 5, 2014 11:49 AM

All replies