Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
kekyo committed Jan 14, 2024
1 parent 1631894 commit e3a5377
Show file tree
Hide file tree
Showing 2 changed files with 172 additions and 173 deletions.
26 changes: 13 additions & 13 deletions FlashCap.Core/Devices/DirectShowDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,20 @@ protected override Task OnInitializeAsync(

return this.workingContext!.InvokeAsync(() =>
{
if (NativeMethods_DirectShow.EnumerateDeviceMoniker(
NativeMethods_DirectShow.CLSID_VideoInputDeviceCategory).
Where(moniker =>
moniker.GetPropertyBag() is { } pb &&
pb.SafeReleaseBlock(pb =>
pb.GetValue("DevicePath", default(string))?.Trim() is { } dp &&
dp.Equals(devicePath))).
Collect(moniker =>
moniker.BindToObject(null, null, in NativeMethods_DirectShow.IID_IBaseFilter, out var captureSource) == 0 ?
captureSource as NativeMethods_DirectShow.IBaseFilter : null).
FirstOrDefault() is { } captureSource)
{
try
if (NativeMethods_DirectShow.EnumerateDeviceMoniker(
NativeMethods_DirectShow.CLSID_VideoInputDeviceCategory).
Where(moniker =>
moniker.GetPropertyBag() is { } pb &&
pb.SafeReleaseBlock(pb =>
pb.GetValue("DevicePath", default(string))?.Trim() is { } dp &&
dp.Equals(devicePath))).
Collect(moniker =>
moniker.BindToObject(null, null, in NativeMethods_DirectShow.IID_IBaseFilter, out var captureSource) == 0 ?
captureSource as NativeMethods_DirectShow.IBaseFilter : null).
FirstOrDefault() is { } captureSource)
{
try
{
if (captureSource.EnumeratePins().
Collect(pin =>
pin.GetPinInfo() is { } pinInfo &&
Expand Down
Loading

0 comments on commit e3a5377

Please sign in to comment.