///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
-// Copyright (C) 2004-2010 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
//
// 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
#include "Encoder_Abstract.h"
-#include <Windows.h>
+#include "Global.h"
AbstractEncoder::AbstractEncoder(void)
{
m_configBitrate = 0;
m_configRCMode = 0;
+ m_configCustomParams.clear();
}
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;
+}