/*
- * consumer_westley.c -- a libxml2 serialiser of mlt service networks
- * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
+ * consumer_xml.c -- a libxml2 serialiser of mlt service networks
+ * Copyright (C) 2003-2009 Ushodaya Enterprises Limited
* Author: Dan Dennedy <dan@dennedy.org>
*
* This library is free software; you can redistribute it and/or
typedef enum
{
- westley_existing,
- westley_producer,
- westley_multitrack,
- westley_playlist,
- westley_tractor,
- westley_filter,
- westley_transition
+ xml_existing,
+ xml_producer,
+ xml_multitrack,
+ xml_playlist,
+ xml_tractor,
+ xml_filter,
+ xml_transition
}
-westley_type;
+xml_type;
/** Create or retrieve an id associated to this service.
*/
-static char *westley_get_id( serialise_context context, mlt_service service, westley_type type )
+static char *xml_get_id( serialise_context context, mlt_service service, xml_type type )
{
char *id = NULL;
int i = 0;
break;
// If the service is not in the map, and the type indicates a new id is needed...
- if ( i >= mlt_properties_count( map ) && type != westley_existing )
+ if ( i >= mlt_properties_count( map ) && type != xml_existing )
{
// Attempt to reuse existing id
id = mlt_properties_get( MLT_SERVICE_PROPERTIES( service ), "id" );
{
switch( type )
{
- case westley_producer:
+ case xml_producer:
sprintf( temp, "producer%d", context->producer_count ++ );
break;
- case westley_multitrack:
+ case xml_multitrack:
sprintf( temp, "multitrack%d", context->multitrack_count ++ );
break;
- case westley_playlist:
+ case xml_playlist:
sprintf( temp, "playlist%d", context->playlist_count ++ );
break;
- case westley_tractor:
+ case xml_tractor:
sprintf( temp, "tractor%d", context->tractor_count ++ );
break;
- case westley_filter:
+ case xml_filter:
sprintf( temp, "filter%d", context->filter_count ++ );
break;
- case westley_transition:
+ case xml_transition:
sprintf( temp, "transition%d", context->transition_count ++ );
break;
- case westley_existing:
+ case xml_existing:
// Never gets here
break;
}
mlt_properties_set_data( map, id, service, 0, NULL, NULL );
}
}
- else if ( type == westley_existing )
+ else if ( type == xml_existing )
{
id = mlt_properties_get_name( map, i );
}
via the argument, but keep it simple.
*/
-mlt_consumer consumer_westley_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
+mlt_consumer consumer_xml_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
{
// Create the consumer object
mlt_consumer this = calloc( sizeof( struct mlt_consumer_s ), 1 );
if ( name != NULL &&
name[ 0 ] != '_' &&
mlt_properties_get_value( properties, i ) != NULL &&
- strcmp( name, "westley" ) != 0 &&
+ strcmp( name, "mlt" ) != 0 &&
strcmp( name, "in" ) != 0 &&
strcmp( name, "out" ) != 0 &&
strcmp( name, "id" ) != 0 &&
for ( i = 0; ( filter = mlt_producer_filter( MLT_PRODUCER( service ), i ) ) != NULL; i ++ )
{
mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
- if ( mlt_properties_get_int( properties, "_fezzik" ) == 0 )
+ if ( mlt_properties_get_int( properties, "_loader" ) == 0 )
{
// Get a new id - if already allocated, do nothing
- char *id = westley_get_id( context, MLT_FILTER_SERVICE( filter ), westley_filter );
+ char *id = xml_get_id( context, MLT_FILTER_SERVICE( filter ), xml_filter );
if ( id != NULL )
{
int in = mlt_properties_get_position( properties, "in" );
{
mlt_properties properties = MLT_SERVICE_PROPERTIES( parent );
// Get a new id - if already allocated, do nothing
- char *id = westley_get_id( context, parent, westley_producer );
+ char *id = xml_get_id( context, parent, xml_producer );
if ( id == NULL )
return;
}
else
{
- char *id = westley_get_id( context, parent, westley_existing );
+ char *id = xml_get_id( context, parent, xml_existing );
mlt_properties properties = MLT_SERVICE_PROPERTIES( service );
xmlNewProp( node, _x("parent"), _x(id) );
xmlNewProp( node, _x("in"), _x(mlt_properties_get( properties, "in" )) );
else
{
// Get a new id - if already allocated, do nothing
- char *id = westley_get_id( context, service, westley_multitrack );
+ char *id = xml_get_id( context, service, xml_multitrack );
if ( id == NULL )
return;
mlt_service parent = MLT_SERVICE( mlt_producer_cut_parent( producer ) );
- char *id = westley_get_id( context, MLT_SERVICE( parent ), westley_existing );
+ char *id = xml_get_id( context, MLT_SERVICE( parent ), xml_existing );
xmlNewProp( track, _x("producer"), _x(id) );
if ( mlt_producer_is_cut( producer ) )
{
if ( context->pass == 0 )
{
// Get a new id - if already allocated, do nothing
- char *id = westley_get_id( context, service, westley_playlist );
+ char *id = xml_get_id( context, service, xml_playlist );
if ( id == NULL )
return;
{
char temp[ 20 ];
xmlNode *entry = xmlNewChild( child, NULL, _x("entry"), NULL );
- id = westley_get_id( context, MLT_SERVICE( producer ), westley_existing );
+ id = xml_get_id( context, MLT_SERVICE( producer ), xml_existing );
xmlNewProp( entry, _x("producer"), _x(id) );
sprintf( temp, "%d", (int)info.frame_in );
xmlNewProp( entry, _x("in"), _x(temp) );
}
else if ( xmlStrcmp( node->name, _x("tractor") ) != 0 )
{
- char *id = westley_get_id( context, service, westley_existing );
+ char *id = xml_get_id( context, service, xml_existing );
xmlNewProp( node, _x("producer"), _x(id) );
}
}
else
{
// Get a new id - if already allocated, do nothing
- char *id = westley_get_id( context, service, westley_tractor );
+ char *id = xml_get_id( context, service, xml_tractor );
if ( id == NULL )
return;
if ( context->pass == 1 )
{
// Get a new id - if already allocated, do nothing
- char *id = westley_get_id( context, service, westley_filter );
+ char *id = xml_get_id( context, service, xml_filter );
if ( id == NULL )
return;
if ( context->pass == 1 )
{
// Get a new id - if already allocated, do nothing
- char *id = westley_get_id( context, service, westley_transition );
+ char *id = xml_get_id( context, service, xml_transition );
if ( id == NULL )
return;
if ( strcmp( mlt_type, "producer" ) == 0 )
{
char *mlt_service = mlt_properties_get( properties, "mlt_service" );
- if ( mlt_properties_get( properties, "westley" ) == NULL && ( mlt_service != NULL && !strcmp( mlt_service, "tractor" ) ) )
+ if ( mlt_properties_get( properties, "xml" ) == NULL && ( mlt_service != NULL && !strcmp( mlt_service, "tractor" ) ) )
{
context->pass = 0;
serialise_tractor( context, service, node );
{
serialise_producer( context, service, node );
}
- if ( mlt_properties_get( properties, "westley" ) != NULL )
+ if ( mlt_properties_get( properties, "xml" ) != NULL )
break;
}
}
}
-xmlDocPtr westley_make_doc( mlt_consumer consumer, mlt_service service )
+xmlDocPtr xml_make_doc( mlt_consumer consumer, mlt_service service )
{
mlt_properties properties = MLT_SERVICE_PROPERTIES( service );
xmlDocPtr doc = xmlNewDoc( _x("1.0") );
- xmlNodePtr root = xmlNewNode( NULL, _x("westley") );
+ xmlNodePtr root = xmlNewNode( NULL, _x("mlt") );
struct serialise_context_s *context = calloc( 1, sizeof( struct serialise_context_s ) );
xmlDocSetRootElement( doc, root );
}
// Make the document
- doc = westley_make_doc( this, service );
+ doc = xml_make_doc( this, service );
// Handle the output
if ( resource == NULL || !strcmp( resource, "" ) )