Ejemplo n.º 1
0
        private void TestMisc()
        {
            WMReaderStatistics ps = new WMReaderStatistics();

            ps.cbSize = Marshal.SizeOf(typeof(WMReaderStatistics));

            m_read.GetStatistics(ps);
            Debug.Assert(ps.wQuality == 100);

            m_read.NotifyLateDelivery(1000);
            m_read.DeliverTime(1000);

            int i;

            m_read.GetMaxOutputSampleSize(1, out i);

            Debug.Assert(i != 0);

            m_read.GetMaxStreamSampleSize(1, out i);
            Debug.Assert(i != 0);

            WMReaderClientInfo w = new WMReaderClientInfo();

            w.cbSize = Marshal.SizeOf(typeof(WMReaderClientInfo));
            m_read.SetClientInfo(w);
        }
Ejemplo n.º 2
0
        //------------------------------------------------------------------------------
        // Name: CWMVCopy::OnStatus()
        // Desc: Implementation of IWMStatusCallback::OnStatus.
        //------------------------------------------------------------------------------
        public void OnStatus(
            Status Status,
            int hr,
            AttrDataType dwType,
            IntPtr pValue,
            IntPtr pvContext)
        {
            //
            // If an error code already exists, just set the event and return.
            //
            if (m_hr < 0)
            {
                m_hEvent.Set();
                return;
            }

            //
            // If an error occurred in the reader, save this error code and set the event.
            //
            if (hr < 0)
            {
                m_hr = hr;
                m_hEvent.Set();
            }

            switch (Status)
            {
            case Status.Opened:
                Console.WriteLine("Reader Callback: File is opened.");
                m_hr = S_Ok;
                m_hEvent.Set();

                break;

            case Status.Started:
                //
                // Ask for 1 second of the stream to be delivered
                //
                m_qwReaderTime = 10000000;

                try
                {
                    m_pReaderAdvanced.DeliverTime(m_qwReaderTime);
                }
                catch (Exception e)
                {
                    int lhr = Marshal.GetHRForException(e);
                    m_hr = hr;
                    m_hEvent.Set();
                }

                break;

            case Status.EOF:
                m_hr   = S_Ok;
                m_fEOF = true;
                m_hEvent.Set();

                break;
            }
        }