Changing the `location’ property on filesink when a file is open is not supported. 错误解决办法

程序运行中动态修改filesink.location来修改文件保存位置会提示 Changing the `location’ property on filesink when a file is open is not supported. 错误,需要将filesink的状态设置为NULL,然后才能修改,例子:

 
        save = pipeline.get_by_name('save')
        save.set_state(gst.STATE_NULL)
        i+=1
        save.set_property('location','save'+str(i)+'.wav')
        save.set_state(gst.STATE_PAUSED)

参考:http://comments.gmane.org/gmane.comp.video.gstreamer.devel/30074

对了,这样修改就像参考里面说的,由于是直接将wav文件截断的,第二个文件没有格式信息,会无法播放。如果想生成的多个wav文件都能正常播放需要将 wavenc 也设置为 gst.STATE_NULL 一次。

  WordPress › 错误