CuteLogger
Fast and simple logging solution for Qt based applications
encodedock.h
1 /*
2  * Copyright (c) 2012-2017 Meltytech, LLC
3  * Author: Dan Dennedy <dan@dennedy.org>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef ENCODEDOCK_H
20 #define ENCODEDOCK_H
21 
22 #include <QDockWidget>
23 #include <QDomElement>
24 #include <QStandardItemModel>
25 #include <QSortFilterProxyModel>
26 #include <MltProperties.h>
27 
28 class QTreeWidgetItem;
29 class QStringList;
30 namespace Ui {
31  class EncodeDock;
32 }
33 class AbstractJob;
34 class MeltJob;
35 namespace Mlt {
36  class Service;
37  class Producer;
38 }
39 
40 class PresetsProxyModel : public QSortFilterProxyModel
41 {
42 protected:
43  bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
44 };
45 
46 class EncodeDock : public QDockWidget
47 {
48  Q_OBJECT
49 
50 public:
51  explicit EncodeDock(QWidget *parent = 0);
52  ~EncodeDock();
53 
54  void loadPresetFromProperties(Mlt::Properties&);
55  bool isExportInProgress() const;
56 
57 signals:
58  void captureStateChanged(bool);
59 
60 public slots:
61  void onProducerOpened();
62  void onProfileChanged();
63 
64 private slots:
65  void on_presetsTree_clicked(const QModelIndex &index);
66  void on_presetsTree_activated(const QModelIndex &index);
67 
68  void on_encodeButton_clicked();
69 
70  void on_streamButton_clicked();
71 
72  void on_addPresetButton_clicked();
73 
74  void on_removePresetButton_clicked();
75 
76  void onFinished(AbstractJob*, bool isSuccess);
77 
78  void on_stopCaptureButton_clicked();
79 
80  void on_videoRateControlCombo_activated(int index);
81 
82  void on_audioRateControlCombo_activated(int index);
83 
84  void on_scanModeCombo_currentIndexChanged(int index);
85 
86  void on_presetsSearch_textChanged(const QString &search);
87 
88  void on_resetButton_clicked();
89 
90  void openCaptureFile();
91 
92  void on_formatCombo_currentIndexChanged(int index);
93 
94  void on_videoBufferDurationChanged();
95 
96  void on_gopSpinner_valueChanged(int value);
97 
98  void on_fromCombo_currentIndexChanged(int index);
99 
100  void on_videoCodecCombo_currentIndexChanged(int index);
101 
102 private:
103  enum {
104  RateControlAverage = 0,
105  RateControlConstant,
106  RateControlQuality,
107  RateControlConstrained
108  };
109  Ui::EncodeDock *ui;
110  Mlt::Properties *m_presets;
111  QScopedPointer<MeltJob> m_immediateJob;
112  QString m_extension;
113  Mlt::Properties *m_profiles;
114  PresetsProxyModel m_presetsModel;
115  QString m_outputFilename;
116  bool m_isDefaultSettings;
117 
118  void loadPresets();
119  Mlt::Properties* collectProperties(int realtime);
120  void collectProperties(QDomElement& node, int realtime);
121  MeltJob* createMeltJob(Mlt::Service* service, const QString& target, int realtime, int pass = 0);
122  void runMelt(const QString& target, int realtime = -1);
123  void enqueueMelt(const QString& target, int realtime);
124  void encode(const QString& target);
125  void resetOptions();
126  Mlt::Producer* fromProducer() const;
127 };
128 
129 #endif // ENCODEDOCK_H
Definition: encodedock.h:35
Definition: addencodepresetdialog.h:24