File indexing completed on 2024-05-19 04:51:10
0001 /* 0002 Copyright (C) 2005 Benjamin Meyer <ben at meyerhome dot net> 0003 0004 This program is free software; you can redistribute it and/or modify 0005 it under the terms of the GNU General Public License as published by 0006 the Free Software Foundation; either version 2 of the License, or 0007 (at your option) any later version. 0008 0009 This program is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 GNU General Public License for more details. 0013 0014 You should have received a copy of the GNU General Public License 0015 along with this program; if not, write to the Free Software 0016 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 0017 USA. 0018 */ 0019 0020 #ifndef ENCODER_LAME_H 0021 #define ENCODER_LAME_H 0022 0023 #include "audiocdencoder.h" 0024 #include "ui_encoderlameconfig.h" 0025 0026 #include <KProcess> 0027 0028 class EncoderLameConfig : public QWidget, public Ui::EncoderLameConfig 0029 { 0030 public: 0031 EncoderLameConfig(QWidget *parent = nullptr) 0032 : QWidget(parent) 0033 { 0034 setupUi(this); 0035 } 0036 }; 0037 0038 /** 0039 * MP3 encoder using the LAME encoder. 0040 * Go to https://lame.sourceforge.io/ for more information. 0041 */ 0042 class EncoderLame : public QObject, public AudioCDEncoder { 0043 Q_OBJECT 0044 0045 public: 0046 explicit EncoderLame(KIO::WorkerBase *worker); 0047 ~EncoderLame() override; 0048 0049 QString type() const override 0050 { 0051 return QStringLiteral("MP3"); 0052 } 0053 bool init() override; 0054 void loadSettings() override; 0055 unsigned long size(long time_secs) const override; 0056 const char *fileType() const override 0057 { 0058 return "mp3"; 0059 } 0060 const char *mimeType() const override 0061 { 0062 return "audio/x-mp3"; 0063 } 0064 void fillSongInfo(KCDDB::CDInfo info, int track, const QString &comment) override; 0065 long readInit(long size) override; 0066 long read(qint16 *buf, int frames) override; 0067 long readCleanup() override; 0068 QString lastErrorMessage() const override; 0069 0070 QWidget *getConfigureWidget(KConfigSkeleton **manager) const override; 0071 0072 protected Q_SLOTS: 0073 // void wroteStdin(); 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_LAME_H