Show last frame from video 1 while starting video 2 RRS feed

  • Question

  • I am writing a system that displays multiple short videos taken back to back. My code is based on player.cpp example.

    At the end of each video, there is a black flash on the video screen. Is there any way of holding the last frame of the video that just completed in the window while the next video is starting?



    Monday, April 7, 2014 6:27 PM

All replies

  • As far as I know the Player.cpp example uses the media session for playback. During playback, when the media session gets at the end of the stream (video) it sends an EndOfPresentation event and after that it paints the video window black.

    I think you could try 2 things out and see if it works for you:

    1. After your topology is ready you can handle the TopologyReady event and query the source for the IMFVideoDisplayControl interface:

    MFGetService(m_pSession, MR_VIDEO_RENDER_SERVICE, IID_PPV_ARGS(&pVideoDisplayControl));

    After you have the interface you can try to set the rendering preferences: m_pVideoDisplay->SetRenderingPrefs(dwRenderFlags);. dwRenderFlags being from of the following enumeration:

      typedef enum MFVideoRenderPrefs {
        MFVideoRenderPrefs_DoNotRenderBorder       = 0x00000001,
        MFVideoRenderPrefs_DoNotClipToDevice       = 0x00000002,
        MFVideoRenderPrefs_AllowOutputThrottling   = 0x00000004,
        MFVideoRenderPrefs_ForceOutputThrottling   = 0x00000008,
        MFVideoRenderPrefs_ForceBatching           = 0x00000010,
        MFVideoRenderPrefs_AllowBatching           = 0x00000020,
        MFVideoRenderPrefs_ForceScaling            = 0x00000040,
        MFVideoRenderPrefs_AllowScaling            = 0x00000080,
        MFVideoRenderPrefs_DoNotRepaintOnStop      = 0x00000100,
        MFVideoRenderPrefs_Mask                    = 0x000000ff 
      } MFVideoRenderPrefs;

    I would try setting the MFVideoRenderPrefs_DoNotRepaintOnStop parameter and see if it solves your Problem.

    2. Try handling the EndOfPresentation event. Usually when it's fired the first time during playback you still have a frame. You could try and pause when the event comes and then leave it like this until the next video starts. This solution is not optimal as it doesn't give you the exact last frame (possibly the one before that or even 2 before the last). I haven't been able to determine the exact time when the event is fired.

    • Edited by AIonascu Tuesday, May 6, 2014 2:25 PM
    Tuesday, May 6, 2014 2:25 PM