gst1: Replace MESSAGE_* with MessageType.*
This commit is contained in:
parent
1911ea0c10
commit
7c473eed07
@ -141,8 +141,13 @@ def _process(pipeline, timeout_ms):
|
|||||||
missing_message = None
|
missing_message = None
|
||||||
|
|
||||||
types = (
|
types = (
|
||||||
Gst.MESSAGE_ELEMENT | Gst.MESSAGE_APPLICATION | Gst.MESSAGE_ERROR |
|
Gst.MessageType.ELEMENT |
|
||||||
Gst.MESSAGE_EOS | Gst.MESSAGE_ASYNC_DONE | Gst.MESSAGE_TAG)
|
Gst.MessageType.APPLICATION |
|
||||||
|
Gst.MessageType.ERROR |
|
||||||
|
Gst.MessageType.EOS |
|
||||||
|
Gst.MessageType.ASYNC_DONE |
|
||||||
|
Gst.MessageType.TAG
|
||||||
|
)
|
||||||
|
|
||||||
previous = clock.get_time()
|
previous = clock.get_time()
|
||||||
while timeout > 0:
|
while timeout > 0:
|
||||||
@ -150,29 +155,29 @@ def _process(pipeline, timeout_ms):
|
|||||||
|
|
||||||
if message is None:
|
if message is None:
|
||||||
break
|
break
|
||||||
elif message.type == Gst.MESSAGE_ELEMENT:
|
elif message.type == Gst.MessageType.ELEMENT:
|
||||||
if GstPbutils.is_missing_plugin_message(message):
|
if GstPbutils.is_missing_plugin_message(message):
|
||||||
missing_message = message
|
missing_message = message
|
||||||
elif message.type == Gst.MESSAGE_APPLICATION:
|
elif message.type == Gst.MessageType.APPLICATION:
|
||||||
if message.structure.get_name() == 'have-type':
|
if message.structure.get_name() == 'have-type':
|
||||||
mime = message.structure['caps'].get_name()
|
mime = message.structure['caps'].get_name()
|
||||||
if mime.startswith('text/') or mime == 'application/xml':
|
if mime.startswith('text/') or mime == 'application/xml':
|
||||||
return tags, mime, have_audio
|
return tags, mime, have_audio
|
||||||
elif message.structure.get_name() == 'have-audio':
|
elif message.structure.get_name() == 'have-audio':
|
||||||
have_audio = True
|
have_audio = True
|
||||||
elif message.type == Gst.MESSAGE_ERROR:
|
elif message.type == Gst.MessageType.ERROR:
|
||||||
error = encoding.locale_decode(message.parse_error()[0])
|
error = encoding.locale_decode(message.parse_error()[0])
|
||||||
if missing_message and not mime:
|
if missing_message and not mime:
|
||||||
caps = missing_message.structure['detail']
|
caps = missing_message.structure['detail']
|
||||||
mime = caps.get_structure(0).get_name()
|
mime = caps.get_structure(0).get_name()
|
||||||
return tags, mime, have_audio
|
return tags, mime, have_audio
|
||||||
raise exceptions.ScannerError(error)
|
raise exceptions.ScannerError(error)
|
||||||
elif message.type == Gst.MESSAGE_EOS:
|
elif message.type == Gst.MessageType.EOS:
|
||||||
return tags, mime, have_audio
|
return tags, mime, have_audio
|
||||||
elif message.type == Gst.MESSAGE_ASYNC_DONE:
|
elif message.type == Gst.MessageType.ASYNC_DONE:
|
||||||
if message.src == pipeline:
|
if message.src == pipeline:
|
||||||
return tags, mime, have_audio
|
return tags, mime, have_audio
|
||||||
elif message.type == Gst.MESSAGE_TAG:
|
elif message.type == Gst.MessageType.TAG:
|
||||||
taglist = message.parse_tag()
|
taglist = message.parse_tag()
|
||||||
# Note that this will only keep the last tag.
|
# Note that this will only keep the last tag.
|
||||||
tags.update(utils.convert_taglist(taglist))
|
tags.update(utils.convert_taglist(taglist))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user