]> git.sesse.net Git - mlt/commitdiff
Fix loading of extra image formats using Kdelibs (xcf, ...)
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Fri, 19 Oct 2012 12:56:42 +0000 (14:56 +0200)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Fri, 19 Oct 2012 12:56:42 +0000 (14:56 +0200)
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 9a936854830387956df55bd4a3fd4090982be565..82f5d8dcda5a39406de8da0d33271e23f04c7d1f 100644 (file)
@@ -16,11 +16,11 @@ ifdef GPL3
        CFLAGS += -DGPL3
 endif
 
-CXXFLAGS += $(CFLAGS) $(QTCXXFLAGS) $(EXIFCXXFLAGS) -Wno-deprecated
+CXXFLAGS += $(CFLAGS) $(QTCXXFLAGS) $(EXIFCXXFLAGS) $(KDECXXFLAGS) -Wno-deprecated
 
-LDFLAGS += $(QTLIBS) $(EXIFLIBS)
+LDFLAGS += $(QTLIBS) $(EXIFLIBS) $(KDELIBS)
 
-ifdef USE_KDE
+ifdef USE_KDE3
 LDFLAGS += -lkio
 endif
 
index 0e9b906081e6c61224277b566bce0b5e29fda477..d6cda9b8ef52c781b54310dc199cc6267bb22f90 100755 (executable)
@@ -114,8 +114,8 @@ else
                else
                    if [ -d "$kde_includedir" ]
                    then
-                           echo "#define USE_KDE" >> config.h
-                           echo "USE_KDE=1" >> config.mak
+                           echo "#define USE_KDE3" >> config.h
+                           echo "USE_KDE3=1" >> config.mak
                            echo "#define USE_QT3" >> config.h
                            echo "USE_QT3=1" >> config.mak
                            echo QTCXXFLAGS=-I$qimage_includedir -I$kde_includedir -DQT_THREAD_SUPPORT >> config.mak
@@ -143,6 +143,30 @@ else
                        touch ../disable-qimage
                fi
        fi
+
+       if [ "$qt4_found" != "" ]
+       then
+               # test if we have KDE4, required on some systems to get QImage extra formats (xcf, ...)
+               if [ "$kde_includedir" = "" ]
+               then
+                     if [ -f "/usr/include/kcomponentdata.h" ]
+                     then
+                             kde_includedir="/usr/include"
+                     elif [ -f "/usr/local/include/kcomponentdata.h" ]
+                     then
+                             kde_includedir="/usr/local/include"
+                     fi
+               fi
+               if [ -d "$kde_includedir" ]
+               then
+                       echo "KDE version 4.x detected, will enable extra image formats"
+                       echo "#define USE_KDE4" >> config.h
+                       echo "USE_KDE4=1" >> config.mak
+                       echo KDECXXFLAGS=-I$kde_includedir >> config.mak
+                       echo KDELIBS=-lkdecore >> config.mak
+               fi
+       fi
+
        [ "$gpl3" = "true" ] && echo GPL3=1 >> config.mak
        exit 0
 fi
index 8f31af2a69b4951f1fcb9072b8c309ba04359e4f..e9a9a7165abdf0e98e929c6e66a3be85b5057521 100644 (file)
@@ -48,10 +48,10 @@ mlt_producer producer_qimage_init( mlt_profile profile, mlt_service_type type, c
                // Get the properties interface
                mlt_properties properties = MLT_PRODUCER_PROPERTIES( &self->parent );
        
-               // Callback registration
-#ifdef USE_KDE
+               // Initialize KDE image plugins
                init_qimage();
-#endif
+
+               // Callback registration
                producer->get_frame = producer_get_frame;
                producer->close = ( mlt_destructor )producer_close;
 
index 13aafbf609d6f78a78d467bfc48a134d7cc8bbf0..2328054ef049d84eef10488ce663775f33c20e04 100644 (file)
 #include <qimage.h>
 #include <qmutex.h>
 
-#ifdef USE_KDE
+#ifdef USE_KDE3
 #include <kinstance.h>
 #include <kimageio.h>
 #endif
-
 #endif
 
+#ifdef USE_KDE4
+#include <kcomponentdata.h>
+#endif
 
 #ifdef USE_QT4
 #include <QtGui/QImage>
@@ -55,7 +57,9 @@ extern "C" {
 #include <framework/mlt_pool.h>
 #include <framework/mlt_cache.h>
 
-#ifdef USE_KDE
+#ifdef USE_KDE4
+static KComponentData *instance = 0L;
+#elif USE_KDE3
 static KInstance *instance = 0L;
 #endif
 
@@ -64,21 +68,27 @@ static void qimage_delete( void *data )
        QImage *image = ( QImage * )data;
        delete image;
        image = NULL;
-#ifdef USE_KDE
+#if defined(USE_KDE3) || defined(USE_KDE4) 
        if (instance) delete instance;
        instance = 0L;
 #endif
+
 }
 
-#ifdef USE_KDE
 void init_qimage()
 {
-       if (!instance) {
-           instance = new KInstance("qimage_prod");
+#ifdef USE_KDE4
+       if ( !instance ) {
+           instance = new KComponentData( "qimage_prod" );
+       }
+#elif defined(USE_KDE3)
+       if ( !instance ) {
+           instance = new KInstance( "qimage_prod" );
            KImageIO::registerFormats();
        }
-}
 #endif
+  
+}
 
 static QImage* reorient_with_exif( producer_qimage self, int image_idx, QImage *qimage )
 {
index b14c29106804400488db65adb6dc918659c5d07d..7e4b7395421d44b33f1e964a8f6b8d44910b7f3a 100644 (file)
@@ -56,10 +56,8 @@ typedef struct producer_qimage_s *producer_qimage;
 extern int refresh_qimage( producer_qimage self, mlt_frame frame );
 extern void refresh_image( producer_qimage, mlt_frame, mlt_image_format, int width, int height );
 extern void make_tempfile( producer_qimage, const char *xml );
-
-#ifdef USE_KDE
 extern void init_qimage();
-#endif
+
 
 #ifdef __cplusplus
 }