Mlt Ref Counts and Playlist split/join
[melted] / mlt++ / src / MltProperties.cpp
index 40d7081..121ca15 100644 (file)
 using namespace Mlt;
 
 Properties::Properties( ) :
-       destroy( true ),
        instance( NULL )
 {
        instance = mlt_properties_new( );
 }
 
+Properties::Properties( bool dummy ) :
+       instance( NULL )
+{
+}
+
 Properties::Properties( Properties &properties ) :
-       destroy( false ),
        instance( properties.get_properties( ) )
 {
+       fprintf( stderr, "Incrementing ref count on properties #1\n" );
+       inc_ref( );
 }
 
 Properties::Properties( mlt_properties properties ) :
-       destroy( false ),
        instance( properties )
 {
+       fprintf( stderr, "Incrementing ref count on properties #2\n" );
+       inc_ref( );
 }
 
 Properties::Properties( char *file ) :
-       destroy( true ),
        instance( NULL )
 {
        instance = mlt_properties_load( file );
@@ -49,8 +54,7 @@ Properties::Properties( char *file ) :
 
 Properties::~Properties( )
 {
-       if ( destroy )
-               mlt_properties_close( instance );
+       mlt_properties_close( instance );
 }
 
 mlt_properties Properties::get_properties( )
@@ -58,6 +62,16 @@ mlt_properties Properties::get_properties( )
        return instance;
 }
 
+int Properties::inc_ref( )
+{
+       return mlt_properties_inc_ref( get_properties( ) );
+}
+
+int Properties::dec_ref( )
+{
+       return mlt_properties_dec_ref( get_properties( ) );
+}
+
 bool Properties::is_valid( )
 {
        return get_properties( ) != NULL;
@@ -153,6 +167,11 @@ void Properties::dump( FILE *output )
        mlt_properties_dump( get_properties( ), output );
 }
 
+void Properties::debug( char *title, FILE *output )
+{
+       mlt_properties_debug( get_properties( ), title, output );
+}
+
 int Properties::save( char *file )
 {
        int error = 0;