2010-11-17 19:35:50 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// LameXP - Audio Encoder Front-End
|
2012-01-02 00:52:27 +01:00
|
|
|
// Copyright (C) 2004-2012 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
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "Encoder_Abstract.h"
|
|
|
|
|
2011-02-20 16:28:28 +01:00
|
|
|
#include "Global.h"
|
2010-11-22 21:45:00 +01:00
|
|
|
|
2010-11-17 19:35:50 +01:00
|
|
|
AbstractEncoder::AbstractEncoder(void)
|
|
|
|
{
|
|
|
|
m_configBitrate = 0;
|
|
|
|
m_configRCMode = 0;
|
2011-02-09 23:36:17 +01:00
|
|
|
m_configCustomParams.clear();
|
2010-11-17 19:35:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
AbstractEncoder::~AbstractEncoder(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-11-24 21:00:59 +01:00
|
|
|
/*
|
|
|
|
* Setters
|
|
|
|
*/
|
|
|
|
|
2011-11-08 15:12:31 +01:00
|
|
|
void AbstractEncoder::setBitrate(int bitrate) { m_configBitrate = qMax(0, bitrate); }
|
|
|
|
void AbstractEncoder::setRCMode(int mode) { m_configRCMode = qMax(0, mode); }
|
2011-02-09 23:36:17 +01:00
|
|
|
void AbstractEncoder::setCustomParams(const QString &customParams) { m_configCustomParams = customParams; }
|
2010-12-19 00:50:22 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Default implementation
|
|
|
|
*/
|
2011-05-06 17:51:49 +02:00
|
|
|
|
|
|
|
// Does encoder require the input to be downmixed to stereo?
|
2011-12-23 00:43:11 +01:00
|
|
|
const unsigned int *AbstractEncoder::supportedChannelCount(void)
|
2010-12-19 00:50:22 +01:00
|
|
|
{
|
2011-12-23 00:43:11 +01:00
|
|
|
return NULL;
|
2010-12-19 00:50:22 +01:00
|
|
|
}
|
2011-02-20 16:28:28 +01:00
|
|
|
|
2011-05-06 17:51:49 +02:00
|
|
|
// Does encoder require the input to be downsampled? (NULL-terminated array of supported sampling rates)
|
2011-12-21 01:23:21 +01:00
|
|
|
const unsigned int *AbstractEncoder::supportedSamplerates(void)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// What bitdepths does the encoder support as input? (NULL-terminated array of supported bits per sample)
|
|
|
|
const unsigned int *AbstractEncoder::supportedBitdepths(void)
|
2011-05-06 17:51:49 +02:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-07-21 19:16:12 +02:00
|
|
|
//Does the encoder need the exact duration of the source?
|
|
|
|
const bool AbstractEncoder::needsTimingInfo(void)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-02-20 16:28:28 +01:00
|
|
|
/*
|
|
|
|
* Helper functions
|
|
|
|
*/
|
2012-12-02 22:55:22 +01:00
|
|
|
|
|
|
|
//Does this text contain Non-ASCII characters?
|
2011-02-20 16:28:28 +01:00
|
|
|
bool AbstractEncoder::isUnicode(const QString &original)
|
|
|
|
{
|
|
|
|
QString asLatin1 = QString::fromLatin1(original.toLatin1().constData());
|
|
|
|
return (wcscmp(QWCHAR(original), QWCHAR(asLatin1)) != 0);
|
|
|
|
}
|
2012-12-02 22:55:22 +01:00
|
|
|
|
|
|
|
//Remove "problematic" characters from tag
|
|
|
|
QString AbstractEncoder::cleanTag(const QString &text)
|
|
|
|
{
|
|
|
|
QString result(text);
|
|
|
|
result.replace(QChar('"'), "'");
|
|
|
|
result.replace(QChar('\\'), "/");
|
|
|
|
return result;
|
|
|
|
}
|