当前位置: 首页>>代码示例>>C#>>正文


C# IMediaControl.Pause方法代码示例

本文整理汇总了C#中IMediaControl.Pause方法的典型用法代码示例。如果您正苦于以下问题:C# IMediaControl.Pause方法的具体用法?C# IMediaControl.Pause怎么用?C# IMediaControl.Pause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IMediaControl的用法示例。


在下文中一共展示了IMediaControl.Pause方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: translateW_Load

        private void translateW_Load(object sender, EventArgs e)
        {
            //this.MaximumSize = this.Size;
            //this.MinimumSize = this.Size;
            toolStripStatusLabel2.Text = "Cargando el Asistente de Traducción...";
            // cargamos script
            autoComplete = new ArrayList();
            al = mW.al;
            gridCont.RowCount = al.Count;

            bool hasAutoComplete = (mW.script.GetHeader().GetHeaderValue("AutoComplete") != string.Empty);

            for (int i = 0; i < al.Count; i++)
            {
                lineaASS lass = (lineaASS)al[i];
                gridCont[0, i].Value = lass.personaje;
                if (!autoComplete.Contains(lass.personaje) && !hasAutoComplete)
                    if (lass.personaje.Trim()!="")
                        autoComplete.Add(lass.personaje);
                gridCont[1, i].Value = lass.texto;
            }
            if (hasAutoComplete) InsertAutoCompleteFromScript();

            labelLineaActual.Text = "1 de " + (al.Count) + " (0%)";
            textPersonaje.Text = gridCont[0, 0].Value.ToString();
            textOrig.Text = gridCont[1, 0].Value.ToString();

            // cargamos video

            graphBuilder = (IGraphBuilder)new FilterGraph();
            graphBuilder.RenderFile(videoInfo.FileName, null);
            mediaControl = (IMediaControl)graphBuilder;
            // mediaEventEx = (IMediaEventEx)this.graphBuilder;
            mediaSeeking = (IMediaSeeking)graphBuilder;
            mediaPosition = (IMediaPosition)graphBuilder;
            basicVideo = graphBuilder as IBasicVideo;
            basicAudio = graphBuilder as IBasicAudio;
            videoWindow = graphBuilder as IVideoWindow;

            try
            {
                int x, y; double atpf;
                basicVideo.GetVideoSize(out x, out y);
                basicVideo.get_AvgTimePerFrame(out atpf);
                videoInfo.FrameRate = Math.Round(1 / atpf, 3);

                int new_x = videoPanel.Width;
                int new_y = (new_x * y) / x;
                videoWindow.put_Height(new_x);
                videoWindow.put_Width(new_y);
                videoWindow.put_Owner(videoPanel.Handle);
                videoPanel.Size = new System.Drawing.Size(new_x, new_y);
                videoWindow.SetWindowPosition(0, 0, videoPanel.Width, videoPanel.Height);
                videoWindow.put_WindowStyle(WindowStyle.Child);
                videoWindow.put_Visible(DirectShowLib.OABool.True);
                mediaSeeking.SetTimeFormat(DirectShowLib.TimeFormat.Frame);

                mediaControl.Run();
            }
            catch { mW.errorMsg("Imposible cargar el vídeo. Debe haber algún problema con el mismo, y el asistente será muy inestable"); }
            // activamos timers & handlers

            timer1.Tick += new EventHandler(timer1_Tick);
            timer1.Enabled = true;
            timer2.Tick += new EventHandler(timer2_Tick);
            AutoSaveTimer.Tick += new EventHandler(timer3_Tick);
            AutoSaveTimer.Enabled = true;

            gridCont.CellClick += new DataGridViewCellEventHandler(gridCont_CellClick);
            textPersonaje.TextChanged += new EventHandler(textPersonaje_TextChanged);
            textTradu.TextChanged += new EventHandler(textTradu_TextChanged);
            textTradu.KeyUp += new KeyEventHandler(textBox1_KeyUp);
            textTradu.KeyDown += new KeyEventHandler(textTradu_KeyDown);
            textTradu.KeyPress += new KeyPressEventHandler(textTradu_KeyPress);
            textPersonaje.KeyDown += new KeyEventHandler(textPersonaje_KeyDown);
            textPersonaje.KeyPress += new KeyPressEventHandler(textPersonaje_KeyPress);
            button8.GotFocus += new EventHandler(button8_GotFocus);
            button9.GotFocus += new EventHandler(button9_GotFocus);
            gridCont.DoubleClick += new EventHandler(gridCont_DoubleClick);
            gridCont.SelectionChanged += new EventHandler(gridCont_SelectionChanged);
            gridCont.KeyUp += new KeyEventHandler(gridCont_KeyUp);
            listBox1.KeyUp += new KeyEventHandler(listBox1_KeyUp);
            textToAdd.KeyPress += new KeyPressEventHandler(textToAdd_KeyPress);
            progressBar1.MouseDown += new MouseEventHandler(progressBar1_MouseDown);
            tiempoInicio_.TimeValidated += new TimeTextBox.OnTimeTextBoxValidated(tiempo_TimeValidated);
            tiempoFin_.TimeValidated += new TimeTextBox.OnTimeTextBoxValidated(tiempo_TimeValidated);
            this.Move += new EventHandler(translateW_Move);

            //textTradu.ContextMenu = new ASSTextBoxRegExDefaultContextMenu(textTradu);

            mediaControl.Pause();

            // cargar de config

            try
            {
                checkAutoComplete.Checked = Convert.ToBoolean(mW.getFromConfigFile("translateW_autoC"));
                checkTagSSA.Checked = Convert.ToBoolean(mW.getFromConfigFile("translateW_tagSSA"));
                checkComment.Checked = Convert.ToBoolean(mW.getFromConfigFile("translateW_Comment"));
                checkVideo.Checked = Convert.ToBoolean(mW.getFromConfigFile("translateW_aud"));
//.........这里部分代码省略.........
开发者ID:nuukcillo,项目名称:PerrySub,代码行数:101,代码来源:translateW.cs

示例2: openVid


//.........这里部分代码省略.........
                int new_y = (int)(y * p);

                videoWindow.put_Height(new_x);
                videoWindow.put_Width(new_y);
                videoWindow.put_Owner(videoPanel.Handle);
                videoPanel.Size = new System.Drawing.Size(new_x, new_y);
                videoWindow.SetWindowPosition(0, 0, videoPanel.Width, videoPanel.Height);
                videoWindow.put_WindowStyle(WindowStyle.Child);
                videoWindow.put_Visible(DirectShowLib.OABool.True);

            }
            else vidScaleFactor.Enabled = false;

            // timer
            actualizaFrames.Interval = 10;
            actualizaFrames.Enabled = true;

            //mediaControl.Run();
            drawPositions();

            framesFin.Enabled = true;
            buttonAddFrameInicio.Enabled = buttonAddFrameInicio.Visible = true;
            framesInicio.Enabled = true;
            buttonAddFrameFin.Enabled = buttonAddFrameFin.Visible = true;
            butClip.Enabled = false;

            mediaSeeking.SetTimeFormat(DirectShowLib.TimeFormat.Frame);

            videoInfo.FrameTotal = VideoUnitConversion.getTotal(mediaSeeking, videoInfo.FrameRate);
            seekBar.Maximum = FrameTotal;
            seekBar.TickFrequency = seekBar.Maximum / 10;

            // VFW ( __ SOLO AVIs __ )

            try
            {
                AVIFileWrapper.AVIFileInit();
                int aviFile = 0;
                IntPtr aviStream;
                int res = AVIFileWrapper.AVIFileOpen(ref aviFile, fileName, 0x20, 0);
                res = AVIFileWrapper.AVIFileGetStream(aviFile, out aviStream, 1935960438, 0);

                videoInfo.KeyFrames = new ArrayList();
                int nFrames = FrameTotal;

                for (int i = 0; i < nFrames; i++)
                {
                    if (isKeyFrame(aviStream.ToInt32(), i))
                        videoInfo.KeyFrames.Add(i);
                }

                setStatus(videoInfo.KeyFrames.Count + " detectados");

                AVIFileWrapper.AVIStreamRelease(aviStream);
                AVIFileWrapper.AVIFileRelease(aviFile);
                AVIFileWrapper.AVIFileExit();
                KeyframesAvailable = true;
                /*
                nextK.Enabled = true;
                prevK.Enabled = true;

                drawKeyFrameBox();
                 */

            }
            catch
            {
                /*
                nextK.Enabled = false;
                prevK.Enabled = false;
                keyFrameBox.Visible = false;
                 */
                KeyframesAvailable = false;
            }

            if (openFile != null && al.Count > 1 && gridASS.RowCount>0)
            {
                gridASS.Rows[1].Selected = true;
                gridASS.Rows[0].Selected = true;
                gridASS.Rows[1].Selected = false;

            }

            frameTime = new Hashtable();
            for (int i = 0; i < FrameTotal; i++)
                frameTime.Add(i, new Tiempo((double)((double)i / videoInfo.FrameRate)));

            isVideoLoaded = true;

            updateMenuEnables();
            mediaControl.Pause();

            setStatus("Vídeo " + fileName + " cargado. [DirectShow]");

            script.GetHeader().SetHeaderValue("Video File", fileName);

            if (isKeyframeGuessNeeded())
                KeyframeGuess(false);
            //FrameIndex = 0;
        }
开发者ID:nuukcillo,项目名称:PerrySub,代码行数:101,代码来源:DirectShowVideo.cs

示例3: openFile

        public void openFile(string filename)
        {
            CleanUp();

            m_objFilterGraph = new FilgraphManager();
            m_objFilterGraph.RenderFile(filename);

           
            try
            {
                m_objVideoWindow = m_objFilterGraph as IVideoWindow;
                m_objVideoWindow.Owner = (int)panel1.Handle;
                m_objVideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
                m_objVideoWindow.SetWindowPosition(panel1.ClientRectangle.Left,
                    panel1.ClientRectangle.Top,
                    panel1.ClientRectangle.Width,
                    panel1.ClientRectangle.Height);
            }
            catch (Exception)
            {
                m_objVideoWindow = null;
            }
            
        
            m_objMediaEvent = m_objFilterGraph as IMediaEvent;

            m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;
            m_objMediaEventEx.SetNotifyWindow((int)this.Handle, WM_GRAPHNOTIFY, 0);

            m_objMediaPosition = m_objFilterGraph as IMediaPosition;

            m_objMediaControl = m_objFilterGraph as IMediaControl;

            this.Text = "Preview - [" + filename + "]";
            m_objMediaControl.Run();
            m_objMediaControl.Pause();
            

            UpdateStatusBar();
            UpdateToolBar();
        }
开发者ID:NeoBoy,项目名称:MiniCoder,代码行数:41,代码来源:Preview.cs


注:本文中的IMediaControl.Pause方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。