gst1: Replace message.structure with message.get_structure()

This commit is contained in:
Stein Magnus Jodal 2015-09-02 01:47:52 +02:00
parent 1b47b6341e
commit e6a4042c3e
2 changed files with 8 additions and 8 deletions

View File

@ -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')

View File

@ -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)