Skip to main content

VideoCapture

Struct VideoCapture 

Source
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

Source

pub fn new(backend: Arc<dyn VideoBackend>) -> VideoCapture

Capture through backend (kessel_video::system, null(), a fake or a fixture).

Source

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.

Source

pub fn stop_preview(&self)

Stops the running preview (its camera closes now, its channel ends).

Source

pub fn preview_running(&self) -> bool

A preview is running (it holds the camera).

Source

pub fn null() -> VideoCapture

No video: kessel-video’s null backend.

Source

pub fn backend(&self) -> &Arc<dyn VideoBackend> ⓘ

The backend (for encoders and decoders).

Source

pub fn capabilities(&self) -> Capabilities

What this machine can do now.

Source

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.

Source

pub fn cameras(&self) -> Vec<CameraInfo>

The cameras now (opens none, never prompts).

Source

pub fn camera_permission(&self) -> Permission

The camera permission (never prompts).

Source

pub fn screen_permission(&self) -> Permission

The screen-recording permission (never prompts).

Source

pub fn events(&self) -> EventRx

Machine-wide events: camera hot-plug, capability changes, thermal, background.

Source

pub async fn request_camera_permission(&self) -> Permission

Asks the camera permission: the OS prompt when not yet determined, else the state now.

Source

pub async fn request_screen_permission(&self) -> Permission

Asks the screen-recording permission (macOS); Granted where there is nothing to ask.

Source

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.

Source

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.

Source

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

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VideoCapture

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneAny for T
where T: Any + Clone,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> CryptoSafe for T
where T: Send + Sync + Debug,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more