Results 1 to 17 of 17

Thread: [SOLVED] DirectShow Video Player Inside Qt

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Third rock from the sun
    Posts
    106
    Thanks
    17
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Talking Re: DirectShow Video Player Inside Qt

    I am working with ToddAtWSU on this problem as well. We have tried a variety of UUID numbers found on the internet, in setControl(), each returns NULL. We cannot find a specific (UUID that works, there may be multiple I am not sure) or a class name for "DirectShow" like the MSCalendar example. The problem is that all the sample code for DirectShow is written using MFC, and each forum post that we have read only asks specific questions about after the video/audio is being played, not how they got it play initially. Essentially what we are looking for, is how to setup (we are assuming using setControl, but that may not be the correct method) the IGraphBuilder using a QAxWidget. We can get the code using the CoCreateInstance() from MFC, but that just draws the video outside of the QAxWidget. After we get the video setup, the rest of the code I understand (I HOPE!! ) . Thanks for the frequent responses jacek!!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: DirectShow Video Player Inside Qt

    You should start with Windows Media Player. It's GUUIDs are easy to find (it has more than one of them), so you should be able to get it running in a short time. If you have trouble finding the right number, you might want to take a look at your OS registry to look which COM objects have been registered at all. There are their id there too, it should ease your job.

  3. #3
    Join Date
    Jan 2006
    Location
    Third rock from the sun
    Posts
    106
    Thanks
    17
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: DirectShow Video Player Inside Qt

    WMP will not work (I dont think...) for our needs. Perhaps a bit of information is needed. We are developing an application to frameskip through an mpeg video. Very rarely will the video be just played through. When we were looking into the frameskipping of Media Player, many of those features are locked out when developing your own front end. When using DirectShow, at least in the MFC exmples we have ran, we have access to the frame properties of the video. We could be wrong in our asessment, we dont have much expirience with COM objects, please let me know. Also, the reason we are not using MFC for the interface, since that seems to be the faster route, is eventually this system may have to work in a UNIX environment. I know DirectShow is not portable, but I have looked into other UNIX solutions and do not want to re-develop the GUI.
    Thanks
    Last edited by Rayven; 4th April 2006 at 14:43. Reason: Added more background info

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: DirectShow Video Player Inside Qt

    How about this?
    Qt Code:
    1. mpVideoPlayer->setControl( QUuid( CLSID_FilterGraph ) );
    2. mpVideoPlayer->queryInterface( QUuid( IID_IGraphBuilder ), (void**) &pGraphBuilder );
    To copy to clipboard, switch view to plain text mode 

  5. The following user says thank you to jacek for this useful post:

    ToddAtWSU (24th April 2006)

  6. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: DirectShow Video Player Inside Qt

    Quote Originally Posted by Rayven
    WMP will not work (I dont think...) for our needs.
    But it's a good start to see if your approach is correct.

  7. #6
    Join Date
    Jan 2006
    Location
    Third rock from the sun
    Posts
    106
    Thanks
    17
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Post Re: DirectShow Video Player Inside Qt

    I got the WMP code to play the video, however, there is no access to the frame properties to directly control WMP.

    Jacek, the code you gave me does work, but I think there is something else I am missing. The video plays now, but it does not play within the Qt structure but outside in a new window. This is definatly one step closer to the solution though. Here is the code for what we have so far:
    Qt Code:
    1. mpFrame = new QFrame( this );
    2. mpFrame->setGeometry( QRect( 10, 41, 561, 351 ) );
    3. mpFrame->setFrameShape( QFrame::WinPanel );
    4. mpFrame->setFrameShadow( QFrame::Sunken );
    5.  
    6. mpVideoPlayer = new QAxWidget( mpFrame );
    7. mpVideoPlayer->setGeometry( QRect( 15, 46, 551, 341 ) );
    8.  
    9. :
    10. :
    11.  
    12. int length = filename.size( ) + 1;
    13. WCHAR* wfile = new WCHAR[length];
    14. int i = 0;
    15. for( i = 0 ; i < filename.size( ) ; i++ )
    16. {
    17. wfile[i] = filename[i].toAscii( );
    18. }
    19. wfile[i] = '\0';
    20.  
    21. // Get the interface for DirectShow's GraphBuilder
    22. mpVideoPlayer->setControl( QUuid( CLSID_FilterGraph ) );
    23. mpVideoPlayer->queryInterface( QUuid( IID_IGraphBuilder ), (void**) &pGraphBuilder );
    24.  
    25. // Query for the media control interfaces
    26. mpVideoPlayer->queryInterface( QUuid( IID_IMediaControl ), (void **)&pMediaControl );
    27. mpVideoPlayer->queryInterface( QUuid( IID_IMediaEventEx ), (void**)&pMediaEvent );
    28. mpVideoPlayer->queryInterface( QUuid( IID_IMediaSeeking ), (void **)&pMediaSeeking );
    29. mpVideoPlayer->queryInterface( QUuid( IID_IMediaPosition ), (void **)&pMediaPosition );
    30.  
    31. pGraphBuilder->RenderFile( wfile, NULL );
    32.  
    33. pMediaControl->Run( );
    To copy to clipboard, switch view to plain text mode 
    Is there something I am missing to place the video in the Qt window? I am thinking it is the RenderFile() call made by pGraphBuilder but I can not find a QAxWidget call that uses the RenderFile functionality.

  8. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: DirectShow Video Player Inside Qt

    Quote Originally Posted by Rayven
    Jacek, the code you gave me does work, but I think there is something else I am missing. The video plays now, but it does not play within the Qt structure but outside in a new window.
    Unfortunately I can't help you much, as I have no access to ActiveQt.

    IMO setControl() should take care of everything, unless that window doesn't come from FilterGraph but some of its sub-objects.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.