]> git.sesse.net Git - mlt/commitdiff
Fix qimage build for MinGW.
authorDan Dennedy <dan@dennedy.org>
Fri, 31 Dec 2010 18:34:16 +0000 (10:34 -0800)
committerDan Dennedy <dan@dennedy.org>
Mon, 24 Jan 2011 01:39:43 +0000 (17:39 -0800)
src/modules/qimage/Makefile
src/modules/qimage/configure
src/modules/qimage/producer_qimage.c
src/modules/qimage/qimage_wrapper.cpp
src/modules/qimage/qimage_wrapper.h

index 23e1710c2501b12cb8991efb34bb88e5add03376..a50ae5eb28cc45bd0ae57e70b64f26c9c7a79231 100644 (file)
@@ -13,7 +13,6 @@ CPPOBJS = qimage_wrapper.o kdenlivetitle_wrapper.o
 CXXFLAGS += $(CFLAGS) $(QTCXXFLAGS) $(EXIFCXXFLAGS) -Wno-deprecated
 
 LDFLAGS += $(QTLIBS) $(EXIFLIBS)
-LDFLAGS += -lstdc++
 
 ifdef USE_KDE
 LDFLAGS += -lkio
@@ -27,7 +26,7 @@ $(TARGET): $(OBJS) $(CPPOBJS)
                $(CXX) $(SHFLAGS) -o $@ $(OBJS) $(CPPOBJS) $(LDFLAGS)
 
 depend:        $(SRCS)
-               $(CC) -MM $(CFLAGS) $(QTCXXFLAGS) $^ 1>.depend
+               $(CXX) -MM $(CXXFLAGS) $^ 1>.depend
 
 distclean:     clean
                rm -f .depend config.h config.mak
index 8f1a6ad76ec266b882e7917ce35694c376892734..b53473e44483809a0811f532ba7525bcc2911cbd 100755 (executable)
@@ -109,7 +109,7 @@ else
        then
 
                # test if we have a Qt3 or Qt4
-               if [ -f "$qimage_libdir/libQtCore.so" ] || [ -d "$qimage_libdir/QtGui.framework" ] && [ "$force_qt3" = "" ]
+               if [ -f "$qimage_libdir/libQtCore.so" ] || [ -d "$qimage_libdir/QtGui.framework" ] || [ -f "$qimage_libdir/libQtCore4.a" ] && [ "$force_qt3" = "" ]
                then
                        echo "Qt version 4.x detected, will compile Qt4 qimage producer"
                        qt4_found=true
@@ -127,9 +127,13 @@ else
                        then
                                echo QTCXXFLAGS=$(pkg-config --cflags QtCore QtGui QtXml QtSvg ) >> config.mak
                                echo QTLIBS=$(pkg-config --libs QtCore QtGui QtXml QtSvg) >> config.mak
+                       elif [ -f "$qimage_libdir/libQtCore4.a" ]
+                       then
+                               echo QTCXXFLAGS=-I$qimage_includedir >> config.mak
+                               echo QTLIBS=-enable-auto-import -L$qimage_libdir -lQtCore4 -lQtGui4 -lQtXml4 -lQtSvg4 >> config.mak
                        else
                                echo QTCXXFLAGS=-I$qimage_includedir >> config.mak
-                                echo QTLIBS=-L$qimage_libdir -lQtCore -lQtGui -lQtXml -lQtSvg >> config.mak
+                               echo QTLIBS=-L$qimage_libdir -lQtCore -lQtGui -lQtXml -lQtSvg >> config.mak
                        fi
                else 
                    if [ -d "$kde_includedir" ]
index 87467dcc095a8de0e7e7f0574924ecfb78af15d0..7820da859fb7427d04292a91b293541dbef13096 100644 (file)
@@ -96,30 +96,7 @@ static void load_filenames( producer_qimage this, mlt_properties producer_proper
        // Read xml string
        if ( strstr( filename, "<svg" ) )
        {
-               // Generate a temporary file for the svg
-               char fullname[ 1024 ] = "/tmp/mlt.XXXXXX";
-               int fd = mkstemp( fullname );
-
-               if ( fd > -1 )
-               {
-                       // Write the svg into the temp file
-                       ssize_t remaining_bytes;
-                       char *xml = filename;
-                       
-                       // Strip leading crap
-                       while ( xml[0] != '<' )
-                               xml++;
-                       
-                       remaining_bytes = strlen( xml );
-                       while ( remaining_bytes > 0 )
-                               remaining_bytes -= write( fd, xml + strlen( xml ) - remaining_bytes, remaining_bytes );
-                       close( fd );
-
-                       mlt_properties_set( this->filenames, "0", fullname );
-
-                       // Teehe - when the producer closes, delete the temp file and the space allo
-                       mlt_properties_set_data( producer_properties, "__temporary_file__", fullname, 0, ( mlt_destructor )unlink, NULL );
-               }
+               make_tempfile( this, filename );
        }
        // Obtain filenames
        else if ( strchr( filename, '%' ) != NULL )
@@ -270,7 +247,8 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
 static void producer_close( mlt_producer parent )
 {
        producer_qimage this = parent->child;
-       pthread_mutex_destroy( &this->mutex );
+       if ( this->mutex )
+               pthread_mutex_destroy( &this->mutex );
        parent->close = NULL;
        mlt_service_cache_purge( MLT_PRODUCER_SERVICE(parent) );
        mlt_producer_close( parent );
index b2627017d9c14f23277142490e059ee2fdf18647..f55cfadcff608713184ce1ac0112385d5a6ba555 100644 (file)
@@ -40,6 +40,7 @@
 #include <QtCore/QSysInfo>
 #include <QtCore/QMutex>
 #include <QtCore/QtEndian>
+#include <QtCore/QTemporaryFile>
 #endif
 
 #ifdef USE_EXIF
@@ -341,4 +342,31 @@ void refresh_qimage( producer_qimage self, mlt_frame frame, int width, int heigh
        g_mutex.unlock();
 }
 
+extern void make_tempfile( producer_qimage self, const char *xml )
+{
+       // Generate a temporary file for the svg
+       QTemporaryFile tempFile( "mlt.XXXXXX" );
+
+       tempFile.setAutoRemove( false );
+       if ( tempFile.open() )
+       {
+               // Write the svg into the temp file
+               char *fullname = tempFile.fileName().toUtf8().data();
+
+               // Strip leading crap
+               while ( xml[0] != '<' )
+                       xml++;
+
+               qint64 remaining_bytes = strlen( xml );
+               while ( remaining_bytes > 0 )
+                       remaining_bytes -= tempFile.write( xml + strlen( xml ) - remaining_bytes, remaining_bytes );
+               tempFile.close();
+
+               mlt_properties_set( self->filenames, "0", fullname );
+
+               mlt_properties_set_data( MLT_PRODUCER_PROPERTIES( &self->parent ), "__temporary_file__",
+                       fullname, 0, ( mlt_destructor )unlink, NULL );
+       }
+}
+
 } // extern "C"
index 22b1110b4aae2af21613b74cc37625858ffb4b89..b66924428900cbd7d60ad1c8e29410d3be83f000 100644 (file)
@@ -51,6 +51,8 @@ struct producer_qimage_s
 typedef struct producer_qimage_s *producer_qimage;
 
 extern void refresh_qimage( producer_qimage, mlt_frame, int width, int height );
+extern void make_tempfile( producer_qimage, const char *xml );
+
 #ifdef USE_KDE
 extern void init_qimage();
 #endif