From: lilo_booter Date: Thu, 25 Nov 2004 13:48:13 +0000 (+0000) Subject: Deque added; simplified producer parent access; transition in and out X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=8433613ca206628beb6f5868d8eab73780fc1faa;p=melted Deque added; simplified producer parent access; transition in and out git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++@537 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/mlt++/src/Makefile b/mlt++/src/Makefile index a04ea5a..b4fca73 100644 --- a/mlt++/src/Makefile +++ b/mlt++/src/Makefile @@ -6,6 +6,7 @@ INSTALL = install TARGET = libmlt++.so OBJS = MltConsumer.o \ + MltDeque.o \ MltEvent.o \ MltFactory.o \ MltField.o \ diff --git a/mlt++/src/Mlt.h b/mlt++/src/Mlt.h index 0b76913..aa34ca8 100644 --- a/mlt++/src/Mlt.h +++ b/mlt++/src/Mlt.h @@ -22,6 +22,7 @@ #define _MLTPP_H_ #include "MltConsumer.h" +#include "MltDeque.h" #include "MltEvent.h" #include "MltFactory.h" #include "MltField.h" diff --git a/mlt++/src/MltDeque.cpp b/mlt++/src/MltDeque.cpp new file mode 100644 index 0000000..8cd70e0 --- /dev/null +++ b/mlt++/src/MltDeque.cpp @@ -0,0 +1,68 @@ +/** + * MltDeque.cpp - MLT Wrapper + * Copyright (C) 2004-2005 Charles Yates + * Author: Charles Yates + * + * 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 "MltDeque.h" +using namespace Mlt; + +Deque::Deque( ) +{ + deque = mlt_deque_init( ); +} + +Deque::~Deque( ) +{ + mlt_deque_close( deque ); +} + +int Deque::count( ) +{ + return mlt_deque_count( deque ); +} + +int Deque::push_back( void *item ) +{ + return mlt_deque_push_back( deque, item ); +} + +void *Deque::pop_back( ) +{ + return mlt_deque_pop_back( deque ); +} + +int Deque::push_front( void *item ) +{ + return mlt_deque_push_front( deque, item ); +} + +void *Deque::pop_front( ) +{ + return mlt_deque_pop_front( deque ); +} + +void *Deque::peek_back( ) +{ + return mlt_deque_peek_back( deque ); +} + +void *Deque::peek_front( ) +{ + return mlt_deque_peek_front( deque ); +} + diff --git a/mlt++/src/MltDeque.h b/mlt++/src/MltDeque.h new file mode 100644 index 0000000..5323fd6 --- /dev/null +++ b/mlt++/src/MltDeque.h @@ -0,0 +1,45 @@ +/** + * MltDeque.h - MLT Wrapper + * Copyright (C) 2004-2005 Charles Yates + * Author: Charles Yates + * + * 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_DEQUE_H +#define _MLTPP_DEQUE_H + +#include + +namespace Mlt +{ + class Deque + { + private: + mlt_deque deque; + public: + Deque( ); + ~Deque( ); + int count( ); + int push_back( void *item ); + void *pop_back( ); + int push_front( void *item ); + void *pop_front( ); + void *peek_back( ); + void *peek_front( ); + }; +} + +#endif diff --git a/mlt++/src/MltFactory.cpp b/mlt++/src/MltFactory.cpp index e52f49a..51aa7f9 100644 --- a/mlt++/src/MltFactory.cpp +++ b/mlt++/src/MltFactory.cpp @@ -30,6 +30,11 @@ int Factory::init( char *arg ) return mlt_factory_init( arg ); } +Properties *Factory::event_object( ) +{ + return new Properties( mlt_factory_event_object( ) ); +} + Producer *Factory::producer( char *id, char *arg ) { return new Producer( id, arg ); diff --git a/mlt++/src/MltFactory.h b/mlt++/src/MltFactory.h index fe70c81..0128698 100644 --- a/mlt++/src/MltFactory.h +++ b/mlt++/src/MltFactory.h @@ -25,6 +25,7 @@ namespace Mlt { + class Properties; class Producer; class Filter; class Transition; @@ -34,6 +35,7 @@ namespace Mlt { public: static int init( char *arg = NULL ); + static Properties *event_object( ); static Producer *producer( char *id, char *arg = NULL ); static Filter *filter( char *id, char *arg = NULL ); static Transition *transition( char *id, char *arg = NULL ); diff --git a/mlt++/src/MltProducer.cpp b/mlt++/src/MltProducer.cpp index 54473e7..3a58819 100644 --- a/mlt++/src/MltProducer.cpp +++ b/mlt++/src/MltProducer.cpp @@ -23,12 +23,14 @@ using namespace Mlt; Producer::Producer( ) : - instance( NULL ) + instance( NULL ), + parent_( NULL ) { } Producer::Producer( char *id, char *service ) : - instance( NULL ) + instance( NULL ), + parent_( NULL ) { if ( id != NULL && service != NULL ) instance = mlt_factory_producer( id, service ); @@ -37,7 +39,8 @@ Producer::Producer( char *id, char *service ) : } Producer::Producer( Service &producer ) : - instance( NULL ) + instance( NULL ), + parent_( NULL ) { mlt_service_type type = producer.type( ); if ( type == producer_type || type == playlist_type || @@ -49,19 +52,22 @@ Producer::Producer( Service &producer ) : } Producer::Producer( mlt_producer producer ) : - instance( producer ) + instance( producer ), + parent_( NULL ) { inc_ref( ); } Producer::Producer( Producer &producer ) : - instance( producer.get_producer( ) ) + instance( producer.get_producer( ) ), + parent_( NULL ) { inc_ref( ); } Producer::Producer( Producer *producer ) : - instance( producer != NULL ? producer->get_producer( ) : NULL ) + instance( producer != NULL ? producer->get_producer( ) : NULL ), + parent_( NULL ) { if ( is_valid( ) ) inc_ref( ); @@ -69,6 +75,7 @@ Producer::Producer( Producer *producer ) : Producer::~Producer( ) { + delete parent_; mlt_producer_close( instance ); instance = NULL; } @@ -83,6 +90,13 @@ mlt_producer Producer::get_parent( ) return get_producer( ) != NULL && mlt_producer_cut_parent( get_producer( ) ) != NULL ? mlt_producer_cut_parent( get_producer( ) ) : get_producer( ); } +Producer &Producer::parent( ) +{ + if ( is_cut( ) && parent_ == NULL ) + parent_ = new Producer( get_parent( ) ); + return parent_ == NULL ? *this : *parent_; +} + mlt_service Producer::get_service( ) { return mlt_producer_service( get_producer( ) ); diff --git a/mlt++/src/MltProducer.h b/mlt++/src/MltProducer.h index d75cf72..81b4dad 100644 --- a/mlt++/src/MltProducer.h +++ b/mlt++/src/MltProducer.h @@ -34,6 +34,7 @@ namespace Mlt { private: mlt_producer instance; + Producer *parent_; public: Producer( ); Producer( char *id, char *service = NULL ); @@ -43,6 +44,7 @@ namespace Mlt Producer( Producer *producer ); virtual ~Producer( ); virtual mlt_producer get_producer( ); + Producer &parent( ); mlt_producer get_parent( ); mlt_service get_service( ); int seek( int position ); diff --git a/mlt++/src/MltTransition.cpp b/mlt++/src/MltTransition.cpp index e26feba..5a18c8e 100644 --- a/mlt++/src/MltTransition.cpp +++ b/mlt++/src/MltTransition.cpp @@ -84,3 +84,7 @@ mlt_service Transition::get_service( ) return mlt_transition_service( get_transition( ) ); } +void Transition::set_in_and_out( int in, int out ) +{ + mlt_transition_set_in_and_out( get_transition( ), in, out ); +} diff --git a/mlt++/src/MltTransition.h b/mlt++/src/MltTransition.h index dbf61bd..1ef8486 100644 --- a/mlt++/src/MltTransition.h +++ b/mlt++/src/MltTransition.h @@ -40,6 +40,7 @@ namespace Mlt virtual ~Transition( ); virtual mlt_transition get_transition( ); mlt_service get_service( ); + void set_in_and_out( int in, int out ); }; }