aboutsummaryrefslogtreecommitdiffstats
path: root/meta-speech-framework/meta-aac/recipes-modules/aac-module-gstreamer
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2019-09-21 13:33:45 -0400
committerScott Murray <scott.murray@konsulko.com>2019-09-21 13:45:43 -0400
commit15196563cf2d6cfc9b095319913d4bf448819559 (patch)
tree39dc93289f4db28fff88a7793c0103dc2720a479 /meta-speech-framework/meta-aac/recipes-modules/aac-module-gstreamer
parent4264e6da82c551a81cda1f4900d3ed7bd8a6b148 (diff)
meta-speech-framework: aac-module-gstreamer: Add PipeWire support patch
Add a version of George's PipeWire support patch updated for the new gstreamer module in Alexa Auto SDK 2.0 to the aac-module-gstreamer bbappend. Bug-AGL: SPEC-2761 Change-Id: I4787d365664089848a9ffa3be1ee646766f6c931 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'meta-speech-framework/meta-aac/recipes-modules/aac-module-gstreamer')
-rw-r--r--meta-speech-framework/meta-aac/recipes-modules/aac-module-gstreamer/aac-module-gstreamer.bbappend4
-rw-r--r--meta-speech-framework/meta-aac/recipes-modules/aac-module-gstreamer/aac-module-gstreamer/0001-gstreamer-implement-pipewire-integration.patch94
2 files changed, 98 insertions, 0 deletions
diff --git a/meta-speech-framework/meta-aac/recipes-modules/aac-module-gstreamer/aac-module-gstreamer.bbappend b/meta-speech-framework/meta-aac/recipes-modules/aac-module-gstreamer/aac-module-gstreamer.bbappend
index 78107c82..1b2618e8 100644
--- a/meta-speech-framework/meta-aac/recipes-modules/aac-module-gstreamer/aac-module-gstreamer.bbappend
+++ b/meta-speech-framework/meta-aac/recipes-modules/aac-module-gstreamer/aac-module-gstreamer.bbappend
@@ -1,5 +1,9 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
+
# Needed for the required gstreamer-app-1.0 pkgconfig bits
DEPENDS += "gstreamer1.0-plugins-base"
+AAC_PATCHES += "file://0001-gstreamer-implement-pipewire-integration.patch"
+
# Pull static library into appropriate package to avoid a QA error
FILES_${PN}-staticdev += "${AAC_PREFIX}/lib/libaal.a"
diff --git a/meta-speech-framework/meta-aac/recipes-modules/aac-module-gstreamer/aac-module-gstreamer/0001-gstreamer-implement-pipewire-integration.patch b/meta-speech-framework/meta-aac/recipes-modules/aac-module-gstreamer/aac-module-gstreamer/0001-gstreamer-implement-pipewire-integration.patch
new file mode 100644
index 00000000..b0a5c104
--- /dev/null
+++ b/meta-speech-framework/meta-aac/recipes-modules/aac-module-gstreamer/aac-module-gstreamer/0001-gstreamer-implement-pipewire-integration.patch
@@ -0,0 +1,94 @@
+gstreamer: implement pipewire integration using pwaudiosrc/pwaudiosink
+
+The code path is wrapped in #ifdef USE_PIPEWIRE so that it can be toggled
+easily at compile time.
+
+The device string is abused to hold the role name, just like it was
+with 4A. In the future this may need to be reconsidered. In theory,
+we could detect the backend or make it configurable from the upper layer
+if we knew exactly what kind of data is in that device string
+(is it an ALSA device name? a pipewire role? a pipewire node id?
+a pulseaudio device name? ...)
+
+Upstream-Status: Pending
+
+Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com>
+[reworked for SDK 2.0]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+diff --git a/lib/aal/CMakeLists.txt b/lib/aal/CMakeLists.txt
+index a892465..c92b2cf 100644
+--- a/lib/aal/CMakeLists.txt
++++ b/lib/aal/CMakeLists.txt
+@@ -7,6 +7,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+
+ add_definitions(-DUSE_GLOOP)
+ add_definitions(-DUSE_FAKEMUTE)
++add_definitions(-DUSE_PIPEWIRE)
+
+ # GStreamer
+ find_package(PkgConfig)
+diff --git a/lib/aal/src/player.c b/lib/aal/src/player.c
+index 02a2881..8747854 100644
+--- a/lib/aal/src/player.c
++++ b/lib/aal/src/player.c
+@@ -120,6 +120,19 @@ aal_handle_t aal_player_create(const aal_attributes_t *attr)
+ g_object_get(volume, "volume", &ctx->saved_volume, NULL);
+ #endif
+
++#ifdef USE_PIPEWIRE
++ sink = create_and_add_element(bin, "pwaudiosink", "sink");
++ if (sink && attr->device && !IS_EMPTY_STRING(attr->device)) {
++ g_info("Using role: %s\n", attr->device);
++ GstStructure *s = gst_structure_new("properties",
++ "media.role",
++ G_TYPE_STRING,
++ attr->device,
++ NULL);
++ g_object_set(G_OBJECT(sink), "stream-properties", s, NULL);
++ gst_structure_free(s);
++ }
++#else
+ if (!attr->device || IS_EMPTY_STRING(attr->device)) {
+ sink = create_and_add_element(bin, "autoaudiosink", "sink");
+ } else {
+@@ -128,6 +141,7 @@ aal_handle_t aal_player_create(const aal_attributes_t *attr)
+ if (sink)
+ g_object_set(G_OBJECT(sink), "device", attr->device, NULL);
+ }
++#endif
+ if (!sink)
+ goto exit;
+
+diff --git a/lib/aal/src/recorder.c b/lib/aal/src/recorder.c
+index 96c9b2a..66b36e1 100644
+--- a/lib/aal/src/recorder.c
++++ b/lib/aal/src/recorder.c
+@@ -86,6 +86,19 @@ aal_handle_t aal_recorder_create(const aal_attributes_t *attr)
+ if (!ctx)
+ goto exit;
+
++#ifdef USE_PIPEWIRE
++ source = create_and_add_element(ctx->pipeline, "pwaudiosrc", "source");
++ if (source && attr->device && !IS_EMPTY_STRING(attr->device)) {
++ g_info("Using role: %s\n", attr->device);
++ GstStructure *s = gst_structure_new("properties",
++ "media.role",
++ G_TYPE_STRING,
++ attr->device,
++ NULL);
++ g_object_set(G_OBJECT(source), "stream-properties", s, NULL);
++ gst_structure_free(s);
++ }
++#else
+ if (!attr->device || IS_EMPTY_STRING(attr->device)) {
+ source = create_and_add_element(ctx->pipeline, "autoaudiosrc", "source");
+ } else {
+@@ -94,6 +107,7 @@ aal_handle_t aal_recorder_create(const aal_attributes_t *attr)
+ if (source)
+ g_object_set(G_OBJECT(source), "device", attr->device, NULL);
+ }
++#endif
+ if (!source)
+ goto exit;
+