diff --git a/src/MMALSharp/Components/MMALCameraComponent.cs b/src/MMALSharp/Components/MMALCameraComponent.cs index 3cc75c30..a1c31d6d 100644 --- a/src/MMALSharp/Components/MMALCameraComponent.cs +++ b/src/MMALSharp/Components/MMALCameraComponent.cs @@ -76,8 +76,8 @@ public MMALCameraComponent() : base(MMALParameters.MMAL_COMPONENT_DEFAULT_CAMERA this.CameraInfo.MaxHeight, 0, 1, - MMALCameraConfig.PreviewResolution.Width, - MMALCameraConfig.PreviewResolution.Height, + MMALCameraConfig.VideoResolution.Width, + MMALCameraConfig.VideoResolution.Height, 3, 0, 0, @@ -138,26 +138,10 @@ internal void Initialise() private void InitialisePreview() { - if (MMALCameraConfig.PreviewResolution.Width == 0 || MMALCameraConfig.PreviewResolution.Width > this.CameraInfo.MaxWidth) - { - MMALCameraConfig.PreviewResolution.Width = this.CameraInfo.MaxWidth; - } - - if (MMALCameraConfig.PreviewResolution.Height == 0 || MMALCameraConfig.PreviewResolution.Height > this.CameraInfo.MaxHeight) - { - MMALCameraConfig.PreviewResolution.Height = this.CameraInfo.MaxHeight; - } - - if (MMALCameraConfig.VideoResolution != null && MMALCameraConfig.PreviewResolution.CompareTo(MMALCameraConfig.VideoResolution) > 0) - { - //HW limitation means Preview must be the same as Video resolution if applicable. Does not apply for still capture. - MMALCameraConfig.PreviewResolution = MMALCameraConfig.VideoResolution; - } - var vFormat = new MMAL_VIDEO_FORMAT_T( - MMALUtil.VCOS_ALIGN_UP(MMALCameraConfig.PreviewResolution.Width, 32), - MMALUtil.VCOS_ALIGN_UP(MMALCameraConfig.PreviewResolution.Height, 16), - new MMAL_RECT_T(0, 0, MMALCameraConfig.PreviewResolution.Width, MMALCameraConfig.PreviewResolution.Height), + MMALUtil.VCOS_ALIGN_UP(MMALCameraConfig.VideoResolution.Width, 32), + MMALUtil.VCOS_ALIGN_UP(MMALCameraConfig.VideoResolution.Height, 16), + new MMAL_RECT_T(0, 0, MMALCameraConfig.VideoResolution.Width, MMALCameraConfig.VideoResolution.Height), new MMAL_RATIONAL_T(0, 1), this.PreviewPort.Ptr->Format->es->video.Par, this.PreviewPort.Ptr->Format->es->video.ColorSpace @@ -227,7 +211,7 @@ private void InitialiseStill() { MMALCameraConfig.StillResolution.Height = this.CameraInfo.MaxHeight; } - + var vFormat = new MMAL_VIDEO_FORMAT_T(); if (MMALCameraConfig.StillEncoding == MMALEncoding.MMAL_ENCODING_RGB32 || @@ -262,12 +246,12 @@ private void InitialiseStill() this.StillPort.Ptr->Format->es->video = vFormat; this.StillPort.Ptr->Format->encoding = MMALCameraConfig.StillEncoding.EncodingVal; this.StillPort.Ptr->Format->encodingVariant = MMALCameraConfig.StillSubFormat.EncodingVal; - + if (MMALCameraConfig.Debug) Console.WriteLine("Commit still"); this.StillPort.Commit(); - + this.StillPort.Ptr->BufferNum = Math.Max(this.StillPort.BufferNumRecommended, this.StillPort.BufferNumMin); diff --git a/src/MMALSharp/MMALCameraConfig.cs b/src/MMALSharp/MMALCameraConfig.cs index bbff8d68..a0b9c3b3 100644 --- a/src/MMALSharp/MMALCameraConfig.cs +++ b/src/MMALSharp/MMALCameraConfig.cs @@ -136,9 +136,7 @@ public static class MMALCameraConfig */ public static MMALEncoding PreviewEncoding { get; set; } = MMALEncoding.MMAL_ENCODING_OPAQUE; public static MMALEncoding PreviewSubformat { get; set; } = MMALEncoding.MMAL_ENCODING_I420; - - public static Resolution PreviewResolution { get; set; } = new Resolution(1024, 768); - + /* * ----------------------------------------------------------------------------------------------------------- * Camera video port specific properties diff --git a/src/MMALSharp/MMALPortBase.cs b/src/MMALSharp/MMALPortBase.cs index 49592acb..c2d1ba29 100644 --- a/src/MMALSharp/MMALPortBase.cs +++ b/src/MMALSharp/MMALPortBase.cs @@ -123,7 +123,7 @@ public int BufferSize /// /// Delegate for native port callback /// - public MMALSharp.Native.MMALPort.MMAL_PORT_BH_CB_T NativeCallback { get; set; } + internal MMALSharp.Native.MMALPort.MMAL_PORT_BH_CB_T NativeCallback { get; set; } /// /// Delegate we use to do further processing on buffer headers when they're received by the native callback delegate