1 /* 2 * Copyright (c) 2012-2021 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 AVFORMATPRODUCERWIDGET_H 19 #define AVFORMATPRODUCERWIDGET_H 20 21 #include <QWidget> 22 #include <QRunnable> 23 #include "abstractproducerwidget.h" 24 #include "sharedframe.h" 25 #include "dialogs/transcodedialog.h" 26 27 namespace Ui { 28 class AvformatProducerWidget; 29 } 30 31 class AvformatProducerWidget : public QWidget, public AbstractProducerWidget 32 { 33 Q_OBJECT 34 35 public: 36 explicit AvformatProducerWidget(QWidget *parent = 0); 37 ~AvformatProducerWidget(); 38 39 // AbstractProducerWidget overrides 40 Mlt::Producer* newProducer(Mlt::Profile&); 41 void setProducer(Mlt::Producer*); 42 43 public slots: 44 void updateDuration(); 45 void rename(); 46 47 signals: 48 void producerChanged(Mlt::Producer*); 49 void producerReopened(bool play); 50 void modified(); 51 52 protected: 53 void keyPressEvent(QKeyEvent *event); 54 55 private slots: 56 void onFrameDisplayed(const SharedFrame&); 57 58 void onProducerChanged(); 59 60 void onFrameDecoded(); 61 62 void on_videoTrackComboBox_activated(int index); 63 64 void on_audioTrackComboBox_activated(int index); 65 66 void on_scanComboBox_activated(int index); 67 68 void on_fieldOrderComboBox_activated(int index); 69 70 void on_aspectNumSpinBox_valueChanged(int ); 71 72 void on_aspectDenSpinBox_valueChanged(int ); 73 74 void on_durationSpinBox_editingFinished(); 75 76 void on_speedSpinBox_editingFinished(); 77 78 void on_pitchCheckBox_stateChanged(int state); 79 80 void on_syncSlider_valueChanged(int value); 81 82 void on_actionOpenFolder_triggered(); 83 84 void on_menuButton_clicked(); 85 86 void on_actionCopyFullFilePath_triggered(); 87 88 void on_notesTextEdit_textChanged(); 89 90 void on_actionFFmpegInfo_triggered(); 91 92 void on_actionFFmpegIntegrityCheck_triggered(); 93 94 void on_actionFFmpegConvert_triggered(); 95 96 void on_reverseButton_clicked(); 97 98 void on_actionExtractSubclip_triggered(); 99 100 void on_actionSetFileDate_triggered(); 101 102 void on_rangeComboBox_activated(int index); 103 104 void on_filenameLabel_editingFinished(); 105 106 void on_convertButton_clicked(); 107 108 void on_actionDisableProxy_triggered(bool checked); 109 110 void on_actionMakeProxy_triggered(); 111 112 void on_actionDeleteProxy_triggered(); 113 114 void on_actionCopyHashCode_triggered(); 115 116 void on_proxyButton_clicked(); 117 118 void on_actionReset_triggered(); 119 120 void on_actionSetEquirectangular_triggered(); 121 122 private: 123 Ui::AvformatProducerWidget *ui; 124 int m_defaultDuration; 125 bool m_recalcDuration; 126 bool m_askToConvert; 127 128 void reopen(Mlt::Producer* p); 129 void recreateProducer(); 130 void convert(TranscodeDialog& dialog); 131 bool revertToOriginalResource(); 132 }; 133 134 135 class DecodeTask : public QObject, public QRunnable 136 { 137 Q_OBJECT 138 139 public: 140 explicit DecodeTask(AvformatProducerWidget* widget); 141 void run(); 142 143 signals: 144 void frameDecoded(); 145 146 private: 147 QScopedPointer<Mlt::Frame> m_frame; 148 }; 149 150 #endif // AVFORMATPRODUCERWIDGET_H 151