1

我正在尝试在两个流之间切换,input-selector但出现错误:

`AttributeError: 'NoneType' object has no attribute 'get_property'`

这是我的 Python 代码:

def __init__(self):
      pipeline_string=(
                       'videotestsrc pattern=0  ! in. '
                       'videotestsrc pattern=2  ! in. '
                       'input-selector name=in  ! autovideosink '                           
                       )
      self.pipeline=Gst.parse_launch(pipeline_string)

  def cam1(self):
      switch = self.pipeline.get_by_name('in')
      stop_time = switch.emit('block')
      newpad = switch.get_static_pad('sink0')
      start_time = newpad.get_property('running-time')    
      switch.emit('switch', newpad, stop_time, start_time)

我认为这两个功能只是你需要的。我写它是为了测试input-stream元素。发生的事情是,None当我尝试获取sink0垫子时,我得到了类型。为什么 ?

4

1 回答 1

1

好吧,在尝试解决这个问题几个小时后,我发现(感谢名叫 Tim 的人)我使用的是 sink0 而不是 sink_0 。

于 2014-09-21T15:35:07.580 回答