public void GetStopTime(out long pDuration) { if (m_pSeek == null) { throw new COMException("No seek pointer", E_Unexpected); } int hr = m_pSeek.GetStopPosition(out pDuration); // If we cannot get the stop time, try to get the duration. if (Failed(hr)) { hr = m_pSeek.GetDuration(out pDuration); } DsError.ThrowExceptionForHR(hr); }
/// <summary> /// Test the functions that read the current position /// </summary> void TestPosition() { int hr; long pCurrent1, pStop1, pDuration1; long pCurrent2, pStop2; long pEarliest, pLatest; // Read the current play position hr = m_ims.GetCurrentPosition(out pCurrent1); Marshal.ThrowExceptionForHR(hr); // Read the current stop position hr = m_ims.GetStopPosition(out pStop1); Marshal.ThrowExceptionForHR(hr); // Read the duraton (probably related to StopPosition - Position hr = m_ims.GetDuration(out pDuration1); Marshal.ThrowExceptionForHR(hr); // Read both current and stop positions hr = m_ims.GetPositions(out pCurrent2, out pStop2); Marshal.ThrowExceptionForHR(hr); // Get the cached range of values hr = m_ims.GetAvailable(out pEarliest, out pLatest); Marshal.ThrowExceptionForHR(hr); // Since we aren't playing, current should be 0, stop & // duration should be the same (the length of the clip) Debug.Assert(pCurrent1 == 0, "CurrentPosition"); Debug.Assert(pStop1 == pDuration1, "Stop, Duration"); Debug.Assert(pCurrent1 == pCurrent2, "GetPositions"); Debug.Assert(pStop1 == pStop2, "CurrentPosition stop"); Debug.Assert(pEarliest == pCurrent1, "CurrentPosition stop"); Debug.Assert(pLatest == pStop2, "CurrentPosition stop"); }