Exemplo n.º 1
0
        private void Config()
        {
            int                 hr;
            IMediaStream        ms;
            IAMMediaTypeStream  mts;
            IMediaStream        ms2  = null;
            IAMMultiMediaStream mms  = (IAMMultiMediaStream) new AMMultiMediaStream();
            IAMMediaTypeStream  amts = (IAMMediaTypeStream) new AMMediaTypeStream();
            IAMMediaTypeSample  mtp;

            //AMMediaType pmt = new AMMediaType();
            //pmt.majorType = MediaType.Video;

            // hr = amts.SetFormat(pmt, 0);
            // MsError.ThrowExceptionForHR(hr);

            hr = mms.Initialize(StreamType.Write, AMMMultiStream.None, null);

            hr = mms.AddMediaStream(amts, null, AMMStream.None, ms2);
            MsError.ThrowExceptionForHR(hr);

            hr = mms.EnumMediaStreams(0, out ms);
            MsError.ThrowExceptionForHR(hr);

            mts = ms as IAMMediaTypeStream;
            hr  = mts.CreateSample(100, IntPtr.Zero, 0, null, out mtp);
            MsError.ThrowExceptionForHR(hr);

            m_ss = mtp as IStreamSample;

            hr = mms.SetState(StreamState.Run);
            MsError.ThrowExceptionForHR(hr);
        }
Exemplo n.º 2
0
        private void TestFlush()
        {
            int hr;

            hr = m_msf.Flush(true);
            MsError.ThrowExceptionForHR(hr);
        }
        private void TestOpenFile()
        {
            int hr;

            hr = m_mms.OpenFile("foo.avi", AMOpenModes.NoRender);
            MsError.ThrowExceptionForHR(hr);
        }
Exemplo n.º 4
0
        private void Config()
        {
            int                 hr;
            IMediaStream        ms;
            IMediaStream        ms2  = null;
            IAMMultiMediaStream mms  = (IAMMultiMediaStream) new AMMultiMediaStream();
            IAMMediaTypeStream  amts = (IAMMediaTypeStream) new AMMediaTypeStream();

            AMMediaType pmt = new AMMediaType();

            pmt.majorType = MediaType.Video;

            //hr = mms.AddMediaStream(null, MSPID.PrimaryAudio, AMMStream.None, null);
            //MsError.ThrowExceptionForHR(hr);

            //pmt = null;
            //hr = amts.GetFormat(pmt, 0);
            //hr = amts.SetFormat(pmt, 0);

            hr = mms.AddMediaStream(amts, null, AMMStream.None, ms2);
            MsError.ThrowExceptionForHR(hr);

            hr = mms.EnumMediaStreams(0, out ms);
            MsError.ThrowExceptionForHR(hr);

            m_mts = ms as IAMMediaTypeStream;
        }
Exemplo n.º 5
0
        private void TestWait()
        {
            int hr;

            hr = m_msf.WaitUntil(10000000);
            MsError.ThrowExceptionForHR(hr);
        }
Exemplo n.º 6
0
        private void TestEnd()
        {
            int hr;

            hr = m_msf.EndOfStream();
            MsError.ThrowExceptionForHR(hr);
        }
        private void TestRender()
        {
            int hr;

            hr = m_mms.Render(AMOpenModes.RenderAllStreams);
            MsError.ThrowExceptionForHR(hr);
        }
        private void TestAdd()
        {
            int          hr;
            IMediaStream pStream = null;

            hr = m_mms.AddMediaStream(null, MSPID.PrimaryAudio, AMMStream.AddDefaultRenderer, pStream);
            MsError.ThrowExceptionForHR(hr);
        }
Exemplo n.º 9
0
        private void TestGetMediaStream()
        {
            int          hr;
            IMediaStream pStream = null;

            hr = m_msf.GetMediaStream(MSPID.PrimaryAudio, out pStream);
            MsError.ThrowExceptionForHR(hr);
        }
Exemplo n.º 10
0
        private void TestRefTime()
        {
            int  hr;
            long l = 1234;

            hr = m_msf.ReferenceTimeToStreamTime(ref l);
            MsError.ThrowExceptionForHR(hr);
        }
        private void TestOpenMoniker()
        {
            int hr;

            DsDevice [] devs = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);

            hr = m_mms.OpenMoniker(null, devs[0].Mon, AMOpenModes.NoRender);
            MsError.ThrowExceptionForHR(hr);
        }
Exemplo n.º 12
0
        private void TestDuration()
        {
            int  hr;
            long lDur;

            hr = m_mms.GetDuration(out lDur);
            MsError.ThrowExceptionForHR(hr);

            Debug.Assert(lDur == 43200000, "GetDuration");
        }
Exemplo n.º 13
0
        private void TestGetMMStream()
        {
            int hr;
            IMultiMediaStream mms;

            hr = m_ms.GetMultiMediaStream(out mms);
            MsError.ThrowExceptionForHR(hr);

            Debug.Assert(m_mms == mms, "GetMultiMediaStream");
        }
Exemplo n.º 14
0
        private void TestEnum()
        {
            int          hr;
            IMediaStream pStream;

            hr = m_msf.EnumMediaStreams(0, out pStream);
            MsError.ThrowExceptionForHR(hr);

            Debug.Assert(pStream != null, "EnumMediaStreams");
        }
Exemplo n.º 15
0
        private void TestSample()
        {
            const int          iSize = 100;
            int                hr;
            IAMMediaTypeSample mts;
            IntPtr             ip = Marshal.AllocCoTaskMem(iSize);

            hr = m_mts.CreateSample(iSize, ip, 0, null, out mts);
            MsError.ThrowExceptionForHR(hr);
        }
Exemplo n.º 16
0
        private void TestGetMediaStream()
        {
            int          hr;
            IMediaStream pms;

            hr = m_ss.GetMediaStream(out pms);
            MsError.ThrowExceptionForHR(hr);

            Debug.Assert(pms != null, "GetMediaStream");
        }
Exemplo n.º 17
0
        private void TestUpdate()
        {
            int hr;

            hr = m_ss.Update(SSUpdate.Continuous, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
            MsError.ThrowExceptionForHR(hr);

            hr = m_ss.CompletionStatus(CompletionStatusFlags.None, 1);
            MsError.ThrowExceptionForHR(hr);
        }
Exemplo n.º 18
0
        private void TestGetInfo()
        {
            int        hr;
            Guid       pPurpose;
            StreamType pType;

            hr = m_ms.GetInformation(out pPurpose, out pType);
            MsError.ThrowExceptionForHR(hr);

            Debug.Assert(pType == StreamType.Read && pPurpose == MSPID.PrimaryAudio, "GetInformation");
        }
        private void TestGetFilter()
        {
            int hr;
            IMediaStreamFilter pFilter;

            hr = m_mms.GetFilter(out pFilter);
            MsError.ThrowExceptionForHR(hr);

            Debug.Assert(pFilter != null, "GetFilter");
            Marshal.ReleaseComObject(pFilter);
        }
Exemplo n.º 20
0
        private void TestGetStream()
        {
            int          hr;
            IMediaStream pStream;

            hr = m_mms.GetMediaStream(MSPID.PrimaryAudio, out pStream);
            MsError.ThrowExceptionForHR(hr);

            Debug.Assert(pStream != null, "GetMediaStream");
            Marshal.ReleaseComObject(pStream);
        }
Exemplo n.º 21
0
        private void TestFormat()
        {
            int          hr;
            WaveFormatEx pCurrent = new WaveFormatEx();

            hr = m_ams.GetFormat(pCurrent);
            MsError.ThrowExceptionForHR(hr);

            hr = m_ams.SetFormat(pCurrent);
            MsError.ThrowExceptionForHR(hr);
        }
Exemplo n.º 22
0
        private void TestGetInfo()
        {
            int        hr;
            MMSSF      f;
            StreamType t;

            hr = m_mms.GetInformation(out f, out t);
            MsError.ThrowExceptionForHR(hr);

            Debug.Assert(f == (MMSSF.HasClock | MMSSF.Asynchronous | MMSSF.SupportSeek), "GetInformation");
            Debug.Assert(t == StreamType.Read, "GetInformation");
        }
Exemplo n.º 23
0
        private void TestCreate()
        {
#if ALLOW_UNTESTED_INTERFACES
            int hr;

            IAudioStreamSample pSample = null;
            IAudioData         pData   = new foo() as IAudioData;

            hr = m_ams.CreateSample(pData, 0, out pSample);
            MsError.ThrowExceptionForHR(hr);
#endif
        }
Exemplo n.º 24
0
        private void TestSeek()
        {
            int  hr;
            long t;

            hr = m_mms.Seek(43200000 / 2);
            MsError.ThrowExceptionForHR(hr);

            hr = m_mms.GetTime(out t);
            MsError.ThrowExceptionForHR(hr);

            Debug.Assert(t == 43200000 / 2, "Seek/GetTime");
        }
Exemplo n.º 25
0
        private void TestActualLength()
        {
            int hr;

            hr = m_ts.SetActualDataLength(99);
            MsError.ThrowExceptionForHR(hr);

            int i = m_ts.GetActualDataLength();

            MsError.ThrowExceptionForHR(hr);

            Debug.Assert(i == 99, "ActualDataLength");
        }
Exemplo n.º 26
0
        private void TestMediaTimes()
        {
            int  hr;
            long ls, le, lc;

            // Despite having initialized the stream as StreamType.Write, apparently
            // DS still sees it as RO.  Not sure how to work around this.
            hr = m_ss.SetSampleTimes(123, 456);
            //MsError.ThrowExceptionForHR(hr);

            hr = m_ss.GetSampleTimes(out ls, out le, out lc);
            MsError.ThrowExceptionForHR(hr);
        }
Exemplo n.º 27
0
        private void TestTime()
        {
            int  hr;
            long ls, le;

            hr = m_ts.SetTime(123, 345);
            MsError.ThrowExceptionForHR(hr);

            hr = m_ts.GetTime(out ls, out le);
            MsError.ThrowExceptionForHR(hr);

            Debug.Assert(ls == 123 && le == 345, "Time");
        }
Exemplo n.º 28
0
        private void TestPreroll()
        {
            int hr;
            int iBefore, iAfter;

            hr = m_ts.SetPreroll(false);
            MsError.ThrowExceptionForHR(hr);

            iBefore = m_ts.IsPreroll();

            hr = m_ts.SetPreroll(true);
            MsError.ThrowExceptionForHR(hr);

            iAfter = m_ts.IsPreroll();
            Debug.Assert(iBefore != iAfter, "Preroll");
        }
Exemplo n.º 29
0
        private void TestAllocateSample()
        {
            int           hr;
            IStreamSample pSample, pNewSample;

            hr = m_ms.AllocateSample(0, out pSample);
            MsError.ThrowExceptionForHR(hr);

            hr = m_ms.CreateSharedSample(pSample, 0, out pNewSample);
            MsError.ThrowExceptionForHR(hr);

            Debug.Assert(pSample != pNewSample && pNewSample != null, "CreateSharedSample");

            Marshal.ReleaseComObject(pSample);
            Marshal.ReleaseComObject(pNewSample);
        }
Exemplo n.º 30
0
        private void TestMediaType()
        {
            int         hr;
            AMMediaType mt2;
            AMMediaType mt = new AMMediaType();

            mt.majorType = MediaType.Timecode;

            hr = m_ts.SetMediaType(mt);
            MsError.ThrowExceptionForHR(hr);

            hr = m_ts.GetMediaType(out mt2);
            MsError.ThrowExceptionForHR(hr);

            Debug.Assert(mt.majorType == mt2.majorType, "MediaType");
        }