예제 #1
0
        private void btnOpenCamere_Click(object sender, RoutedEventArgs e)
        {
            DoAction(() =>
            {
                IEnumerable <InDeviceInfo> videoDeviceInfos;
                IEnumerable <InDeviceInfo> audioDeviceInfos;

                ApiProvider.Default.GetFreeDeviceInfos(out videoDeviceInfos, out audioDeviceInfos);

                if (videoDeviceInfos.Count() > 0)
                {
                    var param = new VideoInParam();

                    param.Type                = VideoInType.Camera;
                    param.CaptureFps          = 20;
                    param.Camera              = new CameraParam();
                    param.Camera.DevicePath   = videoDeviceInfos.First().Path;
                    param.Camera.QualityLevel = VideoQualityLevel.Middle;

                    if (_cameraOpened = _camera.Open(param))
                    {
                        var text = $"fps:{param.CaptureFps}{Environment.NewLine}";
                        text    += $"devicePath:{param.Camera.DevicePath}{Environment.NewLine}";
                        text    += $"qualityLevel:{param.Camera.QualityLevel}{Environment.NewLine}";

                        MessageBox.Show(text, "Open Success");

                        // 测试只能设置为Left=0,Top=0 ???
                        var rect = new RectScreenParam
                        {
                            Left   = 0,
                            Top    = 0,
                            Right  = 200,
                            Bottom = 150
                        };

                        _camera.SetDisplayRect(rect);
                        _camera.AdjustLayer(false);

                        if (_cameraStarted = _camera.StartCapture())
                        {
                            _camera.SwitchSoloPreview(true);
                        }
                    }
                }
            });
        }
예제 #2
0
        /// <summary>
        /// 设置该子视频窗口在主窗口中的显示位置和大小
        /// </summary>
        /// <param name="param">显示位置参数</param>
        public void SetDisplayRect(RectScreenParam param)
        {
            ThrowIfChildServiceException();

            ChildVideoApi.SetDisplayRect(ChildService, ref param);
        }
예제 #3
0
 internal static extern void SetDisplayRect(IntPtr childService, ref RectScreenParam param);