/* * 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); }
// // CFilePlayer::GetColorKeyInternal(): Private method to query the color key // value from teh first input pin of the OverlayMixer. // HRESULT CFilePlayer::GetColorKeyInternal(IBaseFilter *pOvM) { DbgLog((LOG_TRACE, 5, TEXT("CFilePlayer::GetColorKeyInternal() entered"))) ; if (NULL == pOvM) return E_INVALIDARG ; IEnumPins *pEnumPins ; IPin *pPin ; ULONG ul ; PIN_DIRECTION pd ; DWORD dwColorKey ; IMixerPinConfig *pMPC ; HRESULT hr = pOvM->EnumPins(&pEnumPins) ; ASSERT(pEnumPins) ; while (S_OK == pEnumPins->Next(1, &pPin, &ul) && 1 == ul) // try all pins { pPin->QueryDirection(&pd) ; if (PINDIR_INPUT == pd) // only the 1st in pin { hr = pPin->QueryInterface(IID_IMixerPinConfig, (LPVOID *) &pMPC) ; ASSERT(SUCCEEDED(hr) && pMPC) ; hr = pMPC->GetColorKey(NULL, &dwColorKey) ; // just get the physical color SetColorKey(dwColorKey) ; // Set mode to stretch - that way we don't fight the overlay // mixer about the exact way to fix the aspect ratio pMPC->SetAspectRatioMode(AM_ARMODE_STRETCHED); ASSERT(SUCCEEDED(hr)) ; pMPC->Release() ; pPin->Release() ; // exiting early; release pin break ; // we are done } pPin->Release() ; } pEnumPins->Release() ; // done with pin enum return S_OK ; }