]> git.sesse.net Git - kdenlive/blob - src/kthumb.h
Fix audio thumbs progress info when window was not focused
[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, int width, int height, 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 /*      void getImage(KUrl url, int frame, int width, int height);
82         void getThumbs(KUrl url, int startframe, int endframe, int width, int height);*/
83         void stopAudioThumbs();
84         void removeAudioThumb();
85         void getAudioThumbs(int channel, double frame, double frameLength, int arrayWidth);
86
87 protected:
88     virtual void customEvent ( QEvent * event );
89
90 private:
91         MyThread thumbProducer;
92         KUrl m_url;
93         QString m_thumbFile;
94         int m_width;
95         int m_height;
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