Merge pull request #519 from Rafostar/misc-fixes

Miscellaneous fixes
This commit is contained in:
Rafał Dzięgiel
2025-01-19 18:02:10 +01:00
committed by GitHub
8 changed files with 121 additions and 6 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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);
}

View File

@@ -21,18 +21,26 @@
#include <gtk/gtk.h>
#include <clapper/clapper.h>
#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

View File

@@ -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',
]

View File

@@ -181,7 +181,7 @@
<object class="ClapperAppPropertyRow">
<property name="title" translatable="yes">Sink</property>
<binding name="subtitle">
<closure type="gchararray" function="playback_element_name_closure">
<closure type="gchararray" function="playback_sink_closure">
<lookup name="video-sink" type="ClapperPlayer">
<lookup name="player">ClapperAppInfoWindow</lookup>
</lookup>
@@ -222,7 +222,7 @@
<object class="ClapperAppPropertyRow">
<property name="title" translatable="yes">Sink</property>
<binding name="subtitle">
<closure type="gchararray" function="playback_element_name_closure">
<closure type="gchararray" function="playback_sink_closure">
<lookup name="audio-sink" type="ClapperPlayer">
<lookup name="player">ClapperAppInfoWindow</lookup>
</lookup>

View File

@@ -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;

View File

@@ -22,6 +22,11 @@
#include <gst/gst.h>
#include <libpeas.h>
#ifdef G_OS_WIN32
#include <windows.h>
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;
@@ -63,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)
@@ -70,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);
@@ -83,6 +110,8 @@ clapper_enhancers_loader_initialize (void)
GST_INFO ("Clapper enhancers initialized, found: %u", n_items);
}
g_free (custom_path);
}
static inline gboolean