Skip to main content

Project

Struct Project 

Source
pub struct Project {
    pub schema_version: u32,
    pub id: ProjectId,
    pub name: String,
    pub settings: ProjectSettings,
    pub sources: Vec<MediaSource>,
    pub effect_resources: Vec<EffectResource>,
    pub compositions: Vec<Composition>,
    pub timeline: Timeline,
    pub audio: MasterAudio,
    pub data: Vec<DataSet>,
}
Expand description

A complete serializable project document.

Fields§

§schema_version: u32

Version used to serialize this document.

§id: ProjectId

Stable identity of this project.

§name: String

Human-readable project name. It has no semantic meaning.

§settings: ProjectSettings

Output-wide timeline settings.

§sources: Vec<MediaSource>

Media resources referenced by clips.

§effect_resources: Vec<EffectResource>

Non-media resources referenced by effect invocations.

§compositions: Vec<Composition>

Composition graphs that clips show.

§timeline: Timeline

Ordered visual and audio tracks.

§audio: MasterAudio

Master bus applied to the summed track audio.

§data: Vec<DataSet>

Values derived from media that properties and caption tracks can follow. At most crate::MAX_DATA_SETS.

Implementations§

Source§

impl Project

Source

pub fn audio_effect_load(&self) -> AudioEffectLoad

Measures the most audio effect state this project holds at once, which validation bounds by crate::MAX_AUDIO_EFFECTS and crate::MAX_AUDIO_DELAY_MS. O(n log n) in the clips with effects.

Source§

impl Project

Source

pub fn audio_routing(&self) -> Result<AudioRouting, ModelError>

Resolves every output, send and effect key into the routing graph.

§Errors

Returns ModelError::DuplicateAudioBus for a bus id used twice, ModelError::UnknownAudioBus for an output or send that names no bus, ModelError::UnknownAudioSidechain for a key that names no track or bus, and ModelError::AudioRoutingCycle when a track or bus feeds or keys itself, directly or through others.

Source

pub fn audio_node_ref(&self, node: AudioNode) -> AudioNodeRef

The id of the track or bus at node.

§Panics

Panics when node is past the last track or bus.

Source§

impl Project

Source

pub fn stale_data( &self, is_stale: impl FnMut(&SourceId, &MediaFingerprint) -> bool, ) -> Vec<LintIssue>

LintIssue::StaleData for each source-anchored data set with a made_from that is_stale judges different from its source’s current fingerprint, in data order. Hosts pass their fingerprint comparison; the model holds no current fingerprints.

Source

pub fn lint(&self) -> Vec<LintIssue>

Diagnostics that do not stop the project rendering, in a fixed order: unused sources, shapes generators (sources’, then composition nodes’), HDR sources, each track’s clips, transitions and cues, transform nodes marked for motion blur, composition nodes, then generated sources’ trees.

Source§

impl Project

Source

pub fn from_json(json: &str) -> Result<Self, ProjectLoadError>

Parses and validates a serialized project document.

schema_version is read first, so a document of another version reports ModelError::UnsupportedSchemaVersion rather than a shape error.

§Errors

ProjectLoadError for a malformed, unsupported, or structurally invalid document.

Source

pub fn to_json(&self) -> Result<String, ProjectWriteError>

The document as compact JSON, refused once it passes MAX_PROJECT_JSON_BYTES, so a writer never hands out text Project::from_json would refuse. Writing stops at the cap.

§Errors

ProjectWriteError::TooLarge past the cap.

§Panics

Never; serde_json writes UTF-8.

Source

pub fn used_sources(&self) -> Vec<&MediaSource>

The sources a render of this project can read, in source order: each clip’s own, and those read by media nodes its compositions draw.

From a composition’s output the walk follows the inputs each node reads (crate::CompositionReads::needed_inputs, as the renderer plans them), into group and composition-source compositions. A composition source counts only where the clip’s own composition draws the clip (crate::CompositionReads::draws_clip). Unconnected nodes, unshown compositions, inputs a bypassed node skips and unread group ports read nothing.

Source

pub fn hdr_sources(&self) -> Vec<&SourceId>

Returns the HDR sources (PQ, HLG or declared HDR, per alpha2_media::ColorMetadata::is_hdr), which the project tone-maps or refuses as its ColorPipeline says.

Source

pub fn draws_text(&self) -> bool

Whether anything in the project may draw text: a caption track, or a text or layout generator in a source or composition. A project that draws none needs no fonts. Layouts count even without text because the text host resolves them.

Source

pub fn extent(&self) -> Option<TimeRange>

The smallest interval holding every clip, caption cue and timeline-anchored word a caption track shows. None for a project that shows nothing.

Source

pub fn default_export_range(&self) -> Option<TimeRange>

The range a whole-project export covers when none is asked for: from time 0, the origin keyframes, markers and caption times count from, to the end of the Self::extent. None for a project that shows nothing or nothing after time 0.

Source

pub fn new( id: ProjectId, name: impl Into<String>, settings: ProjectSettings, ) -> Self

Creates an empty project using the current schema version.

Source

pub fn validate(&self) -> Result<(), ModelError>

Checks structural invariants without performing media I/O.

§Errors

Returns the first invalid document invariant encountered.

Source§

impl Project

Source

pub fn for_each_timeline_value_mut( &mut self, visit: &mut dyn FnMut(TimelineOwner<'_>, &'static str, &mut dyn TimelineValue), )

Calls visit with every value keyed in timeline time and its owner: the clip values and transition parameters of each track in order, then Self::for_each_bus_value_mut.

Source

pub fn for_each_bus_value_mut( &mut self, visit: &mut dyn FnMut(TimelineOwner<'_>, &'static str, &mut Animated<f32>), )

Calls visit with each bus value keyed in timeline time: the gain, pan, send gains and effect parameters of each track in order, then the master gain and effect parameters, then the same of each bus in order.

Source

pub fn for_each_clip_reference_mut( &mut self, visit: &mut dyn FnMut(TimelineOwner<'_>, ClipReference, &mut ClipId), )

Calls visit with every reference from one part of the timeline to a clip: mattes, transition clips and via: { clip } bindings, in the order of Self::for_each_timeline_value_mut.

Trait Implementations§

Source§

impl Clone for Project

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 Project

Source§

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

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

impl<'de> Deserialize<'de> for Project

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 Project

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 Project

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 Project

Auto Trait Implementations§

§

impl Forget for Project

§

impl Freeze for Project

§

impl Move for Project

§

impl RefUnwindSafe for Project

§

impl Send for Project
where RawVecInner: Send, BoxRaw<DataBinding>: Send, BoxRaw<MotionPath>: Send, BoxRaw<TextStyle>: Send, BoxRaw<LayoutNode>: Send, NodeRef<Owned, String, Animated<EffectValue>, LeafOrInternal>: Send, BoxRaw<(String, Animated<EffectValue>)>: Send, NodeRef<Owned, String, EffectResourceId, LeafOrInternal>: Send, BoxRaw<(String, EffectResourceId)>: Send, NodeRef<Owned, String, Option<NodeId>, LeafOrInternal>: Send, BoxRaw<(String, Option<NodeId>)>: Send, NodeRef<Owned, String, TextStylePatch, LeafOrInternal>: Send, BoxRaw<(String, TextStylePatch)>: Send, NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send,

§

impl Sync for Project
where RawVecInner: Sync, BoxRaw<DataBinding>: Sync, BoxRaw<MotionPath>: Sync, BoxRaw<TextStyle>: Sync, BoxRaw<LayoutNode>: Sync, NodeRef<Owned, String, Animated<EffectValue>, LeafOrInternal>: Sync, BoxRaw<(String, Animated<EffectValue>)>: Sync, NodeRef<Owned, String, EffectResourceId, LeafOrInternal>: Sync, BoxRaw<(String, EffectResourceId)>: Sync, NodeRef<Owned, String, Option<NodeId>, LeafOrInternal>: Sync, BoxRaw<(String, Option<NodeId>)>: Sync, NodeRef<Owned, String, TextStylePatch, LeafOrInternal>: Sync, BoxRaw<(String, TextStylePatch)>: Sync, NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync,

§

impl Unpin for Project

§

impl UnsafeUnpin for Project

§

impl UnwindSafe for Project

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.