Updated SoX binary to v14.4.2-Git (2014-10-06), compiled with ICL 15.0 and MSVC 12.0.
[LameXP.git] / src / Encoder_Abstract.h
blob917bc25b28e4addbc2769b37340a06d8be7abc00
1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2014 LoRd_MuldeR <MuldeR2@GMX.de>
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, but always including the *additional*
9 // restrictions defined in the "License.txt" file.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this program; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 // http://www.gnu.org/licenses/gpl-2.0.txt
21 ///////////////////////////////////////////////////////////////////////////////
23 #pragma once
25 #include "Global.h"
26 #include "Tool_Abstract.h"
27 #include "Model_AudioFile.h"
29 class QProcess;
30 class QStringList;
31 class QMutex;
33 class AbstractEncoderInfo
35 public:
36 typedef enum
38 TYPE_BITRATE = 0,
39 TYPE_APPROX_BITRATE = 1,
40 TYPE_QUALITY_LEVEL_INT = 2,
41 TYPE_QUALITY_LEVEL_FLT = 3,
42 TYPE_COMPRESSION_LEVEL = 4,
43 TYPE_UNCOMPRESSED = 5
45 value_type_t;
47 virtual bool isModeSupported(int mode) const = 0; //Returns whether the encoder does support the current RC mode
48 virtual int valueCount(int mode) const = 0; //The number of bitrate/quality values for current RC mode
49 virtual int valueAt(int mode, int index) const = 0; //The bitrate/quality value at 'index' for the current RC mode
50 virtual int valueType(int mode) const = 0; //The display type of the values for the current RC mode
51 virtual const char* description(void) const = 0; //Description of the encoder that can be displayed to the user
54 class AbstractEncoder : public AbstractTool
56 Q_OBJECT
58 public:
59 AbstractEncoder(void);
60 virtual ~AbstractEncoder(void);
62 //Internal encoder API
63 virtual bool encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, const QString &outputFile, volatile bool *abortFlag) = 0;
64 virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion) = 0;
65 virtual QString extension(void) = 0;
66 virtual const unsigned int *supportedSamplerates(void);
67 virtual const unsigned int *supportedChannelCount(void);
68 virtual const unsigned int *supportedBitdepths(void);
69 virtual const bool needsTimingInfo(void);
71 //Common setter methods
72 virtual void setBitrate(int bitrate);
73 virtual void setRCMode(int mode);
74 virtual void setCustomParams(const QString &customParams);
76 //Encoder info
77 static const AbstractEncoderInfo *getEncoderInfo(void)
79 THROW("This method shall be re-implemented in derived classes!");
80 return NULL;
83 protected:
84 int m_configBitrate; //Bitrate *or* VBR-quality-level
85 int m_configRCMode; //Rate-control mode
86 QString m_configCustomParams; //Custom parameters, if any
88 //Helper functions
89 bool isUnicode(const QString &text);
90 QString cleanTag(const QString &text);