]> git.sesse.net Git - kdenlive/blobdiff - src/mltdevicecapture.cpp
Integrate with the required MLT hooks for getting Movit to work.
[kdenlive] / src / mltdevicecapture.cpp
index 6a23773d9f3cd06500eb9f60f0a73ae71856440f..c94f896dd2707840e243a43acfd3037407b0d7d7 100644 (file)
 #include "mltdevicecapture.h"
 #include "kdenlivesettings.h"
 #include "definitions.h"
+#include "widgets/videosurface.h"
 
 #include <mlt++/Mlt.h>
 
 #include <KDebug>
 #include <KStandardDirs>
 #include <KMessageBox>
-#include <KLocale>
+#include <KLocalizedString>
 #include <KTemporaryFile>
 
 #include <QTimer>
@@ -33,6 +34,7 @@
 #include <QString>
 #include <QApplication>
 #include <QThread>
+#include <QTimer>
 
 #include <cstdlib>
 #include <cstdarg>
@@ -77,7 +79,7 @@ static void rec_consumer_frame_preview(mlt_consumer, MltDeviceCapture * self, ml
 
 
 MltDeviceCapture::MltDeviceCapture(QString profile, VideoSurface *surface, QWidget *parent) :
-    AbstractRender(Kdenlive::recordMonitor, parent),
+    AbstractRender(Kdenlive::RecordMonitor, parent),
     doCapture(0),
     sendFrameForAnalysis(false),
     processingImage(false),
@@ -91,7 +93,8 @@ MltDeviceCapture::MltDeviceCapture(QString profile, VideoSurface *surface, QWidg
 {
     m_captureDisplayWidget = surface;
     analyseAudio = KdenliveSettings::monitor_audio();
-    if (profile.isEmpty()) profile = KdenliveSettings::current_profile();
+    if (profile.isEmpty())
+        profile = KdenliveSettings::current_profile();
     buildConsumer(profile);
     connect(this, SIGNAL(unblockPreview()), this, SLOT(slotPreparePreview()));
     m_droppedFramesTimer.setSingleShot(false);
@@ -252,13 +255,14 @@ void MltDeviceCapture::emitFrameUpdated(Mlt::Frame& frame)
     }
     */
 
-    mlt_image_format format = mlt_image_rgb24a;
+    mlt_image_format format = mlt_image_rgb24;
     int width = 0;
     int height = 0;
     const uchar* image = frame.get_image(format, width, height);
-    QImage qimage(width, height, QImage::Format_ARGB32_Premultiplied);
-    memcpy(qimage.bits(), image, width * height * 4);
-    emit frameUpdated(qimage.rgbSwapped());
+    QImage qimage(width, height, QImage::Format_RGB888);
+    //QImage qimage(width, height, QImage::Format_ARGB32_Premultiplied);
+    memcpy(qimage.bits(), image, width * height * 3);
+    emit frameUpdated(qimage);
 }
 
 void MltDeviceCapture::showFrame(Mlt::Frame& frame)
@@ -456,7 +460,7 @@ bool MltDeviceCapture::slotStartCapture(const QString &params, const QString &pa
 
     QStringList paramList = params.split(' ', QString::SkipEmptyParts);
     char *tmp2;
-    for (int i = 0; i < paramList.count(); i++) {
+    for (int i = 0; i < paramList.count(); ++i) {
         tmp = qstrdup(paramList.at(i).section('=', 0, 0).toUtf8().constData());
         QString value = paramList.at(i).section('=', 1, 1);
         if (value == "%threads") value = QString::number(QThread::idealThreadCount());
@@ -611,7 +615,7 @@ void MltDeviceCapture::setOverlay(const QString &path)
     //delete clip;
 }
 
-void MltDeviceCapture::setOverlayEffect(const QString &tag, QStringList parameters)
+void MltDeviceCapture::setOverlayEffect(const QString &tag, const QStringList &parameters)
 {
     if (m_mltProducer == NULL || !m_mltProducer->is_valid()) return;
     Mlt::Service service(m_mltProducer->parent().get_service());
@@ -770,3 +774,5 @@ void MltDeviceCapture::slotAllowPreview()
 }
 
 
+
+#include "mltdevicecapture.moc"