Beispiel #1
0
        public void RenderAndRunVideo(CaptureGraph vcg, bool playIt)
        {
            if(playIt)
            {
                Log("Playing video (render and run graph) - " + vcg.Source.FriendlyName);

                vcg.RenderLocal();

                if (vcg is VideoCaptureGraph) {
                    // This is not working for DV graphs but doesn't seem critical in this context
                    VideoCapability.DisableDXVA(vcg.FilgraphManager);
                }

                // Set device name in the video window and turn off the system menu
                IVideoWindow iVW = (IVideoWindow)vcg.FilgraphManager;
                iVW.Caption = vcg.Source.FriendlyName;
                iVW.WindowStyle &= ~0x00080000; // WS_SYSMENU

                vcg.Run();
            }
            else
            {
                Log("Stop video (stop and unrender graph) - " + vcg.Source.FriendlyName);

                vcg.Stop();
                vcg.RemoveRenderer(MSR.LST.Net.Rtp.PayloadType.dynamicVideo);

                // I have no idea why the video window stays up but this fixes it
                GC.Collect();
            }

            Log(FilterGraph.Debug(vcg.IFilterGraph));
        }
Beispiel #2
0
        public void RenderAndRunAudio(CaptureGraph cg, bool playIt)
        {
            if(cg == null)
            {
                throw new ArgumentNullException(Strings.CantRenderAudioGraph);
            }

            if(playIt)
            {
                Log("Playing audio (render and run graph) - " + cg.Source.FriendlyName);

                // Re-add the renderer in case they changed it since the last
                // time they played the audio
                cg.AddAudioRenderer((FilterInfo)cboSpeakers.SelectedItem);
                cg.Run();
            }
            else
            {
                Log("Stop audio (stop and unrender graph) - " + cg.Source.FriendlyName);

                cg.Stop();
                cg.RemoveRenderer(MSR.LST.Net.Rtp.PayloadType.dynamicAudio);
            }

            Log(FilterGraph.Debug(cg.IFilterGraph));
        }