]> git.sesse.net Git - mlt/commitdiff
remove old 8-bit only version of xml char filter
authorDan Dennedy <dan@dennedy.org>
Tue, 24 Jan 2012 01:00:55 +0000 (17:00 -0800)
committerDan Dennedy <dan@dennedy.org>
Tue, 24 Jan 2012 01:00:55 +0000 (17:00 -0800)
src/modules/xml/consumer_xml.c

index eb6572aa76de6a6e945d2db3dc5008225dfa18de..2b0f6bc493da54916027fe06056c1ba6f2d3d8e3 100644 (file)
 #include <locale.h>
 #include <libxml/tree.h>
 #include <pthread.h>
-#define FILTER_WCHAR
-#ifdef FILTER_WCHAR
 #include <wchar.h>
-#endif
 
 #define ID_SIZE 128
 
@@ -63,8 +60,6 @@ static int consumer_is_stopped( mlt_consumer this );
 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;
@@ -95,25 +90,7 @@ static void* filter_restricted( const char *in )
        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,
@@ -145,7 +122,7 @@ static char *xml_get_id( serialise_context context, mlt_service service, xml_typ
                // 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 )
                {
@@ -236,7 +213,7 @@ static void serialise_properties( serialise_context context, mlt_properties prop
 {
        int i;
        xmlNode *p;
-       
+
        // Enumerate the properties
        for ( i = 0; i < mlt_properties_count( properties ); i++ )
        {
@@ -272,7 +249,7 @@ static void serialise_store_properties( serialise_context context, mlt_propertie
 {
        int i;
        xmlNode *p;
-       
+
        // Enumerate the properties
        for ( i = 0; store != NULL && i < mlt_properties_count( properties ); i++ )
        {
@@ -298,7 +275,7 @@ static inline void serialise_service_filters( serialise_context context, mlt_ser
        int i;
        xmlNode *p;
        mlt_filter filter = NULL;
-       
+
        // Enumerate the filters
        for ( i = 0; ( filter = mlt_producer_filter( MLT_PRODUCER( service ), i ) ) != NULL; i ++ )
        {
@@ -334,7 +311,7 @@ static void serialise_producer( serialise_context context, mlt_service service,
 {
        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 );
@@ -372,7 +349,7 @@ static void serialise_tractor( serialise_context context, mlt_service service, x
 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
@@ -410,7 +387,7 @@ static void serialise_multitrack( serialise_context context, mlt_service service
                                        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" ) ) );
@@ -425,7 +402,7 @@ static void serialise_playlist( serialise_context context, mlt_service service,
        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
@@ -450,7 +427,7 @@ static void serialise_playlist( serialise_context context, mlt_service service,
                                }
                        }
                }
-               
+
                child = xmlNewChild( node, NULL, _x("playlist"), NULL );
 
                // Set the id
@@ -465,7 +442,7 @@ static void serialise_playlist( serialise_context context, mlt_service service,
 
                // 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++ )
                {
@@ -520,7 +497,7 @@ static void serialise_tractor( serialise_context context, mlt_service service, x
 {
        xmlNode *child = node;
        mlt_properties properties = MLT_SERVICE_PROPERTIES( service );
-       
+
        if ( context->pass == 0 )
        {
                // Recurse on connected producer
@@ -559,7 +536,7 @@ static void serialise_filter( serialise_context context, mlt_service service, xm
 {
        xmlNode *child = node;
        mlt_properties properties = MLT_SERVICE_PROPERTIES( service );
-       
+
        // Recurse on connected producer
        serialise_service( context, mlt_service_producer( service ), node );
 
@@ -588,7 +565,7 @@ static void serialise_transition( serialise_context context, mlt_service service
 {
        xmlNode *child = node;
        mlt_properties properties = MLT_SERVICE_PROPERTIES( service );
-       
+
        // Recurse on connected producer
        serialise_service( context, MLT_SERVICE( MLT_TRANSITION( service )->producer ), node );
 
@@ -600,7 +577,7 @@ static void serialise_transition( serialise_context context, mlt_service service
                        return;
 
                child = xmlNewChild( node, NULL, _x("transition"), NULL );
-       
+
                // Set the id
                xmlNewProp( child, _x("id"), _x(id) );
                if ( mlt_properties_get( properties, "title" ) )
@@ -620,7 +597,7 @@ static void serialise_service( serialise_context context, mlt_service service, x
        {
                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 )
                {
@@ -646,20 +623,20 @@ static void serialise_service( serialise_context context, mlt_service service, x
                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 )
                        {
@@ -677,21 +654,21 @@ static void serialise_service( serialise_context context, mlt_service service, x
                                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 );
        }
@@ -765,7 +742,7 @@ xmlDocPtr xml_make_doc( mlt_consumer consumer, mlt_service 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" );
 
@@ -783,7 +760,7 @@ xmlDocPtr xml_make_doc( mlt_consumer consumer, mlt_service service )
        mlt_properties_close( context->hide_map );
        free( context->root );
        free( context );
-       
+
        return doc;
 }