Exemplo n.º 1
0
        /// <summary>
        /// Connects pins of graph
        /// </summary>
        private void GraphBuilding_ConnectPins()
        {
            // Pins used in graph
            IPin pinSourceCapture = null;

            IPin pinSampleGrabberInput = null;

            int hr = 0;

            try
            {
                // Collect pins
                //pinSourceCapture = DsFindPin.ByCategory(DX.CaptureFilter, PinCategory.Capture, 0);
                pinSourceCapture = DsFindPin.ByDirection(DX.CaptureFilter, PinDirection.Output, 0);

                pinSampleGrabberInput = DsFindPin.ByDirection(DX.SampleGrabberFilter, PinDirection.Input, 0);

                // Connect source to tee splitter
                hr = DX.FilterGraph.Connect(pinSourceCapture, pinSampleGrabberInput);
                DsError.ThrowExceptionForHR(hr);
            }
            catch
            {
                throw;
            }
            finally
            {
                CameraHelpers.SafeReleaseComObject(pinSourceCapture);
                pinSourceCapture = null;

                CameraHelpers.SafeReleaseComObject(pinSampleGrabberInput);
                pinSampleGrabberInput = null;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds video source filter to the filter graph.
        /// </summary>
        private void GraphBuilding_AddFilter_Source()
        {
            int hr = 0;

            DX.CaptureFilter = null;
            hr = DX.FilterGraph.AddSourceFilterForMoniker(_Moniker, null, "Source Filter", out DX.CaptureFilter);
            DsError.ThrowExceptionForHR(hr);

            _ResolutionList = CameraHelpers.GetResolutionsAvailable(DX.CaptureFilter);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Displays property page for filter's pin output.
        /// </summary>
        /// <param name="hwndOwner">The window handler for to make it parent of property page.</param>
        public void DisplayPropertyPage_SourcePinOutput(IntPtr hwndOwner)
        {
            IPin pinSourceCapture = null;

            try
            {
                pinSourceCapture = DsFindPin.ByDirection(DX.CaptureFilter, PinDirection.Output, 0);
                CameraHelpers.DisplayPropertyPagePin(pinSourceCapture, hwndOwner);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                CameraHelpers.SafeReleaseComObject(pinSourceCapture);
                pinSourceCapture = null;
            }
        }
Exemplo n.º 4
0
        // ====================================================================

        #region Graph building stuff


        /// <summary>
        /// Sets the Framerate, and video size.
        /// </summary>
        private void GraphBuilding_SetSourceParams()
        {
            // Pins used in graph
            IPin pinSourceCapture = null;

            try
            {
                // Collect pins
                //pinSourceCapture = DsFindPin.ByCategory(DX.CaptureFilter, PinCategory.Capture, 0);
                pinSourceCapture = DsFindPin.ByDirection(DX.CaptureFilter, PinDirection.Output, 0);

                CameraHelpers.SetSourceParams(pinSourceCapture, _Resolution);
            }
            catch
            {
                throw;
            }
            finally
            {
                CameraHelpers.SafeReleaseComObject(pinSourceCapture);
                pinSourceCapture = null;
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Returns available resolutions with RGB color system for device moniker.
 /// </summary>
 /// <param name="moniker">Moniker (device identification) of camera.</param>
 /// <returns>List of resolutions with RGB color system of device</returns>
 public static ResolutionList GetResolutionList(IMoniker moniker)
 {
     return(CameraHelpers.GetResolutionList(moniker));
 }
Exemplo n.º 6
0
        // ====================================================================

        #region Public Static functions

        /// <summary>
        /// Returns Moniker (device identification) of camera from device index.
        /// </summary>
        /// <param name="iDeviceIndex">Index (Zero-based) in list of available devices with VideoInputDevice filter category.</param>
        /// <returns>Moniker (device identification) of device</returns>
        public static IMoniker GetDeviceMoniker(int iDeviceNum)
        {
            return(CameraHelpers.GetDeviceMoniker(iDeviceNum));
        }
Exemplo n.º 7
0
        // ====================================================================

        #region Property pages (various settings dialogs)

        /// <summary>
        /// Displays property page for device.
        /// </summary>
        /// <param name="moniker">Moniker (device identification) of camera.</param>
        /// <param name="hwndOwner">The window handler for to make it parent of property page.</param>
        /// <seealso cref="Moniker"/>
        public static void DisplayPropertyPage_Device(IMoniker moniker, IntPtr hwndOwner)
        {
            CameraHelpers.DisplayPropertyPage_Device(moniker, hwndOwner);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Displays property page for capture filter.
 /// </summary>
 /// <param name="hwndOwner">The window handler for to make it parent of property page.</param>
 public void DisplayPropertyPage_CaptureFilter(IntPtr hwndOwner)
 {
     CameraHelpers.DisplayPropertyPageFilter(DX.CaptureFilter, hwndOwner);
 }