Rename EngineDevice --> DeviceFinders, Add MMDeviceFinder

This commit is contained in:
Jonas Kvinge
2019-11-03 19:53:08 +01:00
parent 62b8521cbe
commit 7b977ea839
12 changed files with 192 additions and 35 deletions

View File

@@ -40,6 +40,7 @@
#include <QTimeLine>
#include <QMetaObject>
#include <QtDebug>
#include <QUuid>
#include "core/concurrentrun.h"
#include "core/logging.h"
@@ -197,11 +198,11 @@ bool GstEnginePipeline::InitAudioBin() {
if (device_.isValid() && g_object_class_find_property(G_OBJECT_GET_CLASS(audiosink), "device")) {
switch (device_.type()) {
case QVariant::String:
if (device_.toString().isEmpty()) break;
g_object_set(G_OBJECT(audiosink), "device", device_.toString().toUtf8().constData(), nullptr);
if (device_.toString().isEmpty()) break;
g_object_set(G_OBJECT(audiosink), "device", device_.toString().toUtf8().constData(), nullptr);
break;
case QVariant::ByteArray:
g_object_set(G_OBJECT(audiosink), "device", device_.toByteArray().constData(), nullptr);
g_object_set(G_OBJECT(audiosink), "device", device_.toByteArray().constData(), nullptr);
break;
case QVariant::LongLong:
g_object_set(G_OBJECT(audiosink), "device", device_.toLongLong(), nullptr);
@@ -209,12 +210,20 @@ bool GstEnginePipeline::InitAudioBin() {
case QVariant::Int:
g_object_set(G_OBJECT(audiosink), "device", device_.toInt(), nullptr);
break;
case QVariant::Uuid:
g_object_set(G_OBJECT(audiosink), "device", device_.toUuid(), nullptr);
break;
default:
qLog(Warning) << "Unknown device type" << device_;
break;
}
}
if (output_ == "wasapisink") {
g_object_set(G_OBJECT(audiosink), "exclusive", true, nullptr);
g_object_set(G_OBJECT(audiosink), "low-latency", true, nullptr);
}
// Create all the other elements
audioqueue_ = engine_->CreateElement("queue2", audiobin_);
@@ -901,6 +910,7 @@ void GstEnginePipeline::SourceSetupCallback(GstPlayBin *bin, GParamSpec *, gpoin
if (g_object_class_find_property(G_OBJECT_GET_CLASS(element), "device") && !instance->source_device().isEmpty()) {
// Gstreamer is not able to handle device in URL (referring to Gstreamer documentation, this might be added in the future).
// Despite that, for now we include device inside URL: we decompose it during Init and set device here, when this callback is called.
qLog(Info) << instance->source_device().toLocal8Bit().constData();
g_object_set(element, "device", instance->source_device().toLocal8Bit().constData(), nullptr);
}