]> git.sesse.net Git - mlt/blob - src/mlt++/MltGeometry.cpp
Add mlt_geometry_interpolate.
[mlt] / src / mlt++ / MltGeometry.cpp
1 /**
2  * MltGeometry.cpp - MLT Wrapper
3  * Copyright (C) 2004-2005 Charles Yates
4  * Author: Charles Yates <charles.yates@pandora.be>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include <stdlib.h>
22 #include "MltGeometry.h"
23 using namespace Mlt;
24
25 Geometry::Geometry( char *data, int length, int nw, int nh )
26 {
27         geometry = mlt_geometry_init( );
28         parse( data, length, nw, nh );
29 }
30
31 Geometry::~Geometry( )
32 {
33         mlt_geometry_close( geometry );
34 }
35
36 int Geometry::parse( char *data, int length, int nw, int nh )
37 {
38         return mlt_geometry_parse( geometry, data, length, nw, nh );
39 }
40
41 // Fetch a geometry item for an absolute position
42 int Geometry::fetch( GeometryItem &item, float position )
43 {
44         return mlt_geometry_fetch( geometry, item.get_item( ), position );
45 }
46
47 int Geometry::fetch( GeometryItem *item, float position )
48 {
49         return mlt_geometry_fetch( geometry, item->get_item( ), position );
50 }
51
52 // Specify a geometry item at an absolute position
53 int Geometry::insert( GeometryItem &item )
54 {
55         return mlt_geometry_insert( geometry, item.get_item( ) );
56 }
57
58 int Geometry::insert( GeometryItem *item )
59 {
60         return mlt_geometry_insert( geometry, item->get_item( ) );
61 }
62
63 // Remove the key at the specified position
64 int Geometry::remove( int position )
65 {
66         return mlt_geometry_remove( geometry, position );
67 }
68
69 void Geometry::interpolate( )
70 {
71         mlt_geometry_interpolate( geometry );
72 }
73
74 // Get the key at the position or the next following
75 int Geometry::next_key( GeometryItem &item, int position )
76 {
77         return mlt_geometry_next_key( geometry, item.get_item( ), position );
78 }
79
80 int Geometry::next_key( GeometryItem *item, int position )
81 {
82         return mlt_geometry_next_key( geometry, item->get_item( ), position );
83 }
84
85 int Geometry::prev_key( GeometryItem &item, int position )
86 {
87         return mlt_geometry_prev_key( geometry, item.get_item( ), position );
88 }
89
90 int Geometry::prev_key( GeometryItem *item, int position )
91 {
92         return mlt_geometry_prev_key( geometry, item->get_item( ), position );
93 }
94
95 // Serialise the current geometry
96 char *Geometry::serialise( int in, int out )
97 {
98         return mlt_geometry_serialise_cut( geometry, in, out );
99 }
100
101 char *Geometry::serialise( )
102 {
103         return mlt_geometry_serialise( geometry );
104 }
105