-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added CameraControlProperty interface #64
base: main
Are you sure you want to change the base?
Conversation
@macaba Thank you your PR! I will review it within a couple of days, so please give me a moment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be willing to accept the points raised once they are corrected. Thanks for your contribution!
- Please switch base branch
develop
instead ofmain
. - I'll implement the F# support after the merge.
@@ -183,6 +187,20 @@ private sealed class SampleGrabberSink : | |||
|
|||
/////////////////////////////// | |||
|
|||
Guid PinCategory_Capture = new(0xfb6c4281, 0x0353, 0x11d1, 0x90, 0x5f, 0x00, 0x00, 0xc0, 0xcc, 0x16, 0xba); | |||
Guid MediaType_Interleaved = new(0x73766169, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | |||
if (captureGraphBuilder.FindInterface(PinCategory_Capture, MediaType_Interleaved, captureSource, typeof(IAMCameraControl).GUID, out object? intf) < 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, the GUID
property did not declare in netstandard1.3. So switch using self-declared field instead of it. Example and good place at IID_ICaptureGraphBuilder2
symbol.
@@ -0,0 +1,13 @@ | |||
namespace FlashCap | |||
{ | |||
public enum CameraControlProperty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE: This seems to expose the raw definition of DirectShow. Perhaps there is a better way to define it, considering multi-platform. But for now I think this is fine as it is; we may change it when we consider making it V4L2 compliant.
{ | ||
if (this.IsRunning) | ||
{ | ||
cameraControl.Set(property, value, CameraControlFlags.None); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This call to Set()
corresponds to a cross-apartment call on COM interface, so a procedure over the apartment is required. Use this.workingContext.InvokeAsync()
to ensure that it is called on the correct thread. The implementation of the OnStartAsync()
method will be helpful.
Perhaps it needs to be asynchronized, like SetControlPropertyAsync()
.
An implementation of the CameraControlProperty interface, only tested on DirectShow.
I needed this for a thermal camera where it uses the Zoom property in two ways: to switch frame data to raw thermal values (for further processing by the application), and to calibrate the camera (it has an internal shutter for calibration).
Example usage for the thermal camera:
This is incomplete however I wanted to create this PR to start some discussion about how this could be integrated into the main repo in a correct way.