]> git.sesse.net Git - mlt/blob - src/framework/mlt_animation.h
Add mlt_animation and mlt_property_interpolate().
[mlt] / src / framework / mlt_animation.h
1 /*
2  * mlt_animation.h -- provides the property animation API
3  * Copyright (C) 2004-2013 Ushodaya Enterprises Limited
4  * Author: Charles Yates <charles.yates@pandora.be>
5  * Author: Dan Dennedy <dan@dennedy.org>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #ifndef MLT_ANIMATION_H
23 #define MLT_ANIMATION_H
24
25 #include "mlt_types.h"
26 #include "mlt_property.h"
27
28 struct mlt_animation_item_s
29 {
30
31         int is_key; /**< = whether this is a key frame or an interpolated item */
32         int frame; /**< The actual frame this corresponds to */
33         mlt_property property;
34 };
35 typedef struct mlt_animation_item_s *mlt_animation_item;
36
37 struct mlt_animation_s;
38 typedef struct mlt_animation_s *mlt_animation;
39
40 /* Create a new animation object. */
41 extern mlt_animation mlt_animation_new( );
42 /* Parse the geometry specification for a given duration and range */
43 extern int mlt_animation_parse(mlt_animation self, const char *data, int length, double fps, locale_t locale );
44 /* Conditionally refresh the animation if it's modified */
45 extern int mlt_animation_refresh( mlt_animation self, const char *data, int length );
46 /* Get and set the length */
47 extern int mlt_animation_get_length( mlt_animation self );
48 extern void mlt_animation_set_length( mlt_animation self, int length );
49 /* Parse an item - doesn't affect the animation itself but uses current information for evaluation */
50 /* (item->frame should be specified if not included in the data itself) */
51 extern int mlt_animation_parse_item( mlt_animation self, mlt_animation_item item, const char *data );
52 /* Fetch an animation item for an absolute position */
53 extern int mlt_animation_get_item( mlt_animation self, mlt_animation_item item, int position );
54 /* Specify an animation item at an absolute position */
55 extern int mlt_animation_insert( mlt_animation self, mlt_animation_item item );
56 /* Remove the key at the specified position */
57 extern int mlt_animation_remove( mlt_animation self, int position );
58 /* Typically, re-interpolate after a series of insertions or removals. */
59 extern void mlt_animation_interpolate( mlt_animation self );
60 /* Get the key at the position or the next following */
61 extern int mlt_animation_next_key( mlt_animation self, mlt_animation_item item, int position );
62 extern int mlt_animation_prev_key( mlt_animation self, mlt_animation_item item, int position );
63 /* Serialize the current animation. */
64 extern char *mlt_animation_serialize_cut( mlt_animation self, int in, int out );
65 extern char *mlt_animation_serialize( mlt_animation self );
66 /* Close and destrory the animation. */
67 extern void mlt_animation_close( mlt_animation self );
68
69 #endif
70