示例#1
0
        private void InitializeCompressorMediaType()
        {
            ArrayList mts  = new ArrayList();
            ArrayList ihs  = new ArrayList();
            ArrayList sccs = new ArrayList();

            Pin.GetStreamConfigCaps((IAMStreamConfig)cOutputPin, out mts, out ihs, out sccs);

            for (int i = 0; i < mts.Count; i++)
            {
                Console.WriteLine(MediaType.Dump((_AMMediaType)mts[i]));
                Console.WriteLine(Pin.DebugStreamConfigCaps(sccs[i]));
            }

            // There's only one
            cMT            = (_AMMediaType)mts[0];
            cMT.formattype = MediaType.FormatType.FORMAT_VideoInfo;

            // MediaTypes are local to method, so free them all
            // then reallocate just the one we want
            for (int i = 0; i < mts.Count; i++)
            {
                _AMMediaType mt = (_AMMediaType)mts[i];
                MediaType.Free(ref mt);
            }

            cMT.cbFormat = (uint)Marshal.SizeOf(cVI);
            cMT.pbFormat = Marshal.AllocCoTaskMem((int)cMT.cbFormat);
        }