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

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. It sorts the clips’ intervals once: O(n log n) in the clips with effects.

Source§

impl Project

Source

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

Diagnostics that do not stop the project rendering, in a fixed order: sources, then tracks in order and each track’s clips, transitions, and cues in order.

Source§

impl Project

Source

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

Parses and validates a serialized project document.

The document’s schema_version is read first: a document of another version reports ModelError::UnsupportedSchemaVersion rather than whatever shape difference the versions have.

§Errors

Returns ProjectLoadError for malformed, unsupported, or structurally invalid documents.

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 the media nodes its compositions draw read.

A clip’s compositions are the one it names and, for a composition source, the source’s when the one it names draws the clip (crate::CompositionReads::draws_clip). From a composition’s output the walk follows the inputs drawing a node reads (crate::CompositionReads::needed_inputs, as the renderer plans them), into the composition a group node draws and the one a composition source a media node reads shows. So an unconnected node, a composition nothing shows, the inputs a bypassed node passes over, and the group ports a group’s composition never reads read nothing. An unconnected input the output needs fails those frames; what the connected inputs read is still used.

Source

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

Returns the HDR sources, which the project tone-maps or refuses as its ColorPipeline says: those whose color is PQ or HLG, or declared HDR, as the renderer decides (alpha2_media::ColorMetadata::is_hdr).

Source

pub fn draws_text(&self) -> bool

Whether anything in the project may draw text: a caption track, or a text generator in a source or a composition. A host whose project draws none needs no fonts and prepares no text.

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.

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§

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.