This repository has been archived by the owner on Feb 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#184 - Allow splitter component to process still images.
- Loading branch information
Showing
6 changed files
with
232 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// <copyright file="SplitterOutputPort.cs" company="Techyian"> | ||
// Copyright (c) Ian Auty and contributors. All rights reserved. | ||
// Licensed under the MIT License. Please see LICENSE.txt for License info. | ||
// </copyright> | ||
|
||
using System; | ||
using MMALSharp.Common.Utility; | ||
using MMALSharp.Components; | ||
|
||
namespace MMALSharp.Ports.Outputs | ||
{ | ||
/// <summary> | ||
/// Represents a splitter component output port. | ||
/// </summary> | ||
public unsafe abstract class SplitterOutputPort : OutputPort | ||
{ | ||
private Resolution _resolution; | ||
|
||
/// <inheritdoc /> | ||
public override Resolution Resolution | ||
{ | ||
get | ||
{ | ||
return _resolution; | ||
} | ||
|
||
internal set | ||
{ | ||
// The splitter component doesn't support resolution changes. This override has been | ||
// added in case the user wants to use the splitter component with the Image Processing | ||
// library and will use this property to inform what resolution it's running at. Applied | ||
// via port config. | ||
_resolution = new Resolution(value.Width, value.Height); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Creates a new instance of <see cref="SplitterOutputPort"/>. | ||
/// </summary> | ||
/// <param name="ptr">The native pointer.</param> | ||
/// <param name="comp">The component this port is associated with.</param> | ||
/// <param name="guid">Managed unique identifier for this port.</param> | ||
protected SplitterOutputPort(IntPtr ptr, IComponent comp, Guid guid) | ||
: base(ptr, comp, guid) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Creates a new instance of <see cref="SplitterOutputPort"/>. | ||
/// </summary> | ||
/// <param name="copyFrom">The port to copy data from.</param> | ||
protected SplitterOutputPort(IPort copyFrom) | ||
: base((IntPtr)copyFrom.Ptr, copyFrom.ComponentReference, copyFrom.Guid) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// <copyright file="SplitterStillPort.cs" company="Techyian"> | ||
// Copyright (c) Ian Auty and contributors. All rights reserved. | ||
// Licensed under the MIT License. Please see LICENSE.txt for License info. | ||
// </copyright> | ||
|
||
using System; | ||
using Microsoft.Extensions.Logging; | ||
using MMALSharp.Common.Utility; | ||
using MMALSharp.Components; | ||
using MMALSharp.Native; | ||
|
||
namespace MMALSharp.Ports.Outputs | ||
{ | ||
/// <summary> | ||
/// Represents a splitter component still output port. | ||
/// </summary> | ||
public unsafe class SplitterStillPort : SplitterOutputPort | ||
{ | ||
/// <summary> | ||
/// Creates a new instance of <see cref="SplitterStillPort"/>. | ||
/// </summary> | ||
/// <param name="ptr">The native pointer.</param> | ||
/// <param name="comp">The component this port is associated with.</param> | ||
/// <param name="guid">Managed unique identifier for this port.</param> | ||
public SplitterStillPort(IntPtr ptr, IComponent comp, Guid guid) | ||
: base(ptr, comp, guid) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Creates a new instance of <see cref="SplitterStillPort"/>. | ||
/// </summary> | ||
/// <param name="copyFrom">The port to copy data from.</param> | ||
public SplitterStillPort(IPort copyFrom) | ||
: base((IntPtr)copyFrom.Ptr, copyFrom.ComponentReference, copyFrom.Guid) | ||
{ | ||
} | ||
|
||
internal override void NativeOutputPortCallback(MMAL_PORT_T* port, MMAL_BUFFER_HEADER_T* buffer) | ||
{ | ||
if (MMALCameraConfig.Debug) | ||
{ | ||
MMALLog.Logger.LogDebug($"{this.Name}: In native {nameof(SplitterStillPort)} output callback"); | ||
} | ||
|
||
base.NativeOutputPortCallback(port, buffer); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters