Use QStringLiteral

This commit is contained in:
Jonas Kvinge
2024-04-09 23:20:26 +02:00
parent 3cfffa5fbb
commit 58944993b8
233 changed files with 3885 additions and 3885 deletions

View File

@@ -31,7 +31,7 @@
#include "alsadevicefinder.h"
#include "enginedevice.h"
AlsaDeviceFinder::AlsaDeviceFinder() : DeviceFinder("alsa", { "alsa", "alsasink" }) {}
AlsaDeviceFinder::AlsaDeviceFinder() : DeviceFinder(QStringLiteral("alsa"), { "alsa", "alsasink" }) {}
EngineDeviceList AlsaDeviceFinder::ListDevices() {
@@ -91,14 +91,14 @@ EngineDeviceList AlsaDeviceFinder::ListDevices() {
}
EngineDevice device;
device.description = QString("%1 %2").arg(snd_ctl_card_info_get_name(cardinfo), snd_pcm_info_get_name(pcminfo));
device.description = QStringLiteral("%1 %2").arg(snd_ctl_card_info_get_name(cardinfo), snd_pcm_info_get_name(pcminfo));
device.iconname = device.GuessIconName();
device.card = card;
device.device = dev;
device.value = QString("hw:%1,%2").arg(card).arg(dev);
device.value = QStringLiteral("hw:%1,%2").arg(card).arg(dev);
devices.append(device);
device.value = QString("plughw:%1,%2").arg(card).arg(dev);
device.value = QStringLiteral("plughw:%1,%2").arg(card).arg(dev);
devices.append(device);
}

View File

@@ -28,7 +28,7 @@
#include "alsapcmdevicefinder.h"
#include "enginedevice.h"
AlsaPCMDeviceFinder::AlsaPCMDeviceFinder() : DeviceFinder("alsa", { "alsa", "alsasink" }) {}
AlsaPCMDeviceFinder::AlsaPCMDeviceFinder() : DeviceFinder(QStringLiteral("alsa"), { "alsa", "alsasink" }) {}
EngineDeviceList AlsaPCMDeviceFinder::ListDevices() {

View File

@@ -78,11 +78,11 @@ QString Chromaprinter::CreateFingerprint() {
return QString();
}
GstElement *src = CreateElement("filesrc", pipeline);
GstElement *decode = CreateElement("decodebin", pipeline);
GstElement *convert = CreateElement("audioconvert", pipeline);
GstElement *resample = CreateElement("audioresample", pipeline);
GstElement *sink = CreateElement("appsink", pipeline);
GstElement *src = CreateElement(QStringLiteral("filesrc"), pipeline);
GstElement *decode = CreateElement(QStringLiteral("decodebin"), pipeline);
GstElement *convert = CreateElement(QStringLiteral("audioconvert"), pipeline);
GstElement *resample = CreateElement(QStringLiteral("audioresample"), pipeline);
GstElement *sink = CreateElement(QStringLiteral("appsink"), pipeline);
if (!src || !decode || !convert || !resample || !sink) {
gst_object_unref(pipeline);

View File

@@ -394,11 +394,11 @@ std::optional<EBUR128Measures> EBUR128AnalysisImpl::Compute(const Song &song) {
return std::nullopt;
}
GstElement *src = CreateElement("filesrc", pipeline);
GstElement *decode = CreateElement("decodebin", pipeline);
GstElement *convert = CreateElement("audioconvert", pipeline);
GstElement *queue = CreateElement("queue2", pipeline);
GstElement *sink = CreateElement("appsink", pipeline);
GstElement *src = CreateElement(QStringLiteral("filesrc"), pipeline);
GstElement *decode = CreateElement(QStringLiteral("decodebin"), pipeline);
GstElement *convert = CreateElement(QStringLiteral("audioconvert"), pipeline);
GstElement *queue = CreateElement(QStringLiteral("queue2"), pipeline);
GstElement *sink = CreateElement(QStringLiteral("appsink"), pipeline);
if (!src || !decode || !convert || !queue || !sink) {
gst_object_unref(pipeline);

View File

@@ -79,8 +79,8 @@ EngineBase::~EngineBase() = default;
EngineBase::Type EngineBase::TypeFromName(const QString &name) {
if (name.compare("gstreamer", Qt::CaseInsensitive) == 0) return Type::GStreamer;
if (name.compare("vlc", Qt::CaseInsensitive) == 0) return Type::VLC;
if (name.compare(QLatin1String("gstreamer"), Qt::CaseInsensitive) == 0) return Type::GStreamer;
if (name.compare(QLatin1String("vlc"), Qt::CaseInsensitive) == 0) return Type::VLC;
return Type::None;
@@ -89,10 +89,10 @@ EngineBase::Type EngineBase::TypeFromName(const QString &name) {
QString EngineBase::Name(const Type type) {
switch (type) {
case Type::GStreamer: return QString("gstreamer");
case Type::VLC: return QString("vlc");
case Type::GStreamer: return QStringLiteral("gstreamer");
case Type::VLC: return QStringLiteral("vlc");
case Type::None:
default: return QString("None");
default: return QStringLiteral("None");
}
}
@@ -100,10 +100,10 @@ QString EngineBase::Name(const Type type) {
QString EngineBase::Description(const Type type) {
switch (type) {
case Type::GStreamer: return QString("GStreamer");
case Type::VLC: return QString("VLC");
case Type::GStreamer: return QStringLiteral("GStreamer");
case Type::VLC: return QStringLiteral("VLC");
case Type::None:
default: return QString("None");
default: return QStringLiteral("None");
}
}
@@ -203,8 +203,8 @@ void EngineBase::ReloadSettings() {
bool http2_enabled = s.value("http2", false).toBool();
if (http2_enabled != http2_enabled_) {
http2_enabled_ = http2_enabled;
Utilities::SetEnv("SOUP_FORCE_HTTP1", http2_enabled_ ? "" : "1");
qLog(Debug) << "SOUP_FORCE_HTTP1:" << (http2_enabled_ ? "OFF" : "ON");
Utilities::SetEnv("SOUP_FORCE_HTTP1", http2_enabled_ ? QLatin1String("") : QStringLiteral("1"));
qLog(Debug) << "SOUP_FORCE_HTTP1:" << (http2_enabled_ ? QLatin1String("OFF") : QLatin1String("ON"));
}
strict_ssl_enabled_ = s.value("strict_ssl", false).toBool();
@@ -223,7 +223,7 @@ void EngineBase::ReloadSettings() {
proxy_pass_.clear();
}
else {
proxy_address_ = QString("%1:%2").arg(proxy_host).arg(proxy_port);
proxy_address_ = QStringLiteral("%1:%2").arg(proxy_host).arg(proxy_port);
proxy_authentication_ = s.value("use_authentication").toBool();
proxy_user_ = s.value("username").toString();
proxy_pass_ = s.value("password").toString();

View File

@@ -23,28 +23,28 @@ EngineDevice::EngineDevice() : card(0), device(0) {}
QString EngineDevice::GuessIconName() const {
if (description.contains("mcintosh", Qt::CaseInsensitive)) {
return "mcintosh";
if (description.contains(QLatin1String("mcintosh"), Qt::CaseInsensitive)) {
return QStringLiteral("mcintosh");
}
if (description.contains("electrocompaniet", Qt::CaseInsensitive)) {
return "electrocompaniet";
if (description.contains(QLatin1String("electrocompaniet"), Qt::CaseInsensitive)) {
return QStringLiteral("electrocompaniet");
}
if (description.contains("intel", Qt::CaseInsensitive)) {
return "intel";
if (description.contains(QLatin1String("intel"), Qt::CaseInsensitive)) {
return QStringLiteral("intel");
}
if (description.contains("realtek", Qt::CaseInsensitive)) {
return "realtek";
if (description.contains(QLatin1String("realtek"), Qt::CaseInsensitive)) {
return QStringLiteral("realtek");
}
if (description.contains("nvidia", Qt::CaseInsensitive)) {
return "nvidia";
if (description.contains(QLatin1String("nvidia"), Qt::CaseInsensitive)) {
return QStringLiteral("nvidia");
}
if (description.contains("headset", Qt::CaseInsensitive)) {
return "headset";
if (description.contains(QLatin1String("headset"), Qt::CaseInsensitive)) {
return QStringLiteral("headset");
}
if (description.contains("pulseaudio", Qt::CaseInsensitive)) {
return "pulseaudio";
if (description.contains(QLatin1String("pulseaudio"), Qt::CaseInsensitive)) {
return QStringLiteral("pulseaudio");
}
return "soundcard";
return QStringLiteral("soundcard");
}

View File

@@ -416,23 +416,23 @@ EngineBase::OutputDetailsList GstEngine::GetOutputsList() const {
GstElementFactory *factory = GST_ELEMENT_FACTORY(future->data);
const QString metadata = QString::fromUtf8(gst_element_factory_get_metadata(factory, GST_ELEMENT_METADATA_KLASS));
const QString name = QString::fromUtf8(gst_plugin_feature_get_name(future->data));
if (metadata.startsWith("Sink/Audio", Qt::CaseInsensitive) || name == "pipewiresink" || (metadata.startsWith("Source/Audio", Qt::CaseInsensitive) && name.contains("sink"))) {
if (metadata.startsWith(QLatin1String("Sink/Audio"), Qt::CaseInsensitive) || name == "pipewiresink" || (metadata.startsWith(QLatin1String("Source/Audio"), Qt::CaseInsensitive) && name.contains(QLatin1String("sink")))) {
QString description = QString::fromUtf8(gst_element_factory_get_metadata(factory, GST_ELEMENT_METADATA_DESCRIPTION));
if (name == "wasapi2sink" && description == "Stream audio to an audio capture device through WASAPI") {
description.append("2");
}
else if (name == "pipewiresink" && description == "Send video to PipeWire") {
description = "Send audio to PipeWire";
description = QStringLiteral("Send audio to PipeWire");
}
OutputDetails output;
output.name = name;
output.description = description;
if (output.name == kAutoSink) output.iconname = "soundcard";
else if (output.name == kALSASink || output.name == kOSS4Sink) output.iconname = "alsa";
else if (output.name == kJackAudioSink) output.iconname = "jack";
else if (output.name == kPulseSink) output.iconname = "pulseaudio";
else if (output.name == kA2DPSink || output.name == kAVDTPSink) output.iconname = "bluetooth";
else output.iconname = "soundcard";
if (output.name == kAutoSink) output.iconname = QStringLiteral("soundcard");
else if (output.name == kALSASink || output.name == kOSS4Sink) output.iconname = QStringLiteral("alsa");
else if (output.name == kJackAudioSink) output.iconname = QStringLiteral("jack");
else if (output.name == kPulseSink) output.iconname = QStringLiteral("pulseaudio");
else if (output.name == kA2DPSink || output.name == kAVDTPSink) output.iconname = QStringLiteral("bluetooth");
else output.iconname = QStringLiteral("soundcard");
outputs << output;
}
}
@@ -736,8 +736,8 @@ QByteArray GstEngine::FixupUrl(const QUrl &url) {
// So we handle them ourselves: we extract the track number and re-create a URL with only cdda:// + the track number (which can be handled by Gstreamer).
// We keep the device in mind, and we will set it later using SourceSetupCallback
QStringList path = url.path().split('/');
str = QString("cdda://%1").arg(path.takeLast());
QString device = path.join("/");
str = QStringLiteral("cdda://%1").arg(path.takeLast());
QString device = path.join(QStringLiteral("/"));
if (current_pipeline_) current_pipeline_->SetSourceDevice(device);
}
uri = str.toUtf8();
@@ -886,12 +886,12 @@ void GstEngine::UpdateScope(const int chunk_length) {
scope_chunk_++;
if (buffer_format_.startsWith("S16LE") ||
buffer_format_.startsWith("U16LE") ||
buffer_format_.startsWith("S24LE") ||
buffer_format_.startsWith("S24_32LE") ||
buffer_format_.startsWith("S32LE") ||
buffer_format_.startsWith("F32LE")
if (buffer_format_.startsWith(QLatin1String("S16LE")) ||
buffer_format_.startsWith(QLatin1String("U16LE")) ||
buffer_format_.startsWith(QLatin1String("S24LE")) ||
buffer_format_.startsWith(QLatin1String("S24_32LE")) ||
buffer_format_.startsWith(QLatin1String("S32LE")) ||
buffer_format_.startsWith(QLatin1String("F32LE"))
) {
memcpy(dest, source, bytes);
}
@@ -919,7 +919,7 @@ void GstEngine::StreamDiscovered(GstDiscoverer*, GstDiscovererInfo *info, GError
GstDiscovererResult result = gst_discoverer_info_get_result(info);
if (result != GST_DISCOVERER_OK) {
QString error_message = GSTdiscovererErrorMessage(result);
qLog(Error) << QString("Stream discovery for %1 failed: %2").arg(discovered_url, error_message);
qLog(Error) << QStringLiteral("Stream discovery for %1 failed: %2").arg(discovered_url, error_message);
return;
}
@@ -989,12 +989,12 @@ void GstEngine::StreamDiscoveryFinished(GstDiscoverer*, gpointer) {}
QString GstEngine::GSTdiscovererErrorMessage(GstDiscovererResult result) {
switch (result) {
case GST_DISCOVERER_URI_INVALID: return "The URI is invalid";
case GST_DISCOVERER_TIMEOUT: return "The discovery timed-out";
case GST_DISCOVERER_BUSY: return "The discoverer was already discovering a file";
case GST_DISCOVERER_MISSING_PLUGINS: return "Some plugins are missing for full discovery";
case GST_DISCOVERER_URI_INVALID: return QStringLiteral("The URI is invalid");
case GST_DISCOVERER_TIMEOUT: return QStringLiteral("The discovery timed-out");
case GST_DISCOVERER_BUSY: return QStringLiteral("The discoverer was already discovering a file");
case GST_DISCOVERER_MISSING_PLUGINS: return QStringLiteral("Some plugins are missing for full discovery");
case GST_DISCOVERER_ERROR:
default: return "An error happened and the GError is set";
default: return QStringLiteral("An error happened and the GError is set");
}
}

View File

@@ -304,29 +304,29 @@ QString GstEnginePipeline::GstStateText(const GstState state) {
switch (state) {
case GST_STATE_VOID_PENDING:
return "Pending";
return QStringLiteral("Pending");
case GST_STATE_NULL:
return "Null";
return QStringLiteral("Null");
case GST_STATE_READY:
return "Ready";
return QStringLiteral("Ready");
case GST_STATE_PAUSED:
return "Paused";
return QStringLiteral("Paused");
case GST_STATE_PLAYING:
return "Playing";
return QStringLiteral("Playing");
default:
return "Unknown";
return QStringLiteral("Unknown");
}
}
GstElement *GstEnginePipeline::CreateElement(const QString &factory_name, const QString &name, GstElement *bin, QString &error) const {
QString unique_name = QString("pipeline") + "-" + QString::number(id_) + "-" + (name.isEmpty() ? factory_name : name);
QString unique_name = QStringLiteral("pipeline") + "-" + QString::number(id_) + "-" + (name.isEmpty() ? factory_name : name);
GstElement *element = gst_element_factory_make(factory_name.toUtf8().constData(), unique_name.toUtf8().constData());
if (!element) {
qLog(Error) << "GStreamer could not create the element" << factory_name << "with name" << unique_name;
error = QString("GStreamer could not create the element %1 with name %2.").arg(factory_name, unique_name);
error = QStringLiteral("GStreamer could not create the element %1 with name %2.").arg(factory_name, unique_name);
}
if (bin && element) gst_bin_add(GST_BIN(bin), element);
@@ -346,10 +346,10 @@ bool GstEnginePipeline::InitFromUrl(const QUrl &media_url, const QUrl &stream_ur
guint version_major = 0, version_minor = 0, version_micro = 0, version_nano = 0;
gst_plugins_base_version(&version_major, &version_minor, &version_micro, &version_nano);
if (QVersionNumber::compare(QVersionNumber(static_cast<int>(version_major), static_cast<int>(version_minor)), QVersionNumber(1, 22)) >= 0) {
pipeline_ = CreateElement("playbin3", "pipeline", nullptr, error);
pipeline_ = CreateElement(QStringLiteral("playbin3"), QStringLiteral("pipeline"), nullptr, error);
}
else {
pipeline_ = CreateElement("playbin", "pipeline", nullptr, error);
pipeline_ = CreateElement(QStringLiteral("playbin"), QStringLiteral("pipeline"), nullptr, error);
}
if (!pipeline_) return false;
@@ -566,31 +566,31 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Create all the other elements
audioqueue_ = CreateElement("queue2", "audioqueue", audiobin_, error);
audioqueue_ = CreateElement(QStringLiteral("queue2"), QStringLiteral("audioqueue"), audiobin_, error);
if (!audioqueue_) {
return false;
}
audioqueueconverter_ = CreateElement("audioconvert", "audioqueueconverter", audiobin_, error);
audioqueueconverter_ = CreateElement(QStringLiteral("audioconvert"), QStringLiteral("audioqueueconverter"), audiobin_, error);
if (!audioqueueconverter_) {
return false;
}
GstElement *audiosinkconverter = CreateElement("audioconvert", "audiosinkconverter", audiobin_, error);
GstElement *audiosinkconverter = CreateElement(QStringLiteral("audioconvert"), QStringLiteral("audiosinkconverter"), audiobin_, error);
if (!audiosinkconverter) {
return false;
}
// Create the volume element if it's enabled.
if (volume_enabled_ && !volume_) {
volume_sw_ = CreateElement("volume", "volume_sw", audiobin_, error);
volume_sw_ = CreateElement(QStringLiteral("volume"), QStringLiteral("volume_sw"), audiobin_, error);
if (!volume_sw_) {
return false;
}
}
if (fading_enabled_) {
volume_fading_ = CreateElement("volume", "volume_fading", audiobin_, error);
volume_fading_ = CreateElement(QStringLiteral("volume"), QStringLiteral("volume_fading"), audiobin_, error);
if (!volume_fading_) {
return false;
}
@@ -598,7 +598,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Create the stereo balancer elements if it's enabled.
if (stereo_balancer_enabled_) {
audiopanorama_ = CreateElement("audiopanorama", "audiopanorama", audiobin_, error);
audiopanorama_ = CreateElement(QStringLiteral("audiopanorama"), QStringLiteral("audiopanorama"), audiobin_, error);
if (!audiopanorama_) {
return false;
}
@@ -608,11 +608,11 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Create the equalizer elements if it's enabled.
if (eq_enabled_) {
equalizer_preamp_ = CreateElement("volume", "equalizer_preamp", audiobin_, error);
equalizer_preamp_ = CreateElement(QStringLiteral("volume"), QStringLiteral("equalizer_preamp"), audiobin_, error);
if (!equalizer_preamp_) {
return false;
}
equalizer_ = CreateElement("equalizer-nbands", "equalizer_nbands", audiobin_, error);
equalizer_ = CreateElement(QStringLiteral("equalizer-nbands"), QStringLiteral("equalizer_nbands"), audiobin_, error);
if (!equalizer_) {
return false;
}
@@ -662,15 +662,15 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
GstElement *rglimiter = nullptr;
GstElement *rgconverter = nullptr;
if (rg_enabled_) {
rgvolume = CreateElement("rgvolume", "rgvolume", audiobin_, error);
rgvolume = CreateElement(QStringLiteral("rgvolume"), QStringLiteral("rgvolume"), audiobin_, error);
if (!rgvolume) {
return false;
}
rglimiter = CreateElement("rglimiter", "rglimiter", audiobin_, error);
rglimiter = CreateElement(QStringLiteral("rglimiter"), QStringLiteral("rglimiter"), audiobin_, error);
if (!rglimiter) {
return false;
}
rgconverter = CreateElement("audioconvert", "rgconverter", audiobin_, error);
rgconverter = CreateElement(QStringLiteral("audioconvert"), QStringLiteral("rgconverter"), audiobin_, error);
if (!rgconverter) {
return false;
}
@@ -684,7 +684,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Create the EBU R 128 loudness normalization volume element if enabled.
if (ebur128_loudness_normalization_) {
volume_ebur128_ = CreateElement("volume", "ebur128_volume", audiobin_, error);
volume_ebur128_ = CreateElement(QStringLiteral("volume"), QStringLiteral("ebur128_volume"), audiobin_, error);
if (!volume_ebur128_) {
return false;
}
@@ -696,7 +696,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
GstElement *bs2b = nullptr;
if (bs2b_enabled_) {
bs2b = CreateElement("bs2b", "bs2b", audiobin_, error);
bs2b = CreateElement(QStringLiteral("bs2b"), QStringLiteral("bs2b"), audiobin_, error);
if (!bs2b) {
return false;
}
@@ -742,7 +742,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Link all elements
if (!gst_element_link(audioqueue_, audioqueueconverter_)) {
error = "Failed to link audio queue to audio queue converter.";
error = QStringLiteral("Failed to link audio queue to audio queue converter.");
return false;
}
@@ -751,7 +751,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Link replaygain elements if enabled.
if (rg_enabled_ && rgvolume && rglimiter && rgconverter) {
if (!gst_element_link_many(element_link, rgvolume, rglimiter, rgconverter, nullptr)) {
error = "Failed to link replaygain volume, limiter and converter elements.";
error = QStringLiteral("Failed to link replaygain volume, limiter and converter elements.");
return false;
}
element_link = rgconverter;
@@ -764,7 +764,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
"format = (string) { F32LE, F64LE }");
GstCaps *raw_fp_audio_caps = gst_static_caps_get(&static_raw_fp_audio_caps);
if (!gst_element_link_filtered(element_link, volume_ebur128_, raw_fp_audio_caps)) {
error = "Failed to link EBU R 128 volume element.";
error = QStringLiteral("Failed to link EBU R 128 volume element.");
return false;
}
gst_caps_unref(raw_fp_audio_caps);
@@ -774,7 +774,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Link equalizer elements if enabled.
if (eq_enabled_ && equalizer_ && equalizer_preamp_) {
if (!gst_element_link_many(element_link, equalizer_preamp_, equalizer_, nullptr)) {
error = "Failed to link equalizer and equalizer preamp elements.";
error = QStringLiteral("Failed to link equalizer and equalizer preamp elements.");
return false;
}
element_link = equalizer_;
@@ -783,7 +783,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Link stereo balancer elements if enabled.
if (stereo_balancer_enabled_ && audiopanorama_) {
if (!gst_element_link(element_link, audiopanorama_)) {
error = "Failed to link audio panorama (stereo balancer).";
error = QStringLiteral("Failed to link audio panorama (stereo balancer).");
return false;
}
element_link = audiopanorama_;
@@ -792,7 +792,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Link software volume element if enabled.
if (volume_enabled_ && volume_sw_) {
if (!gst_element_link(element_link, volume_sw_)) {
error = "Failed to link software volume.";
error = QStringLiteral("Failed to link software volume.");
return false;
}
element_link = volume_sw_;
@@ -801,7 +801,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Link fading volume element if enabled.
if (fading_enabled_ && volume_fading_) {
if (!gst_element_link(element_link, volume_fading_)) {
error = "Failed to link fading volume.";
error = QStringLiteral("Failed to link fading volume.");
return false;
}
element_link = volume_fading_;
@@ -811,21 +811,21 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
if (bs2b_enabled_ && bs2b) {
qLog(Debug) << "Enabling bs2b";
if (!gst_element_link(element_link, bs2b)) {
error = "Failed to link bs2b.";
error = QStringLiteral("Failed to link bs2b.");
return false;
}
element_link = bs2b;
}
if (!gst_element_link(element_link, audiosinkconverter)) {
error = "Failed to link audio sink converter.";
error = QStringLiteral("Failed to link audio sink converter.");
return false;
}
{
GstCaps *caps = gst_caps_new_empty_simple("audio/x-raw");
if (!caps) {
error = "Failed to create caps for raw audio.";
error = QStringLiteral("Failed to create caps for raw audio.");
return false;
}
if (channels_enabled_ && channels_ > 0) {
@@ -974,7 +974,7 @@ void GstEnginePipeline::SourceSetupCallback(GstElement *playbin, GstElement *sou
if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "user-agent")) {
qLog(Debug) << "Setting user-agent";
QString user_agent = QString("%1 %2").arg(QCoreApplication::applicationName(), QCoreApplication::applicationVersion());
QString user_agent = QStringLiteral("%1 %2").arg(QCoreApplication::applicationName(), QCoreApplication::applicationVersion());
g_object_set(source, "user-agent", user_agent.toUtf8().constData(), nullptr);
}
@@ -1108,7 +1108,7 @@ GstPadProbeReturn GstEnginePipeline::BufferProbeCallback(GstPad *pad, GstPadProb
if (caps) {
GstStructure *structure = gst_caps_get_structure(caps, 0);
if (structure) {
format = QString(gst_structure_get_string(structure, "format"));
format = QString::fromUtf8(gst_structure_get_string(structure, "format"));
gst_structure_get_int(structure, "channels", &channels);
gst_structure_get_int(structure, "rate", &rate);
}
@@ -1122,10 +1122,10 @@ GstPadProbeReturn GstEnginePipeline::BufferProbeCallback(GstPad *pad, GstPadProb
quint64 duration = GST_BUFFER_DURATION(buf);
qint64 end_time = static_cast<qint64>(start_time + duration);
if (format.startsWith("S16LE")) {
if (format.startsWith(QLatin1String("S16LE"))) {
instance->logged_unsupported_analyzer_format_ = false;
}
else if (format.startsWith("S32LE")) {
else if (format.startsWith(QLatin1String("S32LE"))) {
GstMapInfo map_info;
gst_buffer_map(buf, &map_info, GST_MAP_READ);
@@ -1146,7 +1146,7 @@ GstPadProbeReturn GstEnginePipeline::BufferProbeCallback(GstPad *pad, GstPadProb
instance->logged_unsupported_analyzer_format_ = false;
}
else if (format.startsWith("F32LE")) {
else if (format.startsWith(QLatin1String("F32LE"))) {
GstMapInfo map_info;
gst_buffer_map(buf, &map_info, GST_MAP_READ);
@@ -1167,7 +1167,7 @@ GstPadProbeReturn GstEnginePipeline::BufferProbeCallback(GstPad *pad, GstPadProb
instance->logged_unsupported_analyzer_format_ = false;
}
else if (format.startsWith("S24LE")) {
else if (format.startsWith(QLatin1String("S24LE"))) {
GstMapInfo map_info;
gst_buffer_map(buf, &map_info, GST_MAP_READ);
@@ -1190,7 +1190,7 @@ GstPadProbeReturn GstEnginePipeline::BufferProbeCallback(GstPad *pad, GstPadProb
instance->logged_unsupported_analyzer_format_ = false;
}
else if (format.startsWith("S24_32LE")) {
else if (format.startsWith(QLatin1String("S24_32LE"))) {
GstMapInfo map_info;
gst_buffer_map(buf, &map_info, GST_MAP_READ);
@@ -1448,7 +1448,7 @@ void GstEnginePipeline::ErrorMessageReceived(GstMessage *msg) {
qLog(Error) << __FUNCTION__ << "ID:" << id() << "Domain:" << domain << "Code:" << code << "Error:" << message;
qLog(Error) << __FUNCTION__ << "ID:" << id() << "Domain:" << domain << "Code:" << code << "Debug:" << debugstr;
if (!redirect_url_.isEmpty() && debugstr.contains("A redirect message was posted on the bus and should have been handled by the application.")) {
if (!redirect_url_.isEmpty() && debugstr.contains(QLatin1String("A redirect message was posted on the bus and should have been handled by the application."))) {
// mmssrc posts a message on the bus *and* makes an error message when it wants to do a redirect.
// We handle the message, but now we have to ignore the error too.
return;
@@ -1485,8 +1485,8 @@ void GstEnginePipeline::TagMessageReceived(GstMessage *msg) {
if (!engine_metadata.title.isEmpty() && engine_metadata.artist.isEmpty() && engine_metadata.album.isEmpty()) {
QStringList title_splitted;
if (engine_metadata.title.contains(" - ")) {
title_splitted = engine_metadata.title.split(" - ");
if (engine_metadata.title.contains(QLatin1String(" - "))) {
title_splitted = engine_metadata.title.split(QStringLiteral(" - "));
}
else if (engine_metadata.title.contains('~')) {
title_splitted = engine_metadata.title.split('~');

View File

@@ -33,7 +33,7 @@
#include "pulsedevicefinder.h"
#include "enginedevice.h"
PulseDeviceFinder::PulseDeviceFinder() : DeviceFinder("pulseaudio", { "pulseaudio", "pulse", "pulsesink" }), mainloop_(nullptr), context_(nullptr) {}
PulseDeviceFinder::PulseDeviceFinder() : DeviceFinder(QStringLiteral("pulseaudio"), { "pulseaudio", "pulse", "pulsesink" }), mainloop_(nullptr), context_(nullptr) {}
bool PulseDeviceFinder::Initialize() {

View File

@@ -226,8 +226,8 @@ EngineBase::OutputDetailsList VLCEngine::GetOutputsList() const {
OutputDetailsList outputs;
OutputDetails output_auto;
output_auto.name = "auto";
output_auto.description = "Automatically detected";
output_auto.name = QStringLiteral("auto");
output_auto.description = QStringLiteral("Automatically detected");
outputs << output_auto;
libvlc_audio_output_t *audio_output_list = libvlc_audio_output_list_get(instance_);
@@ -235,12 +235,12 @@ EngineBase::OutputDetailsList VLCEngine::GetOutputsList() const {
OutputDetails output;
output.name = QString::fromUtf8(audio_output->psz_name);
output.description = QString::fromUtf8(audio_output->psz_description);
if (output.name == "auto") output.iconname = "soundcard";
else if ((output.name == "alsa")||(output.name == "oss")) output.iconname = "alsa";
else if (output.name== "jack") output.iconname = "jack";
else if (output.name == "pulse") output.iconname = "pulseaudio";
else if (output.name == "afile") output.iconname = "document-new";
else output.iconname = "soundcard";
if (output.name == "auto") output.iconname = QStringLiteral("soundcard");
else if ((output.name == "alsa")||(output.name == "oss")) output.iconname = QStringLiteral("alsa");
else if (output.name== "jack") output.iconname = QStringLiteral("jack");
else if (output.name == "pulse") output.iconname = QStringLiteral("pulseaudio");
else if (output.name == "afile") output.iconname = QStringLiteral("document-new");
else output.iconname = QStringLiteral("soundcard");
outputs << output;
}
libvlc_audio_output_list_release(audio_output_list);

View File

@@ -67,7 +67,7 @@ class VLCEngine : public EngineBase {
OutputDetailsList GetOutputsList() const override;
bool ValidOutput(const QString &output) override;
QString DefaultOutput() override { return ""; }
QString DefaultOutput() override { return QLatin1String(""); }
bool CustomDeviceSupport(const QString &output) override;
bool ALSADeviceSupport(const QString &output) override;
bool ExclusiveModeSupport(const QString &output) override;