CuteLogger
Fast and simple logging solution for Qt based applications
encodedock.h
1/*
2 * Copyright (c) 2012-2022 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 ENCODEDOCK_H
19#define ENCODEDOCK_H
20
21#include "settings.h"
22
23#include <QDockWidget>
24#include <QDomElement>
25#include <QStandardItemModel>
26#include <QSortFilterProxyModel>
27#include <MltProperties.h>
28
29class QTreeWidgetItem;
30namespace Ui {
31class EncodeDock;
32}
33class AbstractJob;
34class MeltJob;
35namespace Mlt {
36class Service;
37class Producer;
38}
39
40class PresetsProxyModel : public QSortFilterProxyModel
41{
42protected:
43 bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
44};
45
46class EncodeDock : public QDockWidget
47{
48 Q_OBJECT
49
50public:
51 explicit EncodeDock(QWidget *parent = 0);
52 ~EncodeDock();
53
54 void loadPresetFromProperties(Mlt::Properties &);
55 bool isExportInProgress() const;
56
57signals:
58 void captureStateChanged(bool);
59
60public slots:
61 void onAudioChannelsChanged();
62 void onProducerOpened();
63 void onProfileChanged();
64 void on_hwencodeButton_clicked();
65 bool detectHardwareEncoders();
66
67private slots:
68 void on_presetsTree_clicked(const QModelIndex &index);
69 void on_presetsTree_activated(const QModelIndex &index);
70
71 void on_encodeButton_clicked();
72
73 void on_streamButton_clicked();
74
75 void on_addPresetButton_clicked();
76
77 void on_removePresetButton_clicked();
78
79 void onFinished(AbstractJob *, bool isSuccess);
80
81 void on_stopCaptureButton_clicked();
82
83 void on_videoRateControlCombo_activated(int index);
84
85 void on_audioRateControlCombo_activated(int index);
86
87 void on_scanModeCombo_currentIndexChanged(int index);
88
89 void on_presetsSearch_textChanged(const QString &search);
90
91 void on_resetButton_clicked();
92
93 void openCaptureFile();
94
95 void on_formatCombo_currentIndexChanged(int index);
96
97 void on_videoBufferDurationChanged();
98
99 void on_gopSpinner_valueChanged(int value);
100
101 void on_fromCombo_currentIndexChanged(int index);
102
103 void on_videoCodecCombo_currentIndexChanged(int index);
104
105 void on_audioCodecCombo_currentIndexChanged(int index);
106
107 void setAudioChannels( int channels );
108
109 void on_widthSpinner_editingFinished();
110
111 void on_heightSpinner_editingFinished();
112
113 void on_advancedButton_clicked(bool checked);
114
115 void on_hwencodeCheckBox_clicked(bool checked);
116
117 void on_advancedCheckBox_clicked(bool checked);
118
119 void on_fpsSpinner_editingFinished();
120
121 void on_fpsComboBox_activated(int arg1);
122
123 void on_videoQualitySpinner_valueChanged(int vq);
124
125 void on_audioQualitySpinner_valueChanged(int aq);
126
127 void on_parallelCheckbox_clicked(bool checked);
128
129 void on_resolutionComboBox_activated(int arg1);
130
131private:
132 enum {
133 RateControlAverage = 0,
134 RateControlConstant,
135 RateControlQuality,
136 RateControlConstrained
137 };
138 enum {
139 AudioChannels1 = 0,
140 AudioChannels2,
141 AudioChannels6,
142 };
143 Ui::EncodeDock *ui;
144 Mlt::Properties *m_presets;
145 QScopedPointer<MeltJob> m_immediateJob;
146 QString m_extension;
147 Mlt::Properties *m_profiles;
148 PresetsProxyModel m_presetsModel;
149 QStringList m_outputFilenames;
150 bool m_isDefaultSettings;
151 double m_fps;
152
153 void loadPresets();
154 Mlt::Properties *collectProperties(int realtime, bool includeProfile = false);
155 void collectProperties(QDomElement &node, int realtime);
156 MeltJob *createMeltJob(Mlt::Producer *service, const QString &target, int realtime, int pass = 0,
157 const QThread::Priority priority = Settings.jobPriority());
158 void runMelt(const QString &target, int realtime = -1);
159 void enqueueAnalysis();
160 void enqueueMelt(const QStringList &targets, int realtime);
161 void encode(const QString &target);
162 void resetOptions();
163 Mlt::Producer *fromProducer() const;
164 static void filterX265Params(QStringList &other);
165 void onVideoCodecComboChanged(int index, bool ignorePreset = false);
166 bool checkForMissingFiles();
167 QString &defaultFormatExtension();
168};
169
170#endif // ENCODEDOCK_H