// Allow thread to be started/stopped
this->start = consumer_start;
+ mlt_properties_set( mlt_consumer_properties( this ), "resource", arg );
+
// Return the consumer produced
return this;
}
// Enumerate the properties
for ( i = 0; i < mlt_properties_count( properties ); i++ )
{
+ if ( mlt_properties_get_value( properties, i ) != NULL )
+ {
#if 0
- p = xmlNewChild( node, NULL, "prop", NULL );
+ p = xmlNewChild( node, NULL, "prop", NULL );
#else
- p = node;
+ p = node;
#endif
- xmlNewProp( p, mlt_properties_get_name( properties, i ), mlt_properties_get_value( properties, i ) );
+ xmlNewProp( p, mlt_properties_get_name( properties, i ), mlt_properties_get_value( properties, i ) );
+ }
}
}
-static xmlNode* serialise_service( serialise_context context, mlt_service service, xmlNode *node )
+static void serialise_service( serialise_context context, mlt_service service, xmlNode *node )
{
int i;
xmlNode *child = node;
child = xmlNewChild( node, NULL, "producer", NULL );
// Set the id
- if ( mlt_properties_get( properties, "id" ) != NULL )
- xmlNewProp( child, "id", mlt_properties_get( properties, "mlt_service" ) );
- else
+ if ( mlt_properties_get( properties, "id" ) == NULL )
{
snprintf( id, 30, "producer%d", context->producer_count++ );
xmlNewProp( child, "id", id );
}
- //xmlNewProp( child, "type", mlt_properties_get( properties, "mlt_service" ) );
- //xmlNewProp( child, "src", mlt_properties_get( properties, "resource" ) );
serialise_properties( properties, child );
}
child = xmlNewChild( node, NULL, "multitrack", NULL );
// Set the id
- if ( mlt_properties_get( properties, "id" ) != NULL )
- xmlNewProp( child, "id", mlt_properties_get( properties, "mlt_service" ) );
- else
+ if ( mlt_properties_get( properties, "id" ) == NULL )
{
snprintf( id, 30, "multitrack%d", context->multitrack_count++ );
xmlNewProp( child, "id", id );
child = xmlNewChild( node, NULL, "playlist", NULL );
// Set the id
- if ( mlt_properties_get( properties, "id" ) != NULL )
- xmlNewProp( child, "id", mlt_properties_get( properties, "mlt_service" ) );
- else
+ if ( mlt_properties_get( properties, "id" ) == NULL )
{
snprintf( id, 30, "playlist%d", context->playlist_count++ );
xmlNewProp( child, "id", id );
char length[ 20 ];
length[ 19 ] = '\0';
xmlNode *entry = xmlNewChild( child, NULL, "blank", NULL );
- snprintf( length, 19, "%lld", info.length );
+ snprintf( length, 19, "%lld", info.frame_count );
xmlNewProp( entry, "length", length );
}
else
child = xmlNewChild( node, NULL, "tractor", NULL );
// Set the id
- if ( mlt_properties_get( properties, "id" ) != NULL )
- xmlNewProp( child, "id", mlt_properties_get( properties, "mlt_service" ) );
- else
+ if ( mlt_properties_get( properties, "id" ) == NULL )
{
snprintf( id, 30, "tractor%d", context->tractor_count++ );
xmlNewProp( child, "id", id );
else if ( strcmp( mlt_type, "filter" ) == 0 )
{
// Recurse on connected producer
- child = serialise_service( context, MLT_SERVICE( MLT_FILTER( service )->producer ), node );
-
- // sanity check
- if ( child == NULL )
- break;
+ serialise_service( context, MLT_SERVICE( MLT_FILTER( service )->producer ), node );
- node = xmlNewChild( child, NULL, "filter", NULL );
+ child = xmlNewChild( node, NULL, "filter", NULL );
// Set the id
- if ( mlt_properties_get( properties, "id" ) != NULL )
- xmlNewProp( node, "id", mlt_properties_get( properties, "mlt_service" ) );
- else
+ if ( mlt_properties_get( properties, "id" ) == NULL )
{
snprintf( id, 30, "filter%d", context->filter_count++ );
- xmlNewProp( node, "id", id );
+ xmlNewProp( child, "id", id );
}
- //xmlNewProp( node, "type", mlt_properties_get( properties, "mlt_service" ) );
-
- serialise_properties( properties, node );
+ serialise_properties( properties, child );
break;
}
else if ( strcmp( mlt_type, "transition" ) == 0 )
{
// Recurse on connected producer
- child = serialise_service( context, MLT_SERVICE( MLT_TRANSITION( service )->producer ), node );
-
- // sanity check
- if ( child == NULL )
- break;
+ serialise_service( context, MLT_SERVICE( MLT_TRANSITION( service )->producer ), node );
- node = xmlNewChild( child, NULL, "transition", NULL );
+ child = xmlNewChild( node, NULL, "transition", NULL );
// Set the id
- if ( mlt_properties_get( properties, "id" ) != NULL )
- xmlNewProp( node, "id", mlt_properties_get( properties, "mlt_service" ) );
- else
+ if ( mlt_properties_get( properties, "id" ) == NULL )
{
snprintf( id, 30, "transition%d", context->transition_count++ );
- xmlNewProp( node, "id", id );
+ xmlNewProp( child, "id", id );
}
- //xmlNewProp( node, "type", mlt_properties_get( properties, "mlt_service" ) );
-
- serialise_properties( properties, node );
+ serialise_properties( properties, child );
break;
}
// Get the next connected service
service = mlt_service_get_producer( service );
}
- return child;
}
static int consumer_start( mlt_consumer this )
// Remember inigo
if ( mlt_properties_get( mlt_service_properties( service ), "mlt_service" ) != NULL &&
strcmp( mlt_properties_get( mlt_service_properties( service ), "mlt_service" ), "inigo" ) == 0 )
- {
inigo = service;
-
- // Turn inigo's producer into a framework producer
- mlt_properties_set( mlt_service_properties( service ), "mlt_type", "mlt_producer" );
- }
+
+ // Ensure producer is a framework producer
+ mlt_properties_set( mlt_service_properties( service ), "mlt_type", "mlt_producer" );
serialise_service( &context, service, root );
- xmlDocFormatDump( stderr, doc, 1 );
+
+ if ( mlt_properties_get( mlt_consumer_properties( this ), "resource" ) == NULL )
+ xmlDocFormatDump( stderr, doc, 1 );
+ else
+ xmlSaveFormatFile( mlt_properties_get( mlt_consumer_properties( this ), "resource" ), doc, 1 );
}
- mlt_consumer_stop( this );
xmlFreeDoc( doc );
+ mlt_consumer_stop( this );
// Tell inigo, enough already!
if ( inigo != NULL )