Пример #1
0
        private void EncodingCompleted()
        {
            m_EncodingDone = true;
            Debug.WriteLine("Completed pass " + m_Profile.ToString() +
                            " WMENC_ENCODER_STATE.WMENC_ENCODER_STOPPED");
            lblStatus.Text           = " Finished encoding " + m_Profile.ToString();
            m_Encoder.OnStateChange -= new _IWMEncoderEvents_OnStateChangeEventHandler(
                OnStateChange);
            m_Encoder = null;

            switch (m_Profile)
            {
            case EncodingProfileEnum.LOW:
                m_Profile = EncodingProfileEnum.HIGH;
                EncodeFile(m_Profile);
                break;

            case EncodingProfileEnum.HIGH:
                m_Profile = EncodingProfileEnum.LOSSLESS;
                EncodeFile(m_Profile);
                break;

            case EncodingProfileEnum.LOSSLESS:
                break;
            }
        }
 private void btnEncodeLossless_Click(object sender, System.EventArgs e)
 {
     m_EncodingSourceInfo = ReadGridInfo();
     this.m_CurrentIndex  = 0;
     m_CurrentProfile     = EncodingProfileEnum.LOSSLESS;
     m_StartingProfile    = m_CurrentProfile;
     this.Cursor          = Cursors.AppStarting;
     EncodeFile(m_CurrentProfile, m_EncodingSourceInfo[0]);
 }
        private void EncodeFile(EncodingProfileEnum Profile, EncoderInfo Info)
        {
            try
            {
                m_CurrentInfo = Info;
                DateTime Now = DateTime.Now;
                lblStatus.Text = " Starting to encode " + m_CurrentProfile.ToString() +
                                 " Starting time = " + Now.ToLongTimeString();
                m_EncodingDone = false;
                // Create a WMEncoder object.
                m_Encoder = new WMEncoder();
                m_Encoder.OnStateChange += new _IWMEncoderEvents_OnStateChangeEventHandler(
                    OnStateChange);

                // Retrieve the source group collection.
                IWMEncSourceGroupCollection SrcGrpColl = m_Encoder.SourceGroupCollection;

                // Add a source group to the collection.
                IWMEncSourceGroup SrcGrp = SrcGrpColl.Add("SG_1");

                // Add a video and audio source to the source group.
                IWMEncSource SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
                SrcAud.SetInput(Info.FileNameAndPath, "", "");
                // Specify a file object in which to save encoded content.
                SetOutputFileName(Info.FileNameNoExtension);
                SelectProfile(SrcGrp);

                // Fill in the description object members.
                IWMEncDisplayInfo Descr = m_Encoder.DisplayInfo;
                Descr.Author      = Info.Author;
                Descr.Copyright   = "Valley Bible Church @2005";
                Descr.Description = Info.Description;
                Descr.Rating      = "All Audiences";
                Descr.Title       = Info.MessageTitle;

                // Add an attribute to the collection.
                IWMEncAttributes Attr = m_Encoder.Attributes;
                Attr.Add("URL", "IP address");

                // Start the encoding process.
                // Wait until the encoding process stops before exiting the application.
                m_Encoder.PrepareToEncode(true);
                m_Encoder.Start();
            }
            catch (Exception e)
            {
                lblError.Text = e.ToString();
                Debug.WriteLine(e.ToString());
                m_CurrentInfo = null;
            }
        }
        private void EncodingCompleted()
        {
            m_EncodingDone = true;
            Debug.WriteLine("Completed pass " + m_CurrentProfile.ToString() +
                            " WMENC_ENCODER_STATE.WMENC_ENCODER_STOPPED");
            lblStatus.Text           = " Finished encoding " + m_CurrentProfile.ToString();
            m_Encoder.OnStateChange -= new _IWMEncoderEvents_OnStateChangeEventHandler(
                OnStateChange);
            m_Encoder = null;
            if (m_AbortRequested == true)
            {
                this.Cursor      = Cursors.Arrow;
                m_CurrentProfile = m_StartingProfile;
                m_CurrentIndex   = 0;
                m_AbortRequested = false;
                return;
            }

            switch (m_CurrentProfile)
            {
            case EncodingProfileEnum.LOW:
                m_CurrentProfile = EncodingProfileEnum.HIGH;
                EncodeFile(m_CurrentProfile, this.m_CurrentInfo);
                break;

            case EncodingProfileEnum.HIGH:
                m_CurrentProfile = EncodingProfileEnum.LOSSLESS;
                EncodeFile(m_CurrentProfile, this.m_CurrentInfo);
                break;

            case EncodingProfileEnum.LOSSLESS:
                m_CurrentIndex++;
                if (m_CurrentIndex >= m_EncodingSourceInfo.Length)
                {
                    this.Cursor = Cursors.Arrow;
                }
                else
                {
                    m_CurrentProfile = m_StartingProfile;
                    EncodeFile(m_CurrentProfile, m_EncodingSourceInfo[m_CurrentIndex]);
                }
                break;
            }
        }
Пример #5
0
 private void btnEncodeLossless_Click(object sender, System.EventArgs e)
 {
     m_Profile = EncodingProfileEnum.LOSSLESS;
     EncodeFile(m_Profile);
 }
Пример #6
0
 private void btnStartEncode_Click(object sender, System.EventArgs e)
 {
     m_Profile = EncodingProfileEnum.LOW;
     EncodeFile(m_Profile);
 }