#[non_exhaustive]pub struct MediaSpec {
pub video: VideoSourceSpec,
pub audio: Option<AudioSourceSpec>,
pub reencode: bool,
}Expand description
A video source and the audio that goes with it, which a broadcast publishes together.
LocalBroadcast::set_spec in moq-ext-publisher opens and publishes
one. A file: video brings its own audio unless audio
names another source, and goes out as it is stored unless
reencode is set.
§Examples
use moq_ext_sources::spec::{AudioSourceSpec, MediaSpec, TestTone};
let spec =
MediaSpec::new("test:bounce".parse()?).with_audio(AudioSourceSpec::Test(TestTone::Beeps));
let file = MediaSpec::new("file:clip.mp4:loop".parse()?);
assert!(file.audio.is_none());Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.video: VideoSourceSpecThe video source. VideoSourceSpec::None stops the video.
audio: Option<AudioSourceSpec>The audio source, or None to leave the audio to the video.
With None, a file: video publishes the file’s own audio, or none
if the file has none, and any other video leaves the current audio
alone. AudioSourceSpec::None stops the audio.
reencode: boolWhether a file: video and its own audio are decoded and encoded again.
Off by default: the file’s H.264 and AAC go out as they are stored, at no CPU cost but in one rendition at the file’s size, bitrate and keyframe interval.
Implementations§
Source§impl MediaSpec
impl MediaSpec
Sourcepub fn new(video: VideoSourceSpec) -> Self
pub fn new(video: VideoSourceSpec) -> Self
Creates a spec of video, leaving the audio to the video.
Sourcepub fn test() -> Self
pub fn test() -> Self
Returns the timing test pattern with the beeps that mark it, which needs no device.
The same as test for the video and the audio specifier.
Sourcepub fn camera() -> Self
pub fn camera() -> Self
Returns the default camera with the default microphone.
The same as cam for the video and mic for the audio specifier.
Sourcepub fn screen() -> Self
pub fn screen() -> Self
Returns the main display, and leaves the audio as it is.
The same as screen for the video specifier. It opens what
screen_source names: in a Wayland session
with the pipewire feature, the desktop portal’s dialog, where the
user picks a screen.
Sourcepub fn with_audio(self, audio: AudioSourceSpec) -> Self
pub fn with_audio(self, audio: AudioSourceSpec) -> Self
Returns this spec with audio as the audio source.
Sourcepub fn with_reencode(self, reencode: bool) -> Self
pub fn with_reencode(self, reencode: bool) -> Self
Returns this spec with reencode as whether a file: video and its own audio are decoded and encoded again.
Trait Implementations§
impl Eq for MediaSpec
Source§impl From<VideoSourceSpec> for MediaSpec
impl From<VideoSourceSpec> for MediaSpec
Source§fn from(video: VideoSourceSpec) -> Self
fn from(video: VideoSourceSpec) -> Self
impl StructuralPartialEq for MediaSpec
Auto Trait Implementations§
impl Freeze for MediaSpec
impl RefUnwindSafe for MediaSpec
impl Send for MediaSpec
impl Sync for MediaSpec
impl Unpin for MediaSpec
impl UnsafeUnpin for MediaSpec
impl UnwindSafe for MediaSpec
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<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.