X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=mlt%2B%2B%2Fsrc%2FMltFilter.cpp;h=6fbc93a3ce313b6adaa8cb7158488e8d4e484b62;hb=7494c523c06d7a54da55075f40a71643cc700712;hp=3c7536fee6935f1207978d0367965107443e2896;hpb=b61d43804b15c0ddf8a3579cdcd2146105d9be26;p=melted diff --git a/mlt++/src/MltFilter.cpp b/mlt++/src/MltFilter.cpp index 3c7536f..6fbc93a 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, const char *id, const 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( ) @@ -61,17 +91,17 @@ 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 ) +void Filter::set_in_and_out( int in, int out ) { mlt_filter_set_in_and_out( get_filter( ), in, out ); } -mlt_position Filter::get_in( ) +int Filter::get_in( ) { return mlt_filter_get_in( get_filter( ) ); } -mlt_position Filter::get_out( ) +int Filter::get_out( ) { return mlt_filter_get_out( get_filter( ) ); }