python中没有gobject内省属性

时间:2017-12-11 21:29:33

标签: python gstreamer pygobject gstreamer-1.0 gobject-introspection

我在python内省和自定义Gstreamer元素方面遇到了一些麻烦......我无法访问该元素的属性。这是我的gstreamer元素中的相关代码:

// Properties declared on the class object
static void gst_videoautogain_class_init(VipreautogainClass* pKlass)
{
  // ... more stuff
  g_object_class_install_property(G_OBJECT_CLASS(pKlass), PROP_LOW_STRETCH,
                                   g_param_spec_float("low_stretch",
                                                      "Low stretch percentile",
                                                      "The percentile corresponding to the lowest output value.",
                                                      0., 1., 0.02,
                                                      G_PARAM_READWRITE));
  g_object_class_install_property(G_OBJECT_CLASS(pKlass), PROP_HIGH_STRETCH,
                                   g_param_spec_float("high_stretch",
                                                      "High stretch percentile",
                                                      "The percentile corresponding to the highest output value.",
                                                      0., 1., 0.98,
                                                      G_PARAM_READWRITE));
}

属性显示在gst-inspect-1.0中。 以下是尝试访问python中的属性的示例:

import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst, GObject
Gst.init([])
p = Gst.parse_launch("videotestsrc ! videoautogain low-stretch=0.05 name=gain ! fakesink")
g = p.get_by_name('gain')
g.props.low_stretch            # 'GProps' object has no attribute 'low_stretch'
g.get_property('low-stretch')  # Unknown property: 'low-stretch'

0 个答案:

没有答案