[connections/vnc-audio-support: 2/3] build, vnc: Enable audio for VNC connections




commit ec98b1c897fafcb4aba0c54232a61beeebb0d49c
Author: Felipe Borges <felipeborges gnome org>
Date:   Mon Nov 1 10:41:24 2021 +0100

    build, vnc: Enable audio for VNC connections

 .gitlab-ci.yml                               | 2 +-
 build-aux/flatpak/org.gnome.Connections.json | 4 ++++
 src/meson.build                              | 1 +
 src/vnc-connection.vala                      | 8 ++++++++
 4 files changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 126e9d5..8abd6ff 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -28,7 +28,7 @@ fedora:latest:
     before_script:
     - dnf update -y --nogpgcheck
     - dnf install -y meson git vala gtk3-devel
-                     gtk-vnc2-devel gettext freerdp-devel
+                     gtk-vnc2-devel gvncpulse-devel gettext freerdp-devel
                      libhandy1-devel python3-devel --nogpgcheck
 
     script:
diff --git a/build-aux/flatpak/org.gnome.Connections.json b/build-aux/flatpak/org.gnome.Connections.json
index 688f7b8..2c01448 100644
--- a/build-aux/flatpak/org.gnome.Connections.json
+++ b/build-aux/flatpak/org.gnome.Connections.json
@@ -8,6 +8,7 @@
         "--share=network",
         "--share=ipc",
         "--socket=fallback-x11",
+        "--socket=pulseaudio",
         "--socket=wayland"
     ],
     "cleanup": [
@@ -26,6 +27,9 @@
         {
             "name" : "gtk-vnc",
             "buildsystem" : "meson",
+            "config-opts" : [
+                "-Dpulseaudio=enabled"
+            ],
             "sources" : [
                 {
                     "type" : "archive",
diff --git a/src/meson.build b/src/meson.build
index 8688374..bf7ad1a 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -29,6 +29,7 @@ connections_deps = [
   dependency('gio-2.0', version: '>= 2.50'),
   dependency('gtk+-3.0', version: '>= 3.22'),
   dependency('gtk-vnc-2.0', version: '> 0.4.4'),
+  dependency('gvncpulse-1.0'),
   dependency('libhandy-1', version: '>= 1.2.0'),
   dependency ('libxml-2.0', version: '>= 2.7.8'),
 ]
diff --git a/src/vnc-connection.vala b/src/vnc-connection.vala
index 6f60b01..3bc92fe 100644
--- a/src/vnc-connection.vala
+++ b/src/vnc-connection.vala
@@ -103,6 +103,14 @@ namespace Connections {
             clipboard.owner_change.connect (on_owner_change_cb);
 
             notify["scale-mode"].connect (scale);
+
+            var connection = display.get_connection ();
+            connection.set_audio_format (new Vnc.AudioFormat () {
+                frequency = 44100,
+                nchannels = 2
+            });
+            connection.set_audio (new Vnc.AudioPulse ());
+            connection.audio_enable ();
         }
 
         public VncConnection (string uuid) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]