/*
* qimage_wrapper.cpp -- a QT/QImage based producer for MLT
- * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
+ * Copyright (C) 2006 Visual Media
* Author: Charles Yates <charles.yates@gmail.com>
*
* NB: This module is designed to be functionally equivalent to the
#include "qimage_wrapper.h"
#include <qimage.h>
+
+
+#include "config.h"
+
+#ifdef USE_KDE
+#include <kinstance.h>
+#include <kimageio.h>
+#endif
+
#include <cmath>
extern "C" {
#include <framework/mlt_pool.h>
+#ifdef USE_KDE
+static KInstance *instance = 0L;
+#endif
+
static void qimage_delete( void *data )
{
QImage *image = ( QImage * )data;
delete image;
+#ifdef USE_KDE
+ if (instance) delete instance;
+ instance = 0L;
+#endif
}
static void clear_buffered_image( mlt_properties producer_props, uint8_t **current_image, uint8_t **current_alpha )
mlt_events_unblock( producer_props, NULL );
}
+void init_qimage()
+{
+#ifdef USE_KDE
+ if (!instance) {
+ instance = new KInstance("qimage_prod");
+ KImageIO::registerFormats();
+ }
+#endif
+}
+
void refresh_qimage( mlt_frame frame, int width, int height )
{
// Obtain a previous assigned qimage (if it exists)
if ( update_cache )
{
- mlt_frame cached = mlt_frame_init( );
+ mlt_frame cached = mlt_frame_init( MLT_PRODUCER_SERVICE( producer ) );
mlt_properties cached_props = MLT_FRAME_PROPERTIES( cached );
mlt_properties_set_int( cached_props, "width", current_width );
mlt_properties_set_int( cached_props, "height", current_height );