2 * MltGeometry.cpp - MLT Wrapper
3 * Copyright (C) 2004-2005 Charles Yates
4 * Author: Charles Yates <charles.yates@pandora.be>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program 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
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include "MltGeometry.h"
25 Geometry::Geometry( char *data, int length, int nw, int nh )
27 geometry = mlt_geometry_init( );
28 parse( data, length, nw, nh );
31 Geometry::~Geometry( )
33 mlt_geometry_close( geometry );
36 int Geometry::parse( char *data, int length, int nw, int nh )
38 return mlt_geometry_parse( geometry, data, length, nw, nh );
41 // Fetch a geometry item for an absolute position
42 int Geometry::fetch( GeometryItem &item, float position )
44 return mlt_geometry_fetch( geometry, item.get_item( ), position );
47 int Geometry::fetch( GeometryItem *item, float position )
49 return mlt_geometry_fetch( geometry, item->get_item( ), position );
52 // Specify a geometry item at an absolute position
53 int Geometry::insert( GeometryItem &item )
55 return mlt_geometry_insert( geometry, item.get_item( ) );
58 int Geometry::insert( GeometryItem *item )
60 return mlt_geometry_insert( geometry, item->get_item( ) );
63 // Remove the key at the specified position
64 int Geometry::remove( int position )
66 return mlt_geometry_remove( geometry, position );
69 // Get the key at the position or the next following
70 int Geometry::next_key( GeometryItem &item, int position )
72 return mlt_geometry_next_key( geometry, item.get_item( ), position );
75 int Geometry::next_key( GeometryItem *item, int position )
77 return mlt_geometry_next_key( geometry, item->get_item( ), position );
80 int Geometry::prev_key( GeometryItem &item, int position )
82 return mlt_geometry_prev_key( geometry, item.get_item( ), position );
85 int Geometry::prev_key( GeometryItem *item, int position )
87 return mlt_geometry_prev_key( geometry, item->get_item( ), position );
90 // Serialise the current geometry
91 char *Geometry::serialise( int in, int out )
93 return mlt_geometry_serialise_cut( geometry, in, out );
96 char *Geometry::serialise( )
98 return mlt_geometry_serialise( geometry );