Skip to content

Commit

Permalink
Merge branch 'feature/138' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
kekyo committed Apr 12, 2024
2 parents 9e2b13b + 678eb26 commit a2ef892
Show file tree
Hide file tree
Showing 24 changed files with 423 additions and 411 deletions.
184 changes: 12 additions & 172 deletions FSharp.FlashCap/CaptureDeviceDescriptorExtension.fs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module public CaptureDeviceDescriptorExtension =
?ct: CancellationToken) : Async<CaptureDevice> =
self.InternalOpenWithFrameProcessorAsync(
characteristics, TranscodeFormats.Auto,
new DelegatedQueuingProcessor(pixelBufferArrived, 1),
new DelegatedQueuingProcessor(pixelBufferArrived, 1, self.defaultBufferPool),
asCT ct) |> Async.AwaitTask

member self.openDevice(
Expand All @@ -50,7 +50,7 @@ module public CaptureDeviceDescriptorExtension =
self.InternalOpenWithFrameProcessorAsync(
characteristics,
transcodeFormat,
new DelegatedQueuingProcessor(pixelBufferArrived, 1),
new DelegatedQueuingProcessor(pixelBufferArrived, 1, self.defaultBufferPool),
asCT ct) |> Async.AwaitTask

member self.openDevice(
Expand All @@ -64,8 +64,8 @@ module public CaptureDeviceDescriptorExtension =
characteristics,
transcodeFormat,
(match isScattering with
| true -> (new DelegatedScatteringProcessor(pixelBufferArrived, maxQueuingFrames) :> FrameProcessor)
| false -> (new DelegatedQueuingProcessor(pixelBufferArrived, maxQueuingFrames) :> FrameProcessor)),
| true -> (new DelegatedScatteringProcessor(pixelBufferArrived, maxQueuingFrames, self.defaultBufferPool) :> FrameProcessor)
| false -> (new DelegatedQueuingProcessor(pixelBufferArrived, maxQueuingFrames, self.defaultBufferPool) :> FrameProcessor)),
asCT ct) |> Async.AwaitTask

//////////////////////////////////////////////////////////////////////////////////
Expand All @@ -77,7 +77,7 @@ module public CaptureDeviceDescriptorExtension =
self.InternalOpenWithFrameProcessorAsync(
characteristics,
TranscodeFormats.Auto,
new DelegatedQueuingTaskProcessor(asTask pixelBufferArrived, 1),
new DelegatedQueuingTaskProcessor(asTask pixelBufferArrived, 1, self.defaultBufferPool),
asCT ct) |> Async.AwaitTask

member self.openDevice(
Expand All @@ -88,7 +88,7 @@ module public CaptureDeviceDescriptorExtension =
self.InternalOpenWithFrameProcessorAsync(
characteristics,
transcodeFormat,
new DelegatedQueuingTaskProcessor(asTask pixelBufferArrived, 1),
new DelegatedQueuingTaskProcessor(asTask pixelBufferArrived, 1, self.defaultBufferPool),
asCT ct) |> Async.AwaitTask

member self.openDevice(
Expand All @@ -102,8 +102,8 @@ module public CaptureDeviceDescriptorExtension =
characteristics,
transcodeFormat,
(match isScattering with
| true -> (new DelegatedScatteringTaskProcessor(asTask pixelBufferArrived, maxQueuingFrames) :> FrameProcessor)
| false -> (new DelegatedQueuingTaskProcessor(asTask pixelBufferArrived, maxQueuingFrames) :> FrameProcessor)),
| true -> (new DelegatedScatteringTaskProcessor(asTask pixelBufferArrived, maxQueuingFrames, self.defaultBufferPool) :> FrameProcessor)
| false -> (new DelegatedQueuingTaskProcessor(asTask pixelBufferArrived, maxQueuingFrames, self.defaultBufferPool) :> FrameProcessor)),
asCT ct) |> Async.AwaitTask

//////////////////////////////////////////////////////////////////////////////////
Expand All @@ -116,7 +116,7 @@ module public CaptureDeviceDescriptorExtension =
characteristics,
TranscodeFormats.Auto,
(new DelegatedQueuingProcessor(
new PixelBufferArrivedDelegate(observerProxy.OnPixelBufferArrived), 1)), asCT ct) |> Async.AwaitTask
new PixelBufferArrivedDelegate(observerProxy.OnPixelBufferArrived), 1, self.defaultBufferPool)), asCT ct) |> Async.AwaitTask
return new ObservableCaptureDevice(captureDevice, observerProxy)
}

Expand All @@ -129,7 +129,7 @@ module public CaptureDeviceDescriptorExtension =
characteristics,
transcodeFormat,
(new DelegatedQueuingProcessor(
new PixelBufferArrivedDelegate(observerProxy.OnPixelBufferArrived), 1)), asCT ct) |> Async.AwaitTask
new PixelBufferArrivedDelegate(observerProxy.OnPixelBufferArrived), 1, self.defaultBufferPool)), asCT ct) |> Async.AwaitTask
return new ObservableCaptureDevice(captureDevice, observerProxy)
}

Expand All @@ -145,8 +145,8 @@ module public CaptureDeviceDescriptorExtension =
characteristics,
transcodeFormat,
(match isScattering with
| true -> (new DelegatedScatteringProcessor(pixelBufferArrived, maxQueuingFrames) :> FrameProcessor)
| false -> (new DelegatedQueuingProcessor(pixelBufferArrived, maxQueuingFrames) :> FrameProcessor)), asCT ct) |> Async.AwaitTask
| true -> (new DelegatedScatteringProcessor(pixelBufferArrived, maxQueuingFrames, self.defaultBufferPool) :> FrameProcessor)
| false -> (new DelegatedQueuingProcessor(pixelBufferArrived, maxQueuingFrames, self.defaultBufferPool) :> FrameProcessor)), asCT ct) |> Async.AwaitTask
return new ObservableCaptureDevice(captureDevice, observerProxy)
}

Expand All @@ -168,163 +168,3 @@ module public CaptureDeviceDescriptorExtension =
characteristics,
transcodeFormat,
asCT ct) |> Async.AwaitTask

//////////////////////////////////////////////////////////////////////////////////

[<Obsolete("This function is obsoleted, please use `openDevice` instead.")>]
[<EditorBrowsable(EditorBrowsableState.Never)>]
member self.openAsync(
characteristics: VideoCharacteristics,
pixelBufferArrived: PixelBufferScope -> unit,
?ct: CancellationToken) : Async<CaptureDevice> =
self.InternalOpenWithFrameProcessorAsync(
characteristics, TranscodeFormats.Auto,
new DelegatedQueuingProcessor(pixelBufferArrived, 1),
asCT ct) |> Async.AwaitTask

[<Obsolete("This function is obsoleted, please use `openDevice` instead.")>]
[<EditorBrowsable(EditorBrowsableState.Never)>]
member self.openAsync(
characteristics: VideoCharacteristics,
transcodeIfYUV: bool,
pixelBufferArrived: PixelBufferScope -> unit,
?ct: CancellationToken) : Async<CaptureDevice> =
self.InternalOpenWithFrameProcessorAsync(
characteristics,
toFormat transcodeIfYUV,
new DelegatedQueuingProcessor(pixelBufferArrived, 1),
asCT ct) |> Async.AwaitTask

[<Obsolete("This function is obsoleted, please use `openDevice` instead.")>]
[<EditorBrowsable(EditorBrowsableState.Never)>]
member self.openAsync(
characteristics: VideoCharacteristics,
transcodeIfYUV: bool,
isScattering: bool,
maxQueuingFrames: int,
pixelBufferArrived: PixelBufferScope -> unit,
?ct: CancellationToken) : Async<CaptureDevice> =
self.InternalOpenWithFrameProcessorAsync(
characteristics,
toFormat transcodeIfYUV,
(match isScattering with
| true -> (new DelegatedScatteringProcessor(pixelBufferArrived, maxQueuingFrames) :> FrameProcessor)
| false -> (new DelegatedQueuingProcessor(pixelBufferArrived, maxQueuingFrames) :> FrameProcessor)),
asCT ct) |> Async.AwaitTask

//////////////////////////////////////////////////////////////////////////////////

[<Obsolete("This function is obsoleted, please use `openDevice` instead.")>]
[<EditorBrowsable(EditorBrowsableState.Never)>]
member self.openAsync(
characteristics: VideoCharacteristics,
pixelBufferArrived: PixelBufferScope -> Async<unit>,
?ct: CancellationToken) : Async<CaptureDevice> =
self.InternalOpenWithFrameProcessorAsync(
characteristics,
TranscodeFormats.Auto,
new DelegatedQueuingTaskProcessor(asTask pixelBufferArrived, 1),
asCT ct) |> Async.AwaitTask

[<Obsolete("This function is obsoleted, please use `openDevice` instead.")>]
[<EditorBrowsable(EditorBrowsableState.Never)>]
member self.openAsync(
characteristics: VideoCharacteristics,
transcodeIfYUV: bool,
pixelBufferArrived: PixelBufferScope -> Async<unit>,
?ct: CancellationToken) : Async<CaptureDevice> =
self.InternalOpenWithFrameProcessorAsync(
characteristics,
toFormat transcodeIfYUV,
new DelegatedQueuingTaskProcessor(asTask pixelBufferArrived, 1),
asCT ct) |> Async.AwaitTask

[<Obsolete("This function is obsoleted, please use `openDevice` instead.")>]
[<EditorBrowsable(EditorBrowsableState.Never)>]
member self.openAsync(
characteristics: VideoCharacteristics,
transcodeIfYUV: bool,
isScattering: bool,
maxQueuingFrames: int,
pixelBufferArrived: PixelBufferScope -> Async<unit>,
?ct: CancellationToken) : Async<CaptureDevice> =
self.InternalOpenWithFrameProcessorAsync(
characteristics,
toFormat transcodeIfYUV,
(match isScattering with
| true -> (new DelegatedScatteringTaskProcessor(asTask pixelBufferArrived, maxQueuingFrames) :> FrameProcessor)
| false -> (new DelegatedQueuingTaskProcessor(asTask pixelBufferArrived, maxQueuingFrames) :> FrameProcessor)),
asCT ct) |> Async.AwaitTask

//////////////////////////////////////////////////////////////////////////////////

[<Obsolete("This function is obsoleted, please use `asObservable` instead.")>]
[<EditorBrowsable(EditorBrowsableState.Never)>]
member self.asObservableAsync(
characteristics: VideoCharacteristics,
?ct: CancellationToken) : Async<ObservableCaptureDevice> = async {
let observerProxy = new ObservableCaptureDevice.ObserverProxy()
let! captureDevice = self.InternalOpenWithFrameProcessorAsync(
characteristics,
TranscodeFormats.Auto,
(new DelegatedQueuingProcessor(
new PixelBufferArrivedDelegate(observerProxy.OnPixelBufferArrived), 1)), asCT ct) |> Async.AwaitTask
return new ObservableCaptureDevice(captureDevice, observerProxy)
}

[<Obsolete("This function is obsoleted, please use `asObservable` instead.")>]
[<EditorBrowsable(EditorBrowsableState.Never)>]
member self.asObservableAsync(
characteristics: VideoCharacteristics,
transcodeIfYUV: bool,
?ct: CancellationToken) : Async<ObservableCaptureDevice> = async {
let observerProxy = new ObservableCaptureDevice.ObserverProxy()
let! captureDevice = self.InternalOpenWithFrameProcessorAsync(
characteristics,
toFormat transcodeIfYUV,
(new DelegatedQueuingProcessor(
new PixelBufferArrivedDelegate(observerProxy.OnPixelBufferArrived), 1)), asCT ct) |> Async.AwaitTask
return new ObservableCaptureDevice(captureDevice, observerProxy)
}

[<Obsolete("This function is obsoleted, please use `asObservable` instead.")>]
[<EditorBrowsable(EditorBrowsableState.Never)>]
member self.asObservableAsync(
characteristics: VideoCharacteristics,
transcodeIfYUV: bool,
isScattering: bool,
maxQueuingFrames: int,
?ct: CancellationToken) : Async<ObservableCaptureDevice> = async {
let observerProxy = new ObservableCaptureDevice.ObserverProxy()
let pixelBufferArrived = new PixelBufferArrivedDelegate(observerProxy.OnPixelBufferArrived)
let! captureDevice = self.InternalOpenWithFrameProcessorAsync(
characteristics,
toFormat transcodeIfYUV,
(match isScattering with
| true -> (new DelegatedScatteringProcessor(pixelBufferArrived, maxQueuingFrames) :> FrameProcessor)
| false -> (new DelegatedQueuingProcessor(pixelBufferArrived, maxQueuingFrames) :> FrameProcessor)), asCT ct) |> Async.AwaitTask
return new ObservableCaptureDevice(captureDevice, observerProxy)
}

//////////////////////////////////////////////////////////////////////////////////

[<Obsolete("This function is obsoleted, please use `takeOneShot` instead.")>]
[<EditorBrowsable(EditorBrowsableState.Never)>]
member self.takeOneShotAsync(
characteristics: VideoCharacteristics,
?ct: CancellationToken) : Async<byte[]> =
self.InternalTakeOneShotAsync(
characteristics,
TranscodeFormats.Auto,
asCT ct) |> Async.AwaitTask

[<Obsolete("This function is obsoleted, please use `takeOneShot` instead.")>]
[<EditorBrowsable(EditorBrowsableState.Never)>]
member self.takeOneShotAsync(
characteristics: VideoCharacteristics,
transcodeIfYUV: bool,
?ct: CancellationToken) : Async<byte[]> =
self.InternalTakeOneShotAsync(
characteristics,
toFormat transcodeIfYUV,
asCT ct) |> Async.AwaitTask
8 changes: 0 additions & 8 deletions FSharp.FlashCap/CaptureDeviceExtension.fs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,3 @@ module public CaptureDeviceExtension =

member self.showPropertyPage(parentWindow: nativeint, ?ct: CancellationToken) =
self.InternalShowPropertyPageAsync(parentWindow, asCT ct) |> Async.AwaitTask

[<Obsolete("This function is obsoleted, please use `start` instead.")>]
member self.startAsync(?ct: CancellationToken) =
self.InternalStartAsync(asCT ct) |> Async.AwaitTask

[<Obsolete("This function is obsoleted, please use `stop` instead.")>]
member self.stopAsync(?ct: CancellationToken) =
self.InternalStopAsync(asCT ct) |> Async.AwaitTask
8 changes: 0 additions & 8 deletions FSharp.FlashCap/ObservableCaptureDeviceExtension.fs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,5 @@ module public ObservableCaptureDeviceExtension =
member self.stop(?ct: CancellationToken) =
self.InternalStopAsync(asCT ct) |> Async.AwaitTask

[<Obsolete("This function is obsoleted, please use `start` instead.")>]
member self.startAsync(?ct: CancellationToken) =
self.InternalStartAsync(asCT ct) |> Async.AwaitTask

[<Obsolete("This function is obsoleted, please use `stop` instead.")>]
member self.stopAsync(?ct: CancellationToken) =
self.InternalStopAsync(asCT ct) |> Async.AwaitTask

member self.subscribe(observer: IObserver<PixelBufferScope>) =
self.InternalSubscribe(observer)
Loading

0 comments on commit a2ef892

Please sign in to comment.