]> git.sesse.net Git - kdenlive/blob - src/kthumb.h
*Re-introduce slideshow clips
[kdenlive] / src / kthumb.h
1 /***************************************************************************
2                          kthumb.h  -  description
3                             -------------------
4    begin                : Fri Nov 22 2002
5    copyright            : (C) 2002 by Jason Wood
6    email                : jasonwood@blueyonder.co.uk
7 ***************************************************************************/
8
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17
18 #ifndef KTHUMB_H
19 #define KTHUMB_H
20
21 #include <qobject.h>
22 #include <qpixmap.h>
23 #include <qfile.h>
24 #include <qthread.h>
25
26 #include <kurl.h>
27
28 #include <mlt++/Mlt.h>
29
30
31 /**KRender encapsulates the client side of the interface to a renderer.
32 From Kdenlive's point of view, you treat the KRender object as the
33 renderer, and simply use it as if it was local. Calls are asyncrhonous -
34 you send a call out, and then recieve the return value through the
35 relevant signal that get's emitted once the call completes.
36   *@author Jason Wood
37   */
38
39
40 namespace Mlt {
41 class Miracle;
42 class Consumer;
43 class Producer;
44 class Frame;
45 class Profile;
46 };
47
48 class ClipManager;
49
50 class MyThread : public QThread {
51
52 public:
53     virtual void run();
54     void init(QObject *parent, KUrl url, QString target, double frame, double frameLength, int frequency, int channels, int arrayWidth);
55     bool isWorking();
56     bool stop_me;
57
58 private:
59     QFile f;
60     KUrl m_url;
61     double m_frame;
62     double m_frameLength;
63     int m_frequency;
64     int m_channels;
65     int m_arrayWidth;
66     bool m_isWorking;
67     QObject *m_parent;
68 };
69
70
71 class KThumb: public QObject {
72 Q_OBJECT public:
73
74
75     KThumb(ClipManager *clipManager, KUrl url, QObject * parent = 0, const char *name = 0);
76     ~KThumb();
77
78 public slots:
79     void extractImage(int frame, int frame2);
80     static QPixmap getImage(KUrl url, int width, int height);
81     static QPixmap getImage(QDomElement xml, int frame, int width, int height);
82     /* void getImage(KUrl url, int frame, int width, int height);
83      void getThumbs(KUrl url, int startframe, int endframe, int width, int height);*/
84     void stopAudioThumbs();
85     void removeAudioThumb();
86     void getAudioThumbs(int channel, double frame, double frameLength, int arrayWidth);
87     static QPixmap getImage(KUrl url, int frame, int width, int height);
88     static QPixmap getFrame(Mlt::Producer* producer, int frame, int width, int height);
89 protected:
90     virtual void customEvent(QEvent * event);
91
92 private:
93     MyThread thumbProducer;
94     KUrl m_url;
95     QString m_thumbFile;
96     Mlt::Profile *m_profile;
97     ClipManager *m_clipManager;
98
99 signals:
100     void thumbReady(int frame, QPixmap pm);
101     void audioThumbReady(QMap <int, QMap <int, QByteArray> >);
102 };
103
104 #endif