From e35d04a7420883bc6eee818045a8c52b9420021c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Sat, 18 Jan 2025 15:11:43 +0100 Subject: [PATCH 1/6] clapper-app: Fix internal functions visibility We have to export functions that are used from UI files, otherwise they are not accessible. For this reason add a special internal visibility header. --- src/bin/clapper-app/clapper-app-list-item-utils.h | 8 ++++++++ src/bin/clapper-app/meson.build | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/bin/clapper-app/clapper-app-list-item-utils.h b/src/bin/clapper-app/clapper-app-list-item-utils.h index 57aa111e..052723d1 100644 --- a/src/bin/clapper-app/clapper-app-list-item-utils.h +++ b/src/bin/clapper-app/clapper-app-list-item-utils.h @@ -21,18 +21,26 @@ #include #include +#include "clapper-app-internal-visibility.h" + G_BEGIN_DECLS +CLAPPER_APP_INTERNAL_API gchar * clapper_app_list_item_make_stream_group_title (GtkListItem *list_item, ClapperStream *stream); +CLAPPER_APP_INTERNAL_API gchar * clapper_app_list_item_make_resolution (GtkListItem *list_item, gint width, gint height); +CLAPPER_APP_INTERNAL_API gchar * clapper_app_list_item_make_bitrate (GtkListItem *list_item, guint value); +CLAPPER_APP_INTERNAL_API gchar * clapper_app_list_item_convert_int (GtkListItem *list_item, gint value); +CLAPPER_APP_INTERNAL_API gchar * clapper_app_list_item_convert_uint (GtkListItem *list_item, guint value); +CLAPPER_APP_INTERNAL_API gchar * clapper_app_list_item_convert_double (GtkListItem *list_item, gdouble value); G_END_DECLS diff --git a/src/bin/clapper-app/meson.build b/src/bin/clapper-app/meson.build index 83f3946c..220b66c0 100644 --- a/src/bin/clapper-app/meson.build +++ b/src/bin/clapper-app/meson.build @@ -53,6 +53,19 @@ configure_file( configuration: config_h, ) +visibility_conf = configuration_data() + +visibility_conf.set( + 'CLAPPER_API', + 'CLAPPER_APP_INTERNAL', +) + +configure_file( + input: '../../lib/shared/clapper-api-visibility.h.in', + output: 'clapper-app-internal-visibility.h', + configuration: visibility_conf, +) + clapperapp_sources = [ 'clapper-app-about-window.c', 'clapper-app-application.c', @@ -77,6 +90,7 @@ clapperapp_sources = [ ] clapperapp_c_args = [ '-DG_LOG_DOMAIN="ClapperApp"', + '-DCLAPPER_APP_INTERNAL_COMPILATION', '-DGST_USE_UNSTABLE_API', ] From 4472d87f8b96e1f0bd95f6eb1c750ba6a43db64f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Sat, 18 Jan 2025 15:49:42 +0100 Subject: [PATCH 2/6] clapper-app: Show sink bin child name in info window Sinks that are bin types often take another configurable sink through a property. We want to show what was set there in info window too. --- src/bin/clapper-app/clapper-app-info-window.c | 43 +++++++++++++++++++ .../clapper-app/ui/clapper-app-info-window.ui | 4 +- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/bin/clapper-app/clapper-app-info-window.c b/src/bin/clapper-app/clapper-app-info-window.c index 216168f1..390e1ede 100644 --- a/src/bin/clapper-app/clapper-app-info-window.c +++ b/src/bin/clapper-app/clapper-app-info-window.c @@ -89,6 +89,48 @@ playback_decoder_closure (ClapperAppInfoWindow *self, GstElement *decoder) return text; } +static gchar * +playback_sink_closure (ClapperAppInfoWindow *self, GstElement *sink) +{ + GstElementFactory *factory; + GParamSpec *pspec; + gchar *text, *el_name, *child_name = NULL; + + if (!sink || !(factory = gst_element_get_factory (sink))) + return NULL; + + el_name = gst_object_get_name (GST_OBJECT_CAST (factory)); + + /* We want to show actual sink if it is configurable + * through a property (e.g. sink of "glsinkbin") */ + if (GST_IS_BIN (sink) + && ((pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (sink), "video-sink")) + || (pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (sink), "sink"))) + && pspec->value_type == GST_TYPE_ELEMENT) { + GstElement *child = NULL; + GstElementFactory *child_factory; + + g_object_get (sink, pspec->name, &child, NULL); + + if (child) { + if ((child_factory = gst_element_get_factory (child))) + child_name = gst_object_get_name (GST_OBJECT_CAST (child_factory)); + + gst_object_unref (child); + } + } + + if (child_name) { + text = g_strdup_printf ("%s + %s", el_name, child_name); + g_free (el_name); + g_free (child_name); + } else { + text = el_name; + } + + return text; +} + static GtkSelectionModel * create_no_selection_closure (ClapperAppInfoWindow *self, ClapperStreamList *stream_list) { @@ -218,6 +260,7 @@ clapper_app_info_window_class_init (ClapperAppInfoWindowClass *klass) gtk_widget_class_bind_template_callback (widget_class, media_duration_closure); gtk_widget_class_bind_template_callback (widget_class, playback_element_name_closure); gtk_widget_class_bind_template_callback (widget_class, playback_decoder_closure); + gtk_widget_class_bind_template_callback (widget_class, playback_sink_closure); gtk_widget_class_bind_template_callback (widget_class, create_no_selection_closure); gtk_widget_class_bind_template_callback (widget_class, has_streams_closure); } diff --git a/src/bin/clapper-app/ui/clapper-app-info-window.ui b/src/bin/clapper-app/ui/clapper-app-info-window.ui index 0393d791..b64353b0 100644 --- a/src/bin/clapper-app/ui/clapper-app-info-window.ui +++ b/src/bin/clapper-app/ui/clapper-app-info-window.ui @@ -181,7 +181,7 @@ Sink - + ClapperAppInfoWindow @@ -222,7 +222,7 @@ Sink - + ClapperAppInfoWindow From fe30ba24fa5d406d4e75f71ddee5aac0d6577e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Sat, 18 Jan 2025 18:31:03 +0100 Subject: [PATCH 3/6] clapper-gtk: extra-menu-button: Drop popover focus on unmap Fixes #496 --- src/lib/clapper-gtk/clapper-gtk-extra-menu-button.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/clapper-gtk/clapper-gtk-extra-menu-button.c b/src/lib/clapper-gtk/clapper-gtk-extra-menu-button.c index 16bd1d98..53a7513d 100644 --- a/src/lib/clapper-gtk/clapper-gtk-extra-menu-button.c +++ b/src/lib/clapper-gtk/clapper-gtk-extra-menu-button.c @@ -574,6 +574,8 @@ popover_map_cb (GtkWidget *widget, ClapperGtkExtraMenuButton *self) GST_TRACE_OBJECT (self, "Popover map"); + gtk_widget_set_can_focus (widget, TRUE); + if (G_UNLIKELY (self->player == NULL)) return; @@ -608,6 +610,11 @@ popover_unmap_cb (GtkWidget *widget, ClapperGtkExtraMenuButton *self) GST_TRACE_OBJECT (self, "Popover unmap"); + /* Drop focus after popover is closed. Fixes issue + * with keyboard shortcuts not working when closed + * while within submenu */ + gtk_widget_set_can_focus (widget, FALSE); + if (G_UNLIKELY (self->player == NULL)) return; From 8752d081133e5fbb05e4566dda4bbe251fe27107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Sun, 19 Jan 2025 15:39:30 +0100 Subject: [PATCH 4/6] clapper: enhancers-loader: Fix default enhancers dir on Win32 --- src/lib/clapper/clapper-enhancers-loader.c | 25 +++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/lib/clapper/clapper-enhancers-loader.c b/src/lib/clapper/clapper-enhancers-loader.c index 286a77ec..6c7a26f4 100644 --- a/src/lib/clapper/clapper-enhancers-loader.c +++ b/src/lib/clapper/clapper-enhancers-loader.c @@ -22,6 +22,11 @@ #include #include +#ifdef G_OS_WIN32 +#include +static HMODULE _enhancers_dll_handle = NULL; +#endif + #include "clapper-enhancers-loader-private.h" #define ENHANCER_INTERFACES "X-Interfaces" @@ -44,13 +49,29 @@ void clapper_enhancers_loader_initialize (void) { const gchar *enhancers_path; - gchar **dir_paths; + gchar **dir_paths, *custom_path = NULL; guint i; GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "clapperenhancersloader", 0, "Clapper Enhancer Loader"); enhancers_path = g_getenv ("CLAPPER_ENHANCERS_PATH"); + +#ifdef G_OS_WIN32 + if (!enhancers_path || *enhancers_path == '\0') { + gchar *win_base_dir; + + win_base_dir = g_win32_get_package_installation_directory_of_module ( + _enhancers_dll_handle); + /* FIXME: Avoid hardcoded major version */ + custom_path = g_build_filename (win_base_dir, + "lib", "clapper-0.0", "enhancers", NULL); + enhancers_path = custom_path; // assign temporarily + + g_free (win_base_dir); + } +#endif + if (!enhancers_path || *enhancers_path == '\0') enhancers_path = CLAPPER_ENHANCERS_PATH; @@ -83,6 +104,8 @@ clapper_enhancers_loader_initialize (void) GST_INFO ("Clapper enhancers initialized, found: %u", n_items); } + + g_free (custom_path); } static inline gboolean From 4df812066f4ab37d03ddadc6fa6c369431506a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Sun, 19 Jan 2025 15:45:55 +0100 Subject: [PATCH 5/6] clapper: enhancers-loader: Support loading extra enhancers Allow setting an additional dir(s) with "CLAPPER_ENHANCERS_EXTRA_PATH" env. This should allow to add other enhancers without removing default ones. If app/user needs to remove default ones, "CLAPPER_ENHANCERS_PATH" env can be set to empty. --- src/lib/clapper/clapper-enhancers-loader.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/clapper/clapper-enhancers-loader.c b/src/lib/clapper/clapper-enhancers-loader.c index 6c7a26f4..119cb637 100644 --- a/src/lib/clapper/clapper-enhancers-loader.c +++ b/src/lib/clapper/clapper-enhancers-loader.c @@ -84,6 +84,7 @@ clapper_enhancers_loader_initialize (void) peas_engine_enable_loader (_engine, "python"); peas_engine_enable_loader (_engine, "gjs"); +load_enhancers: dir_paths = g_strsplit (enhancers_path, G_SEARCHPATH_SEPARATOR_S, 0); for (i = 0; dir_paths[i]; ++i) @@ -91,6 +92,11 @@ clapper_enhancers_loader_initialize (void) g_strfreev (dir_paths); + /* Support loading additional enhancers from non-default directory */ + enhancers_path = g_getenv ("CLAPPER_ENHANCERS_EXTRA_PATH"); + if (enhancers_path && *enhancers_path != '\0') + goto load_enhancers; + if (gst_debug_category_get_threshold (GST_CAT_DEFAULT) >= GST_LEVEL_INFO) { GListModel *list = (GListModel *) _engine; guint n_items = g_list_model_get_n_items (list); From ce102b9c76b43075817a854a4d1ebafc50302615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Sun, 19 Jan 2025 17:30:28 +0100 Subject: [PATCH 6/6] workflows: Use flatpak-builder action master version Since "flatpak-builder" action uses deprecated "upload-artifact" version, that can stop working soon, disable it and upload ourselves. This is supported in master, but not in any tagged version, so for now switch to using action from master branch. Also bump used runtime to GNOME 47 when building. --- .github/workflows/flatpak-nightly.yml | 9 ++++++++- .github/workflows/flatpak.yml | 11 +++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/flatpak-nightly.yml b/.github/workflows/flatpak-nightly.yml index 31ffd407..1b828ac1 100644 --- a/.github/workflows/flatpak-nightly.yml +++ b/.github/workflows/flatpak-nightly.yml @@ -33,7 +33,7 @@ jobs: flatpak --system install -y --noninteractive flathub org.freedesktop.Sdk.Extension.rust-stable/${{ matrix.arch }}/24.08 flatpak --system install -y --noninteractive flathub org.freedesktop.Sdk.Extension.llvm18/${{ matrix.arch }}/24.08 - name: Build - uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v6 + uses: flatpak/flatpak-github-actions/flatpak-builder@master with: bundle: com.github.rafostar.Clapper.flatpak manifest-path: pkgs/flatpak/com.github.rafostar.Clapper-nightly.json @@ -41,3 +41,10 @@ jobs: repository-url: https://nightly.gnome.org/gnome-nightly.flatpakrepo cache-key: flatpak-builder-${{ github.sha }}-testing-${{ github.run_number }} arch: ${{ matrix.arch }} + upload-artifact: false + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: clapper-flatpak-nightly-${{ matrix.arch }} + path: com.github.rafostar.Clapper.flatpak + if-no-files-found: error diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml index 5e203cde..5a92e3ca 100644 --- a/.github/workflows/flatpak.yml +++ b/.github/workflows/flatpak.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 600 container: - image: bilelmoussaoui/flatpak-github-actions:gnome-45 + image: bilelmoussaoui/flatpak-github-actions:gnome-47 options: --privileged strategy: matrix: @@ -33,9 +33,16 @@ jobs: with: platforms: arm64 - name: Build - uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v6 + uses: flatpak/flatpak-github-actions/flatpak-builder@master with: bundle: com.github.rafostar.Clapper.flatpak manifest-path: pkgs/flatpak/com.github.rafostar.Clapper.json cache-key: flatpak-builder-${{ github.sha }} arch: ${{ matrix.arch }} + upload-artifact: false + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: clapper-flatpak-${{ matrix.arch }} + path: com.github.rafostar.Clapper.flatpak + if-no-files-found: error