Skip to content

Commit

Permalink
chore: fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
clearlysid committed Dec 2, 2024
1 parent 269c740 commit 8960b93
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/capture_display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ async fn main() {
};
let filter = CapturableContentFilter::DISPLAYS;
let content = CapturableContent::new(filter).await.unwrap();
let config = CaptureConfig::with_display(content.displays().next().unwrap(), CapturePixelFormat::Bgra8888);
let config = CaptureConfig::with_display(content.displays().next().unwrap(), CapturePixelFormat::Bgra8888, None);

let mut stream = CaptureStream::new(token, config, |result| {
if let StreamEvent::Video(frame) = result.expect("Expected stream event") {
Expand Down
12 changes: 9 additions & 3 deletions examples/feature_dx11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ use std::time::Duration;
use crabgrab::prelude::*;

#[tokio::main]
async fn main() {
async fn main() {
let token = match CaptureStream::test_access(false) {
Some(token) => token,
None => CaptureStream::request_access(false).await.expect("Expected capture access")
None => CaptureStream::request_access(false)
.await
.expect("Expected capture access"),
};
let filter = CapturableContentFilter::DISPLAYS;
let content = CapturableContent::new(filter).await.unwrap();
let config = CaptureConfig::with_display(content.displays().next().unwrap(), CapturePixelFormat::Bgra8888);
let config = CaptureConfig::with_display(
content.displays().next().unwrap(),
CapturePixelFormat::Bgra8888,
None,
);

let mut stream = CaptureStream::new(token, config, |result| {
if let StreamEvent::Video(frame) = result.expect("Expected stream event") {
Expand Down
2 changes: 1 addition & 1 deletion examples/feature_wgpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn main() {
.expect("Expected to get capturable displays");
let display = content.displays().next()
.expect("Expected at least one capturable display");
let config = CaptureConfig::with_display(display, CapturePixelFormat::Bgra8888)
let config = CaptureConfig::with_display(display, CapturePixelFormat::Bgra8888, None)
.with_wgpu_device(gfx.clone())
.expect("Expected config with wgpu device");
let (tx_result, rx_result) = futures::channel::oneshot::channel::<Result<Option<VideoFrame>, StreamError>>();
Expand Down

0 comments on commit 8960b93

Please sign in to comment.