bool ReadV1SensorInfo()
        {
            var ptr1 = Marshal.AllocHGlobal(Marshal.SizeOf <MmalParameterCameraInfoType>());
            var str1 = (MmalParameterHeaderType *)ptr1;

            str1->Id   = MmalParametersCamera.MmalParameterCameraInfo;
            str1->Size = Marshal.SizeOf <MmalParameterCameraInfoType>();

            try
            {
                MmalCheck(MmalPort.GetParameter(Control.Ptr, str1), string.Empty);

                var p = (IntPtr)str1;
                var s = Marshal.PtrToStructure <MmalParameterCameraInfoType>(p);

                if (s.Cameras == null || s.Cameras.Length <= 0)
                {
                    return(false);
                }

                SensorName = "OV5647";
                MaxHeight  = s.Cameras[0].MaxHeight;
                MaxWidth   = s.Cameras[0].MaxWidth;

                return(true);
            }
            catch
            {
                return(false);
            }
            finally
            {
                Marshal.FreeHGlobal(ptr1);
            }
        }
Exemplo n.º 2
0
        void ConfigureIntraRefresh(int outputPort)
        {
            var param = new MmalParameterVideoIntraRefreshType(new MmalParameterHeaderType(MmalParametersVideo.MmalParameterVideoIntraRefresh, Marshal.SizeOf <MmalParameterVideoIntraRefreshType>()), MmalParametersVideo.MmalVideoIntraRefreshT.MmalVideoIntraRefreshBoth, 0, 0, 0, 0);

            int airMbs = 0, airRef = 0, cirMbs = 0, pirMbs = 0;

            try
            {
                MmalCheck(MmalPort.GetParameter(Outputs[outputPort].Ptr, param.HdrPtr), "Unable to set video profile.");
                airMbs = param.AirMbs;
                airRef = param.AirRef;
                cirMbs = param.CirMbs;
                pirMbs = param.PirMbs;
            }
            catch
            {
                /* catch all */
            }

            param = new MmalParameterVideoIntraRefreshType(new MmalParameterHeaderType(MmalParametersVideo.MmalParameterVideoIntraRefresh, Marshal.SizeOf <MmalParameterVideoIntraRefreshType>()), CameraConfig.IntraRefresh, airMbs, airRef, cirMbs, pirMbs);
            MmalCheck(MmalPort.SetParameter(Outputs[outputPort].Ptr, param.HdrPtr), "Unable to set video intra refresh.");
        }