Geometry
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 24 Dec 2004 10:09:20 +0000 (10:09 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 24 Dec 2004 10:09:20 +0000 (10:09 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++@573 d19143bc-622f-0410-bfdd-b5b2a6649095

mlt++/src/Makefile
mlt++/src/Mlt.h
mlt++/src/MltGeometry.cpp [new file with mode: 0644]
mlt++/src/MltGeometry.h [new file with mode: 0644]
mlt++/swig/mltpp.i

index b4fca73..33ebef3 100644 (file)
@@ -13,6 +13,7 @@ OBJS = MltConsumer.o \
           MltFilter.o \
           MltFilteredConsumer.o \
           MltFrame.o \
+          MltGeometry.o \
           MltMiracle.o \
           MltMultitrack.o \
           MltParser.o \
index aa34ca8..b30a8ad 100644 (file)
@@ -29,6 +29,7 @@
 #include "MltFilter.h"
 #include "MltFilteredConsumer.h"
 #include "MltFrame.h"
+#include "MltGeometry.h"
 #include "MltMiracle.h"
 #include "MltMultitrack.h"
 #include "MltParser.h"
diff --git a/mlt++/src/MltGeometry.cpp b/mlt++/src/MltGeometry.cpp
new file mode 100644 (file)
index 0000000..1a85c55
--- /dev/null
@@ -0,0 +1,90 @@
+/**
+ * MltGeometry.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <stdlib.h>
+#include "MltGeometry.h"
+using namespace Mlt;
+
+Geometry::Geometry( char *data, int length, int nw, int nh )
+{
+       geometry = mlt_geometry_init( );
+       parse( data, length, nw, nh );
+}
+
+Geometry::~Geometry( )
+{
+       mlt_geometry_close( geometry );
+}
+
+int Geometry::parse( char *data, int length, int nw, int nh )
+{
+       return mlt_geometry_parse( geometry, data, length, nw, nh );
+}
+
+// Fetch a geometry item for an absolute position
+int Geometry::fetch( GeometryItem &item, float position )
+{
+       return mlt_geometry_fetch( geometry, item.get_item( ), position );
+}
+
+int Geometry::fetch( GeometryItem *item, float position )
+{
+       return mlt_geometry_fetch( geometry, item->get_item( ), position );
+}
+
+// Specify a geometry item at an absolute position
+int Geometry::insert( GeometryItem &item )
+{
+       return mlt_geometry_insert( geometry, item.get_item( ) );
+}
+
+int Geometry::insert( GeometryItem *item )
+{
+       return mlt_geometry_insert( geometry, item->get_item( ) );
+}
+
+// Remove the key at the specified position
+int Geometry::remove( int position )
+{
+       return mlt_geometry_remove( geometry, position );
+}
+
+// Get the key at the position or the next following
+int Geometry::key( GeometryItem &item, int position )
+{
+       return mlt_geometry_key( geometry, item.get_item( ), position );
+}
+
+int Geometry::key( GeometryItem *item, int position )
+{
+       return mlt_geometry_key( geometry, item->get_item( ), position );
+}
+
+// Serialise the current geometry
+char *Geometry::serialise( int in, int out )
+{
+       return mlt_geometry_serialise_cut( geometry, in, out );
+}
+
+char *Geometry::serialise( )
+{
+       return mlt_geometry_serialise( geometry );
+}
+
diff --git a/mlt++/src/MltGeometry.h b/mlt++/src/MltGeometry.h
new file mode 100644 (file)
index 0000000..d383f23
--- /dev/null
@@ -0,0 +1,76 @@
+/**
+ * MltGeometry.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_GEOMETRY_H
+#define _MLTPP_GEOMETRY_H
+
+#include <framework/mlt.h>
+
+namespace Mlt
+{
+       // Just for consistent naming purposes
+       class GeometryItem 
+       {
+               private:
+                       struct mlt_geometry_item_s item;
+               public:
+                       mlt_geometry_item get_item( ) { return &item; }
+                       bool key( ) { return item.key; }
+                       int frame( ) { return item.frame; }
+                       void frame( int value ) { item.frame = value; }
+                       float x( ) { return item.x; }
+                       void x( float value ) { item.x = value; }
+                       float y( ) { return item.y; }
+                       void y( float value ) { item.y = value; }
+                       float w( ) { return item.w; }
+                       void w( float value ) { item.w = value; }
+                       float h( ) { return item.h; }
+                       void h( float value ) { item.h = value; }
+                       float mix( ) { return item.mix; }
+                       void mix( float value ) { item.mix = value; }
+       };
+
+       class Geometry
+       {
+               private:
+                       mlt_geometry geometry;
+               public:
+                       Geometry( char *data = NULL, int length = 0, int nw = -1, int nh = -1 );
+                       ~Geometry( );
+                       int parse( char *data, int length, int nw = -1, int nh = -1 );
+                       // Fetch a geometry item for an absolute position
+                       int fetch( GeometryItem &item, float position );
+                       int fetch( GeometryItem *item, float position );
+                       // Specify a geometry item at an absolute position
+                       int insert( GeometryItem &item );
+                       int insert( GeometryItem *item );
+                       // Remove the key at the specified position
+                       int remove( int position );
+                       // Get the key at the position or the next following
+                       int key( GeometryItem &item, int position );
+                       int key( GeometryItem *item, int position );
+                       // Serialise the current geometry
+                       char *serialise( int in, int out );
+                       char *serialise( );
+       };
+}
+
+#endif
+
index 5249eb5..85bc6b5 100644 (file)
@@ -62,6 +62,7 @@ namespace Mlt {
 %include <MltEvent.h>
 %include <MltProperties.h>
 %include <MltFrame.h>
+%include <MltGeometry.h>
 %include <MltService.h>
 %include <MltProducer.h>
 %include <MltPlaylist.h>