




| Multimedia Player with DirectShow Part 2 |
|
|
|
| Written by Zamrony P. Juhara | |||||
| Friday, 15 September 2006 21:30 | |||||
Page 1 of 3 This tutorial continues previous tutorial, Multimedia Player with DirectShow Part 1. This time, we are going to discuss how to display video on our own window. We also discuss how to display video in fullscreen mode or windowed mode.
Displaying video on particular window.If you already try multimedia player application in first part of the tutorial, you will get video displayed on their own window when playing a video file. Then how if we want to display the video, for example, on our own form? Filter Graph Manager implements IVideoWindow interface. This interface is interface we use to manipulate how video get displayed. We can zoom video in 50%, 100%, 200% or any scales on particular window. Video can also be displayed in fullscreen. To get pointer to this interface, we call QueryInterface of Filter graph manager var FVideoWindow:IVideoWindow; If succeed FVideoWindow will be filled with pointer to IVideoWindow instance. To be able to display video on a window, the steps are as follows:
Displaying Video in FullscreenIVideoWindow has put_FullscreenMode() method that we can use to change mode to fullscreen or windowed. If it is true, video is shown in fullscreen mode, otherwise it is shown in windowed mode. Fullscreen mode: FVideoWindow.put_FullscreenMode(true); Windowed mode: FVideoWindow.put_FullscreenMode(false); To get status of status of fullscreen mode, var statusFull:longBool; When we're in fullscreen mode, our application doesn't receive focus, so all messages will be sent to filter graph manager. To let our application receive messages even in fullscreen mode (so we can, for example, toggle fullscreen on/off), we need to intercept messages to our application with put_MesageDrain() of IVideoWindow. put_MessageDrain() expects window handle that will handle messages. FVideoWindow.put_MessageDrain(FHandleWindow); To get window handle intercepting messages we use IVideoWindow.get_MessageDrain(). FVideoWindow.Get_MessageDrain(FHandleWindow); Clean UpAfter we finish with IVideoWindow, we must change visibility status to false. If we failed to do that, video will keep showing on the screen and user will not be able to get rid of it. After that, owner window must be set to null with put_Owner(). FVideoWindow.put_Visible(false); |
|||||
| Last Updated on Friday, 06 November 2009 15:29 |