Debian Codegraph @

plugins/opus/encoderopus.h

raw
1 /*
2 Copyright (C) 2005 Benjamin Meyer <ben at meyerhome dot net>
3 Copyright (C) 2018 Yuri Chornoivan <[email protected]>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
18 USA.
19 */
20
21 #ifndef ENCODER_OPUS_H
22 #define ENCODER_OPUS_H
23
24 #include "audiocdencoder.h"
25 #include "ui_encoderopusconfig.h"
26
27 #include <KProcess>
28
29 class EncoderOpusConfig : public QWidget, public Ui::EncoderOpusConfig
30 {
31 public:
32 EncoderOpusConfig(QWidget *parent = nullptr)
33 : QWidget(parent)
34 {
35 setupUi(this);
36 }
37 };
38
39 /**
40 * Opus encoder.
41 * Check out https://opus-codec.org/ for lots of information.
42 */
43 class EncoderOpus : public QObject, public AudioCDEncoder
44 {
45 Q_OBJECT
46
47 public:
48 explicit EncoderOpus(KIO::WorkerBase *worker);
49 ~EncoderOpus() override;
50
51 QString type() const override
52 {
53 return QStringLiteral("Opus");
54 }
55 bool init() override;
56 void loadSettings() override;
57 unsigned long size(long time_secs) const override;
58 const char *fileType() const override
59 {
60 return "opus";
61 }
62 const char *mimeType() const override
63 {
64 return "audio/x-opus+ogg";
65 }
66 void fillSongInfo(KCDDB::CDInfo info, int track, const QString &comment) override;
67 long readInit(long size) override;
68 long read(qint16 *buf, int frames) override;
69 long readCleanup() override;
70 QString lastErrorMessage() const override;
71
72 QWidget *getConfigureWidget(KConfigSkeleton **manager) const override;
73
74 protected Q_SLOTS:
75 void receivedStdout();
76 void receivedStderr();
77 void processExited(int exitCode, QProcess::ExitStatus /*status*/);
78
79 private:
80 class Private;
81 Private *d;
82
83 QStringList args;
84 QStringList trackInfo;
85 };
86
87 #endif // ENCODER_OPUS_H