Jump to content
  • Advertisement
Sign in to follow this  
jeykumar83

Full Screen in DirectShow

This topic is 4160 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Guys, Need help in resolving Fullscreen Video in Directshow. I am building graph for playing FlV files by adding appropriate filters. I am connecting all the filters by calling IGraphBuiler::Render(). In this case how can I render the output video in fullscreen? I found out that IVideowindow will b useful in this case. But its helpful only if we call IMediaControl::renderfile(/*Filename*/) without building our own graph. code snippet for your reference: //After adding all the filters pGraph->QueryInterface(IID_IVideoWindow, (LPVOID *)&pVideoWindow); pVideoWindow->put_FullScreenMode(OATRUE); //Getting the outpin of the source filter and connecting the filters in the whole graph IPin *pOutPin = 0; hr = GetOutPin(pSourceFilter, &pOutPin); hr = pGraph->Render(pOutPin); pOutPin->Release(); hr = pMediaControl->Run(); The above code is not working. Wud be helpeful on your input in this problem. Jeykumar S

Share this post


Link to post
Share on other sites
Advertisement
Here's an ancient piece of code of mine which should do what you want. I couldn't explain how it works anymore, because after mucking around with DShow I figured VfW was far more convenient and never looked back. Hopefully you can distill the information you need.


#pragma comment(lib, "strmiids.lib")
#pragma comment(lib, "quartz.lib")
#include <dshow.h>

//..

int Video::Play(const std::string& pFile)
{
IGraphBuilder* pGraph = NULL;
IVideoWindow* pWin = NULL;
IMediaControl* pControl = NULL;
IMediaEvent* pEvent = NULL;
std::string _file = MEDIA_PATH + pFile;

// Initialize the COM library.
HRESULT hr = CoInitialize(NULL);
if (FAILED(hr)) return 1;

// Create the filter graph manager and query for interfaces.
hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph);
if (FAILED(hr)) return 1;

// Get interfaces
hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
hr = pGraph->QueryInterface(IID_IVideoWindow, (void **)&pWin);

// Build the graph.
size_t _size = mbstowcs(NULL, _file.c_str(), 0) + 2; // Add 2 for ZT
wchar_t* _wfile = new wchar_t[_size+2];
_size = mbstowcs(_wfile, _file.c_str(), _file.length()+1); // Add 1 for ZT
hr = pGraph->RenderFile(_wfile, NULL);
delete[] _wfile;

pWin->put_Owner((OAHWND)DXCore::WindowInfo.window);
pWin->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS);

DWORD _left = DXCore::ScreenInfo.left;
DWORD _top = DXCore::ScreenInfo.top;
pWin->SetWindowPosition(_left, _top, DXCore::ScreenInfo.width, DXCore::ScreenInfo.height);

if (SUCCEEDED(hr))
{
// Run the graph.
hr = pControl->Run();
if (SUCCEEDED(hr))
{
// Wait for completion.
long evCode;
pEvent->WaitForCompletion(INFINITE, &evCode);
}
}
pControl->Release();
pEvent->Release();
pWin->Release();
pGraph->Release();
CoUninitialize();

return 0;
}

Share this post


Link to post
Share on other sites
Hey Thanks your reply man.. but unfortunately its not working with my case :(. Even this renders the media file by calling RenderFile(). But in my case I am building my own graph.
I didnt get the DXCore Base in your code!!! It just tries to fill the Video in the entire window of the Handle given. But I couldnt figure out how to bring full screen????

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!