* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include <stdlib.h>
+#include <string.h>
#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( )
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( ) );
}