pub struct VirtualCamera {
running: Mutex<Option<Running>>,
stats: Arc<Stats>,
}Expand description
A virtual camera fed with encoded frames by the consumer.
Fields§
§running: Mutex<Option<Running>>§stats: Arc<Stats>Implementations§
Source§impl VirtualCamera
impl VirtualCamera
Sourcepub const CODEC_MJPEG: u32
pub const CODEC_MJPEG: u32
The codec ids push takes, as the client names a frame’s codec on the wire.
pub const CODEC_H264: u32
pub const CODEC_VP8: u32
pub const CODEC_VP9: u32
pub const CODEC_AV1: u32
pub const CODEC_HEVC: u32
Sourcepub const KEYFRAME_WANTED: u32 = 1
pub const KEYFRAME_WANTED: u32 = 1
push() result bit: the decoder needs a keyframe from the client to resume.
pub fn new() -> Self
Sourcepub fn start(&self, settings: &VirtualCameraSettings) -> Result<(), Error>
pub fn start(&self, settings: &VirtualCameraSettings) -> Result<(), Error>
Bind the socket, allocate the ring, open the kernel device if configured, and start the decoder thread. Restarting a running camera stops it first.
Sourcepub fn push(
&self,
data: &[u8],
codec: u32,
keyframe: bool,
rotation: u32,
flip: bool,
) -> Result<u32, Error>
pub fn push( &self, data: &[u8], codec: u32, keyframe: bool, rotation: u32, flip: bool, ) -> Result<u32, Error>
Hand one encoded frame to the decoder. data is the encoded payload; empty data pushes
nothing and only reports. rotation (clockwise degrees: 0, 90, 180, or 270) and flip
(a horizontal mirror applied after the rotation) carry the frame’s upright transform when
the client’s encoder left it as metadata instead of baking it into the pixels; the decoded
picture is oriented before it is fitted. Returns a bit set (KEYFRAME_WANTED) the caller
relays to the client. Fails when the camera is not running, the codec id is unknown, or the
rotation is not a quarter turn.
Sourcepub fn stop(&self)
pub fn stop(&self)
Stop the decoder thread, close every interposer client, and remove the socket.
pub fn is_running(&self) -> bool
pub fn socket_path(&self) -> Option<String>
Sourcepub fn device_path(&self) -> String
pub fn device_path(&self) -> String
Kernel device currently mirrored, or “” when none is in use.
Sourcepub fn stats(&self) -> CameraStats
pub fn stats(&self) -> CameraStats
Counters and the negotiated geometry.
Trait Implementations§
Source§impl Default for VirtualCamera
impl Default for VirtualCamera
Source§impl Drop for VirtualCamera
impl Drop for VirtualCamera
Auto Trait Implementations§
impl !Freeze for VirtualCamera
impl RefUnwindSafe for VirtualCamera
impl Send for VirtualCamera
impl Sync for VirtualCamera
impl Unpin for VirtualCamera
impl UnsafeUnpin for VirtualCamera
impl UnwindSafe for VirtualCamera
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
§fn null_value() -> T
fn null_value() -> T
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().