MLT 6.26.0
Public Member Functions | Data Fields | Static Private Member Functions
mlt_animation_s Struct Reference

Property Animation class. More...

Public Member Functions

void mlt_animation_close (mlt_animation self)
 Close the animation and deallocate all of its resources.
 
int mlt_animation_get_item (mlt_animation self, mlt_animation_item item, int position)
 Load an animation item for an absolute position.
 
int mlt_animation_get_length (mlt_animation self)
 Get the length of the animation.
 
int mlt_animation_insert (mlt_animation self, mlt_animation_item item)
 Insert an animation item.
 
void mlt_animation_interpolate (mlt_animation self)
 Re-interpolate non-keyframe nodes after a series of insertions or removals.
 
int mlt_animation_key_count (mlt_animation self)
 Get the number of keyframes.
 
int mlt_animation_key_get (mlt_animation self, mlt_animation_item item, int index)
 Get an animation item for the N-th keyframe.
 
int mlt_animation_key_set_frame (mlt_animation self, int index, int frame)
 Change the frame number for the N-th keyframe.
 
int mlt_animation_key_set_type (mlt_animation self, int index, mlt_keyframe_type type)
 Change the interpolation for the N-th keyframe.
 
mlt_animation mlt_animation_new ()
 Create a new animation object.
 
int mlt_animation_next_key (mlt_animation self, mlt_animation_item item, int position)
 Get the keyfame at the position or the next following.
 
int mlt_animation_parse (mlt_animation self, const char *data, int length, double fps, locale_t locale)
 Parse a string representing an animation.
 
int mlt_animation_parse_item (mlt_animation self, mlt_animation_item item, const char *value)
 Parse a string representing an animation keyframe=value.
 
int mlt_animation_prev_key (mlt_animation self, mlt_animation_item item, int position)
 Get the keyfame at the position or the next preceding.
 
int mlt_animation_refresh (mlt_animation self, const char *data, int length)
 Conditionally refresh the animation if it is modified.
 
int mlt_animation_remove (mlt_animation self, int position)
 Remove the keyframe at the specified position.
 
char * mlt_animation_serialize (mlt_animation self)
 Serialize the animation.
 
char * mlt_animation_serialize_cut (mlt_animation self, int in, int out)
 Serialize a cut of the animation.
 
char * mlt_animation_serialize_cut_tf (mlt_animation self, int in, int out, mlt_time_format time_format)
 Serialize a cut of the animation (with time format).
 
char * mlt_animation_serialize_tf (mlt_animation self, mlt_time_format time_format)
 Serialize the animation (with time format).
 
void mlt_animation_set_length (mlt_animation self, int length)
 Set the length of the animation.
 

Data Fields

char * data
 the string representing the animation
 
double fps
 framerate to use when converting time clock strings to frame units
 
int length
 the maximum number of frames to use when interpreting negative keyframe positions
 
locale_t locale
 pointer to a locale to use when converting strings to numeric values
 
animation_node nodes
 a linked list of keyframes (and possibly non-keyframe values)
 

Static Private Member Functions

static void mlt_animation_clean (mlt_animation self)
 Reset an animation and free all strings and properties.
 
static int mlt_animation_drop (mlt_animation self, animation_node node)
 Remove a node from the linked list.
 

Detailed Description

Property Animation class.

This is the animation engine for a Property object. It is dependent upon the mlt_property API and used by the various mlt_property_anim_* functions.

Member Function Documentation

◆ mlt_animation_clean()

static void mlt_animation_clean ( mlt_animation  self)
staticprivate

Reset an animation and free all strings and properties.

Parameters
selfan animation

◆ mlt_animation_close()

void mlt_animation_close ( mlt_animation  self)

Close the animation and deallocate all of its resources.

Parameters
selfthe animation to destroy

◆ mlt_animation_drop()

static int mlt_animation_drop ( mlt_animation  self,
animation_node  node 
)
staticprivate

Remove a node from the linked list.

Parameters
selfan animation
nodethe node to remove
Returns
false

◆ mlt_animation_get_item()

int mlt_animation_get_item ( mlt_animation  self,
mlt_animation_item  item,
int  position 
)

Load an animation item for an absolute position.

This performs interpolation if there is no keyframe at the position.

Parameters
selfan animation
iteman already allocated animation item that will be filled in
positionthe frame number for the point in time
Returns
true if there was an error

◆ mlt_animation_get_length()

int mlt_animation_get_length ( mlt_animation  self)

Get the length of the animation.

If the animation was initialized with a zero or negative value, then this gets the maximum frame number from animation's list of nodes.

Parameters
selfan animation
Returns
the number of frames

◆ mlt_animation_insert()

int mlt_animation_insert ( mlt_animation  self,
mlt_animation_item  item 
)

Insert an animation item.

Parameters
selfan animation
iteman animation item
Returns
true if there was an error
See also
mlt_animation_parse_item

◆ mlt_animation_interpolate()

void mlt_animation_interpolate ( mlt_animation  self)

Re-interpolate non-keyframe nodes after a series of insertions or removals.

Parameters
selfan animation

◆ mlt_animation_key_count()

int mlt_animation_key_count ( mlt_animation  self)

Get the number of keyframes.

Parameters
selfan animation
Returns
the number of keyframes or -1 on error

◆ mlt_animation_key_get()

int mlt_animation_key_get ( mlt_animation  self,
mlt_animation_item  item,
int  index 
)

Get an animation item for the N-th keyframe.

Parameters
selfan animation
iteman already allocated animation item that will be filled in
indexthe N-th keyframe (0 based) in this animation
Returns
true if there was an error

◆ mlt_animation_key_set_frame()

int mlt_animation_key_set_frame ( mlt_animation  self,
int  index,
int  frame 
)

Change the frame number for the N-th keyframe.

Parameters
selfan animation
indexthe N-th keyframe (0 based) in this animation
framethe position of this keyframe in frame units
Returns
true if there was an error

◆ mlt_animation_key_set_type()

int mlt_animation_key_set_type ( mlt_animation  self,
int  index,
mlt_keyframe_type  type 
)

Change the interpolation for the N-th keyframe.

Parameters
selfan animation
indexthe N-th keyframe (0 based) in this animation
typethe method of interpolation for this key frame
Returns
true if there was an error

◆ mlt_animation_new()

mlt_animation mlt_animation_new ( )

Create a new animation object.

Returns
an animation object

◆ mlt_animation_next_key()

int mlt_animation_next_key ( mlt_animation  self,
mlt_animation_item  item,
int  position 
)

Get the keyfame at the position or the next following.

Parameters
selfan animation
iteman already allocated animation item which will be updated
positionthe frame number at which to start looking for the next animation node
Returns
true if there was an error

◆ mlt_animation_parse()

int mlt_animation_parse ( mlt_animation  self,
const char *  data,
int  length,
double  fps,
locale_t  locale 
)

Parse a string representing an animation.

A semicolon is the delimiter between keyframe=value items in the string.

Parameters
selfan animation
datathe string representing an animation
lengththe maximum number of frames when interpreting negative keyframe times, <=0 if you don't care or need that
fpsthe framerate to use when evaluating time strings
localethe locale to use when converting strings to numbers
Returns
true if there was an error

◆ mlt_animation_parse_item()

int mlt_animation_parse_item ( mlt_animation  self,
mlt_animation_item  item,
const char *  value 
)

Parse a string representing an animation keyframe=value.

This function does not affect the animation itself! But it will use some state of the animation for the parsing (e.g. fps, locale). It parses into a mlt_animation_item that you provide. item->frame should be specified if the string does not have an equal sign and time field. If an exclamation point (!) or vertical bar (|) character precedes the equal sign, then the keyframe interpolation is set to discrete. If a tilde (~) precedes the equal sign, then the keyframe interpolation is set to smooth (spline).

Parameters
selfan animation
iteman already allocated animation item
valuethe string representing an animation
Returns
true if there was an error

◆ mlt_animation_prev_key()

int mlt_animation_prev_key ( mlt_animation  self,
mlt_animation_item  item,
int  position 
)

Get the keyfame at the position or the next preceding.

Parameters
selfan animation
iteman already allocated animation item which will be updated
positionthe frame number at which to start looking for the previous animation node
Returns
true if there was an error

◆ mlt_animation_refresh()

int mlt_animation_refresh ( mlt_animation  self,
const char *  data,
int  length 
)

Conditionally refresh the animation if it is modified.

Parameters
selfan animation
datathe string representing an animation
lengththe maximum number of frames when interpreting negative keyframe times, <=0 if you don't care or need that
Returns
true if there was an error

◆ mlt_animation_remove()

int mlt_animation_remove ( mlt_animation  self,
int  position 
)

Remove the keyframe at the specified position.

Parameters
selfan animation
positionthe frame number of the animation node to remove
Returns
true if there was an error

◆ mlt_animation_serialize()

char * mlt_animation_serialize ( mlt_animation  self)

Serialize the animation.

This version outputs the key frames' position as a frame number. The caller is responsible for free-ing the returned string.

Parameters
selfan animation
Returns
a string representing the animation

◆ mlt_animation_serialize_cut()

char * mlt_animation_serialize_cut ( mlt_animation  self,
int  in,
int  out 
)

Serialize a cut of the animation.

This version outputs the key frames' position as a frame number. The caller is responsible for free-ing the returned string.

Parameters
selfan animation
inthe frame at which to start serializing animation nodes
outthe frame at which to stop serializing nodes
Returns
a string representing the animation

◆ mlt_animation_serialize_cut_tf()

char * mlt_animation_serialize_cut_tf ( mlt_animation  self,
int  in,
int  out,
mlt_time_format  time_format 
)

Serialize a cut of the animation (with time format).

The caller is responsible for free-ing the returned string.

Parameters
selfan animation
inthe frame at which to start serializing animation nodes
outthe frame at which to stop serializing nodes
time_formatthe time format to use for the key frames
Returns
a string representing the animation

◆ mlt_animation_serialize_tf()

char * mlt_animation_serialize_tf ( mlt_animation  self,
mlt_time_format  time_format 
)

Serialize the animation (with time format).

The caller is responsible for free-ing the returned string.

Parameters
selfan animation
time_formatthe time format to use for the key frames
Returns
a string representing the animation

◆ mlt_animation_set_length()

void mlt_animation_set_length ( mlt_animation  self,
int  length 
)

Set the length of the animation.

The length is used for interpreting negative keyframe positions as relative to the length. It is also used when serializing an animation as a string.

Parameters
selfan animation
lengththe length of the animation in frame units

Field Documentation

◆ data

char* mlt_animation_s::data

the string representing the animation

◆ fps

double mlt_animation_s::fps

framerate to use when converting time clock strings to frame units

◆ length

int mlt_animation_s::length

the maximum number of frames to use when interpreting negative keyframe positions

◆ locale

locale_t mlt_animation_s::locale

pointer to a locale to use when converting strings to numeric values

◆ nodes

animation_node mlt_animation_s::nodes

a linked list of keyframes (and possibly non-keyframe values)


The documentation for this struct was generated from the following file: