Exemplo n.º 1
0
        private void comboBoxAF_SelectedIndexChanged(object sender, EventArgs e)
        {
            M_AUD_PROPS audProps = new M_AUD_PROPS();
            string      strFormat;

            m_objFile.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, comboBoxAF.SelectedIndex, out audProps, out strFormat);
            m_objFile.FormatAudioSet(eMFormatType.eMFT_Convert, ref audProps);
        }
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            M_AUD_PROPS audProps = new M_AUD_PROPS();
            string      strFormat;

            myPlaylist.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, comboBox2.SelectedIndex, out audProps, out strFormat);
            //Set new audio format
            myPlaylist.FormatAudioSet(eMFormatType.eMFT_Convert, ref audProps);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Format changed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void comboBoxAVF_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox cbxChanged = (ComboBox)sender;
            string   strType    = (string)cbxChanged.Tag;

            if (strType == "video")
            {
                M_VID_PROPS vidProps = new M_VID_PROPS();
                string      strFormat;
                ((IMFormat)m_objLive).FormatVideoGetByIndex(eMFormatType.eMFT_Input, cbxChanged.SelectedIndex, out vidProps, out strFormat);
                //Set new video format
                ((IMFormat)m_objLive).FormatVideoSet(0, ref vidProps);
            }
            else if (strType == "ext_audio")
            {
                M_AUD_PROPS audProps = new M_AUD_PROPS();
                string      strFormat;
                ((IMFormat)m_objLive).FormatAudioGetByIndex(eMFormatType.eMFT_Input, cbxChanged.SelectedIndex, out audProps, out strFormat);
                //Set new audio format
                ((IMFormat)m_objLive).FormatAudioSet(0, ref audProps);
            }
        }
Exemplo n.º 4
0
        protected override void OnSelectedFormatChanged()
        {
            M_AUD_PROPS audProps = _audPropsCache[this.SelectedFormat];

            this.MFormatObject.FormatAudioSet(this.FormatType, ref audProps);
        }
Exemplo n.º 5
0
        private void thread_DoWork(CancellationToken token)
        {
            while (!token.IsCancellationRequested)
            {
                MFFrame pFrame       = null;
                int     audioSamples = 0;
                if (startAudio)
                {
                    M_AUD_PROPS AduioProps = new M_AUD_PROPS();

                    try
                    {
                        m_objReaderAudio.SourceFrameGet(-1, out pFrame, "");
                        m_objAudBuff.BufferFramePut("", pFrame, "");
                        m_objAudBuff.BufferPropsGet("", out AduioProps, out audioSamples);

                        #region BeforeBuffer

                        pFrame.MFAVPropsGet(out VolumeProps, out asamp);

                        levelOrigin = VolumeProps.ancData.audOriginal.arrVUMeter[0];
                        leverOutPut = VolumeProps.ancData.audOutput.arrVUMeter[0];

                        BeginInvoke(new ChangeLabel(UpdateLabel1));
                        BeginInvoke(new ChangeLabel(UpdateLabel2));

                        BeginInvoke(new ChangeLabel(UpdateBar));

                        #endregion
                        Marshal.ReleaseComObject(pFrame);
                    }
                    catch
                    {
                        pFrame = null;
                        MessageBox.Show("Start Audio Part!");
                    }

                    if (startVideo)
                    {
                        m_objReaderFile.SourceFrameGet(-1, out pFrame, "");
                        int samples = 0;
                        if (audioSamples > 2000)
                        {
                            m_objAudBuff.BufferFrameFill("", pFrame, ref samples, "");
                        }

                        m_objPreview.ReceiverFramePut(pFrame, -1, "");

                        #region AfterBuffer

                        pFrame.MFAVPropsGet(out VolumeProps, out asamp);
                        levelOrigin = VolumeProps.ancData.audOriginal.arrVUMeter[0];
                        leverOutPut = VolumeProps.ancData.audOutput.arrVUMeter[0];


                        BeginInvoke(new ChangeLabel(UpdateLabel3));
                        BeginInvoke(new ChangeLabel(UpdateLabel4));
                        #endregion

                        m_objAudBuff.BufferRemove("", ref samples);

                        Marshal.ReleaseComObject(pFrame);
                    }
                }
            }
        }
Exemplo n.º 6
0
        void StartBug()
        {
            // playlist initialization

            M_VID_PROPS vidProps = new M_VID_PROPS();

            vidProps.eVideoFormat = eMVideoFormat.eMVF_Custom;
            MPlaylist.FormatVideoSet(eMFormatType.eMFT_Convert, ref vidProps);
            M_AUD_PROPS audioProp = new M_AUD_PROPS();

            audioProp.nChannels = 0;   //because some writer codecs (such as mp3) do not support 16 audio channels.
            MPlaylist.FormatAudioSet(eMFormatType.eMFT_Convert, audioProp);

            // playlist cue
            //set empty background. In this case playlist doesn't output anything until playback isn't started.
            MItem myBack;

            MPlaylist.PlaylistBackgroundSet(null, "", "", out myBack);
            if (myBack != null)
            {
                System.Runtime.InteropServices.Marshal.ReleaseComObject(myBack);
                GC.Collect();
            }
            // set convert format
            M_VID_PROPS mvid;
            M_AUD_PROPS maud;
            int         fmtind;
            string      fmtname;

            MPlaylist.FormatVideoGet(eMFormatType.eMFT_Output, out mvid, out fmtind, out fmtname);
            MPlaylist.FormatAudioGet(eMFormatType.eMFT_Output, out maud, out fmtind, out fmtname);
            MPlaylist.FormatVideoSet(eMFormatType.eMFT_Convert, ref mvid);
            MPlaylist.FormatAudioSet(eMFormatType.eMFT_Convert, ref maud);
            // set properties
            MPlaylist.PropsSet("loop", "false");
            MPlaylist.PropsSet("active_frc", "false");
            MPlaylist.PropsSet("preview.drop_frames", "true");
            vidProps.eVideoFormat = eMVideoFormat.eMVF_Custom;
            MPlaylist.FormatVideoSet(eMFormatType.eMFT_Convert, ref vidProps);

            int   index = -1;
            MItem item;

            MPlaylist.PlaylistAdd(null, @"\\192.168.0.100\MLFiles\Trash\Roman\WorkFiles\FilesFromCostumer\2019.05.27 Etere31929\kom_mult_kosmik_007sh_s.mpg", "", ref index, out item);

            // writer properties
            MWriter.PropsSet("rate_control", "true");
            MWriter.PropsSet("pull_mode", "false");
            MWriter.PropsSet("external_process", "false");

            //set audio mapping on first 2 channels only
            string       desc;
            IMAudioTrack audioTrack;

            MPlaylist.AudioTrackGetByIndex(0, out desc, out audioTrack);

            int nChIn;
            int nChOutIdx;
            int nChOut;

            audioTrack.TrackChannelsGet(out nChIn, out nChOutIdx, out nChOut);
            for (int i = 0; i < nChOut; i++)
            {
                int mute;
                if (i < 2)
                {
                    // switch on the required audio channels
                    mute = 0;
                }
                else
                {
                    // set mute all other audio channels
                    mute = 1;
                }
                audioTrack.TrackMuteSet(i, mute, 0.0);
            }

            string encodeConfig = @"format='mp4' start_timecode='00:00:00:00' video::codec='q264sw' video::size='640x360' video::b='1M' video::minrate='1M' video::maxrate='1M' video::ar='' video::ref_frames='3' video::profile='Baseline' video::level='4.1' video::rc_type='cbr' audio::codec='aac' audio::ar='48000'";

            MWriter.WriterNameSet(@"\\192.168.0.100\MLFiles\Trash\Roman\WorkFiles\FilesFromCostumer\2019.05.27 Etere31929\test\" + count.ToString() + ".mp4", encodeConfig);
            MWriter.ObjectStart(MPlaylist);
            MPlaylist.FilePlayStart();

            Marshal.ReleaseComObject(item);
            //Marshal.ReleaseComObject(myBack);
            GC.Collect();
        }