X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2FEncoder_Abstract.cpp;h=cf6cb27c0466a6b070f07b81232481afe510c2ef;hb=9f2bffd2fd0c35e71c5fa55c9a3763a013283be1;hp=5963edc3428f1934b0ca476bd25eec0f2d0f5bf8;hpb=fc148e5e65d366379cec9cec32c1fe830d33da16;p=lamexp%2FLameXP.git diff --git a/src/Encoder_Abstract.cpp b/src/Encoder_Abstract.cpp index 5963edc3..cf6cb27c 100644 --- a/src/Encoder_Abstract.cpp +++ b/src/Encoder_Abstract.cpp @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// // LameXP - Audio Encoder Front-End -// Copyright (C) 2004-2010 LoRd_MuldeR +// Copyright (C) 2004-2013 LoRd_MuldeR // // 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 @@ -21,12 +21,13 @@ #include "Encoder_Abstract.h" -#include +#include "Global.h" AbstractEncoder::AbstractEncoder(void) { m_configBitrate = 0; m_configRCMode = 0; + m_configCustomParams.clear(); } AbstractEncoder::~AbstractEncoder(void) @@ -37,13 +38,54 @@ AbstractEncoder::~AbstractEncoder(void) * Setters */ -void AbstractEncoder::setBitrate(int bitrate) { m_configBitrate = max(0, bitrate); } -void AbstractEncoder::setRCMode(int mode) { m_configRCMode = max(0, mode); } +void AbstractEncoder::setBitrate(int bitrate) { m_configBitrate = qMax(0, bitrate); } +void AbstractEncoder::setRCMode(int mode) { m_configRCMode = qMax(0, mode); } +void AbstractEncoder::setCustomParams(const QString &customParams) { m_configCustomParams = customParams; } /* * Default implementation */ -bool AbstractEncoder::requiresDownmix(void) + +// Does encoder require the input to be downmixed to stereo? +const unsigned int *AbstractEncoder::supportedChannelCount(void) +{ + return NULL; +} + +// Does encoder require the input to be downsampled? (NULL-terminated array of supported sampling rates) +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) +{ + return NULL; +} + +//Does the encoder need the exact duration of the source? +const bool AbstractEncoder::needsTimingInfo(void) { return false; } + +/* + * Helper functions + */ + +//Does this text contain Non-ASCII characters? +bool AbstractEncoder::isUnicode(const QString &original) +{ + QString asLatin1 = QString::fromLatin1(original.toLatin1().constData()); + return (wcscmp(QWCHAR(original), QWCHAR(asLatin1)) != 0); +} + +//Remove "problematic" characters from tag +QString AbstractEncoder::cleanTag(const QString &text) +{ + QString result(text); + result.replace(QChar('"'), "'"); + result.replace(QChar('\\'), "/"); + return result; +}