]> git.sesse.net Git - kdenlive/blob - src/kthumb.h
Reindent the codebase using 'linux' bracket placement.
[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 <QMutex>
25 #include <QDomElement>
26
27 #include <KUrl>
28
29 #include <mlt++/Mlt.h>
30
31
32 /**KRender encapsulates the client side of the interface to a renderer.
33 From Kdenlive's point of view, you treat the KRender object as the
34 renderer, and simply use it as if it was local. Calls are asyncrhonous -
35 you send a call out, and then receive the return value through the
36 relevant signal that get's emitted once the call completes.
37   *@author Jason Wood
38   */
39
40
41 namespace Mlt
42 {
43 class Miracle;
44 class Consumer;
45 class Producer;
46 class Frame;
47 class Profile;
48 };
49
50 class ClipManager;
51
52
53
54 class MyThread : public QThread
55 {
56     Q_OBJECT
57 public:
58     virtual void run();
59     void init(QObject *parent, KUrl url, QString target, double frame, double frameLength, int frequency, int channels, int arrayWidth);
60     bool isWorking();
61     bool stop_me;
62
63 private:
64     QFile f;
65     KUrl m_url;
66     double m_frame;
67     double m_frameLength;
68     int m_frequency;
69     int m_channels;
70     int m_arrayWidth;
71     bool m_isWorking;
72     QObject *m_parent;
73
74 signals:
75     void audioThumbProgress(const int);
76     void audioThumbOver();
77 };
78
79 class KThumb: public QObject
80 {
81 Q_OBJECT public:
82
83
84     KThumb(ClipManager *clipManager, KUrl url, const QString &id, const QString &hash, QObject * parent = 0, const char *name = 0);
85     ~KThumb();
86     void setProducer(Mlt::Producer *producer);
87     void askForAudioThumbs(const QString &id);
88     bool hasProducer() const;
89     void clearProducer();
90     void updateThumbUrl(const QString &hash);
91
92 public slots:
93     void extractImage(int frame, int frame2);
94     QPixmap extractImage(int frame, int width, int height);
95     void updateClipUrl(KUrl url, const QString &hash);
96     static QPixmap getImage(KUrl url, int width, int height);
97 //    static QPixmap getImage(QDomElement xml, int frame, int width, int height);
98     /* void getImage(KUrl url, int frame, int width, int height);
99      void getThumbs(KUrl url, int startframe, int endframe, int width, int height);*/
100     void stopAudioThumbs();
101     void removeAudioThumb();
102     void getAudioThumbs(int channel, double frame, double frameLength, int arrayWidth);
103     static QPixmap getImage(KUrl url, int frame, int width, int height);
104     static QPixmap getFrame(Mlt::Producer *producer, int framepos, int width, int height);
105
106 private slots:
107     void slotAudioThumbProgress(const int progress);
108     void slotAudioThumbOver();
109
110 private:
111     MyThread audioThumbProducer;
112     KUrl m_url;
113     QString m_thumbFile;
114     double m_dar;
115     Mlt::Producer *m_producer;
116     ClipManager *m_clipManager;
117     QString m_id;
118     int m_mainFrame;
119
120 signals:
121     void thumbReady(int, QPixmap);
122     void mainThumbReady(const QString &, QPixmap);
123     void audioThumbReady(QMap <int, QMap <int, QByteArray> >);
124 };
125
126 #endif