コード例 #1
0
        void TestSamples()
        {
            int          hr;
            int          iSize = 0;
            IMediaSample pSample;

            hr = m_isg.SetBufferSamples(true);
            DsError.ThrowExceptionForHR(hr);

            hr = m_imc.Run();
            Marshal.ThrowExceptionForHR(hr);

            // Wait a moment for the graph to start running
            Thread.Sleep(500);

            // Get a buffer (needs SetBufferSamples(true)
            hr = m_isg.GetCurrentBuffer(ref iSize, IntPtr.Zero);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(iSize > 0, "GetCurrentBuffer");

            hr = m_isg.GetCurrentSample(out pSample);
            // E_NOTIMPL - Nothing to test
            if (hr != -2147467263)
            {
                DsError.ThrowExceptionForHR(hr);
            }

            hr = m_imc.Stop();
            Marshal.ThrowExceptionForHR(hr);
        }