STDMETHODIMP CAVIOutputPin::GetPositions(LONGLONG * pCurrent, LONGLONG * pStop) { REFERENCE_TIME tStart, tStop; double dRate; m_pSplitter->GetSeekingParams(&tStart, &tStop, &dRate); //convert from reftime to current format ConvertTimeFormat(pCurrent, NULL, tStart, &TIME_FORMAT_MEDIA_TIME); ConvertTimeFormat(pStop, NULL, tStop, &TIME_FORMAT_MEDIA_TIME); //*pCurrent = tStart; //*pStop = tStop; return S_OK; }
STDMETHODIMP CAVIOutputPin::SetPositions( LONGLONG * pCurrent, DWORD dwCurrentFlags, LONGLONG * pStop, DWORD dwStopFlags) { if (!IsConnected()) // only one connected pin can do this return S_OK; if (!(m_pSplitter->SelectSeekingPin(this))) // will be deselected on Inactive return S_OK; LONGLONG refTimeCurrent = 0; LONGLONG refTimeStop = 0; ConvertTimeFormat(&refTimeCurrent, &TIME_FORMAT_MEDIA_TIME, *pCurrent,NULL); *pCurrent = refTimeCurrent; ConvertTimeFormat(&refTimeStop, &TIME_FORMAT_MEDIA_TIME, *pStop,NULL); { char buf[512]; sprintf(buf, "CAVIOutputPin::SetPositions %I64d\n", refTimeCurrent); } // check inputs REFERENCE_TIME duration = m_pSplitter->GetDuration(); if (refTimeCurrent > duration) { refTimeCurrent = duration; ConvertTimeFormat(pCurrent, NULL,refTimeCurrent ,&TIME_FORMAT_MEDIA_TIME); } if (refTimeStop > duration) { refTimeStop = duration; ConvertTimeFormat(pStop, NULL,refTimeStop ,&TIME_FORMAT_MEDIA_TIME); } // fetch current properties REFERENCE_TIME tStart, tStop; double dRate; m_pSplitter->GetSeekingParams(&tStart, &tStop, &dRate); dwCurrentFlags &= AM_SEEKING_PositioningBitsMask; if (dwCurrentFlags) { applySeekPosition(tStart, refTimeCurrent, tStop, refTimeStop, dwCurrentFlags); } // splitter will call SetPositionsValues for all pins HRESULT hr = m_pSplitter->Seek(tStart, tStop, dRate); return hr; }
STDMETHODIMP CAVIOutputPin::GetDuration(LONGLONG *pDuration) { LONGLONG refTimeDuration = m_pSplitter->GetDuration(); //*pDuration = refTimeDuration; //convert from reftime to current format ConvertTimeFormat(pDuration, NULL, refTimeDuration,&TIME_FORMAT_MEDIA_TIME); return S_OK; }
HRESULT CRendererPosPassThru::GetMediaTime(LONGLONG *pStartTime,LONGLONG *pEndTime) { ASSERT(pStartTime); CAutoLock cAutoLock(&m_PositionLock); if (m_bReset == TRUE) { return E_FAIL; } // We don't have to return the end time HRESULT hr = ConvertTimeFormat( pStartTime, 0, m_StartMedia, &TIME_FORMAT_MEDIA_TIME ); if (pEndTime && SUCCEEDED(hr)) { hr = ConvertTimeFormat( pEndTime, 0, m_EndMedia, &TIME_FORMAT_MEDIA_TIME ); } return hr; }
HRESULT CFSTSplitterFilter::GetDuration( LPCWSTR pPinName, const GUID *pCurrentFormat, LONGLONG *pDuration ) { // Protect the filter data CAutoLock datalock(&m_csData); // Convert the duration in frames to the current time format return ConvertTimeFormat( wszFSTVideoOutputName, pDuration, pCurrentFormat, (LONGLONG)m_nVideoFrames, &TIME_FORMAT_FRAME ); }
STDMETHODIMP CStreamSwitcherPassThru::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat) { CallPeerSeeking(ConvertTimeFormat(pTarget, pTargetFormat, Source, pSourceFormat)); }