Improvements to device selection
This commit is contained in:
@@ -60,9 +60,9 @@ QList<DeviceFinder::Device> AlsaDeviceFinder::ListDevices() {
|
||||
result = snd_card_next(&card);
|
||||
if (result < 0) {
|
||||
qLog(Error) << "Unable to get soundcard:" << snd_strerror(result);
|
||||
return ret;
|
||||
break;
|
||||
}
|
||||
if (card < 0) return ret;
|
||||
if (card < 0) break;
|
||||
|
||||
char name[32];
|
||||
sprintf(name, "hw:%d", card);
|
||||
@@ -109,9 +109,6 @@ QList<DeviceFinder::Device> AlsaDeviceFinder::ListDevices() {
|
||||
snd_ctl_close(handle);
|
||||
}
|
||||
|
||||
snd_pcm_info_free(pcminfo); pcminfo = NULL;
|
||||
snd_ctl_card_info_free(cardinfo); cardinfo = NULL;
|
||||
|
||||
snd_config_update_free_global();
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "core/logging.h"
|
||||
|
||||
DirectSoundDeviceFinder::DirectSoundDeviceFinder()
|
||||
: DeviceFinder("directsoundsink") {
|
||||
: DeviceFinder("directsound") {
|
||||
}
|
||||
|
||||
QList<DeviceFinder::Device> DirectSoundDeviceFinder::ListDevices() {
|
||||
|
||||
@@ -81,4 +81,3 @@ void EngineDevice::Init() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -74,12 +74,16 @@ using std::vector;
|
||||
|
||||
const char *GstEngine::kAutoSink = "autoaudiosink";
|
||||
const char *GstEngine::kALSASink = "alsasink";
|
||||
const char *GstEngine::kOpenALSASink = "openalsink";
|
||||
const char *GstEngine::kOSSSink = "osssink";
|
||||
const char *GstEngine::kOSS4Sink = "oss4sink";
|
||||
const char *GstEngine::kJackAudioSink = "jackaudiosink";
|
||||
const char *GstEngine::kPulseSink = "pulsesink";
|
||||
const char *GstEngine::kA2DPSink = "a2dpsink";
|
||||
const char *GstEngine::kAVDTPSink = "avdtpsink";
|
||||
const char *GstEngine::InterAudiosink = "interaudiosink";
|
||||
const char *GstEngine::kDirectSoundSink = "directsoundsink";
|
||||
const char *GstEngine::kOSXAudioSink = "osxaudiosink";
|
||||
|
||||
GstEngine::GstEngine(TaskManager *task_manager)
|
||||
: Engine::Base(),
|
||||
@@ -835,18 +839,6 @@ shared_ptr<GstEnginePipeline> GstEngine::CreatePipeline(const QByteArray &url, q
|
||||
|
||||
}
|
||||
|
||||
bool GstEngine::ALSADeviceSupport(const QString &name) {
|
||||
|
||||
return (name == kALSASink || name == kOSSSink);
|
||||
|
||||
}
|
||||
|
||||
bool GstEngine::PulseDeviceSupport(const QString &name) {
|
||||
|
||||
return (name == kPulseSink);
|
||||
|
||||
}
|
||||
|
||||
void GstEngine::AddBufferConsumer(GstBufferConsumer *consumer) {
|
||||
buffer_consumers_ << consumer;
|
||||
if (current_pipeline_) current_pipeline_->AddBufferConsumer(consumer);
|
||||
@@ -901,3 +893,23 @@ EngineBase::OutputDetailsList GstEngine::GetOutputsList() const {
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
bool GstEngine::ALSADeviceSupport(const QString &name) {
|
||||
return (name == kALSASink);
|
||||
}
|
||||
|
||||
bool GstEngine::PulseDeviceSupport(const QString &name) {
|
||||
return (name == kPulseSink);
|
||||
}
|
||||
|
||||
bool GstEngine::DirectSoundDeviceSupport(const QString &name) {
|
||||
return (name == kDirectSoundSink);
|
||||
}
|
||||
|
||||
bool GstEngine::OSXAudioDeviceSupport(const QString &name) {
|
||||
return (name == kOSXAudioSink);
|
||||
}
|
||||
bool GstEngine::CustomDeviceSupport(const QString &name) {
|
||||
return (name == kALSASink || name == kOpenALSASink || name == kOSSSink || name == kOSS4Sink || name == kA2DPSink || name == kAVDTPSink);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,13 +66,6 @@ class GstEngine : public Engine::Base, public GstBufferConsumer {
|
||||
~GstEngine();
|
||||
|
||||
static const char *kAutoSink;
|
||||
static const char *kALSASink;
|
||||
static const char *kOSSSink;
|
||||
static const char *kOSS4Sink;
|
||||
static const char *kJackAudioSink;
|
||||
static const char *kPulseSink;
|
||||
static const char *kA2DPSink;
|
||||
static const char *kAVDTPSink;
|
||||
|
||||
bool Init();
|
||||
void EnsureInitialised() { initialising_.waitForFinished(); }
|
||||
@@ -86,16 +79,19 @@ class GstEngine : public Engine::Base, public GstBufferConsumer {
|
||||
Engine::State state() const;
|
||||
const Engine::Scope &scope(int chunk_length);
|
||||
|
||||
static bool ALSADeviceSupport(const QString &name);
|
||||
static bool PulseDeviceSupport(const QString &name);
|
||||
|
||||
GstElement *CreateElement(const QString &factoryName, GstElement *bin = 0, bool fatal = true, bool showerror = true);
|
||||
|
||||
// BufferConsumer
|
||||
void ConsumeBuffer(GstBuffer *buffer, int pipeline_id);
|
||||
|
||||
|
||||
bool IsEqualizerEnabled() { return equalizer_enabled_; }
|
||||
|
||||
static bool ALSADeviceSupport(const QString &name);
|
||||
static bool PulseDeviceSupport(const QString &name);
|
||||
static bool DirectSoundDeviceSupport(const QString &name);
|
||||
static bool OSXAudioDeviceSupport(const QString &name);
|
||||
static bool CustomDeviceSupport(const QString &name);
|
||||
|
||||
public slots:
|
||||
void StartPreloading(const QUrl &url, bool force_stop_at_end, qint64 beginning_nanosec, qint64 end_nanosec);
|
||||
bool Load(const QUrl &, Engine::TrackChangeFlags change, bool force_stop_at_end, quint64 beginning_nanosec, qint64 end_nanosec);
|
||||
@@ -142,6 +138,19 @@ class GstEngine : public Engine::Base, public GstBufferConsumer {
|
||||
void BufferingFinished();
|
||||
|
||||
private:
|
||||
|
||||
static const char *kALSASink;
|
||||
static const char *kOpenALSASink;
|
||||
static const char *kOSSSink;
|
||||
static const char *kOSS4Sink;
|
||||
static const char *kJackAudioSink;
|
||||
static const char *kPulseSink;
|
||||
static const char *kA2DPSink;
|
||||
static const char *kAVDTPSink;
|
||||
static const char *InterAudiosink;
|
||||
static const char *kDirectSoundSink;
|
||||
static const char *kOSXAudioSink;
|
||||
|
||||
PluginDetailsList GetPluginList(const QString &classname) const;
|
||||
|
||||
void StartFadeout();
|
||||
|
||||
@@ -62,7 +62,7 @@ std::unique_ptr<T> GetProperty(const AudioDeviceID& device_id, const AudioObject
|
||||
|
||||
|
||||
OsxDeviceFinder::OsxDeviceFinder()
|
||||
: DeviceFinder("osxaudiosink") {
|
||||
: DeviceFinder("osxaudio") {
|
||||
}
|
||||
|
||||
QList<DeviceFinder::Device> OsxDeviceFinder::ListDevices() {
|
||||
@@ -94,8 +94,7 @@ QList<DeviceFinder::Device> OsxDeviceFinder::ListDevices() {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Determine if the device is an output device (it is an output device if
|
||||
// it has output channels)
|
||||
// Determine if the device is an output device (it is an output device if it has output channels)
|
||||
address.mSelector = kAudioDevicePropertyStreamConfiguration;
|
||||
std::unique_ptr<AudioBufferList> buffer_list = GetProperty<AudioBufferList>(id, address);
|
||||
if (!buffer_list.get() || buffer_list->mNumberBuffers == 0) {
|
||||
|
||||
Reference in New Issue
Block a user