cat << EOF
QImage options:
- --qimage-libdir - Location of QT lib directory [/usr/lib/qt3]
- --qimage-includedir - Location of QT include directory [/usr/include/qt3]
+ --force-qt3 - Force compile against Qt3 if Qt4 is present on the system
+ --qimage-libdir - Location of QT lib directory [/usr/lib/qt4 or /usr/lib/qt3]
+ --qimage-includedir - Location of QT include directory [/usr/include/qt4 or /usr/include/qt3]
--kde-libdir - Location of KDE lib directory [/usr/lib]
--kde-includedir - Location of KDE include directory [/usr/include/kde]
;;
esac
- qimage_includedir=/usr/include/qt3
- qimage_libdir=/usr/lib/qt3
+ qimage_includedir=/usr/include/qt4
+ qimage_libdir=/usr/lib/qt4
- kde_includedir=/usr/include/kde
- kde_libdir=/usr/lib
+ if [ -d "$qimage_libdir" -a -d "$qimage_includedir" ]
+ then
+ qimage_includedir=/usr/include/qt3
+ qimage_libdir=/usr/lib/qt3
+ kde_includedir=/usr/include/kde
+ kde_libdir=/usr/lib
+ if [ "$KDEDIR" != "" ]
+ then
+ kde_includedir="$KDEDIR/include"
+ kde_libdir="$KDEDIR"
+ fi
+ fi
if [ "$QTDIR" != "" ]
then
qimage_libdir="$QTDIR"
fi
- if [ "$KDEDIR" != "" ]
- then
- kde_includedir="$KDEDIR/include"
- kde_libdir="$KDEDIR"
- fi
+ export force_qt3=
+ export qt4_found=
for i in "$@"
do
--qimage-includedir=* ) qimage_includedir="${i#--qimage-includedir=}" ;;
--kde-libdir=* ) kde_libdir="${i#--kde-libdir=}" ;;
--kde-includedir=* ) kde_includedir="${i#--kde-includedir=}" ;;
+ --force-qt3 ) force_qt3="true" ;;
esac
done
if [ -d "$qimage_libdir" -a -d "$qimage_includedir" ]
then
+
+ # test if we have a Qt3 or Qt4
+ if test -f $QTDIR/lib/libQtCore.so && [ "$force_qt3" = "" ]
+ then
+ echo "Qt version 4.x detected, will compile Qt4 qimage producer"
+ qt4_found=true
+ else
+ echo "Qt version 3.x detected, will compile Qt3 qimage producer"
+ fi
+
+ echo "Include directory: " $qimage_includedir
+
echo > config.h
echo > config.mak
- if [ -d "$kde_includedir" ]
- then
- echo "#define USE_KDE" >> config.h
- echo "USE_KDE=1" >> config.mak
- echo QTCXXFLAGS=-I$qimage_includedir -I$kde_includedir >> config.mak
- echo QTLIBS=-L$qimage_libdir/lib -L$kde_libdir/lib -lqt-mt >> config.mak
- else
- echo "qimage: KDE environment not found - disabling extra image formats"
+ if [ "$qt4_found" != "" ] && [ "$force_qt3" = "" ]
+ then
+ echo "#define USE_QT4" >> config.h
+ echo "USE_QT4=1" >> config.mak
echo QTCXXFLAGS=-I$qimage_includedir >> config.mak
- echo QTLIBS=-L$qimage_libdir/lib -lqt-mt >> config.mak
+ echo QTLIBS=-L$qimage_libdir/lib -lQtGui >> config.mak
+ else
+ if [ -d "$kde_includedir" ]
+ then
+ echo "#define USE_KDE" >> config.h
+ echo "USE_KDE=1" >> config.mak
+ echo "#define USE_QT3" >> config.h
+ echo "USE_QT3=1" >> config.mak
+ echo QTCXXFLAGS=-I$qimage_includedir -I$kde_includedir >> config.mak
+ echo QTLIBS=-L$qimage_libdir/lib -L$kde_libdir/lib -lqt-mt >> config.mak
+ else
+ echo "qimage: KDE environment not found - disabling extra image formats"
+ echo "#define USE_QT3" >> config.h
+ echo "USE_QT3=1" >> config.mak
+ echo QTCXXFLAGS=-I$qimage_includedir >> config.mak
+ echo QTLIBS=-L$qimage_libdir/lib -lqt-mt >> config.mak
+ fi
fi
else
echo "qimage: QT environment not found - disabling"
mlt_properties properties = MLT_PRODUCER_PROPERTIES( &this->parent );
// Callback registration
+#ifdef USE_KDE
init_qimage();
+#endif
producer->get_frame = producer_get_frame;
producer->close = ( mlt_destructor )producer_close;
if ( stat( full, &buf ) == 0 )
{
sprintf( key, "%d", keyvalue ++ );
- mlt_properties_set( this->filenames, "0", full );
+ mlt_properties_set( this->filenames, key, full );
gap = 0;
}
else
*/
#include "qimage_wrapper.h"
-#include <qimage.h>
-
-#include "config.h"
+#ifdef USE_QT3
+#include <qimage.h>
#ifdef USE_KDE
#include <kinstance.h>
#include <kimageio.h>
#endif
+#endif
+
+
+#ifdef USE_QT4
+#include <QtGui/QImage>
+#include <QtCore/QSysInfo>
+#endif
+
+
#include <cmath>
extern "C" {
mlt_events_unblock( producer_props, NULL );
}
+#ifdef USE_KDE
void init_qimage()
{
-#ifdef USE_KDE
if (!instance) {
instance = new KInstance("qimage_prod");
KImageIO::registerFormats();
}
-#endif
}
+#endif
void refresh_qimage( mlt_frame frame, int width, int height )
{
// Get the original position of this frame
mlt_position position = mlt_properties_get_position( properties, "qimage_position" );
+ position += mlt_producer_get_in( producer );
// Image index
int image_idx = ( int )floor( ( double )position / ttl ) % self->count;
else if ( strcmp( interps, "hyper" ) == 0 )
interp = 1;
+#ifdef USE_QT4
+ // Note - the original qimage is already safe and ready for destruction
+ QImage scaled = interp == 0 ? qimage->scaled( QSize( width, height)) : qimage->scaled( QSize(width, height), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+ QImage temp = scaled.convertToFormat(QImage::Format_ARGB32);
+#endif
+
+#ifdef USE_QT3
// Note - the original qimage is already safe and ready for destruction
QImage scaled = interp == 0 ? qimage->scale( width, height, QImage::ScaleFree ) : qimage->smoothScale( width, height, QImage::ScaleFree );
QImage temp = scaled.convertDepth( 32 );
+#endif
// Store width and height
current_width = width;
// Allocate the alpha mask
current_alpha = ( uint8_t * )mlt_pool_alloc( current_width * current_height );
+#ifdef USE_QT4
+ if ( QSysInfo::ByteOrder == QSysInfo::BigEndian )
+ mlt_convert_argb_to_yuv422( temp.bits( ), current_width, current_height, temp.bytesPerLine( ), current_image, current_alpha );
+ else
+ mlt_convert_bgr24a_to_yuv422( temp.bits( ), current_width, current_height, temp.bytesPerLine( ), current_image, current_alpha );
+#endif
+
+#ifdef USE_QT3
// Convert the image
if ( QImage::systemByteOrder( ) == QImage::BigEndian )
mlt_convert_argb_to_yuv422( temp.bits( ), current_width, current_height, temp.bytesPerLine( ), current_image, current_alpha );
else
mlt_convert_bgr24a_to_yuv422( temp.bits( ), current_width, current_height, temp.bytesPerLine( ), current_image, current_alpha );
-
+#endif
assign_buffered_image( producer_props, current_image, current_alpha, current_width, current_height );
// Ensure we update the cache when we need to
#include <framework/mlt.h>
+#include "config.h"
+
#ifdef __cplusplus
extern "C" {
#endif
typedef struct producer_qimage_s *producer_qimage;
extern void refresh_qimage( mlt_frame, int width, int height );
+#ifdef USE_KDE
extern void init_qimage();
+#endif
#ifdef __cplusplus
}