]> git.sesse.net Git - mlt/commitdiff
Merge branch 'master' of https://github.com/mltframework/mlt
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 19 Nov 2012 16:16:50 +0000 (17:16 +0100)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 19 Nov 2012 16:16:50 +0000 (17:16 +0100)
src/modules/qimage/qimage_wrapper.cpp

index 2328054ef049d84eef10488ce663775f33c20e04..5c9bc4a6b16e7d0597353d9899c776bf837a8ec6 100644 (file)
 #ifdef USE_QT4
 #include <QtGui/QImage>
 #include <QtCore/QSysInfo>
+#include <QtGui/QApplication>
 #include <QtCore/QMutex>
 #include <QtCore/QtEndian>
 #include <QtCore/QTemporaryFile>
+#include <QtCore/QLocale>
 #endif
 
 #ifdef USE_EXIF
@@ -63,6 +65,8 @@ static KComponentData *instance = 0L;
 static KInstance *instance = 0L;
 #endif
 
+static QApplication *app = NULL;
+
 static void qimage_delete( void *data )
 {
        QImage *image = ( QImage * )data;
@@ -178,6 +182,32 @@ int refresh_qimage( producer_qimage self, mlt_frame frame )
        sprintf( image_key, "%d", image_idx );
 
        int disable_exif = mlt_properties_get_int( producer_props, "disable_exif" );
+       
+       
+       if ( app == NULL ) 
+       {
+               if ( qApp ) 
+               {
+                       app = qApp;
+               }
+               else 
+               {
+#ifdef linux
+                       if ( getenv("DISPLAY") == 0 )
+                       {
+                               mlt_log_panic( MLT_PRODUCER_SERVICE( producer ), "Error, cannot render titles without an X11 environment.\nPlease either run melt from an X session or use a fake X server like xvfb:\nxvfb-run -a melt (...)\n" );
+                               exit( 1 );
+                               return -1;
+                       }
+#endif
+                       int argc = 1;
+                       char* argv[1];
+                       argv[0] = (char*) "xxx";
+                       app = new QApplication( argc, argv );
+                       const char *localename = mlt_properties_get_lcnumeric( MLT_SERVICE_PROPERTIES( MLT_PRODUCER_SERVICE( producer ) ) );
+                       QLocale::setDefault( QLocale( localename ) );
+               }
+       }
 
        if ( image_idx != self->qimage_idx )
                self->qimage = NULL;