]> git.sesse.net Git - kdenlive/blobdiff - src/kthumb.h
Many improvements to title clips (recreate when missing, fix text selection visible...
[kdenlive] / src / kthumb.h
index a8637e90145bceaf03cf5d43936bf0d7df6b7663..ae56c9f6eeeb9cb1ba3a651cb67d9f06753f8465 100644 (file)
 #ifndef KTHUMB_H
 #define KTHUMB_H
 
-#include <qobject.h>
-#include <qpixmap.h>
-#include <qfile.h>
-#include <qthread.h>
+#include <QPixmap>
+#include <QFile>
+#include <QThread>
+#include <QMutex>
+#include <QDomElement>
 
-#include <kurl.h>
+#include <KUrl>
 
 #include <mlt++/Mlt.h>
 
@@ -47,6 +48,8 @@ class Profile;
 
 class ClipManager;
 
+
+
 class MyThread : public QThread {
 
 public:
@@ -68,33 +71,62 @@ private:
 };
 
 
+class ThumbThread : public QThread {
+    Q_OBJECT
+public:
+    virtual void run();
+    void init(QObject *parent, Mlt::Producer *prod, int width, int height);
+    void setThumbFrames(Mlt::Producer *prod, int frame1, int frame2);
+    bool isWorking();
+    bool stop_me;
+
+private:
+    int m_width;
+    int m_height;
+    int m_frame1;
+    int m_frame2;
+    Mlt::Producer *m_prod;
+    bool m_isWorking;
+    QObject *m_parent;
+    //QMutex mutex;
+
+signals:
+    void gotStartThumb(QImage);
+    void gotEndThumb(QImage);
+
+};
+
 class KThumb: public QObject {
 Q_OBJECT public:
 
 
-    KThumb(ClipManager *clipManager, KUrl url, int width, int height, QObject * parent = 0, const char *name = 0);
+    KThumb(ClipManager *clipManager, KUrl url, QObject * parent = 0, const char *name = 0);
     ~KThumb();
+    void setProducer(Mlt::Producer *producer);
 
 public slots:
     void extractImage(int frame, int frame2);
+    QPixmap extractImage(int frame, int width, int height);
+    void updateClipUrl(KUrl url);
     static QPixmap getImage(KUrl url, int width, int height);
+//    static QPixmap getImage(QDomElement xml, int frame, int width, int height);
     /* void getImage(KUrl url, int frame, int width, int height);
      void getThumbs(KUrl url, int startframe, int endframe, int width, int height);*/
     void stopAudioThumbs();
     void removeAudioThumb();
     void getAudioThumbs(int channel, double frame, double frameLength, int arrayWidth);
     static QPixmap getImage(KUrl url, int frame, int width, int height);
-    static QPixmap getFrame(Mlt::Producer* producer, int frame, int width, int height);
+    static QPixmap getFrame(Mlt::Producer *producer, int framepos, int width, int height);
+
 protected:
     virtual void customEvent(QEvent * event);
 
 private:
-    MyThread thumbProducer;
+    MyThread audioThumbProducer;
     KUrl m_url;
     QString m_thumbFile;
-    int m_width;
-    int m_height;
-    Mlt::Profile *m_profile;
+    double m_dar;
+    Mlt::Producer *m_producer;
     ClipManager *m_clipManager;
 
 signals: