#include <locale.h>
#include <libxml/tree.h>
#include <pthread.h>
-#define FILTER_WCHAR
-#ifdef FILTER_WCHAR
#include <wchar.h>
-#endif
#define ID_SIZE 128
static void *consumer_thread( void *arg );
static void serialise_service( serialise_context context, mlt_service service, xmlNode *node );
-#ifdef FILTER_WCHAR
-
static void* filter_restricted( const char *in )
{
if ( !in ) return NULL;
return out;
}
-#else
-
-static void* filter_restricted( const char *in )
-{
- if ( !in ) return NULL;
- char *out = calloc( 1, strlen( in ) );
- size_t i, j, n = strlen( in );
- for ( i = 0, j = 0; i < n; i++ )
- {
- char c = in[i];
- if ( c == 0x9 || c == 0xA || c == 0xD || ( c >= 0x20 && c <= 0xFF ) )
- out[ j++ ] = c;
- }
- return out;
-}
-
-#endif
-
-typedef enum
+typedef enum
{
xml_existing,
xml_producer,
// Attempt to reuse existing id
id = mlt_properties_get( MLT_SERVICE_PROPERTIES( service ), "id" );
- // If no id, or the id is used in the map (for another service), then
+ // If no id, or the id is used in the map (for another service), then
// create a new one.
if ( id == NULL || mlt_properties_get_data( map, id, NULL ) != NULL )
{
{
int i;
xmlNode *p;
-
+
// Enumerate the properties
for ( i = 0; i < mlt_properties_count( properties ); i++ )
{
{
int i;
xmlNode *p;
-
+
// Enumerate the properties
for ( i = 0; store != NULL && i < mlt_properties_count( properties ); i++ )
{
int i;
xmlNode *p;
mlt_filter filter = NULL;
-
+
// Enumerate the filters
for ( i = 0; ( filter = mlt_producer_filter( MLT_PRODUCER( service ), i ) ) != NULL; i ++ )
{
{
xmlNode *child = node;
mlt_service parent = MLT_SERVICE( mlt_producer_cut_parent( MLT_PRODUCER( service ) ) );
-
+
if ( context->pass == 0 )
{
mlt_properties properties = MLT_SERVICE_PROPERTIES( parent );
static void serialise_multitrack( serialise_context context, mlt_service service, xmlNode *node )
{
int i;
-
+
if ( context->pass == 0 )
{
// Iterate over the tracks to collect the producers
serialise_store_properties( context, MLT_PRODUCER_PROPERTIES( producer ), track, "meta." );
serialise_service_filters( context, MLT_PRODUCER_SERVICE( producer ), track );
}
-
+
hide = mlt_properties_get_int( context->hide_map, id );
if ( hide )
xmlNewProp( track, _x("hide"), _x( hide == 1 ? "video" : ( hide == 2 ? "audio" : "both" ) ) );
xmlNode *child = node;
mlt_playlist_clip_info info;
mlt_properties properties = MLT_SERVICE_PROPERTIES( service );
-
+
if ( context->pass == 0 )
{
// Get a new id - if already allocated, do nothing
}
}
}
-
+
child = xmlNewChild( node, NULL, _x("playlist"), NULL );
// Set the id
// Add producer to the map
mlt_properties_set_int( context->hide_map, id, mlt_properties_get_int( properties, "hide" ) );
-
+
// Iterate over the playlist entries
for ( i = 0; i < mlt_playlist_count( MLT_PLAYLIST( service ) ); i++ )
{
{
xmlNode *child = node;
mlt_properties properties = MLT_SERVICE_PROPERTIES( service );
-
+
if ( context->pass == 0 )
{
// Recurse on connected producer
{
xmlNode *child = node;
mlt_properties properties = MLT_SERVICE_PROPERTIES( service );
-
+
// Recurse on connected producer
serialise_service( context, mlt_service_producer( service ), node );
{
xmlNode *child = node;
mlt_properties properties = MLT_SERVICE_PROPERTIES( service );
-
+
// Recurse on connected producer
serialise_service( context, MLT_SERVICE( MLT_TRANSITION( service )->producer ), node );
return;
child = xmlNewChild( node, NULL, _x("transition"), NULL );
-
+
// Set the id
xmlNewProp( child, _x("id"), _x(id) );
if ( mlt_properties_get( properties, "title" ) )
{
mlt_properties properties = MLT_SERVICE_PROPERTIES( service );
char *mlt_type = mlt_properties_get( properties, "mlt_type" );
-
+
// Tell about the producer
if ( strcmp( mlt_type, "producer" ) == 0 )
{
else if ( strcmp( mlt_type, "mlt_producer" ) == 0 )
{
char *resource = mlt_properties_get( properties, "resource" );
-
+
// Recurse on multitrack's tracks
if ( resource && strcmp( resource, "<multitrack>" ) == 0 )
{
serialise_multitrack( context, service, node );
break;
}
-
+
// Recurse on playlist's clips
else if ( resource && strcmp( resource, "<playlist>" ) == 0 )
{
serialise_playlist( context, service, node );
}
-
+
// Recurse on tractor's producer
else if ( resource && strcmp( resource, "<tractor>" ) == 0 )
{
serialise_producer( context, service, node );
}
}
-
+
// Tell about a filter
else if ( strcmp( mlt_type, "filter" ) == 0 )
{
serialise_filter( context, service, node );
break;
}
-
+
// Tell about a transition
else if ( strcmp( mlt_type, "transition" ) == 0 )
{
serialise_transition( context, service, node );
break;
}
-
+
// Get the next connected service
service = mlt_service_producer( service );
}
// Construct the context maps
context->id_map = mlt_properties_new();
context->hide_map = mlt_properties_new();
-
+
// Ensure producer is a framework producer
mlt_properties_set( MLT_SERVICE_PROPERTIES( service ), "mlt_type", "mlt_producer" );
mlt_properties_close( context->hide_map );
free( context->root );
free( context );
-
+
return doc;
}