Mlt.h, MltFactory.{h,cpp}, MltRepository.{h,cpp}, swig/mltpp.i: update to deal with...
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Thu, 7 Feb 2008 06:02:34 +0000 (06:02 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Thu, 7 Feb 2008 06:02:34 +0000 (06:02 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++@1060 d19143bc-622f-0410-bfdd-b5b2a6649095

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

index 9dc09c6..ee020d0 100644 (file)
@@ -28,6 +28,7 @@ OBJS = MltConsumer.o \
           MltProfile.o \
           MltProperties.o \
           MltPushConsumer.o \
+          MltRepository.o \
           MltResponse.o \
           MltService.o \
           MltTokeniser.o \
index 0a8e4e8..4dab95a 100644 (file)
@@ -40,6 +40,7 @@
 #include "MltProfile.h"
 #include "MltProperties.h"
 #include "MltPushConsumer.h"
+#include "MltRepository.h"
 #ifndef WIN32
 #include "MltResponse.h"
 #endif
index 38a4200..d5815a4 100644 (file)
 #include "MltFilter.h"
 #include "MltTransition.h"
 #include "MltConsumer.h"
+#include "MltRepository.h"
 using namespace Mlt;
 
-int Factory::init( char *arg )
+Repository *Factory::init( const char *directory )
 {
-       return mlt_factory_init( arg );
+       return new Repository( mlt_factory_init( directory ) );
 }
 
 Properties *Factory::event_object( )
index db4cfa9..aeec588 100644 (file)
@@ -1,6 +1,7 @@
 /**
  * MltFactory.h - MLT Wrapper
  * Copyright (C) 2004-2005 Charles Yates
+ * Copyright (C) 2008 Dan Dennedy <dan@dennedy.org>
  * Author: Charles Yates <charles.yates@pandora.be>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -37,11 +38,12 @@ namespace Mlt
        class Transition;
        class Consumer;
        class Profile;
+       class Repository;
 
        class MLTPP_DECLSPEC Factory
        {
                public:
-                       static int init( char *arg = NULL );
+                       static Repository *init( const char *directory = NULL );
                        static Properties *event_object( );
                        static Producer *producer( Profile& profile, char *id, char *arg = NULL );
                        static Filter *filter( Profile& profile, char *id, char *arg = NULL );
diff --git a/mlt++/src/MltRepository.cpp b/mlt++/src/MltRepository.cpp
new file mode 100644 (file)
index 0000000..a9d1d54
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * MltRepository.cpp - MLT Wrapper
+ * Copyright (C) 2008 Dan Dennedy <dan@dennedy.org>
+ *
+ * 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 "MltRepository.h"
+#include "MltProfile.h"
+using namespace Mlt;
+
+Repository::Repository( const char* directory ) :
+       instance( NULL )
+{
+       instance = mlt_repository_init( directory );
+}
+
+Repository::Repository( mlt_repository repository ) :
+       instance( repository )
+{
+}
+
+Repository::~Repository( )
+{
+       if ( instance )
+               mlt_repository_close( instance );
+       instance = NULL;
+}
+
+void Repository::register_service( mlt_service_type service_type, const char *service, void *symbol )
+{
+       mlt_repository_register( instance, service_type, service, symbol );
+}
+
+void *Repository::create( Profile& profile, mlt_service_type type, const char *service, void *arg )
+{
+       return mlt_repository_create( instance, profile.get_profile(), type, service, arg );
+}
diff --git a/mlt++/src/MltRepository.h b/mlt++/src/MltRepository.h
new file mode 100644 (file)
index 0000000..b5ef957
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * MltRepository.h - MLT Wrapper
+ * Copyright (C) 2008 Dan Dennedy <dan@dennedy.org>
+ *
+ * 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_REPOSITORY_H_
+#define _MLTPP_REPOSITORY_H_
+
+#include "config.h"
+
+#ifdef SWIG
+#define MLTPP_DECLSPEC
+#endif
+
+#include <framework/mlt.h>
+
+namespace Mlt
+{
+       class Profile;
+
+       class MLTPP_DECLSPEC Repository
+       {
+               private:
+                       mlt_repository instance;
+                       Repository( ) { }
+               public:
+                       Repository( const char* directory );
+                       Repository( mlt_repository repository );
+                       ~Repository();
+
+                       void register_service( mlt_service_type service_type, const char *service, void *symbol );
+                       void *create( Profile& profile, mlt_service_type type, const char *service, void *arg );
+       };
+}
+
+#endif
index e456af8..1d6d0a8 100644 (file)
@@ -30,6 +30,7 @@
  */
 
 namespace Mlt {
+%newobject Factory::init( const char * );
 %newobject Factory::producer( Profile &, char *, char * );
 %newobject Factory::filter( Profile &, char *, char * );
 %newobject Factory::transition( Profile &, char *, char * );
@@ -60,6 +61,7 @@ namespace Mlt {
 %include <framework/mlt_types.h>
 %include <framework/mlt_factory.h>
 %include <MltFactory.h>
+%include <MltRepository.h>
 %include <MltEvent.h>
 %include <MltProperties.h>
 %include <MltFrame.h>