Merge pull request #87 from Rafostar/pipewire

Add PipeWire support
This commit is contained in:
Rafał Dzięgiel
2021-06-20 15:46:03 +02:00
committed by GitHub
2 changed files with 21 additions and 6 deletions

View File

@@ -2962,8 +2962,8 @@ gst_clapper_main (gpointer data)
GstClapper *self = GST_CLAPPER (data); GstClapper *self = GST_CLAPPER (data);
GstBus *bus; GstBus *bus;
GSource *source; GSource *source;
GstElement *scaletempo; GstElement *scaletempo, *pipewiresink;
const gchar *env; const gchar *pb_env, *pw_env;
GST_TRACE_OBJECT (self, "Starting main thread"); GST_TRACE_OBJECT (self, "Starting main thread");
@@ -2975,8 +2975,8 @@ gst_clapper_main (gpointer data)
g_source_attach (source, self->context); g_source_attach (source, self->context);
g_source_unref (source); g_source_unref (source);
env = g_getenv ("GST_CLAPPER_USE_PLAYBIN3"); pb_env = g_getenv ("GST_CLAPPER_USE_PLAYBIN3");
if (env && g_str_has_prefix (env, "1")) if (pb_env && g_str_has_prefix (pb_env, "1"))
self->use_playbin3 = TRUE; self->use_playbin3 = TRUE;
if (self->use_playbin3) { if (self->use_playbin3) {
@@ -3018,12 +3018,23 @@ gst_clapper_main (gpointer data)
} }
} }
pw_env = g_getenv ("GST_CLAPPER_USE_PIPEWIRE");
if (pw_env && g_str_has_prefix (pw_env, "1")) {
pipewiresink = gst_element_factory_make ("pipewiresink", NULL);
if (pipewiresink) {
g_object_set (self->playbin, "audio-sink", pipewiresink, NULL);
} else {
g_warning ("GstClapper: pipewiresink element not available. "
"Default audio sink will be used instead.");
}
}
scaletempo = gst_element_factory_make ("scaletempo", NULL); scaletempo = gst_element_factory_make ("scaletempo", NULL);
if (scaletempo) { if (scaletempo) {
g_object_set (self->playbin, "audio-filter", scaletempo, NULL); g_object_set (self->playbin, "audio-filter", scaletempo, NULL);
} else { } else {
g_warning ("GstClapper: scaletempo element not available. Audio pitch " g_warning ("GstClapper: scaletempo element not available. "
"will not be preserved during trick modes"); "Audio pitch will not be preserved during trick modes.");
} }
self->bus = bus = gst_element_get_bus (self->playbin); self->bus = bus = gst_element_get_bus (self->playbin);

View File

@@ -12,6 +12,7 @@
"--socket=pulseaudio", "--socket=pulseaudio",
"--share=network", "--share=network",
"--device=all", "--device=all",
"--filesystem=xdg-run/pipewire-0:ro",
"--filesystem=xdg-videos", "--filesystem=xdg-videos",
"--own-name=org.mpris.MediaPlayer2.Clapper", "--own-name=org.mpris.MediaPlayer2.Clapper",
"--talk-name=org.gnome.Shell", "--talk-name=org.gnome.Shell",
@@ -51,5 +52,8 @@
} }
] ]
} }
],
"cleanup-commands": [
"ln -s /lib/$FLATPAK_ARCH-linux-*/gstreamer-1.0/libgstpipewire.so /app/lib/gstreamer-1.0/"
] ]
} }