]> git.sesse.net Git - mlt/blob - src/framework/mlt_animation.h
a0bb06292e1e625c0ba7ab6d695e1bea01e4c1e7
[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 typedef enum {
29         mlt_keyframe_discrete,
30         mlt_keyframe_linear
31 } mlt_keyframe_type;
32
33 struct mlt_animation_item_s
34 {
35         int is_key; /**< = whether this is a key frame or an interpolated item */
36         int frame; /**< The actual frame this corresponds to */
37         mlt_property property;
38         mlt_keyframe_type keyframe_type;
39 };
40 typedef struct mlt_animation_item_s *mlt_animation_item;
41
42 struct mlt_animation_s;
43 typedef struct mlt_animation_s *mlt_animation;
44
45 /* Create a new animation object. */
46 extern mlt_animation mlt_animation_new( );
47 /* Parse the geometry specification for a given duration and range */
48 extern int mlt_animation_parse(mlt_animation self, const char *data, int length, double fps, locale_t locale );
49 /* Conditionally refresh the animation if it's modified */
50 extern int mlt_animation_refresh( mlt_animation self, const char *data, int length );
51 /* Get and set the length */
52 extern int mlt_animation_get_length( mlt_animation self );
53 extern void mlt_animation_set_length( mlt_animation self, int length );
54 /* Parse an item - doesn't affect the animation itself but uses current information for evaluation */
55 /* (item->frame should be specified if not included in the data itself) */
56 extern int mlt_animation_parse_item( mlt_animation self, mlt_animation_item item, const char *data );
57 /* Fetch an animation item for an absolute position */
58 extern int mlt_animation_get_item( mlt_animation self, mlt_animation_item item, int position );
59 /* Specify an animation item at an absolute position */
60 extern int mlt_animation_insert( mlt_animation self, mlt_animation_item item );
61 /* Remove the key at the specified position */
62 extern int mlt_animation_remove( mlt_animation self, int position );
63 /* Typically, re-interpolate after a series of insertions or removals. */
64 extern void mlt_animation_interpolate( mlt_animation self );
65 /* Get the key at the position or the next following */
66 extern int mlt_animation_next_key( mlt_animation self, mlt_animation_item item, int position );
67 extern int mlt_animation_prev_key( mlt_animation self, mlt_animation_item item, int position );
68 /* Serialize the current animation. */
69 extern char *mlt_animation_serialize_cut( mlt_animation self, int in, int out );
70 extern char *mlt_animation_serialize( mlt_animation self );
71 /* Close and destrory the animation. */
72 extern void mlt_animation_close( mlt_animation self );
73
74 #endif
75