I am trying to develop a video player using Qt and DirectShow. When I use queryInterface( ) from mpVideoPlayer which is a QAxWidget, I get NULL pointers. Whenever I use CoCreateInstance to create the first pointer, I get valid pointers for all my subsequent pointers, but this creates the video playing window in a separate window instead of inside my Qt GUI. So how do I get the UUID for a DirectShow inside Qt? How do I use setControl to act like CoCreateInstance( )? Any help and/or examples would be greatly appreciated. Below is my code for setting up the different pointers and running the video. Thanks!!!

Qt Code:
  1. bool VideoViewerWindow::createVideo( QString filename )
  2. {
  3. int length = filename.size( ) + 1;
  4. WCHAR* wfile = new WCHAR[length];
  5. int i = 0;
  6. for( i = 0 ; i < filename.size( ) ; i++ )
  7. {
  8. wfile[i] = filename[i].toAscii( );
  9. }
  10. wfile[i] = '\0';
  11.  
  12. //mpVideoPlayer->setControl( "DirectShow" );
  13.  
  14. // Get the interface for DirectShow's GraphBuilder
  15. //CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
  16. // IID_IGraphBuilder, (void **)&pGraphBuilder);
  17. mpVideoPlayer->queryInterface( QUuid( IID_IGraphBuilder ), (void**) &pGraphBuilder );
  18.  
  19. pGraphBuilder->RenderFile( wfile, NULL );
  20.  
  21. // Query for the media control interfaces
  22. //mpVideoPlayer->queryInterface( QUuid( IID_IMediaControl ), (void **)&pMediaControl );
  23. pGraphBuilder->QueryInterface( IID_IMediaControl, (void **)&pMediaControl );
  24. pGraphBuilder->QueryInterface( IID_IMediaEventEx, (void **)&pMediaEvent );
  25. pGraphBuilder->QueryInterface( IID_IMediaSeeking, (void **)&pMediaSeeking );
  26. pGraphBuilder->QueryInterface( IID_IMediaPosition, (void **)&pMediaPosition );
  27.  
  28. // Query for video interfaces, which may not be relevant for audio files
  29. pGraphBuilder->QueryInterface( IID_IVideoWindow, (void **)&pVideoWindow );
  30. pGraphBuilder->QueryInterface( IID_IBasicVideo, (void **)&pBasicVideo );
  31.  
  32. // Query for audio interfaces, which may not be relevant for video-only files
  33. pGraphBuilder->QueryInterface( IID_IBasicAudio, (void **)&pBasicAudio );
  34.  
  35. getFrameStepInterface( );
  36.  
  37. pMediaControl->Run( );
  38.  
  39. return true;
  40. }
To copy to clipboard, switch view to plain text mode