Formatting
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
#include "devicefinder.h"
|
||||
#include "alsadevicefinder.h"
|
||||
|
||||
AlsaDeviceFinder::AlsaDeviceFinder() : DeviceFinder("alsa", { "alsa","alsasink" }) {}
|
||||
AlsaDeviceFinder::AlsaDeviceFinder() : DeviceFinder("alsa", { "alsa", "alsasink" }) {}
|
||||
|
||||
QList<DeviceFinder::Device> AlsaDeviceFinder::ListDevices() {
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "devicefinder.h"
|
||||
#include "alsapcmdevicefinder.h"
|
||||
|
||||
AlsaPCMDeviceFinder::AlsaPCMDeviceFinder() : DeviceFinder("alsa", { "alsa","alsasink" }) {}
|
||||
AlsaPCMDeviceFinder::AlsaPCMDeviceFinder() : DeviceFinder("alsa", { "alsa", "alsasink" }) {}
|
||||
|
||||
QList<DeviceFinder::Device> AlsaPCMDeviceFinder::ListDevices() {
|
||||
|
||||
|
||||
@@ -94,19 +94,17 @@ bool Engine::Base::Play(const QUrl &stream_url, const QUrl &original_url, const
|
||||
}
|
||||
|
||||
return Play(offset_nanosec);
|
||||
|
||||
}
|
||||
|
||||
void Engine::Base::SetVolume(const uint value) {
|
||||
|
||||
volume_ = value;
|
||||
SetVolumeSW(MakeVolumeLogarithmic(value));
|
||||
|
||||
}
|
||||
|
||||
uint Engine::Base::MakeVolumeLogarithmic(const uint volume) {
|
||||
// We're using a logarithmic function to make the volume ramp more natural.
|
||||
return static_cast<uint>( 100 - 100.0 * std::log10( ( 100 - volume ) * 0.09 + 1.0 ) );
|
||||
return static_cast<uint>(100 - 100.0 * std::log10((100 - volume) * 0.09 + 1.0));
|
||||
}
|
||||
|
||||
void Engine::Base::ReloadSettings() {
|
||||
|
||||
@@ -865,7 +865,7 @@ void GstEngine::UpdateScope(const int chunk_length) {
|
||||
|
||||
// Make sure we don't go beyond the end of the buffer
|
||||
if (scope_chunk_ == scope_chunks_ - 1) {
|
||||
bytes = qMin(static_cast<Engine::Scope::size_type>(map.size - (chunk_size * scope_chunk_)), scope_.size() * sizeof(sample_type));
|
||||
bytes = qMin(static_cast<Engine::Scope::size_type>(map.size - (chunk_size * scope_chunk_)), scope_.size() * sizeof(sample_type));
|
||||
}
|
||||
else {
|
||||
bytes = qMin(static_cast<Engine::Scope::size_type>(chunk_size), scope_.size() * sizeof(sample_type));
|
||||
|
||||
@@ -564,7 +564,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
|
||||
|
||||
// Link all elements
|
||||
|
||||
GstElement *next = audioqueue_; // The next element to link from.
|
||||
GstElement *next = audioqueue_; // The next element to link from.
|
||||
|
||||
// Link replaygain elements if enabled.
|
||||
if (rg_enabled_ && rgvolume && rglimiter && rgconverter) {
|
||||
@@ -645,7 +645,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
|
||||
gst_caps_unref(caps);
|
||||
}
|
||||
|
||||
{ // Add probes and handlers.
|
||||
{ // Add probes and handlers.
|
||||
GstPad *pad = gst_element_get_static_pad(audioqueue_, "src");
|
||||
if (pad) {
|
||||
gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, HandoffCallback, this, nullptr);
|
||||
@@ -894,7 +894,7 @@ GstPadProbeReturn GstEnginePipeline::HandoffCallback(GstPad *pad, GstPadProbeInf
|
||||
int16_t *s16 = static_cast<int16_t*>(g_malloc(buf16_size));
|
||||
memset(s16, 0, buf16_size);
|
||||
for (int i = 0; i < (samples * channels); ++i) {
|
||||
s16[i] = *(reinterpret_cast<int16_t*>(s24+1));
|
||||
s16[i] = *(reinterpret_cast<int16_t*>(s24 + 1));
|
||||
s24 += 3;
|
||||
if (s24 >= s24e) break;
|
||||
}
|
||||
@@ -919,7 +919,7 @@ GstPadProbeReturn GstEnginePipeline::HandoffCallback(GstPad *pad, GstPadProbeInf
|
||||
memset(s16, 0, buf16_size);
|
||||
for (int i = 0; i < (samples * channels); ++i) {
|
||||
char *s24 = reinterpret_cast<char*>(s32p);
|
||||
s16[i] = *(reinterpret_cast<int16_t*>(s24+1));
|
||||
s16[i] = *(reinterpret_cast<int16_t*>(s24 + 1));
|
||||
++s32p;
|
||||
if (s32p > s32e) break;
|
||||
}
|
||||
|
||||
@@ -120,17 +120,17 @@ void GstStartup::SetEnvironment() {
|
||||
QString gst_registry_filename;
|
||||
|
||||
#ifdef USE_BUNDLE
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_MACOS)
|
||||
# if defined(Q_OS_WIN32) || defined(Q_OS_MACOS)
|
||||
gio_module_path = bundle_path + "/gio-modules";
|
||||
#endif
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
|
||||
# endif
|
||||
# if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
|
||||
gst_plugin_scanner = bundle_path + "/gst-plugin-scanner";
|
||||
gst_plugin_path = bundle_path + "/gstreamer";
|
||||
#endif
|
||||
#if defined(Q_OS_WIN32)
|
||||
# endif
|
||||
# if defined(Q_OS_WIN32)
|
||||
//gst_plugin_scanner = bundle_path + "/gst-plugin-scanner.exe";
|
||||
gst_plugin_path = bundle_path + "/gstreamer-plugins";
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_MACOS)
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
std::unique_ptr<T> GetProperty(const AudioDeviceID &device_id, const AudioObjectPropertyAddress &address, UInt32 *size_bytes_out = nullptr) {
|
||||
|
||||
UInt32 size_bytes = 0;
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "devicefinder.h"
|
||||
#include "pulsedevicefinder.h"
|
||||
|
||||
PulseDeviceFinder::PulseDeviceFinder() : DeviceFinder( "pulseaudio", { "pulseaudio", "pulse", "pulsesink" }), mainloop_(nullptr), context_(nullptr) {}
|
||||
PulseDeviceFinder::PulseDeviceFinder() : DeviceFinder("pulseaudio", { "pulseaudio", "pulse", "pulsesink" }), mainloop_(nullptr), context_(nullptr) {}
|
||||
|
||||
bool PulseDeviceFinder::Initialize() {
|
||||
|
||||
@@ -97,17 +97,17 @@ retry:
|
||||
}
|
||||
|
||||
switch (pa_context_get_state(context_)) {
|
||||
case PA_CONTEXT_READY:
|
||||
break;
|
||||
case PA_CONTEXT_FAILED:
|
||||
case PA_CONTEXT_TERMINATED:
|
||||
// Maybe pulseaudio died. Try reconnecting.
|
||||
if (Reconnect()) {
|
||||
goto retry;
|
||||
}
|
||||
return state.devices;
|
||||
default:
|
||||
return state.devices;
|
||||
case PA_CONTEXT_READY:
|
||||
break;
|
||||
case PA_CONTEXT_FAILED:
|
||||
case PA_CONTEXT_TERMINATED:
|
||||
// Maybe pulseaudio died. Try reconnecting.
|
||||
if (Reconnect()) {
|
||||
goto retry;
|
||||
}
|
||||
return state.devices;
|
||||
default:
|
||||
return state.devices;
|
||||
}
|
||||
|
||||
pa_mainloop_iterate(mainloop_, true, nullptr);
|
||||
|
||||
@@ -25,14 +25,14 @@
|
||||
|
||||
#include <vlc/vlc.h>
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
class VlcScopedRef {
|
||||
public:
|
||||
explicit VlcScopedRef(T *ptr);
|
||||
~VlcScopedRef();
|
||||
|
||||
operator T*() const { return ptr_; }
|
||||
operator bool () const { return ptr_; }
|
||||
operator T *() const { return ptr_; }
|
||||
operator bool() const { return ptr_; }
|
||||
T *operator->() const { return ptr_; }
|
||||
|
||||
private:
|
||||
@@ -49,23 +49,23 @@ class VlcScopedRef {
|
||||
}
|
||||
#define VLCSCOPEDREF_DEFINE(type) VLCSCOPEDREF_DEFINE2(type, libvlc_##type##_release)
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
void VlcScopedRef_Release(T *ptr);
|
||||
|
||||
VLCSCOPEDREF_DEFINE2(instance, libvlc_release)
|
||||
VLCSCOPEDREF_DEFINE(media_player)
|
||||
VLCSCOPEDREF_DEFINE(media)
|
||||
|
||||
template <> void VlcScopedRef_Release<char>(char *ptr) { free(ptr); }
|
||||
template<> void VlcScopedRef_Release<char>(char *ptr) { free(ptr); }
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
VlcScopedRef<T>::VlcScopedRef(T *ptr)
|
||||
: ptr_(ptr) {
|
||||
: ptr_(ptr) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
VlcScopedRef<T>::~VlcScopedRef() {
|
||||
VlcScopedRef_Release(ptr_);
|
||||
}
|
||||
|
||||
#endif // VLCSCOPEDREF_H
|
||||
#endif // VLCSCOPEDREF_H
|
||||
|
||||
Reference in New Issue
Block a user