本文整理汇总了C++中IVideoWindow类的典型用法代码示例。如果您正苦于以下问题:C++ IVideoWindow类的具体用法?C++ IVideoWindow怎么用?C++ IVideoWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IVideoWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: video_set_window_region
void video_set_window_region(int id, long x, long y, long w, long h) {
get_video(videoStruct, id);
IVideoWindow *pVidWin = NULL;
videoStruct->pGraph->QueryInterface(IID_IVideoWindow, (void **)&pVidWin);
pVidWin->SetWindowPosition(x, y, w, h);
}
示例2: __CONTEXT
HRESULT
recChannel_t::unmap(void)
{
__CONTEXT("recChannel_t::unmap");
IBaseFilter * pFilter = NULL;
int hr =0;
hr = pGraph->FindFilterByName(L"Video Renderer",&pFilter);
if (!hr)
{
IVideoWindow *pWindowInfo = NULL;
hr = pFilter->QueryInterface(IID_IVideoWindow, (void **)&pWindowInfo);
errorCheck(hr);
pWindowInfo->put_Visible(OAFALSE);
pWindowInfo->put_AutoShow(OAFALSE);
pWindowInfo->Release();
}
pControl->StopWhenReady();
#ifdef _WINDOWS
if (fControl)
{
fControl->CWnd::ShowWindow(SW_HIDE);
}
#endif
mapping = false;
return 0;
}
示例3: InitCoopLevel
HRESULT CMpcAudioRenderer::InitCoopLevel()
{
HRESULT hr = S_OK;
IVideoWindow* pVideoWindow = nullptr;
HWND hWnd = nullptr;
hr = m_pGraph->QueryInterface(IID_PPV_ARGS(&pVideoWindow));
if (SUCCEEDED(hr)) {
pVideoWindow->get_Owner((OAHWND*)&hWnd);
SAFE_RELEASE(pVideoWindow);
}
if (!hWnd) {
hWnd = GetTopWindow(nullptr);
}
ASSERT(hWnd != nullptr);
if (!m_useWASAPI) {
hr = m_pDS->SetCooperativeLevel(hWnd, DSSCL_PRIORITY);
} else if (hTask == nullptr) {
// Ask MMCSS to temporarily boost the thread priority
// to reduce glitches while the low-latency stream plays.
DWORD taskIndex = 0;
if (pfAvSetMmThreadCharacteristicsW) {
hTask = pfAvSetMmThreadCharacteristicsW(_T("Pro Audio"), &taskIndex);
TRACE(_T("CMpcAudioRenderer::InitCoopLevel Putting thread in higher priority for WASAPI mode (lowest latency)\n"));
hr = GetLastError();
if (hTask == nullptr) {
return hr;
}
}
}
return hr;
}
示例4: play_movie
void play_movie( HWND hwnd )
{
IGraphBuilder *pGraph;
IMediaControl *pMediaControl;
IMediaEvent *pEvent;
IBasicVideo *pBasic;
IVideoWindow *pVidWin = NULL;
RECT grc;
long width, height;
CoInitialize(NULL);
// Create the filter graph manager and query for interfaces.
CoCreateInstance(
CLSID_FilterGraph,
NULL,
CLSCTX_INPROC_SERVER,
IID_IGraphBuilder,
(void **)&pGraph);
pGraph->QueryInterface(IID_IVideoWindow, (void **)&pVidWin);
pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl);
pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
pGraph->QueryInterface(IID_IBasicVideo, (void**)&pBasic );
// Build the graph. IMPORTANT: Change string to a file on your system.
pGraph->RenderFile(L"e:\\alpha\\running.avi", NULL);
pBasic->GetVideoSize( &width, &height );
printf( "video frames are %d x %d\n", width, height );
pVidWin->put_Owner((OAHWND)hwnd);
pVidWin->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS);
GetClientRect( hwnd, &grc );
pVidWin->SetWindowPosition(10, 10, width, height);
printf( "window is %d x %d\n", grc.right, grc.bottom );
// Run the graph.
pMediaControl->Run();
// Wait for completion.
long evCode;
pEvent->WaitForCompletion(INFINITE, &evCode);
pVidWin->put_Visible(OAFALSE);
pVidWin->put_Owner(NULL);
// Clean up.
pBasic->Release();
pVidWin->Release();
pMediaControl->Release();
pEvent->Release();
pGraph->Release();
CoUninitialize();
}
示例5: setVideoHWND
/*
* Class: sage_DShowMediaPlayer
* Method: setVideoHWND0
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL Java_sage_DShowMediaPlayer_setVideoHWND0
(JNIEnv *env, jobject jo, jlong dataPtr, jlong vhwnd)
{
CPlayerData* playData = (CPlayerData*) dataPtr;
IGraphBuilder* pGraph = playData->GetGraph();
IVideoWindow* pVW = NULL;
HRESULT hr = pGraph->QueryInterface(IID_IVideoWindow, (void**)&pVW);
if (SUCCEEDED(hr))
{
slog((env, "DShowPlayer setVideoHWND(%d)\r\n", (int) vhwnd));
pVW->put_AutoShow(OAFALSE);
pVW->put_Owner((OAHWND)vhwnd);
pVW->put_MessageDrain((OAHWND)vhwnd);
pVW->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
pVW->put_Visible(OATRUE);
// We do all of our own aspect ratio control, so don't let DShow do any for us
// by setting the aspect ratio mode on the video rendering filter's pin
IEnumFilters *pEnum = NULL;
hr = pGraph->EnumFilters(&pEnum);
if (SUCCEEDED(hr))
{
IBaseFilter *currFilt = NULL;
while (pEnum->Next(1, &currFilt, NULL) == S_OK)
{
IPin *overlayPin = NULL;
hr = currFilt->FindPin(L"Input0", &overlayPin);
if (SUCCEEDED(hr))
{
// Right pin name, let's see if it's overlay
IMixerPinConfig *pOverlayMix = NULL;
hr = overlayPin->QueryInterface(IID_IMixerPinConfig, (void**)&pOverlayMix);
if (SUCCEEDED(hr))
{
pOverlayMix->SetAspectRatioMode(AM_ARMODE_STRETCHED);
SAFE_RELEASE(pOverlayMix);
}
SAFE_RELEASE(overlayPin);
}
SAFE_RELEASE(currFilt);
}
SAFE_RELEASE(pEnum);
hr = S_OK;
}
SAFE_RELEASE(pVW);
}
HTESTPRINT(hr);
}
示例6: InitCoopLevel
HRESULT CMpcAudioRenderer::InitCoopLevel()
{
HRESULT hr = S_OK;
IVideoWindow* pVideoWindow = NULL;
HWND hWnd = NULL;
CComBSTR bstrCaption;
hr = m_pGraph->QueryInterface (__uuidof(IVideoWindow), (void**) &pVideoWindow);
if (SUCCEEDED (hr))
{
pVideoWindow->get_Owner((long*)&hWnd);
SAFE_RELEASE (pVideoWindow);
}
if (!hWnd)
{
hWnd = GetTopWindow(NULL);
}
ATLASSERT(hWnd != NULL);
if (!useWASAPI)
hr = m_pDS->SetCooperativeLevel(hWnd, DSSCL_PRIORITY);
else if (hTask == NULL)
{
// Ask MMCSS to temporarily boost the thread priority
// to reduce glitches while the low-latency stream plays.
DWORD taskIndex = 0;
hTask = AvSetMmThreadCharacteristics(TEXT("Pro Audio"), &taskIndex);
hr=GetLastError();
if (hTask == NULL)
return hr;
}
return hr;
}
示例7: video_set_fullscreen
void video_set_fullscreen(int id, bool fullscreen) {
get_video(videoStruct, id);
IVideoWindow *pVidWin = NULL;
videoStruct->pGraph->QueryInterface(IID_IVideoWindow, (void **)&pVidWin);
pVidWin->put_FullScreenMode(-fullscreen);
}
示例8: video_set_scale
void video_set_scale(int id, bool scale) {
get_video(videoStruct, id);
IVideoWindow *pVidWin = NULL;
videoStruct->pGraph->QueryInterface(IID_IVideoWindow, (void **)&pVidWin);
RECT rc;
if (scale) {
GetClientRect(enigma::hWnd, &rc);
} else {
//TODO: Finish me
}
pVidWin->SetWindowPosition(0, 0, rc.right, rc.bottom);
}
示例9: Cleanup
void CHogVideo::Cleanup()
{
this->UnHog();
if (m_pEvent)
{
IMediaEvent *pEvent = (IMediaEvent*)m_pEvent;
pEvent->Release();
m_pEvent = NULL;
}
if (m_pVideoWindow)
{
IVideoWindow *pVideoWindow = (IVideoWindow*)m_pVideoWindow;
pVideoWindow->Release();
m_pVideoWindow = NULL;
}
if (m_pMediaControl)
{
IMediaControl *pMediaControl = (IMediaControl*)m_pMediaControl;
pMediaControl->Release();
m_pMediaControl = NULL;
}
if (m_pGraph)
{
IGraphBuilder *pGraph = (IGraphBuilder*)m_pGraph;
pGraph->Release();
m_pGraph = NULL;
}
if (m_bCOMInitialized)
{
CoUninitialize();
m_bCOMInitialized = false;
}
}
示例10: video_add
int video_add(string fname) {
enigma::VideoStruct* videoStruct = new enigma::VideoStruct();
IGraphBuilder *pGraph = NULL;
// Initialize the COM library.
HRESULT hr = CoInitialize(NULL);
if (FAILED(hr))
{
MessageBox(NULL, "Failed to initialize COM library.", "ERROR", MB_ICONERROR | MB_OK);
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))
{
MessageBox(NULL, "Failed to create the Filter Graph Manager.", "ERROR", MB_ICONERROR | MB_OK);
return -1;
}
// Build the graph.
hr = pGraph->RenderFile(std::wstring(fname.begin(), fname.end()).c_str(), NULL);
IVideoWindow *pVidWin = NULL;
pGraph->QueryInterface(IID_IVideoWindow, (void **)&pVidWin);
pVidWin->put_Owner((OAHWND)enigma::hWnd);
pVidWin->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS);
videoStruct->pGraph = pGraph;
enigma::videoStructs.push_back(videoStruct);
return enigma::videoStructs.size() - 1;
}
示例11: Hog
bool CHogVideo::Hog()
{
if (!m_pGraph && !m_pMediaControl && !m_pVideoWindow)
return false;
this->UnHog();
HRESULT hr = NULL;
IGraphBuilder *pGraph = (IGraphBuilder*) m_pGraph;
IMediaControl *pMediaControl = (IMediaControl*) m_pMediaControl;
IVideoWindow *pVideoWindow = (IVideoWindow*) m_pVideoWindow;
// Build the graph. IMPORTANT: Change string to a file on your system.
hr = pGraph->RenderFile(m_wszFilename, NULL);
if (SUCCEEDED(hr))
{
// Run the graph.
hr = pMediaControl->Run();
// Hide the window
pVideoWindow->put_WindowState(SW_HIDE);
pVideoWindow->put_AutoShow(OAFALSE);
pVideoWindow->put_Visible(OAFALSE);
pVideoWindow->put_Top(-100);
pVideoWindow->put_Left(-100);
pVideoWindow->put_Width(0);
pVideoWindow->put_Height(0);
if (SUCCEEDED(hr))
{
// Hog the resource.
pMediaControl->Pause();
return true;
}
else
return false;
}
else
return false;
}
示例12: CoInitialize
void Video::PlayMovie(string path)
{
IGraphBuilder *pGraph = NULL;
IMediaControl *pControl = NULL;
IMediaEvent *pEvent = NULL;
IVideoWindow *pVideo = NULL;
// Initialize the COM library.
CoInitialize(NULL);
// Create the filter graph manager and query for interfaces.
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph);
// Build the graph
int len;
int slength = (int)path.length() + 1;
len = MultiByteToWideChar(CP_ACP, 0, path.c_str(), slength, 0, 0);
wchar_t* buf = new wchar_t[len];
MultiByteToWideChar(CP_ACP, 0, path.c_str(), slength, buf, len);
std::wstring r(buf);
delete[] buf;
pGraph->RenderFile(LPCWSTR(r.c_str()), NULL);
// set the owner window
pGraph->QueryInterface(IID_IVideoWindow, (void **) &pVideo);
pVideo->put_Owner((OAHWND)window);
pVideo->put_WindowStyle( WS_CHILD );
pVideo->put_Left(0);
pVideo->put_Top(0);
pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
pControl->Run();
long evCode;
pEvent->WaitForCompletion(-1, &evCode);
// release controls
pControl->Release();
pEvent->Release();
pGraph->Release();
pVideo->Release();
CoUninitialize();
}
示例13: OnTapiEvent
//.........这里部分代码省略.........
// nothing to do -- we handle connection synchronously
}
break;
}
case TE_CALLMEDIA:
{
// TE_CALLMEDIA is a media event. pEvent is
// an ITCallMediaEvent
CALL_MEDIA_EVENT cme;
ITCallMediaEvent * pCallMediaEvent;
// Get the interface
hr = pEvent->QueryInterface( IID_ITCallMediaEvent, (void **)&pCallMediaEvent );
if ( FAILED(hr) )
{
break;
}
// get the CALL_MEDIA_EVENT that we are being notified of.
hr = pCallMediaEvent->get_Event( &cme );
if ( SUCCEEDED(hr) )
{
switch ( cme )
{
case CME_STREAM_NOT_USED:
case CME_STREAM_INACTIVE:
case CME_NEW_STREAM:
break;
case CME_STREAM_FAIL:
DoMessage( L"Call media event: stream failed");
break;
case CME_TERMINAL_FAIL:
DoMessage( L"Call media event: terminal failed");
break;
case CME_STREAM_ACTIVE:
{
//
// Find out if this stream has a video render terminal. If not,
// we don't need to do anything with this stream. Also note
// if this is the video capture stream or the video render
// stream.
//
ITTerminal * pTerminal;
BOOL fRenderStream;
hr = GetVideoRenderTerminalFromStreamEvent(
pCallMediaEvent,
&pTerminal,
&fRenderStream
);
if ( SUCCEEDED(hr) )
{
// Get the video window interface for the terminal
IVideoWindow *pVideoWindow = NULL;
hr = pTerminal->QueryInterface( IID_IVideoWindow, (void**)&pVideoWindow );
pTerminal->Release();
if ( SUCCEEDED(hr) )
{
// Put this window in our dialog
HostWindow(pVideoWindow, fRenderStream);
pVideoWindow->Release();
}
}
break;
}
default:
break;
}
}
// We no longer need this interface.
pCallMediaEvent->Release();
break;
}
default:
break;
}
pEvent->Release(); // we addrefed it CTAPIEventNotification::Event()
return S_OK;
}
示例14: MultiByteToWideChar
void Video::play( char *fileName, DWORD )
{
WCHAR wPath[100];
HRESULT hr;
IMediaControl *pMC;
if(!init_success)
return;
MultiByteToWideChar( CP_ACP, 0, fileName, -1, wPath, 100 );
if( (hr = pGraph->RenderFile(wPath, NULL)) == 0)
{
// use full screen video interface
// try to change display mode
IVideoWindow *iVideoWindow = NULL;
if( (hr = pGraph->QueryInterface(IID_IVideoWindow, (void **) &iVideoWindow)) == 0)
{
#ifdef CREATE_DUMMY_WINDOW
if(hwnd)
{
HRESULT hr2 = iVideoWindow->put_MessageDrain((OAHWND) hwnd);
hr2 = 0;
}
#endif
#ifdef FULL_SCREEN_VIDEO
IFilter *iFilter;
if( pGraph->FindFilterByName(L"Video Renderer", &iFilter) == 0)
{
IBasicVideo *iBasicVideo;
if( iFilter->QueryInterface(IID_IBasicVideo, (void **)&iBasicVideo) == 0)
{
IFullScreenVideo *iFullScreenVideo;
IDirectDrawVideo *iDirectDrawVideo;
if( iFilter->QueryInterface(IID_IFullScreenVideo, (void **)&iFullScreenVideo) == 0)
{
iFullScreenVideo->Release();
}
else if( iFilter->QueryInterface(IID_IDirectDrawVideo, (void **)&iDirectDrawVideo) == 0)
{
HRESULT hr2;
hr2 = iDirectDrawVideo->UseWhenFullScreen(OATRUE);
iDirectDrawVideo->Release();
}
iBasicVideo->Release();
}
iFilter->Release();
}
hr=iVideoWindow->put_FullScreenMode(OATRUE);
#endif
/* // code to find all filter in the filter graph
{
IEnumFilters *iEnumFilters;
pGraph->EnumFilters(&iEnumFilters);
ULONG filterCount = 16;
IFilter *iFilters[16];
iEnumFilters->Next(filterCount, iFilters, &filterCount);
for( ULONG j = 0; j < filterCount; ++j )
{
FILTER_INFO filterInfo;
iFilters[j]->QueryFilterInfo(&filterInfo);
filterInfo.pGraph->Release();
iFilters[j]->Release();
}
iEnumFilters->Release();
}*/
iVideoWindow->HideCursor(OATRUE);
iVideoWindow->put_Visible( OAFALSE );
iVideoWindow->put_AutoShow( OAFALSE );
LONG windowStyle;
iVideoWindow->get_WindowStyle( &windowStyle);
windowStyle &= ~WS_BORDER & ~WS_CAPTION & ~WS_SIZEBOX & ~WS_THICKFRAME &
~WS_HSCROLL & ~WS_VSCROLL & ~WS_VISIBLE;
iVideoWindow->put_WindowStyle( windowStyle);
}
else
iVideoWindow = NULL;
if( (hr = pGraph->QueryInterface(IID_IMediaControl, (void **) &pMC)) == 0)
{
pMC->Run(); // sometimes it returns 1, but still ok
state = PLAYING;
pMC->Release();
}
if( iVideoWindow )
{
iVideoWindow->put_Visible( OAFALSE );
LONG windowStyle;
iVideoWindow->get_WindowStyle( &windowStyle);
windowStyle &= ~WS_BORDER & ~WS_CAPTION & ~WS_SIZEBOX & ~WS_THICKFRAME &
~WS_HSCROLL & ~WS_VSCROLL & ~WS_VISIBLE;
//.........这里部分代码省略.........
示例15: SetVideoPosition
virtual HRESULT SetVideoPosition(RECT *pSrc, RECT *pDst, BOOL hideMouse)
{
if (!m_pGraph) return E_FAIL;
if (m_pVmrAllocator && pSrc && pDst)
{
// Update our VMR9 window positioning for mouse events to work (this may only
// work on XP, I think it will still fail on 2K)
m_pVmrAllocator->UpdateVideoPosition(pSrc, pDst);
return S_OK;
}
IBasicVideo* pBV = NULL;
HRESULT hr = m_pGraph->QueryInterface(IID_IBasicVideo, (void**)&pBV);
if (SUCCEEDED(hr))
{
/* long nativeWidth;
hr = pBV->get_VideoWidth(&nativeWidth);
if (FAILED(hr))
{
SAFE_RELEASE(pBV);
// no video is present
return;
}
*/
long srcTop, srcLeft, srcWidth, srcHeight;
pBV->GetSourcePosition(&srcLeft, &srcTop, &srcWidth, &srcHeight);
pBV->GetDestinationPosition(&srcLeft, &srcTop, &srcWidth, &srcHeight);
if (pSrc)
{
pBV->SetSourcePosition(pSrc->left, pSrc->top, pSrc->right - pSrc->left, pSrc->bottom - pSrc->top);
}
else
{
pBV->SetDefaultSourcePosition();
}
if (pDst)
{
pBV->SetDestinationPosition(pDst->left, pDst->top, pDst->right - pDst->left, pDst->bottom - pDst->top);
}
else
{
pBV->SetDefaultDestinationPosition();
}
SAFE_RELEASE(pBV);
IVideoWindow* pVW = NULL;
hr = m_pGraph->QueryInterface(IID_IVideoWindow, (void**)&pVW);
if (SUCCEEDED(hr))
{
OAHWND vidWinHWND;
hr = pVW->get_Owner(&vidWinHWND);
if (SUCCEEDED(hr))
{
RECT grc;
GetClientRect((HWND)vidWinHWND, &grc);
pVW->SetWindowPosition(0, 0, grc.right, grc.bottom);
}
pVW->HideCursor(hideMouse == JNI_TRUE ? OATRUE : OAFALSE);
SAFE_RELEASE(pVW);
}
}
return S_OK;
}