]> git.sesse.net Git - mlt/commitdiff
add support for app-supplied properties objects on multi consumer
authorDan Dennedy <dan@dennedy.org>
Sun, 20 Nov 2011 01:39:13 +0000 (17:39 -0800)
committerDan Dennedy <dan@dennedy.org>
Sun, 20 Nov 2011 01:39:13 +0000 (17:39 -0800)
src/modules/core/consumer_multi.c

index 86e17d08d73e9c8916113e65591075a285b9af6a..7b5cc707e1d2e7690bfde912857c6c163af85c43 100644 (file)
@@ -166,13 +166,27 @@ static void foreach_consumer_init( mlt_consumer consumer )
 {
        const char *resource = mlt_properties_get( MLT_CONSUMER_PROPERTIES(consumer), "resource" );
        mlt_properties properties = mlt_properties_parse_yaml( resource );
+       char key[20];
+       int index = 0;
+
+       if ( mlt_properties_get_data( MLT_CONSUMER_PROPERTIES(consumer), "0", NULL ) )
+       {
+               // Properties set directly by application
+               mlt_properties p;
 
-       if ( properties && mlt_properties_get_data( properties, "0", NULL ) )
+               if ( properties )
+                       mlt_properties_close( properties );
+               properties = MLT_CONSUMER_PROPERTIES(consumer);
+               do {
+                       snprintf( key, sizeof(key), "%d", index );
+                       if ( ( p = mlt_properties_get_data( properties, key, NULL ) ) )
+                               generate_consumer( consumer, p, index++ );
+               } while ( p );
+       }
+       else if ( properties && mlt_properties_get_data( properties, "0", NULL ) )
        {
                // YAML file supplied
-               mlt_properties p = NULL;
-               char key[20];
-               int index = 0;
+               mlt_properties p;
 
                do {
                        snprintf( key, sizeof(key), "%d", index );
@@ -184,9 +198,7 @@ static void foreach_consumer_init( mlt_consumer consumer )
        else
        {
                // properties file supplied or properties on this consumer
-               const char *s = NULL;
-               char key[20];
-               int index = 0;
+               const char *s;
 
                if ( properties )
                        mlt_properties_close( properties );