Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

add support for BGRA frames + continuity camera

PJe40f590d07f2
diff --git a/Cargo.lock b/Cargo.lock
index 5dbb79094..647a7702a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -729,6 +729,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"cap-project",
+ "cocoa 0.26.0",
"core-foundation 0.10.0",
"core-graphics 0.24.0",
"cpal",
@@ -736,8 +737,8 @@ dependencies = [
"ffmpeg-sys-next",
"flume 0.11.0",
"indexmap 2.5.0",
- "nokhwa 0.10.3 (git+https://github.com/Brendonovich/nokhwa?rev=2de5a760d5f1)",
- "nokhwa-bindings-macos 0.2.0 (git+https://github.com/Brendonovich/nokhwa?rev=2de5a760d5f1)",
+ "nokhwa",
+ "nokhwa-bindings-macos",
"scap 0.0.5 (git+https://github.com/filleduchaos/scap?rev=8eb00ce1b9bcf)",
"serde",
"specta",
@@ -1517,8 +1518,6 @@ dependencies = [
"indexmap 2.5.0",
"mp4",
"nix 0.29.0",
- "nokhwa 0.10.3 (git+https://github.com/CapSoftware/nokhwa?branch=brendonovich-fork)",
- "nokhwa-bindings-macos 0.2.0 (git+https://github.com/CapSoftware/nokhwa?branch=brendonovich-fork)",
"num-traits",
"objc",
"objc2-app-kit",
@@ -3758,26 +3757,12 @@ checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
[[package]]
name = "nokhwa"
version = "0.10.3"
-source = "git+https://github.com/CapSoftware/nokhwa?branch=brendonovich-fork#523b6d9b6266da8d1d9495a64506953961b748be"
-dependencies = [
- "flume 0.10.14",
- "image 0.24.9",
- "nokhwa-bindings-macos 0.2.0 (git+https://github.com/CapSoftware/nokhwa?branch=brendonovich-fork)",
- "nokhwa-core 0.1.0 (git+https://github.com/CapSoftware/nokhwa?branch=brendonovich-fork)",
- "paste",
- "serde",
- "thiserror",
-]
-
-[[package]]
-name = "nokhwa"
-version = "0.10.3"
-source = "git+https://github.com/Brendonovich/nokhwa?rev=2de5a760d5f1#2de5a760d5f1abfc062bf7d7fec155e8a0eafdcd"
+source = "git+https://github.com/filleduchaos/nokhwa?rev=408354f6bcdd#408354f6bcddb00bfc2cb4f9e62ce3854e438ade"
dependencies = [
"flume 0.10.14",
"image 0.24.9",
- "nokhwa-bindings-macos 0.2.0 (git+https://github.com/Brendonovich/nokhwa?rev=2de5a760d5f1)",
- "nokhwa-core 0.1.0 (git+https://github.com/Brendonovich/nokhwa?rev=2de5a760d5f1)",
+ "nokhwa-bindings-macos",
+ "nokhwa-core",
"paste",
"serde",
"thiserror",
@@ -3786,29 +3771,14 @@ dependencies = [
[[package]]
name = "nokhwa-bindings-macos"
version = "0.2.0"
-source = "git+https://github.com/CapSoftware/nokhwa?branch=brendonovich-fork#523b6d9b6266da8d1d9495a64506953961b748be"
-dependencies = [
- "block",
- "cocoa-foundation 0.1.2",
- "core-media-sys",
- "core-video-sys",
- "flume 0.10.14",
- "nokhwa-core 0.1.0 (git+https://github.com/CapSoftware/nokhwa?branch=brendonovich-fork)",
- "objc",
- "once_cell",
-]
-
-[[package]]
-name = "nokhwa-bindings-macos"
-version = "0.2.0"
-source = "git+https://github.com/Brendonovich/nokhwa?rev=2de5a760d5f1#2de5a760d5f1abfc062bf7d7fec155e8a0eafdcd"
+source = "git+https://github.com/filleduchaos/nokhwa?rev=408354f6bcdd#408354f6bcddb00bfc2cb4f9e62ce3854e438ade"
dependencies = [
"block",
"cocoa-foundation 0.1.2",
"core-media-sys",
"core-video-sys",
"flume 0.10.14",
- "nokhwa-core 0.1.0 (git+https://github.com/Brendonovich/nokhwa?rev=2de5a760d5f1)",
+ "nokhwa-core",
"objc",
"once_cell",
]
@@ -3816,19 +3786,7 @@ dependencies = [
[[package]]
name = "nokhwa-core"
version = "0.1.0"
-source = "git+https://github.com/CapSoftware/nokhwa?branch=brendonovich-fork#523b6d9b6266da8d1d9495a64506953961b748be"
-dependencies = [
- "bytes",
- "image 0.24.9",
- "mozjpeg",
- "serde",
- "thiserror",
-]
-
-[[package]]
-name = "nokhwa-core"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/nokhwa?rev=2de5a760d5f1#2de5a760d5f1abfc062bf7d7fec155e8a0eafdcd"
+source = "git+https://github.com/filleduchaos/nokhwa?rev=408354f6bcdd#408354f6bcddb00bfc2cb4f9e62ce3854e438ade"
dependencies = [
"bytes",
"image 0.24.9",
diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.toml
index efba493b9..52fabf564 100644
--- a/apps/desktop/src-tauri/Cargo.toml
+++ b/apps/desktop/src-tauri/Cargo.toml
@@ -53,10 +53,6 @@ futures-intrusive = "0.5.0"
anyhow.workspace = true
mp4 = "0.14.0"
futures = "0.3.30"
-nokhwa = { git = "https://github.com/CapSoftware/nokhwa", branch = "brendonovich-fork", features = [
- "input-avfoundation",
- "serialize",
-] }
axum = { version = "0.7.5", features = ["ws"] }
tracing = "0.1.40"
cpal = "0.15.3"
@@ -83,7 +79,6 @@ global-hotkey = "0.5.5"
[target.'cfg(target_os = "macos")'.dependencies]
core-graphics = "0.24.0"
core-foundation = "0.10.0"
-nokhwa-bindings-macos = { git = "https://github.com/CapSoftware/nokhwa", branch = "brendonovich-fork" }
objc2-app-kit = { version = "0.2.2", features = ["NSWindow", "NSResponder"] }
cocoa = "0.26.0"
objc = "0.2.7"
diff --git a/apps/desktop/src-tauri/src/permissions.rs b/apps/desktop/src-tauri/src/permissions.rs
index 72b161c92..356e8b850 100644
--- a/apps/desktop/src-tauri/src/permissions.rs
+++ b/apps/desktop/src-tauri/src/permissions.rs
@@ -1,11 +1,11 @@
use serde::{Deserialize, Serialize};
use tauri::AppHandle;
+#[cfg(target_os = "macos")]
+use cap_media::platform::{AVAuthorizationStatus, AVMediaType};
use core_foundation::boolean::CFBoolean;
use core_foundation::dictionary::{CFDictionary, CFDictionaryRef}; // Import CFDictionaryRef
use core_foundation::string::CFString;
-#[cfg(target_os = "macos")]
-use nokhwa_bindings_macos::{AVAuthorizationStatus, AVMediaType};
use crate::windows::CapWindow;
diff --git a/crates/media/Cargo.toml b/crates/media/Cargo.toml
index 6515b081c..bbc1d6da4 100644
--- a/crates/media/Cargo.toml
+++ b/crates/media/Cargo.toml
@@ -13,7 +13,7 @@ ffmpeg.workspace = true
ffmpeg-sys-next.workspace = true
flume = "0.11.0"
indexmap = "2.5.0"
-nokhwa = { git = "https://github.com/Brendonovich/nokhwa", rev = "2de5a760d5f1", features = [
+nokhwa = { git = "https://github.com/filleduchaos/nokhwa", rev = "408354f6bcdd", features = [
"input-avfoundation",
"serialize",
] }
@@ -25,6 +25,7 @@ thiserror = "1.0"
tracing = "0.1"
[target.'cfg(target_os = "macos")'.dependencies]
+cocoa = "0.26.0"
core-graphics = "0.24.0"
core-foundation = "0.10.0"
-nokhwa-bindings-macos = { git = "https://github.com/Brendonovich/nokhwa", rev = "2de5a760d5f1" }
+nokhwa-bindings-macos = { git = "https://github.com/filleduchaos/nokhwa", rev = "408354f6bcdd" }
diff --git a/crates/media/src/feeds/camera.rs b/crates/media/src/feeds/camera.rs
index c2b5b0cb8..2e5354d2f 100644
--- a/crates/media/src/feeds/camera.rs
+++ b/crates/media/src/feeds/camera.rs
@@ -310,6 +310,7 @@ impl FrameConverter {
FrameFormat::NV12 => RawVideoFormat::Nv12,
FrameFormat::GRAY => RawVideoFormat::Gray,
FrameFormat::RAWRGB => RawVideoFormat::RawRgb,
+ FrameFormat::BGRA => RawVideoFormat::Bgra,
};
let video_info = VideoInfo::from_raw(
diff --git a/crates/media/src/platform/macos.rs b/crates/media/src/platform/macos.rs
index 611e37177..c944b537e 100644
--- a/crates/media/src/platform/macos.rs
+++ b/crates/media/src/platform/macos.rs
@@ -14,6 +14,7 @@ use core_graphics::{
kCGWindowOwnerPID, CGWindowListCopyWindowInfo,
},
};
+pub use nokhwa_bindings_macos::{AVAuthorizationStatus, AVMediaType};
use std::ffi::c_void;
use crate::platform::{Bounds, Window};