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

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 SPEECHPLUGIN_H
0008 #define SPEECHPLUGIN_H
0009 
0010 #include <QObject>
0011 
0012 #define SpeechPlugin_iid "org.kde.SubtitleComposer.SpeechPlugin"
0013 
0014 class KCoreConfigSkeleton;
0015 class WaveFormat;
0016 
0017 namespace SubtitleComposer {
0018 class SpeechPlugin : public QObject
0019 {
0020     Q_OBJECT
0021 
0022     friend class SpeechProcessor;
0023     friend class ConfigDialog;
0024     template <class C, class T> friend class PluginHelper;
0025 
0026 protected:
0027     explicit SpeechPlugin();
0028 
0029     virtual QWidget * newConfigWidget(QWidget *parent) = 0;
0030     virtual KCoreConfigSkeleton * config() const = 0;
0031 
0032 private:
0033     virtual const QString & name() = 0;
0034 
0035     virtual const WaveFormat & waveFormat() const = 0;
0036 
0037     virtual bool init() = 0;
0038     virtual void cleanup() = 0;
0039 
0040     virtual void processSamples(const void *sampleData, qint32 sampleCount) = 0;
0041     virtual void processComplete() = 0;
0042 
0043 signals:
0044     void error(int code, const QString &message);
0045     void textRecognized(const QString &text, const double milliShow, const double milliHide);
0046 };
0047 }
0048 
0049 Q_DECLARE_INTERFACE(SubtitleComposer::SpeechPlugin, SpeechPlugin_iid)
0050 
0051 #endif // SPEECHPLUGIN_H