[pitivi] utils: Add a method to get the controllable properties of a GstObject
- From: Edward Hervey <edwardrv src gnome org>
- To: svn-commits-list gnome org
- Subject: [pitivi] utils: Add a method to get the controllable properties of a GstObject
- Date: Wed, 24 Jun 2009 14:02:52 +0000 (UTC)
commit 146458345f6aef42286b10ab12bcf879653a56df
Author: Edward Hervey <bilboed bilboed com>
Date: Fri Jun 12 13:10:09 2009 +0200
utils: Add a method to get the controllable properties of a GstObject
Will recursively go down into the childs.
pitivi/utils.py | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/utils.py b/pitivi/utils.py
index ba03c99..4928743 100644
--- a/pitivi/utils.py
+++ b/pitivi/utils.py
@@ -304,3 +304,24 @@ class Seeker(Signallable):
def get_filesystem_encoding():
return sys.getfilesystemencoding() or "utf-8"
+
+def get_controllable_properties(element):
+ """
+ Returns a list of controllable properties for the given
+ element (and child if it's a container).
+
+ The list is made of tuples containing:
+ * The GstObject
+ * The GParamspec
+ """
+ log.debug("utils", "element %r, %d", element, isinstance(element, gst.Bin))
+ res = []
+ if isinstance(element, gst.Bin):
+ for child in element.elements():
+ res.extend(get_controllable_properties(child))
+ else:
+ for prop in gobject.list_properties(element):
+ if prop.flags & gst.PARAM_CONTROLLABLE:
+ log.debug("utils", "adding property %r", prop)
+ res.append((element, prop))
+ return res
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]