Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
kekyo committed Apr 20, 2024
2 parents 854186a + a99a6d4 commit 93c85ce
Show file tree
Hide file tree
Showing 57 changed files with 3,072 additions and 833 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ on: [push]

jobs:
build:
runs-on: windows-latest
runs-on: ubuntu-latest
steps:

#-----------------------------------------------------------------------
# Checkout

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
# lfs: true
Expand All @@ -20,16 +20,16 @@ jobs:
- name: Extract branch name
id: extract_branch_name
run: |
$branch_name=$(git name-rev --name-only --exclude=tags/* HEAD)
export branch_name=`git name-rev --name-only --exclude=tags/* HEAD`
echo "Detected current branch: ${branch_name}"
echo "::set-output name=branch_name::${branch_name}"
echo "branch_name=${branch_name}" >> $GITHUB_OUTPUT
#-----------------------------------------------------------------------
# Setup environments
# Setup environments

- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
2.2.x
Expand Down Expand Up @@ -66,14 +66,14 @@ jobs:
- name: Deploy NuGet package (develop/ref1)
if: startsWith( github.ref, 'refs/tags/' )
run: |
dotnet nuget push artifacts\FlashCap.*.nupkg --source ref1
dotnet nuget push artifacts\FSharp.FlashCap.*.nupkg --source ref1
dotnet nuget push artifacts/FlashCap.*.nupkg --source ref1
dotnet nuget push artifacts/FSharp.FlashCap.*.nupkg --source ref1
#-----------------------------------------------------------------------
# Deploy packages (main)

#- name: Deploy NuGet package (main/ref2)
# if: (startsWith( github.ref, 'refs/tags/' )) && (endsWith(steps.extract_branch_name.outputs.branch_name, 'main'))
# run: |
# dotnet nuget push artifacts\FlashCap.*.nupkg --source ref1
# dotnet nuget push artifacts\FSharp.FlashCap.*.nupkg --source ref1
# dotnet nuget push artifacts/FlashCap.*.nupkg --source ref1
# dotnet nuget push artifacts/FSharp.FlashCap.*.nupkg --source ref1
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 93c85ce

Please sign in to comment.