#[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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: SourceIdStable source identity.
locator: StringOpaque URI or host locator. The engine does not open it directly.
Required, except that a MediaKind::Generated or
MediaKind::Composition source has none.
kind: MediaKindMedia 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: boolWhether 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
impl MediaSource
Sourcepub fn new(id: SourceId, locator: impl Into<String>, kind: MediaKind) -> Self
pub fn new(id: SourceId, locator: impl Into<String>, kind: MediaKind) -> Self
Creates a silent-by-default source without explicit color metadata.
Sourcepub const fn generated(id: SourceId, generator: Generator) -> Self
pub const fn generated(id: SourceId, generator: Generator) -> Self
Creates a source the engine draws itself.
Sourcepub const fn composition(id: SourceId, composition: CompositionId) -> Self
pub const fn composition(id: SourceId, composition: CompositionId) -> Self
Creates a source that shows composition composition.
Sourcepub const fn is_host_supplied(&self) -> bool
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.
Sourcepub const fn is_audible(&self) -> bool
pub const fn is_audible(&self) -> bool
Returns whether this source can contribute samples to the audio mix.
Sourcepub fn effective_color_metadata(&self) -> ColorMetadata
pub fn effective_color_metadata(&self) -> ColorMetadata
Returns declared color metadata or the SDR BT.709 limited-range fallback.