#[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. Required except for
MediaKind::Generated and MediaKind::Composition sources.
kind: MediaKindMedia payload domain.
color_metadata: Option<ColorMetadata>The color a MediaKind::Video source’s pictures are in, overriding frame and stream
tags on every host. Recorded at import or declared to correct missing or wrong tags;
None leaves the tags in charge. Stills are always read as sRGB code values.
has_audio: boolWhether the media has an audio stream. This is a fact of the file, recorded the same by every host whether or not it can decode the stream; a host that cannot plays the source silent.
MediaKind::Audio always does. A MediaKind::Video source must declare it for its
clips on a visual track to contribute to the mix.
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. Generated sources have none.
provider: Option<ProviderSource>The extension provider and settings that supply this source’s media 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 generated and composition sources 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.