1 /* 2 SPDX-FileCopyrightText: 2010-2018 Mladen Milinkovic <max@smoothware.net> 3 4 SPDX-License-Identifier: GPL-2.0-or-later 5 */ 6 7 #ifndef TEXTDEMUX_H 8 #define TEXTDEMUX_H 9 10 #include <QExplicitlySharedDataPointer> 11 #include <QObject> 12 13 QT_FORWARD_DECLARE_CLASS(QWidget) QT_FORWARD_DECLARE_CLASS(QProgressBar)14QT_FORWARD_DECLARE_CLASS(QProgressBar) 15 16 namespace SubtitleComposer { 17 class Subtitle; 18 class StreamProcessor; 19 20 class TextDemux : public QObject 21 { 22 Q_OBJECT 23 24 public: 25 explicit TextDemux(QWidget *parent=NULL); 26 27 void demuxFile(Subtitle *subtitle, const QString filename, int textStreamIndex); 28 29 QWidget * progressWidget(); 30 31 signals: 32 void onError(const QString &message); 33 34 private slots: 35 void onStreamData(const QString &text, quint64 msecStart, quint64 msecDuration); 36 void onStreamProgress(quint64 msecPos, quint64 msecLength); 37 void onStreamError(int code, const QString &message, const QString &debug); 38 void onStreamFinished(); 39 40 private: 41 QExplicitlySharedDataPointer<Subtitle> m_subtitle; 42 QExplicitlySharedDataPointer<Subtitle> m_subtitleTemp; 43 StreamProcessor *m_streamProcessor; 44 45 QWidget *m_progressWidget; 46 QProgressBar *m_progressBar; 47 }; 48 } 49 50 #endif // TEXTDEMUX_H 51