Some more improvements to LockedFile class.
[LameXP.git] / src / Encoder_Abstract.cpp
blobafeabebac79b853fd8ffdd3cd7c9bccc41c08e78
1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2015 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 #include "Encoder_Abstract.h"
25 //Internal
26 #include "Global.h"
28 //MUtils
29 #include <MUtils/Global.h>
31 AbstractEncoder::AbstractEncoder(void)
33 m_configBitrate = 0;
34 m_configRCMode = 0;
35 m_configCustomParams.clear();
38 AbstractEncoder::~AbstractEncoder(void)
43 * Setters
46 void AbstractEncoder::setBitrate(int bitrate) { m_configBitrate = qMax(0, bitrate); }
47 void AbstractEncoder::setRCMode(int mode) { m_configRCMode = qMax(0, mode); }
48 void AbstractEncoder::setCustomParams(const QString &customParams) { m_configCustomParams = customParams.trimmed(); }
51 * Default implementation
54 // Does encoder require the input to be downmixed to stereo?
55 const unsigned int *AbstractEncoder::supportedChannelCount(void)
57 return NULL;
60 // Does encoder require the input to be downsampled? (NULL-terminated array of supported sampling rates)
61 const unsigned int *AbstractEncoder::supportedSamplerates(void)
63 return NULL;
66 // What bitdepths does the encoder support as input? (NULL-terminated array of supported bits per sample)
67 const unsigned int *AbstractEncoder::supportedBitdepths(void)
69 return NULL;
72 //Does the encoder need the exact duration of the source?
73 const bool AbstractEncoder::needsTimingInfo(void)
75 return false;
79 * Helper functions
82 //Does this text contain Non-ASCII characters?
83 bool AbstractEncoder::isUnicode(const QString &original)
85 if(!original.isEmpty())
87 QString asLatin1 = QString::fromLatin1(original.toLatin1().constData());
88 return (wcscmp(MUTILS_WCHR(original), MUTILS_WCHR(asLatin1)) != 0);
90 return false;
93 //Remove "problematic" characters from tag
94 QString AbstractEncoder::cleanTag(const QString &text)
96 QString result(text);
97 result.replace(QChar('"'), "'");
98 result.replace(QChar('\\'), "/");
99 return result;