Ejemplo n.º 1
0
        /// <summary>
        /// Creates the camera (capture graph)
        /// </summary>
        public void ActivateCamera()
        {
            Log(string.Format(CultureInfo.CurrentCulture, "\r\nInitializing camera - {0}, {1}",
                              fi.DisplayName, fi.Moniker));

            // Get camera up and running
            CreateVideoGraph(fi);
            RestoreCameraSettings();
            RestoreVideoSettings();
            LogCurrentMediaType(cg.Source);

            // Add compressor if necessary
            AddVideoCompressor();

            try {
                //This was observed to fail for some non-standard compressors
                LogCurrentMediaType(cg.Compressor);
            }
            catch (Exception ex) {
                Log("Failed to find compressor current media type: " + ex.Message);
            }

            // Log all the filters in the graph
            Log(FilterGraph.Debug(cg.IFilterGraph));
        }
Ejemplo n.º 2
0
        public void RenderAndRunAudio(AudioCaptureGraph acg, bool playIt)
        {
            if (acg == null)
            {
                throw new ArgumentNullException("Can't render an audio graph without an audio capture device");
            }

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

                // Re-add the renderer in case they changed it since the last
                // time they played the audio
                acg.AddRenderer((FilterInfo)cboSpeakers.SelectedItem);

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

                acg.Stop();
                acg.RemoveRenderer();
            }

            Log(FilterGraph.Debug(acg.IFilterGraph));
        }
Ejemplo n.º 3
0
        public void RenderAndRunVideo(VideoCaptureGraph vcg, bool playIt)
        {
            if (playIt)
            {
                Log("Playing video (render and run graph) - " + vcg.Source.FriendlyName);

                vcg.RenderLocal();

                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();

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

            Log(FilterGraph.Debug(vcg.IFilterGraph));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates the camera (capture graph)
        /// </summary>
        public void ActivateCamera()
        {
            Log(string.Format("\r\nInitializing camera - {0}, {1}", fi.DisplayName, fi.Moniker));

            // Get camera up and running
            CreateVideoGraph(fi);
            RestoreCameraSettings();
            RestoreVideoSettings();
            LogCurrentMediaType(vcg.Source);

            // Add compressor if necessary
            AddVideoCompressor();
            LogCurrentMediaType(vcg.Compressor);

            // Log all the filters in the graph
            Log(FilterGraph.Debug(vcg.IFilterGraph));
        }
        /// <summary>
        /// Creates the microphone (capture graph)
        /// </summary>
        public void ActivateMicrophone()
        {
            Log(string.Format(CultureInfo.CurrentCulture, "\r\nInitializing microphone - {0}, {1}",
                              fi.DisplayName, fi.Moniker));

            // Get microphone up and running
            CreateAudioGraph(fi);
            RestoreMicrophoneSettings();
            RestoreAudioSettings();
            RestoreBufferSettings();

            LogCurrentMediaType(cg.Source);

            // Add compressor if necessary
            AddAudioCompressor();
            LogCurrentMediaType(((IAudioCaptureGraph)cg).AudioCompressor);

            // Log all the filters in the graph
            Log(FilterGraph.Debug(cg.IFilterGraph));
        }