X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=mlt%2B%2B%2Fsrc%2FMltFilter.cpp;h=90a178e175066ac6022870097e73d2b069f948d2;hb=e79ce902489eae87b8511a157e8b9c055e34b5b3;hp=3c51114a45bfc6a2fd6c26afe6dbae63596b7013;hpb=01116637238e74419971afc26311c7a65b7b43aa;p=melted diff --git a/mlt++/src/MltFilter.cpp b/mlt++/src/MltFilter.cpp index 3c51114..90a178e 100644 --- a/mlt++/src/MltFilter.cpp +++ b/mlt++/src/MltFilter.cpp @@ -18,32 +18,60 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include +#include #include "MltFilter.h" using namespace Mlt; -Filter::Filter( char *id, char *service ) : - destroy( true ), +Filter::Filter( char *id, char *arg ) : instance( NULL ) { - instance = mlt_factory_filter( id, service ); + if ( arg != NULL ) + { + instance = mlt_factory_filter( id, arg ); + } + else + { + if ( strchr( id, ':' ) ) + { + char *temp = strdup( id ); + char *arg = strchr( temp, ':' ) + 1; + *( arg - 1 ) = '\0'; + instance = mlt_factory_filter( temp, arg ); + free( temp ); + } + else + { + instance = mlt_factory_filter( 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 ), 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 +89,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( ) ); } @@ -81,4 +109,3 @@ int Filter::get_track( ) return mlt_filter_get_track( get_filter( ) ); } -