#[non_exhaustive]pub enum VideoSourceSpec {
Camera(Option<String>),
Display(Option<String>),
Window(String),
App(String),
Rpicam(RpicamMode),
Test(TestPattern),
File {
path: PathBuf,
looping: bool,
},
None,
}Expand description
A parsed video source specifier.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Camera(Option<String>)
A camera, by the id the camera listing reports. None opens the default.
Display(Option<String>)
A whole display. None opens the main one.
On Linux, None and portal let the user pick a screen in the desktop
portal’s dialog. An x11: id opens that X11 display, which on Wayland
shows only XWayland’s windows.
Window(String)
A single window, by id. Supported on macOS, Windows and X11.
On Linux, portal lets the user pick a window in the desktop portal’s
dialog.
App(String)
Every window of one application, by bundle id. macOS only.
Rpicam(RpicamMode)
The Raspberry Pi camera, driven through rpicam-vid.
A kind of its own because a Pi’s /dev/video0 is the Unicam node. It
delivers raw Bayer that only libcamera can drive.
Test(TestPattern)
A generated picture, for publishing without a camera.
File
An MP4 file, decoded by open or passed through by MediaFile.
None
Publish no video.
Implementations§
Source§impl VideoSourceSpec
impl VideoSourceSpec
Sourcepub async fn open(
&self,
options: &VideoOpenOptions,
) -> Result<Option<VideoSource>, Error>
pub async fn open( &self, options: &VideoOpenOptions, ) -> Result<Option<VideoSource>, Error>
Opens the source this specifier names, or returns None for None.
A camera, display, window or app opens through
VideoSource::capture, so the default camera follows its rules. The
default display is screen_source, the
desktop portal on Wayland with the pipewire feature. The portal asks
on each open unless VideoOpenOptions::with_portal_grants keeps its
grants. A test pattern defaults to 1280x720 at 30 fps.
Cancellation safe, as VideoSource::capture is.
§Errors
Fails with Error::InvalidConfig for a source this build cannot
open, such as a camera without the capture feature or the portal off
Linux, or a file without the file feature. Also fails for
RpicamMode::Encoded, which carries encoded video and has no raw
source: read rpicam_h264 instead. Fails with Error::Device if the
device or the file does not open.
A file decodes through MediaFile::video,
at its own size and rate, which the options do not change. It plays
the file VideoOpenOptions::with_file holds if the paths match.
Trait Implementations§
Source§impl Clone for VideoSourceSpec
impl Clone for VideoSourceSpec
Source§impl Debug for VideoSourceSpec
impl Debug for VideoSourceSpec
Source§impl<'de> Deserialize<'de> for VideoSourceSpec
impl<'de> Deserialize<'de> for VideoSourceSpec
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl Display for VideoSourceSpec
impl Display for VideoSourceSpec
impl Eq for VideoSourceSpec
Source§impl From<VideoSourceSpec> for MediaSpec
impl From<VideoSourceSpec> for MediaSpec
Source§fn from(video: VideoSourceSpec) -> Self
fn from(video: VideoSourceSpec) -> Self
Source§impl FromStr for VideoSourceSpec
impl FromStr for VideoSourceSpec
Source§fn from_str(spec: &str) -> Result<Self, ParseSpecError>
fn from_str(spec: &str) -> Result<Self, ParseSpecError>
Parses a video source specifier.
Fails with a message naming the accepted forms if spec is not one of
them, or if a form that needs an identifier was given without one.
Source§type Err = ParseSpecError
type Err = ParseSpecError
Source§impl PartialEq for VideoSourceSpec
impl PartialEq for VideoSourceSpec
Source§impl Serialize for VideoSourceSpec
impl Serialize for VideoSourceSpec
impl StructuralPartialEq for VideoSourceSpec
Auto Trait Implementations§
impl Freeze for VideoSourceSpec
impl RefUnwindSafe for VideoSourceSpec
impl Send for VideoSourceSpec
impl Sync for VideoSourceSpec
impl Unpin for VideoSourceSpec
impl UnsafeUnpin for VideoSourceSpec
impl UnwindSafe for VideoSourceSpec
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.