#include <QtCore/QSysInfo>
#include <QtCore/QMutex>
#include <QtCore/QtEndian>
+#include <QtCore/QTemporaryFile>
#endif
#ifdef USE_EXIF
-#include <exif-data.h>
+#include <libexif/exif-data.h>
#endif
#include <cmath>
if ( image_idx != self->qimage_idx )
qimage = NULL;
- if ( ( !qimage && !self->current_image ) || mlt_properties_get_int( producer_props, "_disable_exif" ) != disable_exif)
+ if ( !qimage || mlt_properties_get_int( producer_props, "_disable_exif" ) != disable_exif)
{
self->current_image = NULL;
qimage = new QImage( mlt_properties_get_value( self->filenames, image_idx ) );
exif_data_unref(d);
}
+ // Remember EXIF value, might be useful for someone
+ mlt_properties_set_int( producer_props, "_exif_orientation" , exif_orientation );
+
if ( exif_orientation > 1 )
{
// Rotate image according to exif data
#ifdef USE_QT4
// Note - the original qimage is already safe and ready for destruction
+ if ( qimage->depth() == 1 )
+ {
+ QImage temp = qimage->convertToFormat( QImage::Format_RGB32 );
+ delete qimage;
+ qimage = new QImage( temp );
+ }
QImage scaled = interp == 0 ? qimage->scaled( QSize( width, height ) ) :
qimage->scaled( QSize(width, height), Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
- QImage temp;
self->has_alpha = scaled.hasAlphaChannel();
#endif
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"