-
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New platform API to simply ApiBackend and allow for custom backends o…
…n the fly
- Loading branch information
1 parent
096880e
commit 0e2d000
Showing
18 changed files
with
215 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,4 @@ pub mod traits; | |
pub mod types; | ||
pub mod utils; | ||
pub mod stream; | ||
mod platform; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use crate::camera::{AsyncCamera, Camera}; | ||
use crate::error::NokhwaResult; | ||
use crate::types::{CameraIndex, CameraInformation}; | ||
|
||
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq)] | ||
pub enum Backends { | ||
Video4Linux2, | ||
WebWASM, | ||
AVFoundation, | ||
MicrosoftMediaFoundation, | ||
Custom(&'static str) | ||
} | ||
|
||
pub trait PlatformTrait { | ||
const PLATFORM: Backends; | ||
type Camera: Camera; | ||
|
||
|
||
fn block_on_permission(&mut self) -> NokhwaResult<()>; | ||
|
||
fn check_permission_given(&mut self) -> bool; | ||
|
||
fn query(&mut self) -> NokhwaResult<Vec<CameraInformation>>; | ||
|
||
fn open(&mut self, index: &CameraIndex) -> NokhwaResult<Self::Camera>; | ||
} | ||
|
||
#[cfg(feature = "async")] | ||
pub trait AsyncPlatformTrait { | ||
const PLATFORM: Backends; | ||
type AsyncCamera: AsyncCamera; | ||
|
||
|
||
async fn await_permission(&mut self) -> NokhwaResult<()>; | ||
|
||
async fn query_async(&mut self) -> NokhwaResult<Vec<CameraInformation>>; | ||
|
||
async fn open_async (&mut self, index: &CameraIndex) -> NokhwaResult<Self::AsyncCamera>; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.