]> git.sesse.net Git - mlt/commitdiff
Add LC_NUMERIC to MLT XML.
authorDan Dennedy <dan@dennedy.org>
Thu, 7 Jul 2011 06:12:33 +0000 (23:12 -0700)
committerDan Dennedy <dan@dennedy.org>
Thu, 7 Jul 2011 06:12:33 +0000 (23:12 -0700)
This does not permit one to mix locales within a MLT process!
In other words, you can not load a document in a locale using one
decimal separator and then filter with a double property using a
different separator.

src/modules/xml/consumer_xml.c
src/modules/xml/mlt-xml.dtd
src/modules/xml/producer_xml.c

index 174aa068394807aff0e19243ed9b800b149445ee..c9823110e493d609ce710d37b97953dabdc8c8a7 100644 (file)
@@ -23,6 +23,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <locale.h>
 #include <libxml/tree.h>
 
 #define ID_SIZE 128
@@ -635,6 +636,9 @@ xmlDocPtr xml_make_doc( mlt_consumer consumer, mlt_service service )
 
        xmlDocSetRootElement( doc, root );
 
+       // Indicate the numeric locale
+       xmlNewProp( root, _x("LC_NUMERIC"), _x( setlocale( LC_NUMERIC, NULL ) ) );
+
        // If we have root, then deal with it now
        if ( mlt_properties_get( properties, "root" ) != NULL )
        {
index 6c1dc2ba7409b2aedb026b09e583fa59dba16f95..937ff47c4fef4dd130ab232c1683312443ff729b 100644 (file)
@@ -3,6 +3,12 @@
 <!-- MLT XML DTD v0.2.0 -->
 
 <!ELEMENT mlt (profile | producer | playlist | tractor | multitrack)+ >
+<!ATTLIST mlt
+    LC_NUMERIC CDATA    #IMPLIED
+    root       CDATA    #IMPLIED
+    profile    CDATA    #IMPLIED
+    title      CDATA    #IMPLIED
+>
 <!ELEMENT profile EMPTY >
 <!ATTLIST profile
     name               CDATA    #IMPLIED
index 4767ae3145d973aa3d306abca8741c7a9f8bf3ac..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
@@ -1176,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 )