Esempio n. 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);
        }
Esempio n. 2
0
        private void ConfigureWMScreenEncoder()
        {
            //
            // Set Private Data
            //
            IWMCodecPrivateData iPD = (IWMCodecPrivateData)compressor;

            iPD.SetPartialOutputType(ref cMT);

            uint cbData = 0;

            iPD.GetPrivateData(IntPtr.Zero, ref cbData);

            if (cbData != 0)
            {
                int vihSize = Marshal.SizeOf(cVI);

                // Allocate space for video info header + private data
                IntPtr vipd = Marshal.AllocCoTaskMem(vihSize + (int)cbData);

                // Copy vih into place
                Marshal.StructureToPtr(cVI, vipd, false);

                // Fill in private data
                iPD.GetPrivateData(new IntPtr(vipd.ToInt32() + vihSize), ref cbData);

                // Clean up current media type
                MediaType.Free(ref cMT);

                // Reset it
                cMT.pbFormat = vipd;
                cMT.cbFormat = (uint)vihSize + cbData;
            }
        }
Esempio n. 3
0
        private void ConfigureWMScreenEncoder()
        {
            //
            // Note: Configure compressor before setting private data
            //
            //            IPropertyBag iPB = (IPropertyBag)compressor;
            //            object o = 1; // 1 == Live, can be obtained from IWMCodecProps.GetCodecProp(WM9PropList.g_wszWMVCComplexityExLive)
            //            iPB.Write(WM9PropList.g_wszWMVCComplexityEx, ref o);
            //
            //            // More configuration possibilities
            //            o = 0;
            //            iPB.Write(WM9PropList.g_wszWMVCComplexityMode, ref o);
            //
            //            o = 0;
            //            iPB.Write(WM9PropList.g_wszWMVCCrisp, ref o);
            //
            //            o = "MP";
            //            iPB.Write(WM9PropList.g_wszWMVCDecoderComplexityRequested, ref o);
            //
            //            o = 10000;
            //            iPB.Write(WM9PropList.g_wszWMVCVideoWindow, ref o);
            //
            //            o = true;
            //            iPB.Write(WM9PropList.g_wszWMVCVBREnabled, ref o);


            //
            // Set Private Data
            //
            IWMCodecPrivateData iPD = (IWMCodecPrivateData)compressor;

            iPD.SetPartialOutputType(ref cMT);

            uint cbData = 0;

            iPD.GetPrivateData(IntPtr.Zero, ref cbData);

            if (cbData != 0)
            {
                int vihSize = Marshal.SizeOf(cVI);

                // Allocate space for video info header + private data
                IntPtr vipd = Marshal.AllocCoTaskMem(vihSize + (int)cbData);

                // Copy vih into place
                Marshal.StructureToPtr(cVI, vipd, false);

                // Fill in private data
                iPD.GetPrivateData(new IntPtr(vipd.ToInt32() + vihSize), ref cbData);

                // Clean up current media type
                MediaType.Free(ref cMT);

                // Reset it
                cMT.pbFormat = vipd;
                cMT.cbFormat = (uint)vihSize + cbData;
            }
        }