From 30da6add4dfaeea81255d3d141a18e61f9a4a978 Mon Sep 17 00:00:00 2001 From: ddennedy Date: Thu, 7 Feb 2008 06:02:34 +0000 Subject: [PATCH] Mlt.h, MltFactory.{h,cpp}, MltRepository.{h,cpp}, swig/mltpp.i: update to deal with changes and new capabilities in mlt_factory and mlt_repository. git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++@1060 d19143bc-622f-0410-bfdd-b5b2a6649095 --- mlt++/src/Makefile | 1 + mlt++/src/Mlt.h | 1 + mlt++/src/MltFactory.cpp | 5 ++- mlt++/src/MltFactory.h | 4 ++- mlt++/src/MltRepository.cpp | 50 +++++++++++++++++++++++++++++++++++++++++++ mlt++/src/MltRepository.h | 50 +++++++++++++++++++++++++++++++++++++++++++ mlt++/swig/mltpp.i | 2 + 7 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 mlt++/src/MltRepository.cpp create mode 100644 mlt++/src/MltRepository.h diff --git a/mlt++/src/Makefile b/mlt++/src/Makefile index 9dc09c6..ee020d0 100644 --- a/mlt++/src/Makefile +++ b/mlt++/src/Makefile @@ -28,6 +28,7 @@ OBJS = MltConsumer.o \ MltProfile.o \ MltProperties.o \ MltPushConsumer.o \ + MltRepository.o \ MltResponse.o \ MltService.o \ MltTokeniser.o \ diff --git a/mlt++/src/Mlt.h b/mlt++/src/Mlt.h index 0a8e4e8..4dab95a 100644 --- a/mlt++/src/Mlt.h +++ b/mlt++/src/Mlt.h @@ -40,6 +40,7 @@ #include "MltProfile.h" #include "MltProperties.h" #include "MltPushConsumer.h" +#include "MltRepository.h" #ifndef WIN32 #include "MltResponse.h" #endif diff --git a/mlt++/src/MltFactory.cpp b/mlt++/src/MltFactory.cpp index 38a4200..d5815a4 100644 --- a/mlt++/src/MltFactory.cpp +++ b/mlt++/src/MltFactory.cpp @@ -24,11 +24,12 @@ #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( ) diff --git a/mlt++/src/MltFactory.h b/mlt++/src/MltFactory.h index db4cfa9..aeec588 100644 --- a/mlt++/src/MltFactory.h +++ b/mlt++/src/MltFactory.h @@ -1,6 +1,7 @@ /** * MltFactory.h - MLT Wrapper * Copyright (C) 2004-2005 Charles Yates + * Copyright (C) 2008 Dan Dennedy * Author: Charles Yates * * 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 index 0000000..a9d1d54 --- /dev/null +++ b/mlt++/src/MltRepository.cpp @@ -0,0 +1,50 @@ +/** + * MltRepository.cpp - MLT Wrapper + * Copyright (C) 2008 Dan Dennedy + * + * 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 index 0000000..b5ef957 --- /dev/null +++ b/mlt++/src/MltRepository.h @@ -0,0 +1,50 @@ +/** + * MltRepository.h - MLT Wrapper + * Copyright (C) 2008 Dan Dennedy + * + * 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 + +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 diff --git a/mlt++/swig/mltpp.i b/mlt++/swig/mltpp.i index e456af8..1d6d0a8 100644 --- a/mlt++/swig/mltpp.i +++ b/mlt++/swig/mltpp.i @@ -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 %include %include +%include %include %include %include -- 1.7.4.4