This repository has been archived by the owner on Feb 22, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is sort of a cross-pollination of my previous effort and the existing capture handlers. As mentioned in the issue, it gives us the on-demand single-image capture capability I wanted, it retains the continuous-capture capability of the existing handler, and requires no extra classes or interfaces. It should also perform very marginally better, it shouldn't accidentally store incomplete frames, and the timestamp format is configurable when writing those types of filenames.
IFileStreamCaptureHandler
NewFrame
method to be invoked when the callback reaches EOSFastImageOutputCallbackHandler
NewFrame
instead ofNewFile
ImageStreamCaptureHandler
continuousCapture
argument to constructors to pass to the baseFileStreamCaptureHandler
MemoryStreamCaptureHandler
CaptureNextFrame
bool property, resets after one write ifCaptureNextFrame
is falseContinuousCapture
bool property, when true also keepsCaptureNextFrame
trueFilenameDateTimeFormat
string propertyLastWrittenPathname
string propertycontinuousCapture = true
argument to constructors to keep existing behaviorGetFilename
andGetFilepath
NewFile
writes on demand and only when invoked byNewFrame
(which is automatic)NewFrame
manages the capture properties and resets theMemoryStream
_skippingFirstPartialFrame
bool, true untilNewFrame
is invoked onceConceptually, the only big change is that no "ambient" file stream is open, so it doesn't make sense to query for the "current" filename/path. Performance should be identical (or better) since file streams are just memory streams under the hood with some occasional flush behaviors. This also means
CurrentFilename
is only set when the filepath-based constructor is used.Logically,
NewFrame
(invoked at EOS) checks if a capture is requested. If so,NewFile
is invoked. If continuous capture is disabled, the capture flag is also disabled. Meanwhile, ifNewFile
is invoked externally, but next-frame capture is not enabled, the flag is set to true which waits for EOS, thenNewFrame
invokesNewFile
.Fixes #163