[gst-devel] Python question (Queues)
John Janecek
nopa90 at gmail.com
Thu Nov 17 03:25:04 CET 2005
I made a little python program as below it works fine.
The stream i am using to test has a theora and vorbis stream
If I do not put the 2 queues in place it will lock (nothing happens)
With no queue and only one stream hooked up it works fine.
Why does this happen ?
Is it a python problem or just the way gstreamer is designed ?
import gobject
import gtk
import gst
class Player(object):
def __init__(self) :
self.pipeline = gst.Pipeline("pipeline")
self.src = gst.element_factory_make("filesrc","source")
self.src.props.location = "/home/john/ccc.ogg"
self.parser = gst.element_factory_make("oggdemux","ogg-parser")
self.audio_queue = gst.element_factory_make("queue","audio-queue")
self.audio_decoder =
gst.element_factory_make("vorbisdec","vorbis-decoder")
self.audio_conv =
gst.element_factory_make("audioconvert","audio-converter")
self.audio_sink = gst.element_factory_make("alsasink", "alsa-output")
self.videobin = gst.Bin()
self.video_queue = gst.element_factory_make("queue","video-queue")
self.video_decoder =
gst.element_factory_make("theoradec","theora-decoder")
self.video_sink = gst.element_factory_make("xvimagesink",
"video-output")
self.videobin.add(self.video_queue,self.video_decoder,self.video_sink)
gst.element_link_many(self.video_queue,self.video_decoder,self.video_sink)
pad = self.video_queue.get_pad("sink")
ghostpad = gst.GhostPad("sink",pad)
self.videobin.add_pad(ghostpad)
self.pipeline.add(self.src,self.parser,self.audio_queue,self.audio_decoder,self.audio_conv,self.audio_sink,self.videobin)
gst.element_link_many(self.audio_queue,self.audio_decoder,self.audio_conv,self.audio_sink)
bus = self.pipeline.get_bus()
bus.add_signal_watch()
self.watch_id = bus.connect('message', self.on_bus_message)
self.parser.connect("pad-added",self.new_pad)
self.src.link(self.parser)
gobject.timeout_add(1000,self.timer_cb)
def timer_cb(self) :
print self.pipeline.query_position(gst.FORMAT_TIME)
print self.pipeline.query_duration(gst.FORMAT_TIME)
return True
def new_pad(self,element,pad):
print "new_pad"
print pad.get_caps()[0].get_name()
if pad.get_caps()[0].get_name()=="audio/x-vorbis" :
pad.link(self.audio_queue.get_pad("sink"))
if pad.get_caps()[0].get_name()=="video/x-theora" :
pass
pad.link(self.videobin.get_pad("sink"))
def on_bus_message(self,bus, msg):
print msg
print msg.type
def play(self):
self.pipeline.set_state(gst.STATE_PLAYING)
player = Player()
print "playing"
player.play()
gobject.MainLoop().run()
#gtk.main()
More information about the gstreamer-devel
mailing list