示例#1
0
        private void TestWaitForNext()
        {
            int          hr;
            IntPtr       pUser;
            IMediaSample pSample;
            IMediaSample pSample2;

            hr = m_pActual.GetBuffer(out pSample, 0, 0, AMGBF.None);
            DsError.ThrowExceptionForHR(hr);

            hr = pSample.SetTime(0, 512 * 10000000L);
            DsError.ThrowExceptionForHR(hr);

            hr = pSample.SetActualDataLength(5);
            DsError.ThrowExceptionForHR(hr);

            hr = m_iar.Request(pSample, (IntPtr)2);
            DsError.ThrowExceptionForHR(hr);

            hr = m_iar.WaitForNext(1000, out pSample2, out pUser);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(pUser == (IntPtr)2, "WaitForNext");
            Debug.Assert(pSample2.GetActualDataLength() == 512, "WaitForNext2");

            Marshal.ReleaseComObject(pSample);
        }
示例#2
0
        private void TestBuffer()
        {
            int          hr;
            IMediaSample pBuff;

            hr = m_ma.GetBuffer(out pBuff, 1, 2, AMGBF.None);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(pBuff.GetActualDataLength() == 1024, "Check size");

            hr = m_ma.ReleaseBuffer(pBuff);
            DsError.ThrowExceptionForHR(hr);
        }