public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Felipe Borges <felipeborges@gnome.org>
To: git-commits@fedoraproject.org
Subject: [rpms/showtime] f44: Use GstPlay's missing plugin details instead of get_state
Date: Mon, 09 Nov 2026 15:22:44 GMT	[thread overview]
Message-ID: <179423776481.1.4481246300310558934.rpms-showtime-e5de4e6eb3bd@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/showtime
            Branch : f44
            Commit : e5de4e6eb3bdac497c69919d6dc0e808a14b817e
            Author : Felipe Borges <felipeborges@gnome.org>
            Date   : 2026-11-09T16:21:09+01:00
            Stats  : +246/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/showtime/c/e5de4e6eb3bdac497c69919d6dc0e808a14b817e?branch=f44

            Log:
            Use GstPlay's missing plugin details instead of get_state

Posted upstream at
https://gitlab.gnome.org/GNOME/showtime/-/merge_requests/110

See also
 https://gitlab.gnome.org/GNOME/showtime/-/work_items/299

Resolves: rhbz#2502739

---
diff --git a/0001-play-Use-GstPlay-s-missing-plugin-details-instead-of.patch b/0001-play-Use-GstPlay-s-missing-plugin-details-instead-of.patch
new file mode 100644
index 0000000..c0e868e
--- /dev/null
+++ b/0001-play-Use-GstPlay-s-missing-plugin-details-instead-of.patch
@@ -0,0 +1,244 @@
+From 73e10943f0d64b247c6ec3b87b19ae7b5d7abe4c Mon Sep 17 00:00:00 2001
+From: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
+Date: Thu, 22 Oct 2026 06:52:00 -0700
+Subject: [PATCH] play: Use GstPlay's missing plugin details instead of
+ get_state
+
+Blocking on get_state() on the main thread deadlocks with
+gtk4paintablesink. Instead, use WARNING and ERROR messages
+to derive missing plugins.
+
+Fixes https://gitlab.gnome.org/GNOME/showtime/-/work_items/299
+---
+ showtime/play.py           | 90 +++++++++++++++++++++++++++-----------
+ showtime/widgets/window.py | 26 ++++-------
+ 2 files changed, 73 insertions(+), 43 deletions(-)
+
+diff --git a/showtime/play.py b/showtime/play.py
+index 3a46df6..2b3cdb5 100644
+--- a/showtime/play.py
++++ b/showtime/play.py
+@@ -1,20 +1,24 @@
+ # SPDX-License-Identifier: GPL-3.0-or-later
+ # SPDX-FileCopyrightText: Copyright 2024-2026 kramo
+ 
+-from functools import partial
+-from typing import Any
++from typing import Any, NamedTuple
+ 
+ from gi.repository import (
+     Gdk,
+-    GLib,
+     GObject,
+     Gst,
+-    GstPbutils,
+     GstPlay,  # pyright: ignore[reportAttributeAccessIssue]
+     Gtk,
+ )
+ 
+-from showtime import system, utils
++from showtime import logger, system, utils
++
++
++class MissingPlugin(NamedTuple):
++    """A missing plugin reported by GStreamer."""
++
++    description: str
++    detail: str
+ 
+ 
+ def gst_play_setup(
+@@ -52,11 +56,47 @@ def gst_play_setup(
+     return paintable, play, pipeline, paintable_sink
+ 
+ 
++def _should_missing_plugin_be_ignored(missing_plugin: MissingPlugin) -> bool:
++    """Check if a missing plugin should be ignored.
++
++    qtdemux generates {audio,video,text,meta}/x-gst-fourcc-<fourcc>
++    caps as a fallback for any fourcc code it doesn't recognise in a
++    QuickTime/MP4 file. If a decoder existed, qtdemux would already
++    know the fourcc and emit proper caps for it. These are therefore
++    not actionable from the missing-plugin UI, so they're ignored.
++    """
++    return "x-gst-fourcc" in missing_plugin.detail
++
++
++def _parse_missing_plugins(msg: GstPlay.PlayMessage) -> tuple[MissingPlugin, ...]:
++    result: tuple[bool, list[str], list[str]] = (
++        GstPlay.play_message_parse_error_missing_plugin(msg)
++        if GstPlay.PlayMessage.parse_type(msg) == GstPlay.PlayMessage.ERROR
++        else GstPlay.play_message_parse_warning_missing_plugin(msg)
++    )
++    found, descriptions, details = result
++    if not found:
++        return ()
++
++    missing_plugins: list[MissingPlugin] = [
++        MissingPlugin(description, detail)
++        for description, detail in zip(descriptions, details, strict=True)
++    ]
++
++    return tuple(
++        missing_plugin
++        for missing_plugin in missing_plugins
++        if not _should_missing_plugin_be_ignored(missing_plugin)
++    )
++
++
+ class Messenger(GObject.Object):
+     """A messenger between GStreamer and the app."""
+ 
+     __gtype_name__ = "Messenger"
+ 
++    _pending_missing_plugins: tuple[MissingPlugin, ...] = ()
++
+     state_changed = GObject.Signal(name="state-changed", arg_types=(object,))
+     duration_changed = GObject.Signal(name="duration-changed", arg_types=(object,))
+     position_updated = GObject.Signal(name="position-updated", arg_types=(object,))
+@@ -66,12 +106,11 @@ class Messenger(GObject.Object):
+     end_of_stream = GObject.Signal(name="end-of-stream")
+     warning = GObject.Signal(name="warning", arg_types=(object,))
+     error = GObject.Signal(name="error", arg_types=(object,))
+-    missing_plugin = GObject.Signal(name="missing-plugin", arg_types=(object,))
++    missing_plugins = GObject.Signal(name="missing-plugins", arg_types=(object, bool))
+ 
+     def __init__(
+         self,
+         play: GstPlay.Play,
+-        pipeline: Gst.Element,
+         **kwargs: Any,
+     ) -> None:
+         super().__init__(**kwargs)
+@@ -80,22 +119,12 @@ class Messenger(GObject.Object):
+             bus.add_signal_watch()
+             bus.connect("message", self._on_play_bus_message)
+ 
+-        if bus := pipeline.get_bus():
+-            bus.add_signal_watch()
+-            bus.connect(
+-                "message",
+-                lambda bus, msg: GLib.idle_add(
+-                    partial(self._on_pipeline_bus_message, bus, msg)
+-                ),
+-            )
+-
+     def _on_play_bus_message(self, _bus: Gst.Bus, msg: GstPlay.PlayMessage) -> None:
+         match GstPlay.PlayMessage.parse_type(msg):
+             case GstPlay.PlayMessage.STATE_CHANGED:
+-                self.emit(
+-                    "state-changed",
+-                    GstPlay.PlayMessage.parse_state_changed(msg),
+-                )
++                state = GstPlay.PlayMessage.parse_state_changed(msg)
++                self._resolve_pending_missing_plugins(state)
++                self.emit("state-changed", state)
+ 
+             case GstPlay.PlayMessage.DURATION_CHANGED:
+                 self.emit(
+@@ -125,12 +154,23 @@ class Messenger(GObject.Object):
+                 self.emit("end-of-stream")
+ 
+             case GstPlay.PlayMessage.WARNING:
++                if plugins := _parse_missing_plugins(msg):
++                    self._pending_missing_plugins = plugins
+                 self.emit("warning", GstPlay.PlayMessage.parse_warning(msg))
+ 
+             case GstPlay.PlayMessage.ERROR:
+                 error, _details = GstPlay.PlayMessage.parse_error(msg)
+-                self.emit("error", error)
+-
+-    def _on_pipeline_bus_message(self, _bus: Gst.Bus, msg: Gst.Message) -> None:
+-        if GstPbutils.is_missing_plugin_message(msg):
+-            self.emit("missing-plugin", msg)
++                if plugins := _parse_missing_plugins(msg):
++                    logger.error(error.message)
++                    self.emit("missing-plugins", plugins, False)
++                else:
++                    self.emit("error", error)
++
++    def _resolve_pending_missing_plugins(self, state: GstPlay.PlayState) -> None:
++        match state:
++            case GstPlay.PlayState.STOPPED:
++                self._pending_missing_plugins = ()
++            case GstPlay.PlayState.PAUSED | GstPlay.PlayState.PLAYING:
++                if self._pending_missing_plugins:
++                    self.emit("missing-plugins", self._pending_missing_plugins, True)
++                    self._pending_missing_plugins = ()
+diff --git a/showtime/widgets/window.py b/showtime/widgets/window.py
+index b2adf3d..642ca43 100644
+--- a/showtime/widgets/window.py
++++ b/showtime/widgets/window.py
+@@ -33,7 +33,7 @@ from showtime import (
+     state_settings,
+     system,
+ )
+-from showtime.play import Messenger, gst_play_setup
++from showtime.play import Messenger, MissingPlugin, gst_play_setup
+ from showtime.utils import (
+     get_title,
+     lookup_action,
+@@ -141,7 +141,6 @@ class Window(Adw.ApplicationWindow):
+     _prev_motion_xy: tuple = (0, 0)
+     _prev_volume = -1
+     _toplevel_focused: bool = False
+-    _already_shown_missing_plugins = False
+ 
+     @GObject.Property(type=bool, default=False)
+     def mute(self) -> bool:
+@@ -212,7 +211,7 @@ class Window(Adw.ApplicationWindow):
+ 
+         self.paintable.connect("invalidate-size", self._on_paintable_invalidate_size)
+ 
+-        messenger = Messenger(self.play, self.pipeline)
++        messenger = Messenger(self.play)
+         messenger.connect("state-changed", self._on_playback_state_changed)
+         messenger.connect("duration-changed", self._on_duration_changed)
+         messenger.connect("position-updated", self._on_position_updated)
+@@ -222,7 +221,7 @@ class Window(Adw.ApplicationWindow):
+         messenger.connect("end-of-stream", self._on_end_of_stream)
+         messenger.connect("warning", self._on_warning)
+         messenger.connect("error", self._on_error)
+-        messenger.connect("missing-plugin", self._on_missing_plugin)
++        messenger.connect("missing-plugins", self._on_missing_plugins)
+ 
+         if PROFILE == "development":
+             self.add_css_class("devel")
+@@ -292,7 +291,6 @@ class Window(Adw.ApplicationWindow):
+         app.save_play_position(self)  # pyright: ignore[reportAttributeAccessIssue]
+ 
+         self._playing_gfile = gfile
+-        self._already_shown_missing_plugins = False
+ 
+         try:
+             file_info = gfile.query_info(
+@@ -773,21 +771,13 @@ class Window(Adw.ApplicationWindow):
+         self.placeholder_stack.props.visible_child = self.error_status_page
+         self.stack.props.visible_child = self.placeholder_page
+ 
+-    def _on_missing_plugin(self, _obj, msg: Gst.Message) -> None:
+-        if self._already_shown_missing_plugins:
+-            return
+-
+-        self._already_shown_missing_plugins = True
+-
+-        # https://gstreamer.freedesktop.org/documentation/additional/design/missing-plugins.html#partially-missing-plugins
+-        if partially_missing := (
+-            self.pipeline.get_state(Gst.CLOCK_TIME_NONE)[0]
+-            != Gst.StateChangeReturn.FAILURE
+-        ):
++    def _on_missing_plugins(
++        self, _obj, missing_plugins: tuple[MissingPlugin, ...], partially_missing: bool
++    ) -> None:
++        if partially_missing:
+             self.pause()
+ 
+-        desc = GstPbutils.missing_plugin_message_get_description(msg)
+-        detail = GstPbutils.missing_plugin_message_get_installer_detail(msg)
++        desc, detail = missing_plugins[0]
+         group = Adw.PreferencesGroup(
+             halign=Gtk.Align.CENTER,
+             width_request=250,
+-- 
+2.55.0
+

diff --git a/showtime.spec b/showtime.spec
index 9041dbe..2c86981 100644
--- a/showtime.spec
+++ b/showtime.spec
@@ -13,6 +13,8 @@ License:        GPL-3.0-or-later
 URL:            https://apps.gnome.org/Showtime/
 Source0:        https://download.gnome.org/sources/%{name}/%{gnome_major_version}/%{name}-%{gnome_tarball_version}.tar.xz
 
+Patch0: 0001-play-Use-GstPlay-s-missing-plugin-details-instead-of.patch
+
 %gnome_check_version
 
 BuildArch:      noarch

                 reply	other threads:[~2026-11-09 15:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179423776481.1.4481246300310558934.rpms-showtime-e5de4e6eb3bd@fedoraproject.org \
    --to=felipeborges@gnome.org \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox