File indexing completed on 2024-05-26 04:52:52
0001 /* 0002 Copyright (C) 2005 Benjamin Meyer <ben at meyerhome dot net> 0003 Copyright (C) 2018 Yuri Chornoivan <yurchor@mageia.org> 0004 0005 This program is free software; you can redistribute it and/or modify 0006 it under the terms of the GNU General Public License as published by 0007 the Free Software Foundation; either version 2 of the License, or 0008 (at your option) any later version. 0009 0010 This program is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 GNU General Public License for more details. 0014 0015 You should have received a copy of the GNU General Public License 0016 along with this program; if not, write to the Free Software 0017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 0018 USA. 0019 */ 0020 0021 #ifndef ENCODER_OPUS_H 0022 #define ENCODER_OPUS_H 0023 0024 #include "audiocdencoder.h" 0025 #include "ui_encoderopusconfig.h" 0026 0027 #include <KProcess> 0028 0029 class EncoderOpusConfig : public QWidget, public Ui::EncoderOpusConfig 0030 { 0031 public: 0032 EncoderOpusConfig(QWidget *parent = nullptr) 0033 : QWidget(parent) 0034 { 0035 setupUi(this); 0036 } 0037 }; 0038 0039 /** 0040 * Opus encoder. 0041 * Check out https://opus-codec.org/ for lots of information. 0042 */ 0043 class EncoderOpus : public QObject, public AudioCDEncoder { 0044 Q_OBJECT 0045 0046 public: 0047 explicit EncoderOpus(KIO::WorkerBase *worker); 0048 ~EncoderOpus() override; 0049 0050 QString type() const override 0051 { 0052 return QStringLiteral("Opus"); 0053 } 0054 bool init() override; 0055 void loadSettings() override; 0056 unsigned long size(long time_secs) const override; 0057 const char *fileType() const override 0058 { 0059 return "opus"; 0060 } 0061 const char *mimeType() const override 0062 { 0063 return "audio/x-opus+ogg"; 0064 } 0065 void fillSongInfo(KCDDB::CDInfo info, int track, const QString &comment) override; 0066 long readInit(long size) override; 0067 long read(qint16 *buf, int frames) override; 0068 long readCleanup() override; 0069 QString lastErrorMessage() const override; 0070 0071 QWidget *getConfigureWidget(KConfigSkeleton **manager) const override; 0072 0073 protected Q_SLOTS: 0074 void receivedStdout(); 0075 void receivedStderr(); 0076 void processExited(int exitCode, QProcess::ExitStatus /*status*/); 0077 0078 private: 0079 class Private; 0080 Private *d; 0081 0082 QStringList args; 0083 QStringList trackInfo; 0084 }; 0085 0086 #endif // ENCODER_OPUS_H