diff options
author | Louis Sautier <sbraz@gentoo.org> | 2020-05-24 17:08:35 +0200 |
---|---|---|
committer | Louis Sautier <sbraz@gentoo.org> | 2020-05-24 17:44:24 +0200 |
commit | a4bd9f0033575b1314cce0576a639be4a17eb870 (patch) | |
tree | edd9d6c2de28e35496b7666c0b4bcfbef47e74b7 /media-video/gaupol | |
parent | games-emulation/pcsx2: add missing flag-o-matic inherit (diff) | |
download | gentoo-a4bd9f0033575b1314cce0576a639be4a17eb870.tar.gz gentoo-a4bd9f0033575b1314cce0576a639be4a17eb870.tar.bz2 gentoo-a4bd9f0033575b1314cce0576a639be4a17eb870.zip |
media-video/gaupol: mention required GST plugins in postinst
Also backport a patch to fix audio tracks order.
Closes: https://bugs.gentoo.org/638052
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Louis Sautier <sbraz@gentoo.org>
Diffstat (limited to 'media-video/gaupol')
-rw-r--r-- | media-video/gaupol/files/gaupol-1.8-fix-audio-tracks-order.patch | 174 | ||||
-rw-r--r-- | media-video/gaupol/gaupol-1.8-r1.ebuild (renamed from media-video/gaupol/gaupol-1.8.ebuild) | 6 |
2 files changed, 179 insertions, 1 deletions
diff --git a/media-video/gaupol/files/gaupol-1.8-fix-audio-tracks-order.patch b/media-video/gaupol/files/gaupol-1.8-fix-audio-tracks-order.patch new file mode 100644 index 000000000000..3f554c4ef335 --- /dev/null +++ b/media-video/gaupol/files/gaupol-1.8-fix-audio-tracks-order.patch @@ -0,0 +1,174 @@ +From e26cfcfe002c87a39eac63bbaa5ad0d4d69c95a4 Mon Sep 17 00:00:00 2001 +From: Quentin Gliosca <quentin.gliosca@gmail.com> +Date: Tue, 12 May 2020 16:48:31 +0200 +Subject: [PATCH 1/3] Fix the order of languages in audio track selection + +Fix #129 +--- + gaupol/player.py | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/gaupol/player.py b/gaupol/player.py +index 836abea2..c266e0b9 100644 +--- a/gaupol/player.py ++++ b/gaupol/player.py +@@ -118,7 +118,8 @@ def _ensure_default_segment(self): + + def get_audio_languages(self): + """Return a sequence of audio languages or ``None``.""" +- return tuple(x.get_language() for x in self._info.get_audio_streams()) ++ return tuple(self._playbin.emit("get-audio-tags", i).get_string("language-code")[1] ++ for i in range(self._playbin.props.n_audio)) + + def get_duration(self, mode=None): + """Return duration of video stream or ``None``.""" +@@ -356,6 +357,10 @@ def set_uri(self, uri): + dialog.add_button(_("_OK"), Gtk.ResponseType.OK) + dialog.set_default_response(Gtk.ResponseType.OK) + gaupol.util.flash_dialog(dialog) ++ else: ++ # Make stream tags available from _playbin ++ self._playbin.set_state(Gst.State.PAUSED) ++ self._playbin.get_state(Gst.CLOCK_TIME_NONE) + + def stop(self): + """Stop.""" + +From 9ace4fefe5d246c5588538a715a185c796e218ef Mon Sep 17 00:00:00 2001 +From: Quentin Gliosca <quentin.gliosca@gmail.com> +Date: Tue, 12 May 2020 17:27:35 +0200 +Subject: [PATCH 2/3] Improve names of audio tracks in menu + +--- + gaupol/agents/video.py | 18 ++++++++++++++---- + gaupol/player.py | 20 ++++++++++++++++---- + 2 files changed, 30 insertions(+), 8 deletions(-) + +diff --git a/gaupol/agents/video.py b/gaupol/agents/video.py +index d434255a..0f6b935c 100644 +--- a/gaupol/agents/video.py ++++ b/gaupol/agents/video.py +@@ -27,7 +27,11 @@ + from gi.repository import Gtk + + with aeidon.util.silent(Exception): ++ from gi import require_version ++ require_version('GstTag', '1.0') + from gi.repository import Gst ++ from gi.repository import GstTag ++ + + + class VideoAgent(aeidon.Delegate): +@@ -348,11 +352,17 @@ def _update_languages_menu(self): + """Update the audio language selection menu.""" + menu = self.get_menubar_section("audio-languages-placeholder") + menu.remove_all() +- languages = self.player.get_audio_languages() +- for i, language in enumerate(languages): +- language = language or _("Undefined") ++ tracks = self.player.get_audio_infos() ++ for i, track in enumerate(tracks): ++ title = track.title or "{} {}".format(_("Track"), i + 1) ++ lang = None ++ if track.language_code is not None: ++ lang = GstTag.tag_get_language_name(track.language_code) ++ if lang is None: ++ lang = track.language_name ++ name = title if lang is None else "{} - [{}]".format(title, lang.title()) + action = "win.set-audio-language::{:d}".format(i) +- menu.append(language, action) ++ menu.append(name, action) + if i == self.player.audio_track: + action = self.get_action("set-audio-language") + action.set_state(str(i)) +diff --git a/gaupol/player.py b/gaupol/player.py +index c266e0b9..ee1e96dc 100644 +--- a/gaupol/player.py ++++ b/gaupol/player.py +@@ -21,6 +21,7 @@ + import gaupol + import time + ++from collections import namedtuple + from aeidon.i18n import _ + from gi.repository import GLib + from gi.repository import Gtk +@@ -56,6 +57,8 @@ class VideoPlayer(aeidon.Observable): + + signals = ("state-changed",) + ++ TrackInfo = namedtuple("TrackInfo", ["title", "language_code", "language_name"]) ++ + def __init__(self): + """Initialize a :class:`VideoPlayer` instance.""" + aeidon.Observable.__init__(self) +@@ -116,10 +119,19 @@ def _ensure_default_segment(self): + self._playbin.seek_simple(Gst.Format.TIME, seek_flags, pos) + self._in_default_segment = True + +- def get_audio_languages(self): +- """Return a sequence of audio languages or ``None``.""" +- return tuple(self._playbin.emit("get-audio-tags", i).get_string("language-code")[1] +- for i in range(self._playbin.props.n_audio)) ++ def get_audio_infos(self): ++ """Return a sequence of audio track infos.""" ++ return tuple( ++ self._make_track_infos(self._playbin.emit("get-audio-tags", i)) ++ for i in range(self._playbin.props.n_audio) ++ ) ++ ++ def _make_track_infos(self, tags): ++ return self.TrackInfo( ++ tags.get_string("title")[1], ++ tags.get_string("language-code")[1], ++ tags.get_string("language-name")[1] ++ ) + + def get_duration(self, mode=None): + """Return duration of video stream or ``None``.""" + +From f50b4e54dc9aa84fc1b3eb403d680b8a0be77dc3 Mon Sep 17 00:00:00 2001 +From: Quentin Gliosca <quentin.gliosca@gmail.com> +Date: Wed, 13 May 2020 07:29:27 +0200 +Subject: [PATCH 3/3] Cosmetic changes + +--- + gaupol/__init__.py | 1 + + gaupol/agents/video.py | 4 +--- + 2 files changed, 2 insertions(+), 3 deletions(-) + +diff --git a/gaupol/__init__.py b/gaupol/__init__.py +index f7a9663d..fc02287b 100644 +--- a/gaupol/__init__.py ++++ b/gaupol/__init__.py +@@ -44,6 +44,7 @@ + "Gst": "1.0", + "GstPbutils": "1.0", + "GstVideo": "1.0", ++ "GstTag": "1.0", + }.items(): + with aeidon.util.silent(Exception): + gi.require_version(module, version) +diff --git a/gaupol/agents/video.py b/gaupol/agents/video.py +index 0f6b935c..3c9e3113 100644 +--- a/gaupol/agents/video.py ++++ b/gaupol/agents/video.py +@@ -27,8 +27,6 @@ + from gi.repository import Gtk + + with aeidon.util.silent(Exception): +- from gi import require_version +- require_version('GstTag', '1.0') + from gi.repository import Gst + from gi.repository import GstTag + +@@ -354,7 +352,7 @@ def _update_languages_menu(self): + menu.remove_all() + tracks = self.player.get_audio_infos() + for i, track in enumerate(tracks): +- title = track.title or "{} {}".format(_("Track"), i + 1) ++ title = track.title or _("Track {:d}").format(i + 1) + lang = None + if track.language_code is not None: + lang = GstTag.tag_get_language_name(track.language_code) diff --git a/media-video/gaupol/gaupol-1.8.ebuild b/media-video/gaupol/gaupol-1.8-r1.ebuild index 9fa5bf5a0ca1..33dec788257c 100644 --- a/media-video/gaupol/gaupol-1.8.ebuild +++ b/media-video/gaupol/gaupol-1.8-r1.ebuild @@ -37,6 +37,8 @@ DEPEND=" DOCS=( AUTHORS.md NEWS.md TODO.md README.md README.aeidon.md ) +PATCHES=( "${FILESDIR}/${P}-fix-audio-tracks-order.patch" ) + python_test() { virtx pytest -vv } @@ -45,7 +47,9 @@ pkg_postinst() { xdg_desktop_database_update xdg_icon_cache_update if [[ -z ${REPLACING_VERSIONS} ]]; then - elog "Previewing support requires MPV, MPlayer or VLC." + elog "The integrated video player requires media-plugins/gst-plugins-gtk." + elog "" + elog "External video previewing support requires MPV, MPlayer or VLC." if use spell; then elog "" elog "Spell-checking requires a dictionary, any of app-dicts/myspell-*" |