1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
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.
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.
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
24 #include "Tool_Abstract.h"
25 #include "Model_AudioFile.h"
31 class AbstractEncoderInfo
37 TYPE_APPROX_BITRATE = 1,
38 TYPE_QUALITY_LEVEL = 2,
39 TYPE_COMPRESSION_LEVEL = 3,
44 virtual bool isModeSupported(int mode) const = 0; //Returns whether the encoder does support the current RC mode
45 virtual int valueCount(int mode) const = 0; //The number of bitrate/quality values for current RC mode
46 virtual int valueAt(int mode, int index) const = 0; //The bitrate/quality value at 'index' for the current RC mode
47 virtual int valueType(int mode) const = 0; //The display type of the values for the current RC mode
50 class AbstractEncoder : public AbstractTool
55 AbstractEncoder(void);
56 virtual ~AbstractEncoder(void);
58 //Internal encoder API
59 virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag) = 0;
60 virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion) = 0;
61 virtual QString extension(void) = 0;
62 virtual const unsigned int *supportedSamplerates(void);
63 virtual const unsigned int *supportedChannelCount(void);
64 virtual const unsigned int *supportedBitdepths(void);
65 virtual const bool needsTimingInfo(void);
67 //Common setter methods
68 virtual void setBitrate(int bitrate);
69 virtual void setRCMode(int mode);
70 virtual void setCustomParams(const QString &customParams);
73 static const AbstractEncoderInfo *getEncoderInfo(void)
75 throw "This method is supposed to be re-implemented in derived classes!";
80 int m_configBitrate; //Bitrate *or* VBR-quality-level
81 int m_configRCMode; //Rate-control mode
82 QString m_configCustomParams; //Custom parameters, if any
85 bool isUnicode(const QString &text);
86 QString cleanTag(const QString &text);