From 451711b9c65afdb057f4df832acfc57a1ee136ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Wed, 1 Sep 2021 14:28:15 +0200 Subject: [PATCH] Show current video/audio decoder in popover --- src/buttons.js | 5 +++++ src/main.js | 1 + src/widget.js | 13 +++++++++++++ 3 files changed, 19 insertions(+) diff --git a/src/buttons.js b/src/buttons.js index a86d7e85..88f39e2c 100644 --- a/src/buttons.js +++ b/src/buttons.js @@ -191,6 +191,11 @@ class ClapperTrackSelectButton extends PopoverButtonBase this._scrolled_window.max_content_height = (isFullscreen && !isMobileMonitor) ? 290 : 220; } + + setDecoder(decoder) + { + this._decoder_separator.label = _('Decoder: %s').format(decoder); + } }); var VolumeButton = GObject.registerClass({ diff --git a/src/main.js b/src/main.js index ed62309d..48437cd4 100644 --- a/src/main.js +++ b/src/main.js @@ -3,6 +3,7 @@ imports.gi.versions.Gtk = '4.0'; imports.gi.versions.Soup = '2.4'; pkg.initGettext(); +pkg.initFormat(); const { GstClapper, Gtk, Adw } = imports.gi; const { App } = imports.src.app; diff --git a/src/widget.js b/src/widget.js index 3a86dec4..2d72cf51 100644 --- a/src/widget.js +++ b/src/widget.js @@ -79,6 +79,9 @@ class ClapperWidget extends Gtk.Grid this.player.connect('duration-changed', this._onPlayerDurationChanged.bind(this)); this.player.connect('media-info-updated', this._onMediaInfoUpdated.bind(this)); + this.player.connect('video-decoder-changed', this._onPlayerVideoDecoderChanged.bind(this)); + this.player.connect('audio-decoder-changed', this._onPlayerAudioDecoderChanged.bind(this)); + this.overlay.set_child(playerWidget); this.overlay.add_overlay(this.revealerTop); this.overlay.add_overlay(this.revealerBottom); @@ -507,6 +510,16 @@ class ClapperWidget extends Gtk.Grid this.controls.positionScale.set_value(positionSeconds); } + _onPlayerVideoDecoderChanged(player, decoder) + { + this.controls.videoTracksButton.setDecoder(decoder); + } + + _onPlayerAudioDecoderChanged(player, decoder) + { + this.controls.audioTracksButton.setDecoder(decoder); + } + _onStateNotify(toplevel) { const isMaximized = Boolean(