File indexing completed on 2024-12-22 04:40:08

0001 /*
0002     SPDX-FileCopyrightText: 2010-2022 Mladen Milinkovic <max@smoothware.net>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef TEXTDEMUX_H
0008 #define TEXTDEMUX_H
0009 
0010 #include <QExplicitlySharedDataPointer>
0011 #include <QObject>
0012 
0013 QT_FORWARD_DECLARE_CLASS(QWidget)
0014 QT_FORWARD_DECLARE_CLASS(QProgressBar)
0015 
0016 namespace SubtitleComposer {
0017 class Subtitle;
0018 class StreamProcessor;
0019 
0020 class TextDemux : public QObject
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025     explicit TextDemux(QWidget *parent=NULL);
0026 
0027     void demuxFile(Subtitle *subtitle, const QString filename, int textStreamIndex);
0028 
0029     QWidget * progressWidget();
0030 
0031 signals:
0032     void onError(const QString &message);
0033 
0034 private slots:
0035     void onStreamData(const QString &text, quint64 msecStart, quint64 msecDuration);
0036     void onStreamProgress(quint64 msecPos, quint64 msecLength);
0037     void onStreamError(int code, const QString &message, const QString &debug);
0038     void onStreamFinished();
0039 
0040 private:
0041     QExplicitlySharedDataPointer<Subtitle> m_subtitle;
0042     QExplicitlySharedDataPointer<Subtitle> m_subtitleTemp;
0043     StreamProcessor *m_streamProcessor;
0044 
0045     QWidget *m_progressWidget;
0046     QProgressBar *m_progressBar;
0047 };
0048 }
0049 
0050 #endif // TEXTDEMUX_H