]> git.sesse.net Git - mlt/commitdiff
Properties rename and dump function
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 13 Feb 2004 17:18:19 +0000 (17:18 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 13 Feb 2004 17:18:19 +0000 (17:18 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@146 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_consumer.c
src/framework/mlt_properties.c
src/framework/mlt_properties.h

index f0e21e338071d1751d1204e8c968e78d0cb8e2bb..67578e6feda62dba530190a154386896fbd4971d 100644 (file)
@@ -162,8 +162,16 @@ mlt_frame mlt_consumer_get_frame( mlt_consumer this )
 
 int mlt_consumer_stop( mlt_consumer this )
 {
+       // Get the properies
+       mlt_properties properties = mlt_consumer_properties( this );
+
+       // Stop the consumer
        if ( this->stop != NULL )
                return this->stop( this );
+
+       // Kill the test card
+       mlt_properties_set_data( properties, "test_card_producer", NULL, 0, NULL, NULL );
+
        return 0;
 }
 
@@ -172,16 +180,10 @@ int mlt_consumer_stop( mlt_consumer this )
 
 int mlt_consumer_is_stopped( mlt_consumer this )
 {
-       // Get the properies
-       mlt_properties properties = mlt_consumer_properties( this );
-
        // Stop the consumer
        if ( this->is_stopped != NULL )
                return this->is_stopped( this );
 
-       // Kill the test card
-       mlt_properties_set_data( properties, "test_card_producer", NULL, 0, NULL, NULL );
-
        return 0;
 }
 
index 970fbd4a02bab11f28ee6e42441779641f7f7b9a..e1e6453968bec63d35eab80b139410897fd62efa 100644 (file)
@@ -373,6 +373,44 @@ int mlt_properties_set_data( mlt_properties this, char *name, void *value, int l
        return error;
 }
 
+/** Rename a property.
+*/
+
+int mlt_properties_rename( mlt_properties this, char *source, char *dest )
+{
+       mlt_property value = mlt_properties_find( this, dest );
+
+       if ( value == NULL )
+       {
+               property_list *list = this->private;
+               int i = 0;
+
+               // Locate the item 
+               for ( i = 0; i < list->count; i ++ )
+               {
+                       if ( !strcmp( list->name[ i ], source ) )
+                       {
+                               free( list->name[ i ] );
+                               list->name[ i ] = strdup( dest );
+                               break;
+                       }
+               }
+       }
+
+       return value != NULL;
+}
+
+/** Dump the properties.
+*/
+
+void mlt_properties_dump( mlt_properties this, FILE *output )
+{
+       property_list *list = this->private;
+       int i = 0;
+       for ( i = 0; i < list->count; i ++ )
+               fprintf( stderr, "%s = %s\n", list->name[ i ], mlt_properties_get( this, list->name[ i ] ) );
+}
+
 /** Close the list.
 */
 
index 1527f3887818e6e132ee08f5ccc7470f1bfc6833..139bcf7290980f09ffb1af1098be2ce4247a8031 100644 (file)
@@ -22,6 +22,7 @@
 #define _MLT_PROPERTIES_H_
 
 #include "mlt_types.h"
+#include <stdio.h>
 
 /** The properties base class defines the basic property propagation and
        handling.
@@ -53,7 +54,9 @@ extern mlt_position mlt_properties_get_position( mlt_properties this, char *name
 extern int mlt_properties_set_position( mlt_properties this, char *name, mlt_position value );
 extern int mlt_properties_set_data( mlt_properties this, char *name, void *value, int length, mlt_destructor, mlt_serialiser );
 extern void *mlt_properties_get_data( mlt_properties this, char *name, int *length );
+extern int mlt_properties_rename( mlt_properties this, char *source, char *dest );
 extern int mlt_properties_count( mlt_properties this );
+extern void mlt_properties_dump( mlt_properties this, FILE *output );
 extern void mlt_properties_close( mlt_properties this );
 
 #endif