2010-11-17 19:35:50 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// LameXP - Audio Encoder Front-End
|
2014-01-01 17:05:52 +01:00
|
|
|
// Copyright (C) 2004-2014 LoRd_MuldeR <MuldeR2@GMX.de>
|
2010-11-17 19:35:50 +01:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
2013-10-23 20:56:57 +02:00
|
|
|
// (at your option) any later version, but always including the *additional*
|
|
|
|
// restrictions defined in the "License.txt" file.
|
2010-11-17 19:35:50 +01:00
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License along
|
|
|
|
// with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
//
|
|
|
|
// http://www.gnu.org/licenses/gpl-2.0.txt
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2014-11-30 21:32:23 +01:00
|
|
|
//Internal
|
2013-10-18 21:37:40 +02:00
|
|
|
#include "Global.h"
|
2010-12-01 23:14:47 +01:00
|
|
|
#include "Tool_Abstract.h"
|
2010-11-17 19:35:50 +01:00
|
|
|
#include "Model_AudioFile.h"
|
|
|
|
|
2014-11-30 21:32:23 +01:00
|
|
|
//MUtils
|
|
|
|
#include <MUtils/Exception.h>
|
|
|
|
|
2010-11-24 21:00:59 +01:00
|
|
|
class QProcess;
|
|
|
|
class QStringList;
|
|
|
|
class QMutex;
|
|
|
|
|
2013-09-30 21:39:56 +02:00
|
|
|
class AbstractEncoderInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TYPE_BITRATE = 0,
|
|
|
|
TYPE_APPROX_BITRATE = 1,
|
2013-10-07 02:28:01 +02:00
|
|
|
TYPE_QUALITY_LEVEL_INT = 2,
|
|
|
|
TYPE_QUALITY_LEVEL_FLT = 3,
|
|
|
|
TYPE_COMPRESSION_LEVEL = 4,
|
|
|
|
TYPE_UNCOMPRESSED = 5
|
2013-09-30 21:39:56 +02:00
|
|
|
}
|
|
|
|
value_type_t;
|
|
|
|
|
|
|
|
virtual bool isModeSupported(int mode) const = 0; //Returns whether the encoder does support the current RC mode
|
|
|
|
virtual int valueCount(int mode) const = 0; //The number of bitrate/quality values for current RC mode
|
|
|
|
virtual int valueAt(int mode, int index) const = 0; //The bitrate/quality value at 'index' for the current RC mode
|
|
|
|
virtual int valueType(int mode) const = 0; //The display type of the values for the current RC mode
|
2013-10-02 16:39:26 +02:00
|
|
|
virtual const char* description(void) const = 0; //Description of the encoder that can be displayed to the user
|
2013-09-30 21:39:56 +02:00
|
|
|
};
|
|
|
|
|
2010-12-01 23:14:47 +01:00
|
|
|
class AbstractEncoder : public AbstractTool
|
2010-11-17 19:35:50 +01:00
|
|
|
{
|
2010-11-20 02:14:22 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
2010-11-17 19:35:50 +01:00
|
|
|
public:
|
|
|
|
AbstractEncoder(void);
|
2013-01-18 01:08:58 +01:00
|
|
|
virtual ~AbstractEncoder(void);
|
2010-11-17 19:35:50 +01:00
|
|
|
|
2010-11-25 18:09:31 +01:00
|
|
|
//Internal encoder API
|
2013-10-12 22:55:41 +02:00
|
|
|
virtual bool encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, const QString &outputFile, volatile bool *abortFlag) = 0;
|
2010-11-25 18:09:31 +01:00
|
|
|
virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion) = 0;
|
2010-11-20 02:14:22 +01:00
|
|
|
virtual QString extension(void) = 0;
|
2011-12-21 01:23:21 +01:00
|
|
|
virtual const unsigned int *supportedSamplerates(void);
|
2011-12-23 00:43:11 +01:00
|
|
|
virtual const unsigned int *supportedChannelCount(void);
|
2011-12-21 01:23:21 +01:00
|
|
|
virtual const unsigned int *supportedBitdepths(void);
|
2012-07-21 19:16:12 +02:00
|
|
|
virtual const bool needsTimingInfo(void);
|
2010-11-17 19:35:50 +01:00
|
|
|
|
2010-11-25 18:09:31 +01:00
|
|
|
//Common setter methods
|
2013-07-07 23:49:29 +02:00
|
|
|
virtual void setBitrate(int bitrate);
|
|
|
|
virtual void setRCMode(int mode);
|
|
|
|
virtual void setCustomParams(const QString &customParams);
|
2010-11-17 19:35:50 +01:00
|
|
|
|
2013-09-30 21:39:56 +02:00
|
|
|
//Encoder info
|
|
|
|
static const AbstractEncoderInfo *getEncoderInfo(void)
|
|
|
|
{
|
2014-11-30 21:32:23 +01:00
|
|
|
MUTILS_THROW("This method shall be re-implemented in derived classes!");
|
2013-09-30 21:39:56 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-11-17 19:35:50 +01:00
|
|
|
protected:
|
2013-07-07 23:49:29 +02:00
|
|
|
int m_configBitrate; //Bitrate *or* VBR-quality-level
|
|
|
|
int m_configRCMode; //Rate-control mode
|
|
|
|
QString m_configCustomParams; //Custom parameters, if any
|
2011-02-20 16:28:28 +01:00
|
|
|
|
|
|
|
//Helper functions
|
|
|
|
bool isUnicode(const QString &text);
|
2012-12-02 22:55:22 +01:00
|
|
|
QString cleanTag(const QString &text);
|
2010-11-17 19:35:50 +01:00
|
|
|
};
|