STDMETHODIMP CPosPassThru::GetCapabilities(DWORD * pCaps) { IMediaSeeking* pMS; HRESULT hr = GetPeerSeeking(&pMS); if (FAILED(hr)) { return hr; } hr = pMS->GetCapabilities(pCaps); pMS->Release(); return hr; }
long video_get_seek(int id) { get_videor(videoStruct, id, -1); IMediaSeeking* pSeek; HRESULT hr = videoStruct->pGraph->QueryInterface(IID_IMediaSeeking, (void**)&pSeek); DWORD dwCap = 0; hr = pSeek->GetCapabilities(&dwCap); long long position = 0; if (AM_SEEKING_CanSeekAbsolute & dwCap) { hr = pSeek->GetCurrentPosition(&position); } pSeek->Release(); return position; }
long video_get_duration(int id) { get_videor(videoStruct, id, -1); IMediaSeeking* pSeek; HRESULT hr = videoStruct->pGraph->QueryInterface(IID_IMediaSeeking, (void**)&pSeek); DWORD dwCap = 0; hr = pSeek->GetCapabilities(&dwCap); long long duration = 0; if (AM_SEEKING_CanSeekAbsolute & dwCap) //TODO: This if check might not be needed { hr = pSeek->GetDuration(&duration); } pSeek->Release(); return duration; }
void video_set_seek(int id, long position) { get_video(videoStruct, id); IMediaSeeking* pSeek; HRESULT hr = videoStruct->pGraph->QueryInterface(IID_IMediaSeeking, (void**)&pSeek); DWORD dwCap = 0; hr = pSeek->GetCapabilities(&dwCap); if (AM_SEEKING_CanSeekAbsolute & dwCap) { // Graph can seek to absolute positions. REFERENCE_TIME rtNow = position; hr = pSeek->SetPositions( &rtNow, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning ); } pSeek->Release(); }