Debian Codegraph @

plugins/lame/encoderlame.h

raw
1 /*
2 Copyright (C) 2005 Benjamin Meyer <ben at meyerhome dot net>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17 USA.
18 */
19
20 #ifndef ENCODER_LAME_H
21 #define ENCODER_LAME_H
22
23 #include "audiocdencoder.h"
24 #include "ui_encoderlameconfig.h"
25
26 #include <KProcess>
27
28 class EncoderLameConfig : public QWidget, public Ui::EncoderLameConfig
29 {
30 public:
31 EncoderLameConfig(QWidget *parent = nullptr)
32 : QWidget(parent)
33 {
34 setupUi(this);
35 }
36 };
37
38 /**
39 * MP3 encoder using the LAME encoder.
40 * Go to https://lame.sourceforge.io/ for more information.
41 */
42 class EncoderLame : public QObject, public AudioCDEncoder
43 {
44 Q_OBJECT
45
46 public:
47 explicit EncoderLame(KIO::WorkerBase *worker);
48 ~EncoderLame() override;
49
50 QString type() const override
51 {
52 return QStringLiteral("MP3");
53 }
54 bool init() override;
55 void loadSettings() override;
56 unsigned long size(long time_secs) const override;
57 const char *fileType() const override
58 {
59 return "mp3";
60 }
61 const char *mimeType() const override
62 {
63 return "audio/x-mp3";
64 }
65 void fillSongInfo(KCDDB::CDInfo info, int track, const QString &comment) override;
66 long readInit(long size) override;
67 long read(qint16 *buf, int frames) override;
68 long readCleanup() override;
69 QString lastErrorMessage() const override;
70
71 QWidget *getConfigureWidget(KConfigSkeleton **manager) const override;
72
73 protected Q_SLOTS:
74 // void wroteStdin();
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_LAME_H