/** Memory leak checks.
*/
-#define _MLT_PROPERTY_CHECKS_
+//#define _MLT_PROPERTY_CHECKS_ 2
#ifdef _MLT_PROPERTY_CHECKS_
static int properties_created = 0;
{
// Temp string
char temp[ 1024 ];
+ char last[ 1024 ] = "";
// Read each string from the file
while( fgets( temp, 1024, file ) )
// Chomp the string
temp[ strlen( temp ) - 1 ] = '\0';
+ // Check if the line starts with a .
+ if ( temp[ 0 ] == '.' )
+ {
+ char temp2[ 1024 ];
+ sprintf( temp2, "%s%s", last, temp );
+ strcpy( temp, temp2 );
+ }
+ else if ( strchr( temp, '=' ) )
+ {
+ strcpy( last, temp );
+ *( strchr( last, '=' ) ) = '\0';
+ }
+
// Parse and set the property
if ( strcmp( temp, "" ) && temp[ 0 ] != '#' )
mlt_properties_parse( this, temp );
return 0;
}
+/** Return the ref count of this object.
+*/
+
+int mlt_properties_ref_count( mlt_properties this )
+{
+ if ( this != NULL )
+ {
+ property_list *list = this->local;
+ return list->ref_count;
+ }
+ return 0;
+}
+
/** Allow the specification of a mirror.
*/
void mlt_properties_debug( mlt_properties this, char *title, FILE *output )
{
- fprintf( stderr, "%s: ", title );
+ fprintf( output, "%s: ", title );
if ( this != NULL )
{
property_list *list = this->local;
for ( i = 0; i < list->count; i ++ )
if ( mlt_properties_get( this, list->name[ i ] ) != NULL )
fprintf( output, ", %s=%s", list->name[ i ], mlt_properties_get( this, list->name[ i ] ) );
+ else
+ fprintf( output, ", %s=%p", list->name[ i ], mlt_properties_get_data( this, list->name[ i ], NULL ) );
fprintf( output, " ]" );
}
- fprintf( stderr, "\n" );
+ fprintf( output, "\n" );
}
/** Close the list.
property_list *list = this->local;
int index = 0;
-#ifdef _MLT_PROPERTY_CHECKS_
+#if _MLT_PROPERTY_CHECKS_ == 1
// Show debug info
mlt_properties_debug( this, "Closing", stderr );
+#endif
+#ifdef _MLT_PROPERTY_CHECKS_
// Increment destroyed count
properties_destroyed ++;