]> git.sesse.net Git - kdenlive/blob - src/kthumb.h
e6bed31e760df1881c4022224554e4e9bdad900d
[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 <QPixmap>
22 #include <QFile>
23 #include <QThread>
24 #include <QDomElement>
25
26 #include <KUrl>
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     void setProducer(Mlt::Producer *producer);
78
79 public slots:
80     void extractImage(int frame, int frame2);
81     void updateClipUrl(KUrl url);
82     static QPixmap getImage(KUrl url, int width, int height);
83     static QPixmap getImage(QDomElement xml, int frame, int width, int height);
84     /* void getImage(KUrl url, int frame, int width, int height);
85      void getThumbs(KUrl url, int startframe, int endframe, int width, int height);*/
86     void stopAudioThumbs();
87     void removeAudioThumb();
88     void getAudioThumbs(int channel, double frame, double frameLength, int arrayWidth);
89     static QPixmap getImage(KUrl url, int frame, int width, int height);
90     static QPixmap getFrame(Mlt::Producer producer, int framepos, int width, int height);
91
92 protected:
93     virtual void customEvent(QEvent * event);
94
95 private:
96     MyThread thumbProducer;
97     KUrl m_url;
98     QString m_thumbFile;
99     double m_dar;
100     Mlt::Producer *m_producer;
101     ClipManager *m_clipManager;
102
103 signals:
104     void thumbReady(int frame, QPixmap pm);
105     void audioThumbReady(QMap <int, QMap <int, QByteArray> >);
106 };
107
108 #endif