Пытаюсь повторить на Python 2.7 такую строчку gst-launch souphttpsrc location='http://........' ! flump3dec! audioconvert ! vorbisenc ! oggmux ! udpsink host='192.168.0.22' port=5000
На Python у меня это выглядит так (в чем косяк?):
import gst, gobject
gobject.threads_init()
class audio_ply:
def __init__(self):
self.mainloop=gobject.MainLoop()
self.pipe=gst.Pipeline("pipe")
self.src=gst.element_factory_make("souphttpsrc", "src")
self.src.set_property("location", "http://......")
self.pipe.add(self.src)
print "soup started"
self.decode=gst.element_factory_make("flump3dec", "decode")
self.pipe.add(self.decode)
print "flump3dec started"
self.convert=gst.element_factory_make("audioconvert", "convert")
self.pipe.add(self.convert)
print "audioconvert started"
self.encode=gst.element_factory_make("vorbisenc", "encode")
self.pipe.add(self.encode)
print "vorbisenc started"
self.mux=gst.element_factory_make("oggmux", "mux")
self.pipe.add(self.mux)
print "oggmux started"
self.sink=gst.element_factory_make('udpsink', 'sink')
self.sink.set_property("host", """127.0.0.1""")
self.sink.set_property("port", 5000)
self.pipe.add(self.sink)
print "sink started"
self.src.link(self.decode)
self.decode.link(self.convert)
self.convert.link(self.encode)
self.encode.link(self.sink)
def decode_src_created(self, element, pad):
pad.link(self.sink.get_static_pad("sink"))
def run(self):
self.pipe.set_state(gst.STATE_PLAYING)
print "State Play"
self.mainloop.run()
def done(self):
self.pipe.set_state(gst.STATE_NULL)
print "state null"
try:
play=audio_ply()
play.run()
finally:
play.done()