CuteLogger
Fast and simple logging solution for Qt based applications
producerpreviewwidget.h
1/*
2 * Copyright (c) 2020 Meltytech, LLC
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef PRODUCERPREVIEWWIDGET_H
19#define PRODUCERPREVIEWWIDGET_H
20
21#include "dataqueue.h"
22
23#include <MltProducer.h>
24
25#include <QFuture>
26#include <QPixmap>
27#include <QWidget>
28
29class QLabel;
30class ScrubBar;
31
32class ProducerPreviewWidget : public QWidget
33{
34 Q_OBJECT
35
36public:
37 explicit ProducerPreviewWidget(double dar, int width = 320);
38 virtual ~ProducerPreviewWidget();
39
40 void start(const Mlt::Producer &producer);
41 void stop(bool releaseProducer = true);
42 void showText(QString text);
43 void setLooping(bool enabled);
44
45public slots:
46 void restart();
47
48private slots:
49 void seeked(int);
50
51private:
52 void timerEvent(QTimerEvent *) override;
53 void frameGeneratorThread();
54 void generateFrame();
55
56 QSize m_previewSize;
57 QLabel *m_imageLabel;
58 ScrubBar *m_scrubber;
59 QLabel *m_posLabel;
60 int m_seekTo;
61 int m_timerId;
62 Mlt::Producer m_producer;
63 struct QueueItem {
64 QPixmap pixmap;
65 int position;
66 QString positionText;
67 };
69 QFuture<void> m_future;
70 bool m_generateFrames;
71 bool m_isLooping;
72};
73
74#endif // PRODUCERPREVIEWWIDGET_H
The DataQueue provides a thread safe container for passing data between objects.
Definition dataqueue.h:49