def __init__(self): """ Init playbin """ Gst.init(None) BasePlayer.__init__(self) self._codecs = Codecs() self._playbin = Gst.ElementFactory.make('playbin', 'player') flags = self._playbin.get_property("flags") flags &= ~GstPlayFlags.GST_PLAY_FLAG_VIDEO self._playbin.set_property('flags', flags) self._playbin.set_property('buffer-size', 5 << 20) self._playbin.set_property('buffer-duration', 10 * Gst.SECOND) ReplayGainPlayer.__init__(self, self._playbin) self._playbin.connect('about-to-finish', self._on_stream_about_to_finish) bus = self._playbin.get_bus() bus.add_signal_watch() bus.connect('message::error', self._on_bus_error) bus.connect('message::eos', self._on_bus_eos) bus.connect('message::element', self._on_bus_element) bus.connect('message::stream-start', self._on_stream_start) bus.connect("message::tag", self._on_bus_message_tag) self._handled_error = None self._start_time = 0
def __init__(self): """ Init playbin """ # In the case of gapless playback, both 'about-to-finish' # and 'eos' can occur during the same stream. self.__track_in_pipe = False self.__cancellable = Gio.Cancellable() self.__codecs = Codecs() self._current_track = Track() self._next_track = Track() self._prev_track = Track() self._playbin = self._playbin1 = Gst.ElementFactory.make( "playbin", "player") self._playbin2 = Gst.ElementFactory.make("playbin", "player") self._plugins = self._plugins1 = PluginsPlayer(self._playbin1) self._plugins2 = PluginsPlayer(self._playbin2) for playbin in [self._playbin1, self._playbin2]: flags = playbin.get_property("flags") flags &= ~GstPlayFlags.GST_PLAY_FLAG_VIDEO playbin.set_property("flags", flags) playbin.set_property("buffer-size", 5 << 20) playbin.set_property("buffer-duration", 10 * Gst.SECOND) playbin.connect("notify::volume", self.__on_volume_changed) playbin.connect("about-to-finish", self._on_stream_about_to_finish) bus = playbin.get_bus() bus.add_signal_watch() bus.connect("message::error", self._on_bus_error) bus.connect("message::eos", self._on_bus_eos) bus.connect("message::element", self._on_bus_element) bus.connect("message::stream-start", self._on_stream_start) bus.connect("message::tag", self._on_bus_message_tag) self._start_time = 0
def __init__(self): """ Init playbin """ Gst.init(None) BasePlayer.__init__(self) self.__codecs = Codecs() self._playbin = self.__playbin1 = Gst.ElementFactory.make( "playbin", "player") self.__playbin2 = Gst.ElementFactory.make("playbin", "player") self.__preview = None self._plugins = self._plugins1 = PluginsPlayer(self.__playbin1) self._plugins2 = PluginsPlayer(self.__playbin2) self._playbin.connect("notify::volume", self.__on_volume_changed) for playbin in [self.__playbin1, self.__playbin2]: flags = playbin.get_property("flags") flags &= ~GstPlayFlags.GST_PLAY_FLAG_VIDEO playbin.set_property("flags", flags) playbin.set_property("buffer-size", 5 << 20) playbin.set_property("buffer-duration", 10 * Gst.SECOND) playbin.connect("about-to-finish", self.__on_stream_about_to_finish) bus = playbin.get_bus() bus.add_signal_watch() bus.connect("message::error", self.__on_bus_error) bus.connect("message::eos", self.__on_bus_eos) bus.connect("message::element", self.__on_bus_element) bus.connect("message::stream-start", self._on_stream_start) bus.connect("message::tag", self.__on_bus_message_tag) self._start_time = 0
def __init__(self): """ Init playbin """ Gst.init(None) BasePlayer.__init__(self) self._codecs = Codecs() self._crossfading = False self._playbin = self._playbin1 = Gst.ElementFactory.make( 'playbin', 'player') self._playbin2 = Gst.ElementFactory.make('playbin', 'player') self._plugins = self.plugins1 = PluginsPlayer(self._playbin1) self.plugins2 = PluginsPlayer(self._playbin2) self._volume_id = self._playbin.connect('notify::volume', self._on_volume_changed) for playbin in [self._playbin1, self._playbin2]: flags = playbin.get_property("flags") flags &= ~GstPlayFlags.GST_PLAY_FLAG_VIDEO playbin.set_property('flags', flags) playbin.set_property('buffer-size', 5 << 20) playbin.set_property('buffer-duration', 10 * Gst.SECOND) playbin.connect('about-to-finish', self._on_stream_about_to_finish) bus = playbin.get_bus() bus.add_signal_watch() bus.connect('message::error', self._on_bus_error) bus.connect('message::eos', self._on_bus_eos) bus.connect('message::element', self._on_bus_element) bus.connect('message::stream-start', self._on_stream_start) bus.connect("message::tag", self._on_bus_message_tag) self._handled_error = None self._start_time = 0