summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2019-01-10 00:36:04 +0100
committerDaniel Schürmann <daschuer@mixxx.org>2019-01-10 00:36:04 +0100
commit9598072229678dea8ffefec3826490f5806bfaea (patch)
treebdf7da9dd73c22e102196bb89b63b1d06844e0b3 /src
parent98ca2864ad1d47748b6399e45e7e120f6c35ff6b (diff)
help tr to find the text
Diffstat (limited to 'src')
-rw-r--r--src/encoder/encoderopus.cpp29
-rw-r--r--src/encoder/encoderopus.h4
-rw-r--r--src/engine/sidechain/shoutconnection.cpp12
3 files changed, 27 insertions, 18 deletions
diff --git a/src/encoder/encoderopus.cpp b/src/encoder/encoderopus.cpp
index 09a116b303..269d7970d1 100644
--- a/src/encoder/encoderopus.cpp
+++ b/src/encoder/encoderopus.cpp
@@ -12,15 +12,6 @@
#include "encoder/encoderopus.h"
-// Opus only supports 48 and 96 kHz samplerates
-constexpr int EncoderOpus::MASTER_SAMPLERATE = 48000;
-
-const char* EncoderOpus::INVALID_SAMPLERATE_MESSAGE =
- "Using Opus at samplerates other than 48 kHz "
- "is not supported by the Opus encoder. Please use "
- "48000 Hz in \"Sound Hardware\" preferences "
- "or switch to a different encoding.";
-
namespace {
// From libjitsi's Opus encoder:
// 1 byte TOC + maximum frame size (1275)
@@ -29,6 +20,8 @@ constexpr int kMaxOpusBufferSize = 1+1275;
// Opus frame duration in milliseconds. Fixed to 60ms
constexpr int kOpusFrameMs = 60;
constexpr int kOpusChannelCount = 2;
+// Opus only supports 48 and 96 kHz samplerates
+constexpr int kMasterSamplerate = 48000;
const mixxx::Logger kLogger("EncoderOpus");
@@ -79,6 +72,20 @@ int getSerial() {
}
}
+//static
+int EncoderOpus::getMasterSamplerate() {
+ return kMasterSamplerate;
+}
+
+//static
+QString EncoderOpus::getInvalidSamplerateMessage() {
+ return QObject::tr(
+ "Using Opus at samplerates other than 48 kHz "
+ "is not supported by the Opus encoder. Please use "
+ "48000 Hz in \"Sound Hardware\" preferences "
+ "or switch to a different encoding.");
+};
+
EncoderOpus::EncoderOpus(EncoderCallback* pCallback)
: m_bitrate(0),
m_bitrateMode(0),
@@ -133,10 +140,10 @@ void EncoderOpus::setEncoderSettings(const EncoderSettings& settings) {
int EncoderOpus::initEncoder(int samplerate, QString errorMessage) {
Q_UNUSED(errorMessage);
- if (samplerate != MASTER_SAMPLERATE) {
+ if (samplerate != kMasterSamplerate) {
kLogger.warning() << "initEncoder failed: samplerate not supported by Opus";
- QString invalidSamplerateMessage = QObject::tr(INVALID_SAMPLERATE_MESSAGE);
+ const QString invalidSamplerateMessage = getInvalidSamplerateMessage();
ErrorDialogProperties* props = ErrorDialogHandler::instance()->newDialogProperties();
props->setType(DLG_WARNING);
diff --git a/src/encoder/encoderopus.h b/src/encoder/encoderopus.h
index 8c1e5a31e2..652269ba11 100644
--- a/src/encoder/encoderopus.h
+++ b/src/encoder/encoderopus.h
@@ -20,8 +20,8 @@
class EncoderOpus: public Encoder {
public:
- static const int MASTER_SAMPLERATE;
- static const char* INVALID_SAMPLERATE_MESSAGE;
+ static int getMasterSamplerate();
+ static QString getInvalidSamplerateMessage();
explicit EncoderOpus(EncoderCallback* pCallback = nullptr);
~EncoderOpus() override;
diff --git a/src/engine/sidechain/shoutconnection.cpp b/src/engine/sidechain/shoutconnection.cpp
index 14f3f10065..1c856e49ba 100644
--- a/src/engine/sidechain/shoutconnection.cpp
+++ b/src/engine/sidechain/shoutconnection.cpp
@@ -33,13 +33,15 @@
#include <engine/sidechain/shoutconnection.h>
namespace {
-static const int kConnectRetries = 30;
-static const int kMaxNetworkCache = 491520; // 10 s mp3 @ 192 kbit/s
+
+const int kConnectRetries = 30;
+const int kMaxNetworkCache = 491520; // 10 s mp3 @ 192 kbit/s
// Shoutcast default receive buffer 1048576 and autodumpsourcetime 30 s
// http://wiki.shoutcast.com/wiki/SHOUTcast_DNAS_Server_2
-static const int kMaxShoutFailures = 3;
+const int kMaxShoutFailures = 3;
const mixxx::Logger kLogger("ShoutConnection");
+
}
ShoutConnection::ShoutConnection(BroadcastProfilePtr profile,
@@ -371,9 +373,9 @@ void ShoutConnection::updateFromPreferences() {
return;
}
- if(m_format_is_opus && iMasterSamplerate != EncoderOpus::MASTER_SAMPLERATE) {
+ if(m_format_is_opus && iMasterSamplerate != EncoderOpus::getMasterSamplerate()) {
errorDialog(
- tr(EncoderOpus::INVALID_SAMPLERATE_MESSAGE),
+ EncoderOpus::getInvalidSamplerateMessage(),
tr("Unsupported samplerate")
);
return;