Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit 49e338d

Browse files
author
techyian
committed
Removing PreviewResolution as this should match Video.
1 parent b32dcec commit 49e338d

3 files changed

Lines changed: 10 additions & 28 deletions

File tree

src/MMALSharp/Components/MMALCameraComponent.cs

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ public MMALCameraComponent() : base(MMALParameters.MMAL_COMPONENT_DEFAULT_CAMERA
7676
this.CameraInfo.MaxHeight,
7777
0,
7878
1,
79-
MMALCameraConfig.PreviewResolution.Width,
80-
MMALCameraConfig.PreviewResolution.Height,
79+
MMALCameraConfig.VideoResolution.Width,
80+
MMALCameraConfig.VideoResolution.Height,
8181
3,
8282
0,
8383
0,
@@ -138,26 +138,10 @@ internal void Initialise()
138138

139139
private void InitialisePreview()
140140
{
141-
if (MMALCameraConfig.PreviewResolution.Width == 0 || MMALCameraConfig.PreviewResolution.Width > this.CameraInfo.MaxWidth)
142-
{
143-
MMALCameraConfig.PreviewResolution.Width = this.CameraInfo.MaxWidth;
144-
}
145-
146-
if (MMALCameraConfig.PreviewResolution.Height == 0 || MMALCameraConfig.PreviewResolution.Height > this.CameraInfo.MaxHeight)
147-
{
148-
MMALCameraConfig.PreviewResolution.Height = this.CameraInfo.MaxHeight;
149-
}
150-
151-
if (MMALCameraConfig.VideoResolution != null && MMALCameraConfig.PreviewResolution.CompareTo(MMALCameraConfig.VideoResolution) > 0)
152-
{
153-
//HW limitation means Preview must be the same as Video resolution if applicable. Does not apply for still capture.
154-
MMALCameraConfig.PreviewResolution = MMALCameraConfig.VideoResolution;
155-
}
156-
157141
var vFormat = new MMAL_VIDEO_FORMAT_T(
158-
MMALUtil.VCOS_ALIGN_UP(MMALCameraConfig.PreviewResolution.Width, 32),
159-
MMALUtil.VCOS_ALIGN_UP(MMALCameraConfig.PreviewResolution.Height, 16),
160-
new MMAL_RECT_T(0, 0, MMALCameraConfig.PreviewResolution.Width, MMALCameraConfig.PreviewResolution.Height),
142+
MMALUtil.VCOS_ALIGN_UP(MMALCameraConfig.VideoResolution.Width, 32),
143+
MMALUtil.VCOS_ALIGN_UP(MMALCameraConfig.VideoResolution.Height, 16),
144+
new MMAL_RECT_T(0, 0, MMALCameraConfig.VideoResolution.Width, MMALCameraConfig.VideoResolution.Height),
161145
new MMAL_RATIONAL_T(0, 1),
162146
this.PreviewPort.Ptr->Format->es->video.Par,
163147
this.PreviewPort.Ptr->Format->es->video.ColorSpace
@@ -227,7 +211,7 @@ private void InitialiseStill()
227211
{
228212
MMALCameraConfig.StillResolution.Height = this.CameraInfo.MaxHeight;
229213
}
230-
214+
231215
var vFormat = new MMAL_VIDEO_FORMAT_T();
232216

233217
if (MMALCameraConfig.StillEncoding == MMALEncoding.MMAL_ENCODING_RGB32 ||
@@ -262,12 +246,12 @@ private void InitialiseStill()
262246
this.StillPort.Ptr->Format->es->video = vFormat;
263247
this.StillPort.Ptr->Format->encoding = MMALCameraConfig.StillEncoding.EncodingVal;
264248
this.StillPort.Ptr->Format->encodingVariant = MMALCameraConfig.StillSubFormat.EncodingVal;
265-
249+
266250
if (MMALCameraConfig.Debug)
267251
Console.WriteLine("Commit still");
268252

269253
this.StillPort.Commit();
270-
254+
271255
this.StillPort.Ptr->BufferNum = Math.Max(this.StillPort.BufferNumRecommended,
272256
this.StillPort.BufferNumMin);
273257

src/MMALSharp/MMALCameraConfig.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,7 @@ public static class MMALCameraConfig
136136
*/
137137
public static MMALEncoding PreviewEncoding { get; set; } = MMALEncoding.MMAL_ENCODING_OPAQUE;
138138
public static MMALEncoding PreviewSubformat { get; set; } = MMALEncoding.MMAL_ENCODING_I420;
139-
140-
public static Resolution PreviewResolution { get; set; } = new Resolution(1024, 768);
141-
139+
142140
/*
143141
* -----------------------------------------------------------------------------------------------------------
144142
* Camera video port specific properties

src/MMALSharp/MMALPortBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public int BufferSize
123123
/// <summary>
124124
/// Delegate for native port callback
125125
/// </summary>
126-
public MMALSharp.Native.MMALPort.MMAL_PORT_BH_CB_T NativeCallback { get; set; }
126+
internal MMALSharp.Native.MMALPort.MMAL_PORT_BH_CB_T NativeCallback { get; set; }
127127

128128
/// <summary>
129129
/// Delegate we use to do further processing on buffer headers when they're received by the native callback delegate

0 commit comments

Comments
 (0)