Example #1
0
        private unsafe void SetVideoConnectionSettings()
        {
            FillVideoConnectionSettings();

            // Set capture format
            v4l2_format format = new v4l2_format
            {
                type = v4l2_buf_type.V4L2_BUF_TYPE_VIDEO_CAPTURE,
                fmt  = new fmt
                {
                    pix = new v4l2_pix_format
                    {
                        width       = Settings.CaptureSize.Width,
                        height      = Settings.CaptureSize.Height,
                        pixelformat = Settings.PixelFormat
                    }
                }
            };

            V4l2Struct(VideoSettings.VIDIOC_S_FMT, ref format);

            // Set exposure type
            v4l2_control ctrl = new v4l2_control
            {
                id    = VideoDeviceValueType.ExposureType,
                value = (int)Settings.ExposureType
            };

            V4l2Struct(VideoSettings.VIDIOC_S_CTRL, ref ctrl);

            // Set exposure time
            // If exposure type is auto, this field is invalid
            ctrl.id    = VideoDeviceValueType.ExposureTime;
            ctrl.value = Settings.ExposureTime;
            V4l2Struct(VideoSettings.VIDIOC_S_CTRL, ref ctrl);

            // Set brightness
            ctrl.id    = VideoDeviceValueType.Brightness;
            ctrl.value = Settings.Brightness;
            V4l2Struct(VideoSettings.VIDIOC_S_CTRL, ref ctrl);

            // Set contrast
            ctrl.id    = VideoDeviceValueType.Contrast;
            ctrl.value = Settings.Contrast;
            V4l2Struct(VideoSettings.VIDIOC_S_CTRL, ref ctrl);

            // Set saturation
            ctrl.id    = VideoDeviceValueType.Saturation;
            ctrl.value = Settings.Saturation;
            V4l2Struct(VideoSettings.VIDIOC_S_CTRL, ref ctrl);

            // Set sharpness
            ctrl.id    = VideoDeviceValueType.Sharpness;
            ctrl.value = Settings.Sharpness;
            V4l2Struct(VideoSettings.VIDIOC_S_CTRL, ref ctrl);

            // Set gain
            ctrl.id    = VideoDeviceValueType.Gain;
            ctrl.value = Settings.Gain;
            V4l2Struct(VideoSettings.VIDIOC_S_CTRL, ref ctrl);

            // Set gamma
            ctrl.id    = VideoDeviceValueType.Gamma;
            ctrl.value = Settings.Gamma;
            V4l2Struct(VideoSettings.VIDIOC_S_CTRL, ref ctrl);

            // Set power line frequency
            ctrl.id    = VideoDeviceValueType.PowerLineFrequency;
            ctrl.value = (int)Settings.PowerLineFrequency;
            V4l2Struct(VideoSettings.VIDIOC_S_CTRL, ref ctrl);

            // Set white balance effect
            ctrl.id    = VideoDeviceValueType.WhiteBalanceEffect;
            ctrl.value = (int)Settings.WhiteBalanceEffect;
            V4l2Struct(VideoSettings.VIDIOC_S_CTRL, ref ctrl);

            // Set white balance temperature
            ctrl.id    = VideoDeviceValueType.WhiteBalanceTemperature;
            ctrl.value = Settings.WhiteBalanceTemperature;
            V4l2Struct(VideoSettings.VIDIOC_S_CTRL, ref ctrl);

            // Set color effect
            ctrl.id    = VideoDeviceValueType.ColorEffect;
            ctrl.value = (int)Settings.ColorEffect;
            V4l2Struct(VideoSettings.VIDIOC_S_CTRL, ref ctrl);

            // Set scene mode
            ctrl.id    = VideoDeviceValueType.SceneMode;
            ctrl.value = (int)Settings.SceneMode;
            V4l2Struct(VideoSettings.VIDIOC_S_CTRL, ref ctrl);

            // Set rotate
            ctrl.id    = VideoDeviceValueType.Rotate;
            ctrl.value = Settings.Rotate;
            V4l2Struct(VideoSettings.VIDIOC_S_CTRL, ref ctrl);

            // Set horizontal flip
            ctrl.id    = VideoDeviceValueType.HorizontalFlip;
            ctrl.value = Settings.HorizontalFlip ? 1 : 0;
            V4l2Struct(VideoSettings.VIDIOC_S_CTRL, ref ctrl);

            // Set vertical flip
            ctrl.id    = VideoDeviceValueType.VerticalFlip;
            ctrl.value = Settings.VerticalFlip ? 1 : 0;
            V4l2Struct(VideoSettings.VIDIOC_S_CTRL, ref ctrl);
        }
Example #2
0
 public static extern int ioctl(int fd, UInt64 request, ref v4l2_format fmt);
Example #3
0
 public static extern int ioctl(int fd, UInt64 request, ref v4l2_format fmt);
Example #4
0
 ioctl(int device, v4l2_operation request, ref v4l2_format argp);
Example #5
0
 /// <summary>
 /// Calls VIDIOC_S_FMT.
 /// </summary>
 public int SetFormat(ref v4l2_format fmt)
 {
     return(ioctl(deviceHandle, v4l2_operation.SetFormat, ref fmt));
 }
Example #6
0
 internal BaseFormat(v4l2_format format)
 {
     this.format = format;
 }