int pass;
mlt_properties hide_map;
char *root;
+ char *store;
};
typedef struct serialise_context_s* serialise_context;
}
}
+static inline void serialise_store_properties( serialise_context context, mlt_properties properties, xmlNode *node )
+{
+ int i;
+ xmlNode *p;
+
+ // Enumerate the properties
+ for ( i = 0; context->store != NULL && i < mlt_properties_count( properties ); i++ )
+ {
+ char *name = mlt_properties_get_name( properties, i );
+ if ( !strncmp( name, context->store, strlen( context->store ) ) )
+ {
+ char *value = mlt_properties_get_value( properties, i );
+ if ( value != NULL )
+ {
+ p = xmlNewChild( node, NULL, "property", NULL );
+ xmlNewProp( p, "name", mlt_properties_get_name( properties, i ) );
+ if ( context->root != NULL && strcmp( context->root, "" ) && !strncmp( value, context->root, strlen( context->root ) ) )
+ xmlNodeSetContent( p, value + strlen( context->root ) + 1 );
+ else
+ xmlNodeSetContent( p, value );
+ }
+ }
+ }
+}
+
static inline void serialise_service_filters( serialise_context context, mlt_service service, xmlNode *node )
{
int i;
for ( i = 0; i < mlt_multitrack_count( MLT_MULTITRACK( service ) ); i++ )
{
mlt_producer producer = mlt_producer_cut_parent( mlt_multitrack_track( MLT_MULTITRACK( service ), i ) );
- char *resource_s = mlt_properties_get( mlt_producer_properties( producer ), "resource" );
- if ( resource_s != NULL && !strcmp( resource_s, "<tractor>" ) )
- {
- serialise_tractor( context, MLT_SERVICE( producer ), node );
- context->pass ++;
- serialise_tractor( context, MLT_SERVICE( producer ), node );
- context->pass --;
- }
- else
- {
- serialise_service( context, MLT_SERVICE( producer ), node );
- }
+ serialise_service( context, MLT_SERVICE( producer ), node );
}
}
else
mlt_producer producer = mlt_producer_cut_parent( info.producer );
char *service_s = mlt_properties_get( mlt_producer_properties( producer ), "mlt_service" );
char *resource_s = mlt_properties_get( mlt_producer_properties( producer ), "resource" );
- if ( resource_s != NULL && !strcmp( resource_s, "<tractor>" ) )
- {
- serialise_tractor( context, MLT_SERVICE( producer ), node );
- context->pass ++;
- serialise_tractor( context, MLT_SERVICE( producer ), node );
- context->pass --;
- }
- else if ( resource_s != NULL && !strcmp( resource_s, "<playlist>" ) )
+ if ( resource_s != NULL && !strcmp( resource_s, "<playlist>" ) )
serialise_playlist( context, MLT_SERVICE( producer ), node );
else if ( service_s != NULL && strcmp( service_s, "blank" ) != 0 )
serialise_service( context, MLT_SERVICE( producer ), node );
// Set the id
xmlNewProp( child, "id", id );
+ // Store application specific properties
+ serialise_store_properties( context, properties, child );
+
// Add producer to the map
mlt_properties_set_int( context->hide_map, id, mlt_properties_get_int( properties, "hide" ) );
xmlNewProp( child, "in", mlt_properties_get( properties, "in" ) );
xmlNewProp( child, "out", mlt_properties_get( properties, "out" ) );
+ // Store application specific properties
+ serialise_store_properties( context, mlt_service_properties( service ), child );
+
// Recurse on connected producer
serialise_service( context, mlt_service_producer( service ), child );
serialise_service_filters( context, service, child );
// Tell about the producer
if ( strcmp( mlt_type, "producer" ) == 0 )
{
- serialise_producer( context, service, node );
+ char *mlt_service = mlt_properties_get( properties, "mlt_service" );
+ if ( mlt_properties_get( properties, "westley" ) == NULL && !strcmp( mlt_service, "tractor" ) )
+ {
+ context->pass = 0;
+ serialise_tractor( context, service, node );
+ context->pass = 1;
+ serialise_tractor( context, service, node );
+ context->pass = 0;
+ break;
+ }
+ else
+ {
+ serialise_producer( context, service, node );
+ }
if ( mlt_properties_get( properties, "westley" ) != NULL )
break;
}
// Recurse on tractor's producer
else if ( strcmp( resource, "<tractor>" ) == 0 )
{
+ context->pass = 0;
serialise_tractor( context, service, node );
+ context->pass = 1;
+ serialise_tractor( context, service, node );
+ context->pass = 0;
break;
}
}
}
-xmlDocPtr westley_make_doc( mlt_service service )
+xmlDocPtr westley_make_doc( mlt_consumer consumer, mlt_service service )
{
mlt_properties properties = mlt_service_properties( service );
xmlDocPtr doc = xmlNewDoc( "1.0" );
context->root = strdup( "" );
}
+ // Assign the additional 'storage' pattern for properties
+ context->store = mlt_properties_get( mlt_consumer_properties( consumer ), "store" );
+
// Assign a title property
if ( mlt_properties_get( properties, "title" ) != NULL )
xmlNewProp( root, "title", mlt_properties_get( properties, "title" ) );
}
// Make the document
- doc = westley_make_doc( service );
+ doc = westley_make_doc( this, service );
// Handle the output
if ( resource == NULL || !strcmp( resource, "" ) )
{
xmlDocFormatDump( stdout, doc, 1 );
}
- else if ( !strcmp( resource, "buffer" ) )
+ else if ( strchr( resource, '.' ) == NULL )
{
xmlChar *buffer = NULL;
int length = 0;
xmlDocDumpMemory( doc, &buffer, &length );
- mlt_properties_set_data( properties, "buffer", buffer, length, xmlFree, NULL );
+ mlt_properties_set( properties, resource, buffer );
+ xmlFree( buffer );
}
else
{