Commit cf22542b authored by Edward Hervey's avatar Edward Hervey 🤘
Browse files

gst/extend/ Add timeout property.

Original commit message from CVS:
* gst/extend/
Add timeout property.
Fix typos.
Beautify debugging.
Fix email.
parent 8fef95c5
2008-05-17 Edward Hervey <>
* gst/extend/
Add timeout property.
Fix typos.
Beautify debugging.
Fix email.
2008-05-14 Edward Hervey <>
Patch by: Jan Schmidt <thaytan at mad dot scientist dot com>
common @ 3b363108
Subproject commit 2d9c09df0fe4ad3f570fea9f649cfc6c4511080d
Subproject commit 3b3631082d04b426f450810e8836de94e9c5d60a
......@@ -2,7 +2,7 @@
# vi:si:et:sw=4:sts=4:ts=4
# (c) 2005 Edward Hervey <edward at fluendo dot com>
# (c) 2005-2008 Edward Hervey <bilboed at bilboed dot com>
# Discovers multimedia information on files
# This library is free software; you can redistribute it and/or
......@@ -74,7 +74,7 @@ class Discoverer(gst.Pipeline):
tags = {}
def __init__(self, filename, max_interleave=1.0):
def __init__(self, filename, max_interleave=1.0, timeout=3000):
filename: str; absolute path of the file to be discovered.
max_interleave: int or float; the maximum frame interleave in seconds.
......@@ -82,6 +82,7 @@ class Discoverer(gst.Pipeline):
or the discoverer may not find out all input file's streams.
The default value is 1 second and you shouldn't have to change it,
changing it mean larger discovering time and bigger memory usage.
timeout: int; duration in ms for the discovery to complete.
......@@ -114,6 +115,7 @@ class Discoverer(gst.Pipeline):
self._nomorepads = False
self._timeoutid = 0
self._timeout = timeout
self._max_interleave = max_interleave
if not os.path.isfile(filename):
......@@ -184,7 +186,7 @@ class Discoverer(gst.Pipeline):
self.bus.connect("message", self._bus_message_cb)
# 3s timeout
self._timeoutid = gobject.timeout_add(3000, self._timed_out_or_eos)
self._timeoutid = gobject.timeout_add(self._timeout, self._timed_out_or_eos)"setting to PLAY")
if not self.set_state(gst.STATE_PLAYING):
......@@ -265,13 +267,16 @@ class Discoverer(gst.Pipeline):
# the caps are fixed
# We now get the total length of that stream
q = gst.query_new_duration(gst.FORMAT_TIME)"sending position query")"sending duration query")
if pad.get_peer().query(q):
format, length = q.parse_duration()"got position query answer : %d:%d" % (length, format))
if format == gst.FORMAT_TIME:"got duration (time) : %s" % (gst.TIME_ARGS(length),))
else:"got duration : %d [format:%d]" % (length, format))
length = -1
gst.warning("position query didn't work")
gst.warning("duration query failed")
# We store the caps and length in the proper location
if "audio" in caps.to_string():
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment