]> git.sesse.net Git - mlt/commitdiff
Localised data storage and utf-8 properties
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 25 Jan 2005 12:32:07 +0000 (12:32 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 25 Jan 2005 12:32:07 +0000 (12:32 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@628 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/westley/consumer_westley.c
src/modules/westley/producer_westley.c

index 87ab12dfcb0eb18534014f455df47f09e4a6b330..8bf93c9a538aff754889ccb12e83bbdd1e79ed2d 100644 (file)
@@ -189,12 +189,10 @@ static void serialise_properties( serialise_context context, mlt_properties prop
                         strcmp( name, "height" ) != 0 )
                {
                        char *value = mlt_properties_get_value( properties, i );
-                       p = xmlNewChild( node, NULL, "property", NULL );
-                       xmlNewProp( p, "name", mlt_properties_get_name( properties, i ) );
                        if ( strcmp( context->root, "" ) && !strncmp( value, context->root, strlen( context->root ) ) )
-                               xmlNodeSetContent( p, value + strlen( context->root ) + 1 );
-                       else
-                               xmlNodeSetContent( p, value );
+                               value += strlen( context->root ) + 1;
+                       p = xmlNewTextChild( node, NULL, "property", value );
+                       xmlNewProp( p, "name", name );
                }
        }
 }
@@ -213,12 +211,10 @@ static void serialise_store_properties( serialise_context context, mlt_propertie
                        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 );
+                               if ( strcmp( context->root, "" ) && !strncmp( value, context->root, strlen( context->root ) ) )
+                                       value += strlen( context->root ) + 1;
+                               p = xmlNewTextChild( node, NULL, "property", value );
+                               xmlNewProp( p, "name", name );
                        }
                }
        }
@@ -704,13 +700,13 @@ static int consumer_start( mlt_consumer this )
                {
                        xmlChar *buffer = NULL;
                        int length = 0;
-                       xmlDocDumpMemory( doc, &buffer, &length );
+                       xmlDocDumpMemoryEnc( doc, &buffer, &length, "utf-8" );
                        mlt_properties_set( properties, resource, buffer );
                        xmlFree( buffer );
                }
                else
                {
-                       xmlSaveFormatFile( resource, doc, 1 );
+                       xmlSaveFormatFileEnc( resource, doc, "utf-8", 1 );
                }
                
                // Close the document
index 111a7e2c8c785f8937d81682b93c1077432a8a9b..f929ca5656294250976587b28e55b9c98e284e37 100644 (file)
@@ -931,7 +931,7 @@ static void on_start_property( deserialise_context context, const xmlChar *name,
 
                if ( context->property != NULL )
                        mlt_properties_set( properties, context->property, value == NULL ? "" : value );
-       
+
                // Tell parser to collect any further nodes for serialisation
                context->is_value = 1;
 
@@ -967,7 +967,7 @@ static void on_end_property( deserialise_context context, const xmlChar *name )
                        xmlFreeDoc( context->value_doc );
                        context->value_doc = NULL;
                }
-       
+
                // Close this property handling
                free( context->property );
                context->property = NULL;
@@ -1145,6 +1145,8 @@ static void on_internal_subset( void *ctx, const xmlChar* name,
        params_to_entities( context );
 }
 
+// TODO: Check this with Dan... I think this is for westley parameterisation
+// but it's breaking standard escaped entities (like &lt; etc).
 static void on_entity_declaration( void *ctx, const xmlChar* name, int type, 
        const xmlChar* publicId, const xmlChar* systemId, xmlChar* content)
 {
@@ -1154,7 +1156,8 @@ static void on_entity_declaration( void *ctx, const xmlChar* name, int type,
        xmlAddDocEntity( context->entity_doc, name, type, publicId, systemId, content );
 }
 
-xmlEntityPtr on_get_entity( void *ctx, const xmlChar* name )
+// TODO: Check this functionality (see on_entity_declaration)
+static xmlEntityPtr on_get_entity( void *ctx, const xmlChar* name )
 {
        struct _xmlParserCtxt *xmlcontext = ( struct _xmlParserCtxt* )ctx;
        deserialise_context context = ( deserialise_context )( xmlcontext->_private );
@@ -1301,7 +1304,7 @@ mlt_producer producer_westley_init( int info, char *data )
        sax->cdataBlock = on_characters;
        sax->internalSubset = on_internal_subset;
        sax->entityDecl = on_entity_declaration;
-       sax->getEntity = on_get_entity;
+       //sax->getEntity = on_get_entity;
 
        // Setup libxml2 SAX parsing
        xmlInitParser();