Skip to main content

MediaSource

Struct MediaSource 

Source
#[non_exhaustive]
pub struct MediaSource { pub id: SourceId, pub locator: String, pub kind: MediaKind, pub color_metadata: Option<ColorMetadata>, pub has_audio: bool, pub generator: Option<Generator>, pub composition: Option<CompositionId>, pub fingerprint: Option<MediaFingerprint>, pub provider: Option<ProviderSource>, }
Expand description

A host-resolved media resource.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§id: SourceId

Stable source identity.

§locator: String

Opaque URI or host locator. The engine does not open it directly. Required, except that a MediaKind::Generated or MediaKind::Composition source has none.

§kind: MediaKind

Media payload domain.

§color_metadata: Option<ColorMetadata>

The color a MediaKind::Video source’s pictures are in, which wins over what its frames and its stream are tagged with on every host: a host records it at import, or a document declares it to correct missing or wrong tags. None leaves the tags in charge. A still is read as sRGB code values whatever it declares.

§has_audio: bool

Whether this source’s media has an audio stream: a fact of the file, so every host that imports it records the same, whether or not that host can decode the stream. A host that cannot reports so at run time and plays the source silent; the document keeps the stream for the hosts that can.

MediaKind::Audio always does. A MediaKind::Video source declares it so that clips on a visual track contribute to the mix; leaving it unset keeps a video clip silent.

§generator: Option<Generator>

What a MediaKind::Generated source draws; present exactly for that kind.

§composition: Option<CompositionId>

The composition a MediaKind::Composition source shows; present exactly for that kind.

§fingerprint: Option<MediaFingerprint>

What the host found at the locator when the project recorded it, so another host can tell whether media it finds is the same. A generated source has none.

§provider: Option<ProviderSource>

The extension provider that supplies this source’s media, and its settings, when the host’s own decoders do not read it.

Implementations§

Source§

impl MediaSource

Source

pub fn new(id: SourceId, locator: impl Into<String>, kind: MediaKind) -> Self

Creates a silent-by-default source without explicit color metadata.

Source

pub const fn generated(id: SourceId, generator: Generator) -> Self

Creates a source the engine draws itself.

Source

pub const fn composition(id: SourceId, composition: CompositionId) -> Self

Creates a source that shows composition composition.

Source

pub const fn is_host_supplied(&self) -> bool

Returns whether a host supplies this source’s media; the engine draws a generated or composition source itself.

Source

pub const fn is_audible(&self) -> bool

Returns whether this source can contribute samples to the audio mix.

Source

pub fn effective_color_metadata(&self) -> ColorMetadata

Returns declared color metadata or the SDR BT.709 limited-range fallback.

Trait Implementations§

Source§

impl Clone for MediaSource

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 MediaSource

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for MediaSource

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for MediaSource

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for MediaSource

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for MediaSource

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<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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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> 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.