private void TestCreate()
        {
            IWMProfile pProfile;

            m_pWMProfileManager.CreateEmptyProfile(WMVersion.V9_0, out pProfile);
            Debug.Assert(pProfile != null);
        }
Пример #2
0
        private void Config()
        {
            IWMProfileManager pWMProfileManager = null;
            IWMProfile        pWMProfile        = null;

            // Open the profile manager
            WMUtils.WMCreateProfileManager(out pWMProfileManager);

            pWMProfileManager.CreateEmptyProfile(WMVersion.V9_0, out pWMProfile);
            pWMProfile.CreateNewMutualExclusion(out m_pME);
        }
Пример #3
0
        private void Config()
        {
            IWMProfileManager pWMProfileManager = null;
            IWMProfile        pWMProfile        = null;
            IWMProfile3       pWMProfile3       = null;

            // Open the profile manager
            WMUtils.WMCreateProfileManager(out pWMProfileManager);

            pWMProfileManager.CreateEmptyProfile(WMVersion.V9_0, out pWMProfile);
            pWMProfile3 = pWMProfile as IWMProfile3;
            pWMProfile3.CreateNewBandwidthSharing(out m_pBS);
        }
Пример #4
0
        public IWMWriter GetWriter()
        {
            IWMProfileManager pProfileManager = null;

            try
            {
                WMUtils.WMCreateProfileManager(out pProfileManager);
                var pCodecInfo3 = pProfileManager as IWMCodecInfo3;
                // We have to use the same pProfileManager for enumeration,
                // because it calls SetCodecEnumerationSetting, so chosenFormat.format
                // would not point to the same format for a pProfileManager
                // with different (default) settings, and GetCodecFormat
                // would return the wrong stream config.
                var formats = GetFormats(pProfileManager);
                if (this.EncoderMode != "")
                {
                    formats.RemoveAll(fmt => fmt.modeName != this.EncoderMode);
                }
                if (formats.Count < 1)
                {
                    throw new NotSupportedException("codec/format not found");
                }
                if (formats.Count > 1)
                {
                    throw new NotSupportedException("codec/format ambiguous");
                }
                var             chosenFormat = formats[0];
                IWMStreamConfig pStreamConfig1;
                pCodecInfo3.GetCodecFormat(MediaType.Audio, chosenFormat.codec, chosenFormat.format, out pStreamConfig1);
                try
                {
                    pStreamConfig1.SetStreamNumber(1);
                    IWMProfile pProfile;
                    pProfileManager.CreateEmptyProfile(WMVersion.V9_0, out pProfile);
                    try
                    {
                        pProfile.AddStream(pStreamConfig1);
                        IWMWriter pWriter;
                        WMUtils.WMCreateWriter(IntPtr.Zero, out pWriter);
                        try
                        {
                            pWriter.SetProfile(pProfile);
                        }
                        catch (Exception ex)
                        {
                            Marshal.ReleaseComObject(pWriter);
                            throw ex;
                        }
                        return(pWriter);
                    }
                    finally
                    {
                        Marshal.ReleaseComObject(pProfile);
                    }
                }
                finally
                {
                    Marshal.ReleaseComObject(pStreamConfig1);
                }
            }
            finally
            {
                Marshal.ReleaseComObject(pProfileManager);
            }
        }