Initial revision
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sun, 15 Aug 2004 18:26:07 +0000 (18:26 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sun, 15 Aug 2004 18:26:07 +0000 (18:26 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++@360 d19143bc-622f-0410-bfdd-b5b2a6649095

21 files changed:
mlt++/src/Makefile [new file with mode: 0644]
mlt++/src/MltConsumer.cpp [new file with mode: 0644]
mlt++/src/MltConsumer.h [new file with mode: 0644]
mlt++/src/MltFactory.cpp [new file with mode: 0644]
mlt++/src/MltFactory.h [new file with mode: 0644]
mlt++/src/MltFilter.cpp [new file with mode: 0644]
mlt++/src/MltFilter.h [new file with mode: 0644]
mlt++/src/MltFrame.cpp [new file with mode: 0644]
mlt++/src/MltFrame.h [new file with mode: 0644]
mlt++/src/MltPlaylist.cpp [new file with mode: 0644]
mlt++/src/MltPlaylist.h [new file with mode: 0644]
mlt++/src/MltProducer.cpp [new file with mode: 0644]
mlt++/src/MltProducer.h [new file with mode: 0644]
mlt++/src/MltProperties.cpp [new file with mode: 0644]
mlt++/src/MltProperties.h [new file with mode: 0644]
mlt++/src/MltService.cpp [new file with mode: 0644]
mlt++/src/MltService.h [new file with mode: 0644]
mlt++/src/MltTransition.cpp [new file with mode: 0644]
mlt++/src/MltTransition.h [new file with mode: 0644]
mlt++/test/Makefile [new file with mode: 0644]
mlt++/test/play.cpp [new file with mode: 0644]

diff --git a/mlt++/src/Makefile b/mlt++/src/Makefile
new file mode 100644 (file)
index 0000000..a52bde9
--- /dev/null
@@ -0,0 +1,35 @@
+prefix = /usr/local
+CXXFLAGS = -Wall -pthread `mlt-config --cflags`
+LDFLAGS = `mlt-config --libs`
+INSTALL = install
+
+TARGET = libmlt++.so
+
+OBJS = MltConsumer.o \
+          MltFactory.o \
+          MltFilter.o \
+          MltFrame.o \
+          MltPlaylist.o \
+          MltProducer.o \
+          MltProperties.o \
+          MltService.o \
+          MltTransition.o
+
+SRCS = $(OBJS:.o=.cpp)
+
+HEADERS = $(OBJS:.o=.h)
+
+CC=g++
+
+all:           $(TARGET)
+
+$(TARGET):     $(OBJS)
+       $(CC) -shared -o $@ $(OBJS) $(LDFLAGS)
+
+clean:
+       $(RM) $(OBJS) $(TARGET)
+
+install:
+       $(INSTALL) -m 755 $(TARGET) $(prefix)/lib
+       $(INSTALL) -d "$(prefix)/include/mlt++"
+       $(INSTALL) -m 644 $(HEADERS) "$(prefix)/include/mlt++"
diff --git a/mlt++/src/MltConsumer.cpp b/mlt++/src/MltConsumer.cpp
new file mode 100644 (file)
index 0000000..4db0bcf
--- /dev/null
@@ -0,0 +1,78 @@
+/**
+ * MltConsumer.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 "MltConsumer.h"
+using namespace Mlt;
+
+mlt_service Consumer::get_service( )
+{
+       return mlt_consumer_service( get_consumer( ) );
+}
+
+int Consumer::connect( Service &service )
+{
+       return mlt_consumer_connect( get_consumer( ), service.get_service( ) );
+}
+
+int Consumer::start( )
+{
+       return mlt_consumer_start( get_consumer( ) );
+}
+
+int Consumer::stop( )
+{
+       return mlt_consumer_stop( get_consumer( ) );
+}
+
+int Consumer::is_stopped( )
+{
+       return mlt_consumer_is_stopped( get_consumer( ) );
+}
+
+mlt_consumer ConsumerInstance::get_consumer( )
+{
+       return instance;
+}
+
+ConsumerInstance::ConsumerInstance( char *id, char *service ) :
+       destroy( true ),
+       instance( NULL )
+{
+       instance = mlt_factory_consumer( id, service );
+}
+
+ConsumerInstance::ConsumerInstance( Consumer &consumer ) :
+       destroy( false ),
+       instance( consumer.get_consumer( ) )
+{
+}
+
+ConsumerInstance::ConsumerInstance( mlt_consumer consumer ) :
+       destroy( false ),
+       instance( consumer )
+{
+}
+
+ConsumerInstance::~ConsumerInstance( )
+{
+       if ( destroy )
+               mlt_consumer_close( instance );
+}
+
diff --git a/mlt++/src/MltConsumer.h b/mlt++/src/MltConsumer.h
new file mode 100644 (file)
index 0000000..37af2eb
--- /dev/null
@@ -0,0 +1,55 @@
+/**
+ * MltConsumer.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_CONSUMER_H_
+#define _MLTPP_CONSUMER_H_
+
+#include <framework/mlt.h>
+
+#include "MltService.h"
+
+namespace Mlt
+{
+       class Consumer : public Service
+       {
+               public:
+                       virtual mlt_consumer get_consumer( ) = 0;
+                       mlt_service get_service( );
+                       int connect( Service &service );
+                       int start( );
+                       int stop( );
+                       int is_stopped( );
+       };
+
+       class ConsumerInstance : public Consumer
+       {
+               private:
+                       bool destroy;
+                       mlt_consumer instance;
+               public:
+                       mlt_consumer get_consumer( );
+                       ConsumerInstance( char *id, char *service = NULL );
+                       ConsumerInstance( Consumer &consumer );
+                       ConsumerInstance( mlt_consumer consumer );
+                       virtual ~ConsumerInstance( );
+       };
+}
+
+#endif
diff --git a/mlt++/src/MltFactory.cpp b/mlt++/src/MltFactory.cpp
new file mode 100644 (file)
index 0000000..d3fcc9e
--- /dev/null
@@ -0,0 +1,54 @@
+/**
+ * MltFactory.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 "MltFactory.h"
+using namespace Mlt;
+
+int Factory::init( char *arg )
+{
+       return mlt_factory_init( arg );
+}
+
+Producer *Factory::producer( char *id, char *arg )
+{
+       return new ProducerInstance( id, arg );
+}
+
+Filter *Factory::filter( char *id, char *arg )
+{
+       return new FilterInstance( id, arg );
+}
+
+Transition *Factory::transition( char *id, char *arg )
+{
+       return new TransitionInstance( id, arg );
+}
+
+Consumer *Factory::consumer( char *id, char *arg )
+{
+       return new ConsumerInstance( id, arg );
+}
+
+void Factory::close( )
+{
+       mlt_factory_close( );
+}
+
+
diff --git a/mlt++/src/MltFactory.h b/mlt++/src/MltFactory.h
new file mode 100644 (file)
index 0000000..0be3cb9
--- /dev/null
@@ -0,0 +1,44 @@
+/**
+ * MltFactory.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_FACTORY_H_
+#define _MLTPP_FACTORY_H_
+
+#include <framework/mlt.h>
+#include "MltProducer.h"
+#include "MltFilter.h"
+#include "MltTransition.h"
+#include "MltConsumer.h"
+
+namespace Mlt
+{
+       class Factory
+       {
+               public:
+                       static int init( char *arg = NULL );
+                       static Producer *producer( char *id, char *arg = NULL );
+                       static Filter *filter( char *id, char *arg = NULL );
+                       static Transition *transition( char *id, char *arg = NULL );
+                       static Consumer *consumer( char *id, char *arg = NULL );
+                       static void close( );
+       };
+}
+
+#endif
diff --git a/mlt++/src/MltFilter.cpp b/mlt++/src/MltFilter.cpp
new file mode 100644 (file)
index 0000000..7bb7968
--- /dev/null
@@ -0,0 +1,83 @@
+/**
+ * MltFilter.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 "MltFilter.h"
+using namespace Mlt;
+
+mlt_service Filter::get_service( )
+{
+       return mlt_filter_service( get_filter( ) );
+}
+
+int Filter::connect( Service &service, int index )
+{
+       return mlt_filter_connect( get_filter( ), service.get_service( ), index );
+}
+
+void Filter::set_in_and_out( mlt_position in, mlt_position out )
+{
+       mlt_filter_set_in_and_out( get_filter( ), in, out );
+}
+
+mlt_position Filter::get_in( )
+{
+       return mlt_filter_get_in( get_filter( ) );
+}
+
+mlt_position Filter::get_out( )
+{
+       return mlt_filter_get_out( get_filter( ) );
+}
+
+int Filter::get_track( )
+{
+       return mlt_filter_get_track( get_filter( ) );
+}
+
+mlt_filter FilterInstance::get_filter( )
+{
+       return instance;
+}
+
+FilterInstance::FilterInstance( char *id, char *service ) :
+       destroy( true ),
+       instance( NULL )
+{
+       instance = mlt_factory_filter( id, service );
+}
+
+FilterInstance::FilterInstance( Filter &filter ) :
+       destroy( false ),
+       instance( filter.get_filter( ) )
+{
+}
+
+FilterInstance::FilterInstance( mlt_filter filter ) :
+       destroy( false ),
+       instance( filter )
+{
+}
+
+FilterInstance::~FilterInstance( )
+{
+       if ( destroy )
+               mlt_filter_close( instance );
+}
+
diff --git a/mlt++/src/MltFilter.h b/mlt++/src/MltFilter.h
new file mode 100644 (file)
index 0000000..79ae989
--- /dev/null
@@ -0,0 +1,56 @@
+/**
+ * MltFilter.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_FILTER_H_
+#define _MLTPP_FILTER_H_
+
+#include <framework/mlt.h>
+
+#include "MltService.h"
+
+namespace Mlt
+{
+       class Filter : public Service
+       {
+               public:
+                       virtual mlt_filter get_filter( ) = 0;
+                       mlt_service get_service( );
+                       int connect( Service &service, int index = 0 );
+                       void set_in_and_out( mlt_position in, mlt_position out );
+                       mlt_position get_in( );
+                       mlt_position get_out( );
+                       int get_track( );
+       };
+
+       class FilterInstance : public Filter
+       {
+               private:
+                       bool destroy;
+                       mlt_filter instance;
+               public:
+                       mlt_filter get_filter( );
+                       FilterInstance( char *id, char *service = NULL );
+                       FilterInstance( Filter &filter );
+                       FilterInstance( mlt_filter filter );
+                       virtual ~FilterInstance( );
+       };
+}
+
+#endif
diff --git a/mlt++/src/MltFrame.cpp b/mlt++/src/MltFrame.cpp
new file mode 100644 (file)
index 0000000..af0302b
--- /dev/null
@@ -0,0 +1,66 @@
+/**
+ * MltFrame.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 "MltFrame.h"
+using namespace Mlt;
+
+mlt_properties Frame::get_properties( )
+{
+       return mlt_frame_properties( get_frame( ) );
+}
+
+uint8_t *Frame::get_image( mlt_image_format &format, int &w, int &h, int writable )
+{
+       uint8_t *image = NULL;
+       mlt_frame_get_image( get_frame( ), &image, &format, &w, &h, writable );
+       return image;
+}
+
+int16_t *Frame::get_audio( mlt_audio_format &format, int &frequency, int &channels, int &samples )
+{
+       int16_t *audio = NULL;
+       mlt_frame_get_audio( get_frame( ), &audio, &format, &frequency, &channels, &samples );
+       return audio;
+}
+
+mlt_frame FrameInstance::get_frame( )
+{
+       return instance;
+}
+
+FrameInstance::FrameInstance( mlt_frame frame ) :
+       destroy( true ),
+       instance( frame )
+{
+}
+
+FrameInstance::FrameInstance( Frame &frame ) :
+       destroy( false ),
+       instance( frame.get_frame( ) )
+{
+}
+
+FrameInstance::~FrameInstance( )
+{
+       if ( destroy )
+               mlt_frame_close( instance );
+}
+
+
diff --git a/mlt++/src/MltFrame.h b/mlt++/src/MltFrame.h
new file mode 100644 (file)
index 0000000..0b057a5
--- /dev/null
@@ -0,0 +1,51 @@
+/**
+ * MltFilter.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_FRAME_H_
+#define _MLTPP_FRAME_H_
+
+#include <framework/mlt.h>
+#include "MltProperties.h"
+
+namespace Mlt
+{
+       class Frame : public Properties
+       {
+               public:
+                       virtual mlt_frame get_frame( ) = 0;
+                       mlt_properties get_properties( );
+                       uint8_t *get_image( mlt_image_format &format, int &w, int &h, int writable = 0 );
+                       int16_t *get_audio( mlt_audio_format &format, int &frequency, int &channels, int &samples );
+       };
+       
+       class FrameInstance : public Frame
+       {
+               private:
+                       bool destroy;
+                       mlt_frame instance;
+               public:
+                       mlt_frame get_frame( );
+                       FrameInstance( mlt_frame frame );
+                       FrameInstance( Frame &frame );
+                       virtual ~FrameInstance( );
+       };
+}
+
+#endif
diff --git a/mlt++/src/MltPlaylist.cpp b/mlt++/src/MltPlaylist.cpp
new file mode 100644 (file)
index 0000000..1e3a1cd
--- /dev/null
@@ -0,0 +1,78 @@
+/**
+ * MltPlaylist.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 "MltPlaylist.h"
+using namespace Mlt;
+
+mlt_producer Playlist::get_producer( )
+{
+       return mlt_playlist_producer( get_playlist( ) );
+}
+
+int Playlist::count( )
+{
+       return mlt_playlist_count( get_playlist( ) );
+}
+
+int Playlist::clear( )
+{
+       return mlt_playlist_clear( get_playlist( ) );
+}
+
+int Playlist::append( Producer &producer, mlt_position in, mlt_position out )
+{
+       return mlt_playlist_append_io( get_playlist( ), producer.get_producer( ), in, out );
+}
+
+int Playlist::blank( mlt_position length )
+{
+       return mlt_playlist_blank( get_playlist( ), length );
+}
+
+mlt_playlist PlaylistInstance::get_playlist( )
+{
+       return instance;
+}
+
+PlaylistInstance::PlaylistInstance( ) :
+       destroy( true ),
+       instance( NULL )
+{
+       instance = mlt_playlist_init( );
+}
+
+PlaylistInstance::PlaylistInstance( Playlist &playlist ) :
+       destroy( false ),
+       instance( playlist.get_playlist( ) )
+{
+}
+
+PlaylistInstance::PlaylistInstance( mlt_playlist playlist ) :
+       destroy( false ),
+       instance( playlist )
+{
+}
+
+PlaylistInstance::~PlaylistInstance( )
+{
+       if ( destroy )
+               mlt_playlist_close( instance );
+}
+
diff --git a/mlt++/src/MltPlaylist.h b/mlt++/src/MltPlaylist.h
new file mode 100644 (file)
index 0000000..1326ca7
--- /dev/null
@@ -0,0 +1,55 @@
+/**
+ * MltPlaylist.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_PLAYLIST_H_
+#define _MLTPP_PLAYLIST_H_
+
+#include <framework/mlt.h>
+
+#include "MltProducer.h"
+
+namespace Mlt
+{
+       class Playlist : public Producer
+       {
+               public:
+                       virtual mlt_playlist get_playlist( ) = 0;
+                       mlt_producer get_producer( );
+                       int count( );
+                       int clear( );
+                       int append( Producer &producer, mlt_position in = -1, mlt_position out = -1 );
+                       int blank( mlt_position length );
+       };
+       
+       class PlaylistInstance : public Playlist
+       {
+               private:
+                       bool destroy;
+                       mlt_playlist instance;
+               public:
+                       mlt_playlist get_playlist( );
+                       PlaylistInstance( );
+                       PlaylistInstance( Playlist &playlist );
+                       PlaylistInstance( mlt_playlist playlist );
+                       virtual ~PlaylistInstance( );
+       };
+}
+
+#endif
diff --git a/mlt++/src/MltProducer.cpp b/mlt++/src/MltProducer.cpp
new file mode 100644 (file)
index 0000000..c0bfa49
--- /dev/null
@@ -0,0 +1,116 @@
+/**
+ * MltProducer.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 "MltProducer.h"
+using namespace Mlt;
+
+mlt_service Producer::get_service( )
+{
+       return mlt_producer_service( get_producer( ) );
+}
+       
+int Producer::seek( mlt_position position )
+{
+       return mlt_producer_seek( get_producer( ), position );
+}
+
+mlt_position Producer::position( )
+{
+       return mlt_producer_position( get_producer( ) );
+}
+
+mlt_position Producer::frame( )
+{
+       return mlt_producer_frame( get_producer( ) );
+}
+
+int Producer::set_speed( double speed )
+{
+       return mlt_producer_set_speed( get_producer( ), speed );
+}
+
+double Producer::get_speed( )
+{
+       return mlt_producer_get_speed( get_producer( ) );
+}
+
+double Producer::get_fps( )
+{
+       return mlt_producer_get_fps( get_producer( ) );
+}
+
+int Producer::set_in_and_out( mlt_position in, mlt_position out )
+{
+       return mlt_producer_set_in_and_out( get_producer( ), in, out );
+}
+
+mlt_position Producer::get_in( )
+{
+       return mlt_producer_get_in( get_producer( ) );
+}
+
+mlt_position Producer::get_out( )
+{
+       return mlt_producer_get_out( get_producer( ) );
+}
+
+mlt_position Producer::get_length( )
+{
+       return mlt_producer_get_length( get_producer( ) );
+}
+
+mlt_position Producer::get_playtime( )
+{
+       return mlt_producer_get_playtime( get_producer( ) );
+}
+
+mlt_producer ProducerInstance::get_producer( )
+{
+       return instance;
+}
+
+ProducerInstance::ProducerInstance( char *id, char *service ) :
+       destroy( true ),
+       instance( NULL )
+{
+       if ( id != NULL && service != NULL )
+               instance = mlt_factory_producer( id, service );
+       else
+               instance = mlt_factory_producer( "fezzik", id != NULL ? id : service );
+}
+
+ProducerInstance::ProducerInstance( mlt_producer producer ) :
+       destroy( false ),
+       instance( producer )
+{
+}
+
+ProducerInstance::ProducerInstance( Producer &producer ) :
+       destroy( false ),
+       instance( producer.get_producer( ) )
+{
+}
+
+ProducerInstance::~ProducerInstance( )
+{
+       if ( destroy )
+               mlt_producer_close( instance );
+}
+
diff --git a/mlt++/src/MltProducer.h b/mlt++/src/MltProducer.h
new file mode 100644 (file)
index 0000000..2973f3f
--- /dev/null
@@ -0,0 +1,62 @@
+/**
+ * MltProducer.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_PRODUCER_H_
+#define _MLTPP_PRODUCER_H_
+
+#include <framework/mlt.h>
+
+#include "MltService.h"
+
+namespace Mlt
+{
+       class Producer : public Service
+       {
+               public:
+                       virtual mlt_producer get_producer( ) = 0;
+                       mlt_service get_service( );
+                       int seek( mlt_position position );
+                       mlt_position position( );
+                       mlt_position frame( );
+                       int set_speed( double speed );
+                       double get_speed( );
+                       double get_fps( );
+                       int set_in_and_out( mlt_position in, mlt_position out );
+                       mlt_position get_in( );
+                       mlt_position get_out( );
+                       mlt_position get_length( );
+                       mlt_position get_playtime( );
+       };
+       
+       class ProducerInstance : public Producer
+       {
+               private:
+                       bool destroy;
+                       mlt_producer instance;
+               public:
+                       mlt_producer get_producer( );
+                       ProducerInstance( char *id, char *service = NULL );
+                       ProducerInstance( mlt_producer producer );
+                       ProducerInstance( Producer &producer );
+                       virtual ~ProducerInstance( );
+       };
+}
+
+#endif
diff --git a/mlt++/src/MltProperties.cpp b/mlt++/src/MltProperties.cpp
new file mode 100644 (file)
index 0000000..72dcba3
--- /dev/null
@@ -0,0 +1,99 @@
+/**
+ * MltProperties.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 "MltProperties.h"
+using namespace Mlt;
+
+PropertiesInstance::PropertiesInstance( ) :
+       destroy( true ),
+       instance( NULL )
+{
+       instance = mlt_properties_new( );
+}
+
+PropertiesInstance::PropertiesInstance( Properties &properties ) :
+       destroy( false ),
+       instance( properties.get_properties( ) )
+{
+}
+
+PropertiesInstance::PropertiesInstance( mlt_properties properties ) :
+       destroy( false ),
+       instance( properties )
+{
+}
+
+PropertiesInstance::~PropertiesInstance( )
+{
+       if ( destroy )
+               mlt_properties_close( instance );
+}
+
+int Properties::count( )
+{
+       return mlt_properties_count( get_properties( ) );
+}
+
+char *Properties::get( char *name )
+{
+       return mlt_properties_get( get_properties( ), name );
+}
+
+int Properties::get_int( char *name )
+{
+       return mlt_properties_get_int( get_properties( ), name );
+}
+
+double Properties::get_double( char *name )
+{
+       return mlt_properties_get_double( get_properties( ), name );
+}
+
+void *Properties::get_data( char *name, int &size )
+{
+       return mlt_properties_get_data( get_properties( ), name, &size );
+}
+
+int Properties::set( char *name, char *value )
+{
+       return mlt_properties_set( get_properties( ), name, value );
+}
+
+int Properties::set( char *name, int value )
+{
+       return mlt_properties_set_int( get_properties( ), name, value );
+}
+
+int Properties::set( char *name, double value )
+{
+       return mlt_properties_set_double( get_properties( ), name, value );
+}
+
+int Properties::set( char *name, void *value, int size, mlt_destructor destructor, mlt_serialiser serialiser )
+{
+       return mlt_properties_set_data( get_properties( ), name, value, size, destructor, serialiser );
+}
+
+mlt_properties PropertiesInstance::get_properties( )
+{
+       return instance;
+}
+
+
diff --git a/mlt++/src/MltProperties.h b/mlt++/src/MltProperties.h
new file mode 100644 (file)
index 0000000..c9429c1
--- /dev/null
@@ -0,0 +1,63 @@
+/**
+ * MltProperties.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_PROPERTIES_H_
+#define _MLTPP_PROPERTIES_H_
+
+#include <framework/mlt.h>
+
+namespace Mlt 
+{
+       /** Abstract Properties class.
+        */
+
+       class Properties 
+       {
+               public:
+                       virtual mlt_properties get_properties( ) = 0;
+                       int count( );
+                       char *get( char *name );
+                       int get_int( char *name );
+                       double get_double( char *name );
+                       void *get_data( char *name, int &size );
+                       int set( char *name, char *value );
+                       int set( char *name, int value );
+                       int set( char *name, double value );
+                       int set( char *name, void *value, int size, mlt_destructor destroy = NULL, mlt_serialiser serial = NULL );
+       };
+       
+       /** Instance class.
+        */
+       
+       class PropertiesInstance : public Properties
+       {
+               private:
+                       bool destroy;
+                       mlt_properties instance;
+               public:
+                       mlt_properties get_properties( );
+                       PropertiesInstance( );
+                       PropertiesInstance( Properties &properties );
+                       PropertiesInstance( mlt_properties properties );
+                       virtual ~PropertiesInstance( );
+       };
+}
+
+#endif
diff --git a/mlt++/src/MltService.cpp b/mlt++/src/MltService.cpp
new file mode 100644 (file)
index 0000000..b836bea
--- /dev/null
@@ -0,0 +1,65 @@
+/**
+ * MltService.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 "MltService.h"
+using namespace Mlt;
+
+mlt_properties Service::get_properties( )
+{
+       return mlt_service_properties( get_service( ) );
+}
+
+int Service::connect_producer( Service &producer, int index )
+{
+       return mlt_service_connect_producer( get_service( ), producer.get_service( ), index );
+}
+
+Service *Service::producer( )
+{
+       return new ServiceInstance( mlt_service_producer( get_service( ) ) );
+}
+
+Service *Service::consumer( )
+{
+       return new ServiceInstance( mlt_service_consumer( get_service( ) ) );
+}
+
+Frame *Service::get_frame( int index )
+{
+       mlt_frame frame = NULL;
+       mlt_service_get_frame( get_service( ), &frame, index );
+       return new FrameInstance( frame );
+}
+
+mlt_service ServiceInstance::get_service( )
+{
+       return instance;
+}
+
+ServiceInstance::ServiceInstance( Service &service ) :
+       instance( service.get_service( ) )
+{
+}
+
+ServiceInstance::ServiceInstance( mlt_service service ) :
+       instance( service )
+{
+}
+
diff --git a/mlt++/src/MltService.h b/mlt++/src/MltService.h
new file mode 100644 (file)
index 0000000..7e1b4d4
--- /dev/null
@@ -0,0 +1,53 @@
+/**
+ * MltService.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_SERVICE_H_
+#define _MLTPP_SERVICE_H_
+
+#include <framework/mlt.h>
+
+#include "MltProperties.h"
+#include "MltFrame.h"
+
+namespace Mlt
+{
+       class Service : public Properties
+       {
+               public:
+                       virtual mlt_service get_service( ) = 0;
+                       mlt_properties get_properties( );
+                       int connect_producer( Service &producer, int index = 0 );
+                       Service *consumer( );
+                       Service *producer( );
+                       Frame *get_frame( int index = 0 );
+       };
+       
+       class ServiceInstance : public Service
+       {
+               private:
+                       mlt_service instance;
+               public:
+                       mlt_service get_service( );
+                       ServiceInstance( Service &service );
+                       ServiceInstance( mlt_service service );
+       };
+}
+
+#endif
diff --git a/mlt++/src/MltTransition.cpp b/mlt++/src/MltTransition.cpp
new file mode 100644 (file)
index 0000000..544d8e2
--- /dev/null
@@ -0,0 +1,59 @@
+/**
+ * MltTransition.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 "MltTransition.h"
+using namespace Mlt;
+
+mlt_service Transition::get_service( )
+{
+       return mlt_transition_service( get_transition( ) );
+}
+
+mlt_transition TransitionInstance::get_transition( )
+{
+       return instance;
+}
+
+TransitionInstance::TransitionInstance( char *id, char *arg ) :
+       destroy( true ),
+       instance( NULL )
+{
+       instance = mlt_factory_transition( id, arg );
+}
+
+TransitionInstance::TransitionInstance( Transition &transition ) :
+       destroy( false ),
+       instance( transition.get_transition( ) )
+{
+}
+
+TransitionInstance::TransitionInstance( mlt_transition transition ) :
+       destroy( false ),
+       instance( transition )
+{
+}
+
+TransitionInstance::~TransitionInstance( )
+{
+       if ( destroy )
+               mlt_transition_close( instance );
+}
+
+
diff --git a/mlt++/src/MltTransition.h b/mlt++/src/MltTransition.h
new file mode 100644 (file)
index 0000000..3244fbc
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * MltTransition.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_TRANSITION_H_
+#define _MLTPP_TRANSITION_H_
+
+#include <framework/mlt.h>
+#include "MltService.h"
+
+namespace Mlt
+{
+       class Transition : public Service
+       {
+               public:
+                       virtual mlt_transition get_transition( ) = 0;
+                       mlt_service get_service( );
+       };
+       
+       class TransitionInstance : public Transition
+       {
+               private:
+                       bool destroy;
+                       mlt_transition instance;
+               public:
+                       mlt_transition get_transition( );
+                       TransitionInstance( char *id, char *arg = NULL );
+                       TransitionInstance( Transition &transition );
+                       TransitionInstance( mlt_transition transition );
+                       virtual ~TransitionInstance( );
+       };
+}
+
+#endif
diff --git a/mlt++/test/Makefile b/mlt++/test/Makefile
new file mode 100644 (file)
index 0000000..58d48b6
--- /dev/null
@@ -0,0 +1,8 @@
+CXXFLAGS=-Wall `mlt-config --cflags`
+LDFLAGS=-lmlt++
+CC=c++
+
+play:  play.o
+
+play.o:        play.cpp
+
diff --git a/mlt++/test/play.cpp b/mlt++/test/play.cpp
new file mode 100644 (file)
index 0000000..4f08026
--- /dev/null
@@ -0,0 +1,31 @@
+
+#include <iostream>
+#include <string>
+using namespace std;
+
+#include <mlt++/MltFactory.h>
+using namespace Mlt;
+
+#include <time.h>
+
+int main( int argc, char **argv )
+{
+       Factory::init( NULL );
+       Consumer *consumer = Factory::consumer( "sdl" );
+       consumer->set( "rescale", "none" );
+       Producer *producer = Factory::producer( argv[ 1 ] );
+       Filter *filter = Factory::filter( "greyscale" );
+       filter->connect( *producer );
+       consumer->connect( *filter );
+       consumer->start( );
+       while ( !consumer->is_stopped( ) )
+       {
+               struct timespec tm = { 1, 0 };
+               nanosleep( &tm, NULL );
+       }
+       consumer->stop( );
+       delete consumer;
+       delete producer;
+       delete filter;
+       return 0;
+}