pub struct VideoCapture { /* private fields */ }Expand description
Video capture (video-core): cameras, screens, the OS picker, screen thumbnails and the
pre-join preview over a kessel-video backend, as the sources the publish side takes.
Video capture (video-core): cameras, screens, the OS picker, screen thumbnails and the
pre-join preview over a kessel-video backend, as the sources the publish side takes.
Video capture (video-core): cameras, screens, the OS picker, screen thumbnails and the
pre-join preview over a kessel-video backend, as the sources the publish side takes.
The app’s video capture over one kessel-video backend. Cheap to clone; clones share the
camera: one opener holds it at a time (a new preview, or a camera opened for the publish,
stops the running preview first).
Implementations§
Source§impl VideoCapture
impl VideoCapture
Sourcepub fn new(backend: Arc<dyn VideoBackend>) -> VideoCapture
pub fn new(backend: Arc<dyn VideoBackend>) -> VideoCapture
Capture through backend (kessel_video::system, null(), a fake or a fixture).
Sourcepub fn camera_tap(&self) -> CameraTap
pub fn camera_tap(&self) -> CameraTap
Raw camera frames for a native self-view (super::CameraTap): the frames of the
camera open through this capture or a clone of it (the preview, the bridge’s camera
publish), as captured, before any encoder, with the camera’s facing; the feed first
(Off, Live or Paused). Never opens the camera. Each call is a new tap; dropping
it closes it.
Sourcepub fn stop_preview(&self)
pub fn stop_preview(&self)
Stops the running preview (its camera closes now, its channel ends).
Sourcepub fn preview_running(&self) -> bool
pub fn preview_running(&self) -> bool
A preview is running (it holds the camera).
Sourcepub fn null() -> VideoCapture
pub fn null() -> VideoCapture
No video: kessel-video’s null backend.
Sourcepub fn backend(&self) -> &Arc<dyn VideoBackend> ⓘ
pub fn backend(&self) -> &Arc<dyn VideoBackend> ⓘ
The backend (for encoders and decoders).
Sourcepub fn capabilities(&self) -> Capabilities
pub fn capabilities(&self) -> Capabilities
What this machine can do now.
Sourcepub fn camera_facing(&self, device: Option<&str>) -> Facing
pub fn camera_facing(&self, device: Option<&str>) -> Facing
Which way the camera device faces (None: the default one, as open_camera picks
it); Unknown when it isn’t listed.
Sourcepub fn cameras(&self) -> Vec<CameraInfo>
pub fn cameras(&self) -> Vec<CameraInfo>
The cameras now (opens none, never prompts).
Sourcepub fn camera_permission(&self) -> Permission
pub fn camera_permission(&self) -> Permission
The camera permission (never prompts).
Sourcepub fn screen_permission(&self) -> Permission
pub fn screen_permission(&self) -> Permission
The screen-recording permission (never prompts).
Sourcepub fn events(&self) -> EventRx
pub fn events(&self) -> EventRx
Machine-wide events: camera hot-plug, capability changes, thermal, background.
Sourcepub async fn request_camera_permission(&self) -> Permission
pub async fn request_camera_permission(&self) -> Permission
Asks the camera permission: the OS prompt when not yet determined, else the state now.
Sourcepub async fn request_screen_permission(&self) -> Permission
pub async fn request_screen_permission(&self) -> Permission
Asks the screen-recording permission (macOS); Granted where there is nothing to ask.
Sourcepub async fn open_camera(
&self,
device: Option<&str>,
constraints: CaptureConstraints,
) -> Result<CameraSource, CaptureError>
pub async fn open_camera( &self, device: Option<&str>, constraints: CaptureConstraints, ) -> Result<CameraSource, CaptureError>
Opens a camera (None: the default) at constraints: the permission first (the OS
prompt only when not yet determined), then the device, taken over from a running
preview (stopped first: one opener holds the camera). Returns once it is open; frames
follow on Capture::ready.
Sourcepub async fn screen_sources(&self) -> Result<Vec<ScreenChoice>, CaptureError>
pub async fn screen_sources(&self) -> Result<Vec<ScreenChoice>, CaptureError>
The displays and windows to share, each with a PNG thumbnail when the backend has one.
[] where only the OS picker exists; screen_unsupported with no screen capture.
Sourcepub async fn open_screen(
&self,
pick: ScreenPick,
constraints: CaptureConstraints,
) -> Result<ScreenSource, CaptureError>
pub async fn open_screen( &self, pick: ScreenPick, constraints: CaptureConstraints, ) -> Result<ScreenSource, CaptureError>
Opens a display or window: screen capture must exist here (screen_unsupported: Linux
without the xdg portal or libpipewire), the screen-recording permission (macOS), then the
listed source or the OS picker’s choice (ScreenPick::System passes the parent window
on, which Windows needs), then capture at constraints (see screen_constraints).
The source’s encoders take ContentHint::Screen.
Source§impl VideoCapture
impl VideoCapture
Sourcepub async fn preview(
&self,
device: Option<&str>,
) -> Result<(Preview, PreviewFrames), CaptureError>
pub async fn preview( &self, device: Option<&str>, ) -> Result<(Preview, PreviewFrames), CaptureError>
The camera outside a call (device: None for the default): the permission (the OS
prompt only when not yet determined), the camera at up to 640x360 and 30 fps, and one
encoder at that size (the camera’s aspect ratio kept). Its frames come on the returned
channel; nothing is sent anywhere and no lease is taken. Needs a tokio runtime. One
opener holds the camera: a running preview stops first, and a camera opened later
through this VideoCapture (the bridge’s camera publish) stops this one.
Trait Implementations§
Source§impl Clone for VideoCapture
impl Clone for VideoCapture
Auto Trait Implementations§
impl !RefUnwindSafe for VideoCapture
impl !UnwindSafe for VideoCapture
impl Forget for VideoCapture
impl Freeze for VideoCapture
impl Move for VideoCapture
impl Send for VideoCapture
impl Sync for VideoCapture
impl Unpin for VideoCapture
impl UnsafeUnpin for VideoCapture
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CryptoSafe for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more