From 0f6ab868f4253de21c81a9ba5a83efa598974ced Mon Sep 17 00:00:00 2001 From: lilo_booter Date: Fri, 13 Feb 2004 17:18:19 +0000 Subject: [PATCH] Properties rename and dump function git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@146 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/framework/mlt_consumer.c | 14 ++++++++------ src/framework/mlt_properties.c | 38 ++++++++++++++++++++++++++++++++++++++ src/framework/mlt_properties.h | 3 +++ 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/src/framework/mlt_consumer.c b/src/framework/mlt_consumer.c index f0e21e3..67578e6 100644 --- a/src/framework/mlt_consumer.c +++ b/src/framework/mlt_consumer.c @@ -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; } diff --git a/src/framework/mlt_properties.c b/src/framework/mlt_properties.c index 970fbd4..e1e6453 100644 --- a/src/framework/mlt_properties.c +++ b/src/framework/mlt_properties.c @@ -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. */ diff --git a/src/framework/mlt_properties.h b/src/framework/mlt_properties.h index 1527f38..139bcf7 100644 --- a/src/framework/mlt_properties.h +++ b/src/framework/mlt_properties.h @@ -22,6 +22,7 @@ #define _MLT_PROPERTIES_H_ #include "mlt_types.h" +#include /** 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 -- 1.7.4.4