gst1: Update query_position() usage
This commit is contained in:
parent
87b1c9455c
commit
01cf013b09
@ -621,15 +621,16 @@ class Audio(pykka.ThreadingActor):
|
|||||||
|
|
||||||
:rtype: int
|
:rtype: int
|
||||||
"""
|
"""
|
||||||
try:
|
success, position = self._playbin.query_position(Gst.Format.TIME)
|
||||||
gst_position = self._playbin.query_position(Gst.Format.TIME)[1]
|
|
||||||
return utils.clocktime_to_millisecond(gst_position)
|
if not success:
|
||||||
except Gst.QueryError:
|
|
||||||
# TODO: take state into account for this and possibly also return
|
# TODO: take state into account for this and possibly also return
|
||||||
# None as the unknown value instead of zero?
|
# None as the unknown value instead of zero?
|
||||||
logger.debug('Position query failed')
|
logger.debug('Position query failed')
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
return utils.clocktime_to_millisecond(position)
|
||||||
|
|
||||||
def set_position(self, position):
|
def set_position(self, position):
|
||||||
"""
|
"""
|
||||||
Set position in milliseconds.
|
Set position in milliseconds.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user