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 onAudioChannelsChanged();
62  void onProducerOpened();
63  void onProfileChanged();
64 
65 private slots:
66  void on_presetsTree_clicked(const QModelIndex &index);
67  void on_presetsTree_activated(const QModelIndex &index);
68 
69  void on_encodeButton_clicked();
70 
71  void on_streamButton_clicked();
72 
73  void on_addPresetButton_clicked();
74 
75  void on_removePresetButton_clicked();
76 
77  void onFinished(AbstractJob*, bool isSuccess);
78 
79  void on_stopCaptureButton_clicked();
80 
81  void on_videoRateControlCombo_activated(int index);
82 
83  void on_audioRateControlCombo_activated(int index);
84 
85  void on_scanModeCombo_currentIndexChanged(int index);
86 
87  void on_presetsSearch_textChanged(const QString &search);
88 
89  void on_resetButton_clicked();
90 
91  void openCaptureFile();
92 
93  void on_formatCombo_currentIndexChanged(int index);
94 
95  void on_videoBufferDurationChanged();
96 
97  void on_gopSpinner_valueChanged(int value);
98 
99  void on_fromCombo_currentIndexChanged(int index);
100 
101  void on_videoCodecCombo_currentIndexChanged(int index);
102 
103  void setAudioChannels( int channels );
104 
105  void on_widthSpinner_editingFinished();
106 
107  void on_heightSpinner_editingFinished();
108 
109  void on_advancedButton_clicked(bool checked);
110 
111  void on_hwencodeCheckBox_clicked(bool checked);
112 
113  void on_hwencodeButton_clicked();
114 
115  void on_advancedCheckBox_clicked(bool checked);
116 
117 private:
118  enum {
119  RateControlAverage = 0,
120  RateControlConstant,
121  RateControlQuality,
122  RateControlConstrained
123  };
124  enum {
125  AudioChannels1 = 0,
126  AudioChannels2,
127  AudioChannels6,
128  };
129  Ui::EncodeDock *ui;
130  Mlt::Properties *m_presets;
131  QScopedPointer<MeltJob> m_immediateJob;
132  QString m_extension;
133  Mlt::Properties *m_profiles;
134  PresetsProxyModel m_presetsModel;
135  QString m_outputFilename;
136  bool m_isDefaultSettings;
137 
138  void loadPresets();
139  Mlt::Properties* collectProperties(int realtime);
140  void collectProperties(QDomElement& node, int realtime);
141  MeltJob* createMeltJob(Mlt::Producer* service, const QString& target, int realtime, int pass = 0);
142  void runMelt(const QString& target, int realtime = -1);
143  void enqueueMelt(const QString& target, int realtime);
144  void encode(const QString& target);
145  void resetOptions();
146  Mlt::Producer* fromProducer() const;
147 };
148 
149 #endif // ENCODEDOCK_H
Definition: encodedock.h:35
Definition: addencodepresetdialog.h:24