temporarily disable glsink due to ubuntu 20.10 regressions

This commit is contained in:
Jonas Weinz 2020-10-24 13:55:58 +02:00
parent 5c1047346e
commit 0a0abcf206
3 changed files with 40 additions and 39 deletions

View File

@ -40,6 +40,8 @@ class GstWidget(Gtk.Box):
return gtksink return gtksink
def _build_sink_and_widget(self) -> None: def _build_sink_and_widget(self) -> None:
"""
gtkglsink = Gst.ElementFactory.make("gtkglsink") gtkglsink = Gst.ElementFactory.make("gtkglsink")
# TODO: fallback if not graphic acceleration is available # TODO: fallback if not graphic acceleration is available
@ -50,6 +52,10 @@ class GstWidget(Gtk.Box):
self._sink = sinkbin self._sink = sinkbin
self._sinkwidget = gtkglsink.get_property("widget") self._sinkwidget = gtkglsink.get_property("widget")
"""
self._sink = Gst.ElementFactory.make("gtksink")
self._sinkwidget = self._sink.get_property("widget")
def _create_player(self) -> None: def _create_player(self) -> None:
self._player = Gst.ElementFactory.make("playbin", "player") self._player = Gst.ElementFactory.make("playbin", "player")

View File

@ -1,14 +1,16 @@
import gi import gi
from . import main_window
from gi.repository import Gtk, Gio, Gst, Gdk
gi.require_version('Gtk', '3.0') gi.require_version('Gtk', '3.0')
gi.require_version('Gst', '1.0') gi.require_version('Gst', '1.0')
Gst.init(None) from gi.repository import Gtk, Gst
Gst.init_check(None)
from . import gst_pipeline
from . import main_window
gst_pipeline.init_gst()
win = main_window.MainApp() win = main_window.MainApp()

View File

@ -1,12 +1,12 @@
from . import mediathek_request as mr
from . import tools
from . import search_widget
from . import player_widget
from gi.repository import Gtk, GLib
import gi import gi
gi.require_version("Gtk", "3.0") gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GLib
from . import player_widget
from . import search_widget
from . import tools
from . import mediathek_request as mr
class MainApp(Gtk.Window): class MainApp(Gtk.Window):
def __init__(self): def __init__(self):
@ -37,12 +37,11 @@ class MainApp(Gtk.Window):
self._headerbar = self._create_headerbar(True) self._headerbar = self._create_headerbar(True)
self._create_fullscreen_bar() self._create_fullscreen_bar()
#self._main_container.add_overlay(self._create_fullscreen_bar()) # self._main_container.add_overlay(self._create_fullscreen_bar())
self._main_container.add_overlay(self._revealer) self._main_container.add_overlay(self._revealer)
self.add(self._main_container) self.add(self._main_container)
self.connect('motion-notify-event', self.on_mouse_move) self.connect('motion-notify-event', self.on_mouse_move)
self._seconds_after_mouse_move = 0 self._seconds_after_mouse_move = 0
@ -51,24 +50,22 @@ class MainApp(Gtk.Window):
GLib.timeout_add_seconds(1, self.update) GLib.timeout_add_seconds(1, self.update)
def on_mouse_move(self, _, __): def on_mouse_move(self, _, __):
self._player_widget.show_controls() self._player_widget.show_controls()
self._seconds_after_mouse_move = 0 self._seconds_after_mouse_move = 0
if self._fullscreen: if self._fullscreen:
self._revealer.set_reveal_child(True) self._revealer.set_reveal_child(True)
def update(self): def update(self):
if self._seconds_after_mouse_move > 1: if self._seconds_after_mouse_move > 1:
self._revealer.set_reveal_child(False) self._revealer.set_reveal_child(False)
self._seconds_after_mouse_move += 1 self._seconds_after_mouse_move += 1
self._player_widget.update_controls() self._player_widget.update_controls()
return True return True
def on_search(self, _=None):
def on_search(self, _ = None):
if self.get_active_pane() == "player": if self.get_active_pane() == "player":
self._player_widget.pause() self._player_widget.pause()
self.set_active_pane("search") self.set_active_pane("search")
@ -76,14 +73,12 @@ class MainApp(Gtk.Window):
def _create_context_switch(self): def _create_context_switch(self):
self._search_radio = tools.new_button_with_icon("edit-find") self._search_radio = tools.new_button_with_icon("edit-find")
self._search_radio.connect("clicked", self.on_search) self._search_radio.connect("clicked", self.on_search)
# more to come... # more to come...
def _create_headerbar(self, main_bar=True):
def _create_headerbar(self, main_bar = True):
headerbar = Gtk.HeaderBar() headerbar = Gtk.HeaderBar()
fullscreen = tools.new_button_with_icon("view-fullscreen") fullscreen = tools.new_button_with_icon("view-fullscreen")
@ -103,30 +98,29 @@ class MainApp(Gtk.Window):
headerbar.set_show_close_button(True) headerbar.set_show_close_button(True)
headerbar.props.title = "Gtk Mediathek Player" headerbar.props.title = "Gtk Mediathek Player"
self.set_titlebar(headerbar) self.set_titlebar(headerbar)
return headerbar return headerbar
def _create_fullscreen_bar(self): def _create_fullscreen_bar(self):
self._revealer = Gtk.Revealer() self._revealer = Gtk.Revealer()
self._revealer.add(self._create_headerbar(False)) self._revealer.add(self._create_headerbar(False))
self._revealer.set_valign(Gtk.Align.START) self._revealer.set_valign(Gtk.Align.START)
self._revealer.set_vexpand(False) self._revealer.set_vexpand(False)
self._revealer.set_transition_type(Gtk.RevealerTransitionType.SLIDE_DOWN) self._revealer.set_transition_type(
Gtk.RevealerTransitionType.SLIDE_DOWN)
return self._revealer return self._revealer
def _create_player_widget(self): def _create_player_widget(self):
return player_widget.PlayerWidget() return player_widget.PlayerWidget()
def _create_search_widget(self): def _create_search_widget(self):
return search_widget.SearchWidget(self) return search_widget.SearchWidget(self)
def run(self): def run(self):
self.connect("destroy", Gtk.main_quit) self.connect("destroy", Gtk.main_quit)
self.show_all() self.show_all()
Gtk.main() Gtk.main()
def set_active_pane(self, name: str): def set_active_pane(self, name: str):
self._main_stack.set_visible_child_name(name) self._main_stack.set_visible_child_name(name)
if name != "player": if name != "player":
@ -134,10 +128,9 @@ class MainApp(Gtk.Window):
else: else:
self._fullscreen_button.set_sensitive(True) self._fullscreen_button.set_sensitive(True)
def get_active_pane(self): def get_active_pane(self):
return self._main_stack.get_visible_child_name() return self._main_stack.get_visible_child_name()
def start_player(self, uri: str): def start_player(self, uri: str):
if self.get_active_pane() != "player": if self.get_active_pane() != "player":
self.set_active_pane("player") self.set_active_pane("player")
@ -145,26 +138,26 @@ class MainApp(Gtk.Window):
self._player_widget.stop() self._player_widget.stop()
self._player_widget.play_from_uri(uri) self._player_widget.play_from_uri(uri)
self._player_widget.play() self._player_widget.play()
def go_fullscreen(self): def go_fullscreen(self):
if self._fullscreen: if self._fullscreen:
return return
self._fullscreen = True self._fullscreen = True
self.fullscreen() self.fullscreen()
self._revealer.set_reveal_child(True) self._revealer.set_reveal_child(True)
def go_unfullscreen(self): def go_unfullscreen(self):
if not self._fullscreen: if not self._fullscreen:
return return
self._fullscreen = False self._fullscreen = False
self.unfullscreen() self.unfullscreen()
self._revealer.set_reveal_child(False) self._revealer.set_reveal_child(False)
def toggle_fullscreen(self,_ = None): def toggle_fullscreen(self, _=None):
if self._fullscreen: if self._fullscreen:
self.go_unfullscreen() self.go_unfullscreen()
else: else: