Show warnings in GTK player as a dialog box. This can be particularly helpful when the user tries to play an unsupported format.
[YOCTO #12168] Signed-off-by: Mathieu Dubois-Briand <[email protected]> --- I'm not sure this is going to be accepted upstream, as gtk-play is mostly example code. --- ...-gtk-show-player-warnings-in-a-dialog-box.patch | 69 ++++++++++++++++++++++ .../gstreamer/gst-examples_1.28.5.bb | 1 + 2 files changed, 70 insertions(+) diff --git a/meta/recipes-multimedia/gstreamer/gst-examples/0002-examples-gtk-show-player-warnings-in-a-dialog-box.patch b/meta/recipes-multimedia/gstreamer/gst-examples/0002-examples-gtk-show-player-warnings-in-a-dialog-box.patch new file mode 100644 index 000000000000..b437b7a998f5 --- /dev/null +++ b/meta/recipes-multimedia/gstreamer/gst-examples/0002-examples-gtk-show-player-warnings-in-a-dialog-box.patch @@ -0,0 +1,69 @@ +From 11d95270c5216bbe4d0f011c219374800b9ac627 Mon Sep 17 00:00:00 2001 +From: Mathieu Dubois-Briand <[email protected]> +Date: Tue, 25 Aug 2026 11:03:34 +0200 +Subject: [PATCH] examples: gtk: show player warnings in a dialog box + +Right now, the player example fails silently on playback failures. Show +a dialog box with the warning message coming from the gstplay instance. + +Upstream-Status: Submitted [https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/12346] +Signed-off-by: Mathieu Dubois-Briand <[email protected]> +--- + .../gst-examples/playback/player/gtk/gtk-play.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/playback/player/gtk/gtk-play.c b/subprojects/gst-examples/playback/player/gtk/gtk-play.c +index fb83f6be29c5..0b87bcb03171 100644 +--- a/playback/player/gtk/gtk-play.c ++++ b/playback/player/gtk/gtk-play.c +@@ -88,6 +88,7 @@ typedef struct + gboolean loop; + gboolean fullscreen; + gint toolbar_hide_timeout; ++ gboolean warning_shown; + + GtkBuilder *toolbar_ui; + } GtkPlay; +@@ -438,6 +439,7 @@ play_current_uri (GtkPlay * play, GList * uri, const gchar * ext_suburi) + else + gst_play_set_uri (play->player, uri->data); + play->current_uri = uri; ++ play->warning_shown = FALSE; + if (play->playing) { + if (play->inhibit_cookie) + gtk_application_uninhibit (GTK_APPLICATION (g_application_get_default ()), +@@ -1740,6 +1742,22 @@ show_cb (GtkWidget * widget, gpointer user_data) + play_current_uri (self, g_list_first (self->uris), NULL); + } + ++static void ++warning_cb (GstPlaySignalAdapter * adapter, GError * warning, ++ GstStructure * details, GtkPlay * self) ++{ ++ GtkWidget *dialog; ++ ++ if (!self->warning_shown) { ++ self->warning_shown = TRUE; ++ dialog = gtk_message_dialog_new (GTK_WINDOW (self), ++ GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, ++ GTK_BUTTONS_CLOSE, "%s", warning->message); ++ gtk_dialog_run (GTK_DIALOG (dialog)); ++ gtk_widget_destroy (dialog); ++ } ++} ++ + static GObject * + gtk_play_constructor (GType type, guint n_construct_params, + GObjectConstructParam * construct_params) +@@ -1774,6 +1791,8 @@ gtk_play_constructor (GType type, guint n_construct_params, + G_CALLBACK (media_info_updated_cb), self); + g_signal_connect (self->signal_adapter, "volume-changed", + G_CALLBACK (player_volume_changed_cb), self); ++ g_signal_connect (self->signal_adapter, "warning", ++ G_CALLBACK (warning_cb), self); + + /* enable visualization (by default playbin uses goom) */ + /* if visualization is enabled then use the first element */ +-- +2.47.3 + diff --git a/meta/recipes-multimedia/gstreamer/gst-examples_1.28.5.bb b/meta/recipes-multimedia/gstreamer/gst-examples_1.28.5.bb index dcdf7fd4331f..a2dc90a7af74 100644 --- a/meta/recipes-multimedia/gstreamer/gst-examples_1.28.5.bb +++ b/meta/recipes-multimedia/gstreamer/gst-examples_1.28.5.bb @@ -9,6 +9,7 @@ DEPENDS = "glib-2.0 gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins- SRC_URI = "git://gitlab.freedesktop.org/gstreamer/gstreamer.git;protocol=https;branch=1.28;tag=${PV} \ file://0001-Make-player-examples-installable.patch \ + file://0002-examples-gtk-show-player-warnings-in-a-dialog-box.patch \ file://gst-player.desktop \ " --- base-commit: 6f7a806ece411ab32e4b1c08a0299400bdf3b588 change-id: 20260825-mathieu-gst-warning-dialog-40b7f308d15a Best regards, -- Mathieu Dubois-Briand <[email protected]>
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#244229): https://lists.openembedded.org/g/openembedded-core/message/244229 Mute This Topic: https://lists.openembedded.org/mt/120918446/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
