コード例 #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            // Create MF objects
            m_objFactory  = new MFFactory();
            m_objPreview  = new MFPreviewClass();
            m_playerState = new PlayerState();
            m_objRenderer = new MFRendererClass();
            m_objCharGen  = new CoMLCharGenClass();
            m_objMFSink   = new MFSinkClass();

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


            m_CEFResourcesPath = (string)Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Medialooks\MFormats", "resources.path", null);

            if (File.Exists(m_CEFResourcesPath + "\\CEF\\demo.html"))
            {
                m_strDemoURL        = Path.GetFullPath(m_CEFResourcesPath + "\\CEF\\demo.html");
                textBoxHTMLURL.Text = "demo";
            }

            m_playerState.bLoop = checkBoxLoop.Checked;

            // First file start with pause, next file open in same state
            pause();

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

            FillVideoFormats();

            // Fill renderer devices
            FillRenderers();

            // Fill audio renderers
            FillAudioRenderers();
            CheckForIllegalCrossThreadCalls = false;   //Need for use Combobox in multithreading

            mAudioMeter1.ChannelsUpdated += MAudioMeter1_ChannelsUpdated;
            // Create thread worker
            //m_bThread = true;
            cancelSource        = new CancellationTokenSource();
            m_threadWorker      = new Thread(() => thread_DoWork(cancelSource.Token));
            m_threadWorker.Name = "thread_DoWork";
            m_threadWorker.Start();

            if (m_arrArgs.Length > 0 && File.Exists(m_arrArgs[0]))
            {
                OpenFile(m_arrArgs[0]);
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Dronissim0/MLTestSamples
        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
        }
コード例 #3
0
        private void checkBoxCC_CheckedChanged(object sender, EventArgs e)
        {
            if (m_CCDisplay != null)
            {
                m_objPlaylist.PluginsRemove(m_CCDisplay);
                System.Runtime.InteropServices.Marshal.ReleaseComObject(m_CCDisplay);
                m_CCDisplay = null;
            }

            if (checkBoxCC.Checked)
            {
                m_CCDisplay = new MCCDisplayClass();
                m_objPlaylist.PluginsAdd(m_CCDisplay, 0);
            }
        }