]> git.sesse.net Git - mlt/blobdiff - src/modules/xml/producer_xml.c
Add LC_NUMERIC to MLT XML.
[mlt] / src / modules / xml / producer_xml.c
index 285b9223669f71c5205d3d8544434e4065ded9bf..d90cdf66c208eec828c0744f0e44553e8e9aa2ce 100644 (file)
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <unistd.h>
+#include <locale.h>
 
 #include <libxml/parser.h>
 #include <libxml/parserInternals.h> // for xmlCreateFileParserCtxt
@@ -1096,13 +1097,10 @@ static void on_end_property( deserialise_context context, const xmlChar *name )
                        xmlDocDumpMemory( context->value_doc, &value, &size );
                        mlt_properties_set( properties, context->property, _s(value) );
 #ifdef WIN32
-                       xmlFreeFunc myXmlFree = NULL;
-                       xmlMemGet( &myXmlFree, NULL, NULL, NULL);
-                       if ( myXmlFree )
-                               myXmlFree( value );
-#else
-                       xmlFree( value );
+                       xmlFreeFunc xmlFree = NULL;
+                       xmlMemGet( &xmlFree, NULL, NULL, NULL);
 #endif
+                       xmlFree( value );
                        xmlFreeDoc( context->value_doc );
                        context->value_doc = NULL;
                }
@@ -1179,8 +1177,15 @@ static void on_start_element( void *ctx, const xmlChar *name, const xmlChar **at
        else if ( xmlStrcmp( name, _x("property") ) == 0 )
                on_start_property( context, name, atts );
        else if ( xmlStrcmp( name, _x("westley") ) == 0 || xmlStrcmp( name, _x("mlt") ) == 0 )
+       {
                for ( ; atts != NULL && *atts != NULL; atts += 2 )
-                       mlt_properties_set( context->producer_map, ( const char * )atts[ 0 ], ( const char * )atts[ 1 ] );
+               {
+                       if ( xmlStrcmp( atts[0], _x("LC_NUMERIC") ) )
+                               mlt_properties_set( context->producer_map, _s( atts[0] ), _s(atts[1] ) );
+                       else
+                               setlocale( LC_NUMERIC, _s( atts[1] ) );
+               }
+       }
 }
 
 static void on_end_element( void *ctx, const xmlChar *name )
@@ -1578,7 +1583,7 @@ mlt_producer producer_xml_init( mlt_profile profile, mlt_service_type servtype,
                for ( i = mlt_properties_count( properties ) - 1; i >= 1; i -- )
                {
                        char *name = mlt_properties_get_name( properties, i );
-                       if ( mlt_properties_get_data( properties, name, NULL ) == service )
+                       if ( mlt_properties_get_data_at( properties, i, NULL ) == service )
                        {
                                mlt_properties_set_data( properties, name, service, 0, NULL, NULL );
                                break;