X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=mlt%2B%2B%2Fsrc%2FMltFilter.cpp;h=ad79fcf063c7f558d54a798cf62f0297225b19c8;hb=c1dda4b336a041cef7ad422a9dffc4705c7128fa;hp=afb3916a54f479e801192407aaabcaa602a53dfd;hpb=1e779c37ceeceadaeb9733966d6cdda6a5b11358;p=melted diff --git a/mlt++/src/MltFilter.cpp b/mlt++/src/MltFilter.cpp index afb3916..ad79fcf 100644 --- a/mlt++/src/MltFilter.cpp +++ b/mlt++/src/MltFilter.cpp @@ -18,32 +18,62 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include +#include #include "MltFilter.h" +#include "MltProfile.h" using namespace Mlt; -Filter::Filter( char *id, char *service ) : - destroy( true ), +Filter::Filter( Profile& profile, char *id, char *arg ) : instance( NULL ) { - instance = mlt_factory_filter( id, service ); + if ( arg != NULL ) + { + instance = mlt_factory_filter( profile.get_profile(), id, arg ); + } + else + { + if ( strchr( id, ':' ) ) + { + char *temp = strdup( id ); + char *arg = strchr( temp, ':' ) + 1; + *( arg - 1 ) = '\0'; + instance = mlt_factory_filter( profile.get_profile(), temp, arg ); + free( temp ); + } + else + { + instance = mlt_factory_filter( profile.get_profile(), id, NULL ); + } + } +} + +Filter::Filter( Service &filter ) : + instance( NULL ) +{ + if ( filter.type( ) == filter_type ) + { + instance = ( mlt_filter )filter.get_service( ); + inc_ref( ); + } } Filter::Filter( Filter &filter ) : - destroy( false ), + Mlt::Service( filter ), instance( filter.get_filter( ) ) { + inc_ref( ); } Filter::Filter( mlt_filter filter ) : - destroy( false ), instance( filter ) { + inc_ref( ); } Filter::~Filter( ) { - if ( destroy ) - mlt_filter_close( instance ); + mlt_filter_close( instance ); } mlt_filter Filter::get_filter( )