Esempio n. 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            mWriter  = new MFWriterClass();
            mReader  = new MFReaderClass();
            mPreview = new MFPreviewClass();
            //Preview = new MFPreviewClass();
            try
            {
                mLive = new MFLiveClass();
            }
            catch (Exception ex)
            {
                MessageBox.Show("No Live Devices Available: " + ex.ToString());
            }
            mPreview.PreviewWindowSet("", panelPreview.Handle.ToInt32());
            mPreview.PreviewEnable("", 1, 1);

            FillComboBox();

            cancelSource      = new CancellationTokenSource();
            threadWorker      = new Thread(() => thread_DoWork(cancelSource.Token));
            threadWorker.Name = "thread_DoWork";
            threadWorker.Start();

            avProps.vidProps.eVideoFormat = eMVideoFormat.eMVF_Custom;
            System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
        }
Esempio n. 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Panel[] panels = { panel1, panel2, panel3, panel4, panel5 };
            for (int i = 0; i < COUNT; i++)
            {
                m_arrPreviews[i] = new MFPreviewClass();
                m_arrPreviews[i].PreviewWindowSet("", panels[i].Handle.ToInt32());
                m_arrPreviews[i].PreviewEnable("", 0, 1);

                m_arrWriters[i] = new MFWriterClass();

                m_arrLiveState[i]        = false;
                m_arrWritersState[i]     = false;
                m_arrLiveStateRestart[i] = false;
            }

            cancelSource   = new CancellationTokenSource();
            m_threadWorker = new Thread(() => thread_DoWork(cancelSource.Token))
            {
                Name = "thread_DoWork"
            };
            m_threadWorker.Start();

            FillListBox();
        }
Esempio n. 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            m_objPreview = new MFPreviewClass();
            m_objWriter  = new MFWriterClass();
            m_objReader  = new MFReaderClass();

            try
            {
                m_objLive   = new MFLiveClass();
                m_audioLive = new MFLiveClass();
                FillCombo(eMFDeviceType.eMFDT_Video, video, true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("MLive device not found\n\n" + ex.ToString());
            }

            try
            {
                m_objCCDisplay = new MCCDisplayClass();
            }
            catch
            {
                MessageBox.Show("MCCDisplay module was not found.");
            }

            //Configure preview
            m_objPreview.PreviewWindowSet("", panelPreview.Handle.ToInt32());
            m_objPreview.PreviewEnable("", Convert.ToInt32(checkBoxAPrev.Checked), Convert.ToInt32(checkBoxVPrev.Checked));

            // Fill Senders
            FillSenders();

            FillVideoFormats();

            //Fill live devices
            FillMLiveDevices();

            //Fill formats
            FillMWriterFormats();

            // Create & config background worker

            cancelSource        = new CancellationTokenSource();
            m_threadWorker      = new Thread(() => thread_DoWork(cancelSource.Token));
            m_threadWorker.Name = "thread_DoWork";
            m_threadWorker.Start();

            System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;   //Need for use renderersCombobox in multithreading
        }
Esempio n. 4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            m_objPreview = new MFPreviewClass();
            m_objReader  = new MFReaderClass();
            m_objWriter  = new MFWriterClass();

            m_objPreview.PreviewWindowSet("", panelPrev.Handle.ToInt32());
            m_objPreview.PreviewEnable("", 1, 1);

            cancelSource        = new CancellationTokenSource();
            m_threadWorker      = new Thread(() => thread_DoWork(cancelSource.Token));
            m_threadWorker.Name = "thread_DoWork";
            m_threadWorker.Start();
        }
Esempio n. 5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            EncodingConf_lsb.Items.Add(" format='mp4' video::codec='n264' video::b='7M' video::profile='High' video::preset='high_quality' audio::codec='aac'");
            EncodingConf_lsb.Items.Add(" format='mp4' video::codec='n264' video::b='7M' video::profile='High' video::preset='high_quality' video::interlace='Progressive' audio::codec='aac'");
            EncodingConf_lsb.Items.Add(" format='mp4' video::codec='n264' video::b='6M' video::profile='High' video::preset='high_quality' video::interlace='Progressive' audio::codec='aac'");
            EncodingConf_lsb.Items.Add(" format='mp4' video::codec='n264' video::b='6M' video::profile='High' video::preset='high_quality' video::interlace='Progressive' audio::codec='aac'");
            EncodingConf_lsb.Items.Add(" format='mp4' video::codec='n264' video::b='5M' video::interlace='Progressive' audio::codec='aac'");


            currentEncodingConf = EncodingConf_lsb.Items[0].ToString();

            m_objLive1 = new MFLiveClass();
            m_objLive2 = new MFLiveClass();
            m_objLive3 = new MFLiveClass();
            m_objLive4 = new MFLiveClass();
            m_objLive5 = new MFLiveClass();

            m_objPrev1 = new MFPreviewClass();
            m_objPrev2 = new MFPreviewClass();
            m_objPrev3 = new MFPreviewClass();
            m_objPrev4 = new MFPreviewClass();
            m_objPrev5 = new MFPreviewClass();

            m_objPrev1.PreviewWindowSet("", panelPr1.Handle.ToInt32());
            m_objPrev1.PreviewEnable("", 0, 1);
            m_objPrev2.PreviewWindowSet("", panelPr2.Handle.ToInt32());
            m_objPrev2.PreviewEnable("", 0, 1);
            m_objPrev3.PreviewWindowSet("", panelPr3.Handle.ToInt32());
            m_objPrev3.PreviewEnable("", 0, 1);
            m_objPrev4.PreviewWindowSet("", panelPr4.Handle.ToInt32());
            m_objPrev4.PreviewEnable("", 0, 1);
            m_objPrev5.PreviewWindowSet("", panelPr5.Handle.ToInt32());
            m_objPrev5.PreviewEnable("", 0, 1);

            m_objWriter1 = new MFWriterClass();
            m_objWriter2 = new MFWriterClass();
            m_objWriter3 = new MFWriterClass();
            m_objWriter4 = new MFWriterClass();
            m_objWriter5 = new MFWriterClass();

            cancelSource        = new CancellationTokenSource();
            m_threadWorker      = new Thread(() => thread_DoWork(cancelSource.Token));
            m_threadWorker.Name = "thread_DoWork";
            m_threadWorker.Start();

            avProps.vidProps.eVideoFormat = eMVideoFormat.eMVF_HD1080_25p;

            UpdateTheListOfDevices();
        }
Esempio n. 6
0
        private void Form1_Load(object sender, EventArgs e)
        {
            m_objReader1 = new MFReaderClass();
            m_objReader2 = new MFReaderClass();
            m_objReader3 = new MFReaderClass();
            m_objReader4 = new MFReaderClass();
            m_objReader5 = new MFReaderClass();

            m_objPreview1 = new MFPreviewClass();
            m_objPreview1.PreviewWindowSet("", panel1.Handle.ToInt32());
            m_objPreview1.PreviewEnable("", 0, 1);

            m_objPreview2 = new MFPreviewClass();
            m_objPreview2.PreviewWindowSet("", panel2.Handle.ToInt32());
            m_objPreview2.PreviewEnable("", 0, 1);

            m_objPreview3 = new MFPreviewClass();
            m_objPreview3.PreviewWindowSet("", panel3.Handle.ToInt32());
            m_objPreview3.PreviewEnable("", 0, 1);

            m_objPreview4 = new MFPreviewClass();
            m_objPreview4.PreviewWindowSet("", panel4.Handle.ToInt32());
            m_objPreview4.PreviewEnable("", 0, 1);

            m_objPreview5 = new MFPreviewClass();
            m_objPreview5.PreviewWindowSet("", panel5.Handle.ToInt32());
            m_objPreview5.PreviewEnable("", 0, 1);

            m_objWriter1 = new MFWriterClass();
            m_objWriter2 = new MFWriterClass();
            m_objWriter3 = new MFWriterClass();
            m_objWriter4 = new MFWriterClass();
            m_objWriter5 = new MFWriterClass();

            cancelSource   = new CancellationTokenSource();
            m_threadWorker = new Thread(() => thread_DoWork(cancelSource.Token))
            {
                Name = "thread_DoWork"
            };
            m_threadWorker.Start();

            FillListBox();
        }
Esempio n. 7
0
        private void Form1_Load(object sender, EventArgs e)
        {
            m_objPrev = new MFPreviewClass();
            m_objRed  = new MFReaderClass();
            m_objWr1  = new MFWriterClass();
            WriterSet();


            m_objPrev.PreviewWindowSet("", Prewiew_panel.Handle.ToInt32());
            m_objPrev.PreviewEnable("", 1, 1);


            cancelSource        = new CancellationTokenSource();
            m_threadWorker      = new Thread(() => thread_DoWork(cancelSource.Token));
            m_threadWorker.Name = "thread_DoWork";
            m_threadWorker.Start();

            //System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
        }
Esempio n. 8
0
        private void Form1_Load(object sender, EventArgs e)
        {
            m_objPreviewPub = new MFPreviewClass();
            m_objPreviewRec = new MFPreviewClass();



            m_objWriter = new MFWriterClass();

            m_objPreviewPub.PreviewWindowSet("", panelPub.Handle.ToInt32());
            m_objPreviewPub.PreviewEnable("", PubAudio_chb.Checked?1:0, 1);

            m_objPreviewRec.PreviewWindowSet("", panelRec.Handle.ToInt32());
            m_objPreviewRec.PreviewEnable("", RecAudio_chb.Checked?1:0, 1);

            cancelSource        = new CancellationTokenSource();
            m_threadWorker      = new Thread(() => thread_DoWork(cancelSource.Token));
            m_threadWorker.Name = "thread_DoWork";
            m_threadWorker.Start();
        }
Esempio n. 9
0
        void WriterSet()
        {
            m_objWr1.WriterClose(-1);
            Marshal.ReleaseComObject(m_objWr1);
            m_objWr1 = new MFWriterClass();
            string savePath = savePath_txb.Text + number.ToString() + ".mp4";

            m_objWr1.WriterSet(savePath, 0, encodingCon_txb.Text);


            string a = Environment.CurrentDirectory + "\\output\\mformats_test.flv";
            string b = @"format='flv' " +
                       "video::codec='q264hw' video::b='3.7M' video::size='1280x720' video::g='30' " +
                       "audio::codec='aac' audio::b='64K' audio::ar='44100'";



            BeginInvoke(new InvokeDelegate(UpdateList));
            number++;
        }
Esempio n. 10
0
        private void Form1_Load(object sender, EventArgs e)
        {
            m_objPrev = new MFPreviewClass();
            m_objRed  = new MFReaderClass();
            m_objRed.PropsSet("external_process", "false");
            m_objWriter = new MFWriterClass();
            m_objWriter.PropsSet("external_process", "false");

            m_objWriter.WriterSet("", 0, "");

            m_objRed.ReaderOpen(openFilePath_txb.Text, "");
            m_objWriter.WriterSet(savePath_txb.Text, 0, @"format='mp4' video::codec='n264' video::size='720x1080' audio::codec='aac'");

            m_objPrev.PreviewWindowSet("", prevPanel.Handle.ToInt32());
            m_objPrev.PreviewEnable("", 1, 1);


            cancelSource        = new CancellationTokenSource();
            m_threadWorker      = new Thread(() => thread_DoWork(cancelSource.Token));
            m_threadWorker.Name = "thread_DoWork";
            //m_threadWorker.Start();
        }
Esempio n. 11
0
        private void UpdateStatistic(Label label, MFWriterClass m_objWriter)
        {
            label.BackColor = Color.OrangeRed;

            string srtOrPath, opttionsList;
            string fIn, bIn, fDrops, buff;

            m_objWriter.WriterGet(out srtOrPath, out opttionsList);

            int propsCount;

            m_objWriter.PropsGetCount("stat", out propsCount);
            StringBuilder propsBuilder = new StringBuilder();

            for (int propsIndex = 0; propsIndex < propsCount; propsIndex++)
            {
                string propsName;
                string propsValue;
                int    propsIsNode;
                m_objWriter.PropsGetByIndex("stat", propsIndex, out propsName, out propsValue, out propsIsNode);
                propsBuilder.AppendLine(propsName + " : " + propsValue);
            }

            string propsStatList = propsBuilder.ToString();

            m_objWriter.PropsGet("stat::frames_in", out fIn);
            m_objWriter.PropsGet("stat::breaks_in", out bIn);

            m_objWriter.PropsGet("stat::buffers_overflow", out fDrops);
            m_objWriter.PropsGet("stat::buffered", out buff);


            label.Text = "Capturing file: " + srtOrPath + "\n\n" +
                         "Frames In: " + fIn + "; " +
                         "Break In: " + bIn + "; " +
                         "Frame drops: " + fDrops + ";\n" +
                         "Buffer: " + buff;
        }
Esempio n. 12
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (m_objLive != null)
            {
                //setting the audio channels
                m_audioLive.PropsSet("audio_channels", "0+2+4+6+8+10,1+3+5+7+9+11,0,1,2,3,4,5,6,7,8,9,10,11");

                if (m_objWriter == null)
                {
                    m_objWriter = new MFWriterClass();
                }

                SaveFileDialog save = new SaveFileDialog();
                save.ShowDialog();
                string file_path = save.FileName;
                m_objWriter.WriterSet(file_path, 1, "format='mp4' split_channels='2' video::codec='mpeg4' video::b='2500K' audio::codec='aac' audio::b='128K' metadata::comment = 'StereoChannels'");
                m_bWork = true;
                rec     = true;
            }
            else
            {
                MessageBox.Show("Please init Live with audio only device");
            }
        }
Esempio n. 13
0
 private void Form1_Load(object sender, EventArgs e)
 {
     reader = new MFReaderClass();
     writer = new MFWriterClass();
 }