Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft implementation of nannou_webcam #808

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

l1npengtul
Copy link

This is a draft implementation of nannou_webcam, an extension to nannou to allow for simple webcam capture. See #464

Currently Implemented are MSMF, V4L2, and AVFoundation* backends. WASM will require some work. This crate re-exports nokhwa to fit nannou.

(Disclaimer - I made nokhwa)

*: AVFoundation is weird and will ignore user settings. If anyone can get their hands on an C API for AVFoundation, please let me know

@l1npengtul
Copy link
Author

Waiting on RustAudio/cpal#620 to re-enable ASIO feature

Also working on enabling JSCAM and IPCAM for this

@mitchmindtree
Copy link
Member

Omg epic work @l1npengtul, this is awesome! I'll dive in and review this properly soon. nokhwa looks amazing by the way, looking forward to trying it out.

@l1npengtul
Copy link
Author

Thanks! This is a draft since I am working on 0.9.2 (Properly fix media foundation) and I'll eventually work on 0.10 when a couple things become availible in wasm-bindgen.

@l1npengtul
Copy link
Author

I believe that this is ready for review but we are still blocked on waiting for CPAL to update their bindgen.

@l1npengtul
Copy link
Author

CPAL bindgen updated! Just have to wait for the 0.2.1 on crates now.

@l1npengtul l1npengtul marked this pull request as ready for review December 31, 2021 13:40
@rrrnld
Copy link
Contributor

rrrnld commented Sep 14, 2022

Heya, thanks for working on this. :) I just tried running this fork and I'm hit with the following error:

thread 'main' panicked at 'cannot execute `LocalPool` executor from within another executor: EnterError', /home/arne/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.24/src/local_pool.rs:81:26
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: core::result::Result<T,E>::expect
             at /build/rustc-1.62.1-src/library/core/src/result.rs:1035:23
   4: futures_executor::local_pool::run_executor
             at /home/arne/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.24/src/local_pool.rs:81:18
   5: futures_executor::local_pool::block_on
             at /home/arne/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.24/src/local_pool.rs:317:5
   6: nannou::window::Builder::build
             at /home/arne/.cargo/git/checkouts/nannou-c1eab9fe2746171b/2eee004/nannou/src/window.rs:731:9
   7: nannou_webcam::model
             at ./src/main.rs:15:19
   8: nannou::app::Builder<M>::new::{{closure}}
             at /home/arne/.cargo/git/checkouts/nannou-c1eab9fe2746171b/2eee004/nannou/src/app.rs:255:59
   9: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /build/rustc-1.62.1-src/library/core/src/ops/function.rs:248:5
  10: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /build/rustc-1.62.1-src/library/alloc/src/boxed.rs:1872:9
  11: nannou::app::Builder<M,E>::run_async::{{closure}}
             at /home/arne/.cargo/git/checkouts/nannou-c1eab9fe2746171b/2eee004/nannou/src/app.rs:498:31
  12: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /build/rustc-1.62.1-src/library/core/src/future/mod.rs:91:19
  13: futures_executor::local_pool::block_on::{{closure}}
             at /home/arne/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.24/src/local_pool.rs:317:23
  14: futures_executor::local_pool::run_executor::{{closure}}
             at /home/arne/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.24/src/local_pool.rs:90:37
  15: std::thread::local::LocalKey<T>::try_with
             at /build/rustc-1.62.1-src/library/std/src/thread/local.rs:445:16
  16: std::thread::local::LocalKey<T>::with
             at /build/rustc-1.62.1-src/library/std/src/thread/local.rs:421:9
  17: futures_executor::local_pool::run_executor
             at /home/arne/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.24/src/local_pool.rs:86:5
  18: futures_executor::local_pool::block_on
             at /home/arne/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.24/src/local_pool.rs:317:5
  19: nannou::app::Builder<M,E>::run
             at /home/arne/.cargo/git/checkouts/nannou-c1eab9fe2746171b/2eee004/nannou/src/app.rs:454:9
  20: nannou_webcam::main
             at ./src/main.rs:11:5
  21: core::ops::function::FnOnce::call_once
             at /build/rustc-1.62.1-src/library/core/src/ops/function.rs:248:5

It tried to git pull --rebase it onto the current master branch of the repository at nannou-org/nannou, but I'm hit with the same error. I'm running rust 1.62.1. Any idea what causes this error?

@l1npengtul
Copy link
Author

This is very old and outdated code, would need a lot more love to get it working again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants