Commit 26b583b0 authored by Simon Eugster's avatar Simon Eugster

Switch to C locale after initialising MLT

This ensures that we always use . as decimal separator, regardless of
the user locale (which might use , or something else).

References #713
parent 217ef52e
......@@ -17,9 +17,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "framework/mlt_version.h"
#include "mlt++/Mlt.h"
#include "renderjob.h"
#include <QtGlobal>
#include <QApplication>
#include <QDir>
#include <QDomDocument>
......@@ -79,7 +79,13 @@ int main(int argc, char **argv)
#endif
args.removeFirst();
QDir baseFolder(target);
// After initialising the MLT factory, set the locale back from user default to C
// to ensure numbers are always serialised with . as decimal point.
Mlt::Factory::init();
std::setlocale(LC_ALL, "C");
::qputenv("LC_ALL", "C");
Mlt::Profile profile(profilePath.toUtf8().constData());
profile.set_explicit(1);
Mlt::Producer prod(profile, nullptr, playlist.toUtf8().constData());
......
......@@ -85,7 +85,13 @@ MltConnection::MltConnection(const QString &mltPath)
// Disable VDPAU that crashes in multithread environment.
// TODO: make configurable
setenv("MLT_NO_VDPAU", "1", 1);
// After initialising the MLT factory, set the locale back from user default to C
// to ensure numbers are always serialised with . as decimal point.
m_repository = std::unique_ptr<Mlt::Repository>(Mlt::Factory::init());
std::setlocale(LC_ALL, "C");
::qputenv("LC_ALL", "C");
locateMeltAndProfilesPath(mltPath);
// Retrieve the list of available producers.
......
......@@ -20,14 +20,12 @@
#include "mltpreview.h"
#include <QtGlobal>
#include <QImage>
#include <QVarLengthArray>
#include <QDebug>
#include <krandomsequence.h>
#include <unistd.h>
#define DBG_AREA
extern "C" {
Q_DECL_EXPORT ThumbCreator *new_creator()
......@@ -38,7 +36,11 @@ Q_DECL_EXPORT ThumbCreator *new_creator()
MltPreview::MltPreview()
{
// After initialising the MLT factory, set the locale back from user default to C
// to ensure numbers are always serialised with . as decimal point.
Mlt::Factory::init();
std::setlocale(LC_ALL, "C");
::qputenv("LC_ALL", "C");
}
MltPreview::~MltPreview()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment