audio: Add a TODO and some notes on duration handling

This commit is contained in:
Thomas Adamcik 2016-02-01 23:58:00 +01:00
parent eda91cfa96
commit af43612630
2 changed files with 6 additions and 0 deletions

View File

@ -746,6 +746,7 @@ class Audio(pykka.ThreadingActor):
# Default to blank data to trick shoutcast into clearing any previous
# values it might have.
# TODO: Verify if this works at all, likely it doesn't.
set_value(Gst.TAG_ARTIST, ' ')
set_value(Gst.TAG_TITLE, ' ')
set_value(Gst.TAG_ALBUM, ' ')

View File

@ -137,6 +137,11 @@ def _start_pipeline(pipeline):
def _query_duration(pipeline, timeout=100):
# 1. Try and get a duration, return if success.
# 2. Some formats need to play some buffers before duration is found.
# 3. Wait for a duration change event.
# 4. Try and get a duration again.
success, duration = pipeline.query_duration(Gst.Format.TIME)
if success and duration >= 0:
return duration // Gst.MSECOND