Fix up warnings about explicit base initializers in copy constructors
[melted] / mlt++ / src / MltFilter.cpp
index 9fa0439..ad79fcf 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include "MltFilter.h"
+#include "MltProfile.h"
 using namespace Mlt;
 
-Filter::Filter( char *id, char *arg ) :
-       destroy( true ),
+Filter::Filter( Profile& profile, char *id, char *arg ) :
        instance( NULL )
 {
        if ( arg != NULL )
        {
-               instance = mlt_factory_filter( id, arg );
+               instance = mlt_factory_filter( profile.get_profile(), id, arg );
        }
        else
        {
@@ -38,32 +38,42 @@ Filter::Filter( char *id, char *arg ) :
                        char *temp = strdup( id );
                        char *arg = strchr( temp, ':' ) + 1;
                        *( arg - 1 ) = '\0';
-                       instance = mlt_factory_filter( temp, arg );
+                       instance = mlt_factory_filter( profile.get_profile(), temp, arg );
                        free( temp );
                }
                else
                {
-                       instance = mlt_factory_filter( id, NULL );
+                       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( )