diff --git a/mopidy/audio/actor.py b/mopidy/audio/actor.py index 92abe4bc..ea452c22 100644 --- a/mopidy/audio/actor.py +++ b/mopidy/audio/actor.py @@ -238,7 +238,7 @@ class _Handler(object): msg.src == self._element): self.on_playbin_state_changed(*msg.parse_state_changed()) elif msg.type == Gst.MessageType.BUFFERING: - self.on_buffering(msg.parse_buffering(), msg.structure) + self.on_buffering(msg.parse_buffering(), msg.get_structure()) elif msg.type == Gst.MessageType.EOS: self.on_end_of_stream() elif msg.type == Gst.MessageType.ERROR: @@ -260,8 +260,8 @@ class _Handler(object): # Handle stream changed messages when they reach our output bin. # If we listen for it on the bus we get one per tee branch. msg = event.parse_sink_message() - if msg.structure.has_name('playbin-stream-changed'): - self.on_stream_changed(msg.structure['uri']) + if msg.get_structure().has_name('playbin-stream-changed'): + self.on_stream_changed(msg.get_structure().get_string('uri')) return True def on_playbin_state_changed(self, old_state, new_state, pending_state): @@ -303,7 +303,7 @@ class _Handler(object): def on_buffering(self, percent, structure=None): if structure and structure.has_field('buffering-mode'): - if structure['buffering-mode'] == Gst.BUFFERING_LIVE: + if structure.get_enum('buffering-mode') == Gst.BufferingMode.LIVE: return # Live sources stall in paused. level = logging.getLevelName('TRACE') diff --git a/mopidy/audio/scan.py b/mopidy/audio/scan.py index 0eb4067e..fbe80585 100644 --- a/mopidy/audio/scan.py +++ b/mopidy/audio/scan.py @@ -159,16 +159,16 @@ def _process(pipeline, timeout_ms): if GstPbutils.is_missing_plugin_message(message): missing_message = message elif message.type == Gst.MessageType.APPLICATION: - if message.structure.get_name() == 'have-type': - mime = message.structure['caps'].get_name() + if message.get_structure().get_name() == 'have-type': + mime = message.get_structure()['caps'].get_name() if mime.startswith('text/') or mime == 'application/xml': return tags, mime, have_audio - elif message.structure.get_name() == 'have-audio': + elif message.get_structure().get_name() == 'have-audio': have_audio = True elif message.type == Gst.MessageType.ERROR: error = encoding.locale_decode(message.parse_error()[0]) if missing_message and not mime: - caps = missing_message.structure['detail'] + caps = missing_message.get_structure()['detail'] mime = caps.get_structure(0).get_name() return tags, mime, have_audio raise exceptions.ScannerError(error)