Gnolin and Python - Theora/Vorbis ogg video only creating one pad

Matt Veenstra matt at tribalmedia.com
Fri Feb 11 18:42:11 CET 2011


Hi,

I use a gnlfilesource with an .ogv source file (theora/vorbis).  I
only get one pad created when we start playing (the video pad), I
never receive the audio pad added callback of the composition.

I tried to add a "decodebin" and connect this to the composition or
gnlfilesource without any luck.

What am I missing to get both pads created?  A plain vorbis audio file
works fine.  I receive no errors in the code.

Here is the code.

class Main:
	def __init__(self):
		self.mainloop = gobject.MainLoop()
		
		# creating the pipeline
		self.pipeline = gst.Pipeline("mypipeline")
		
		# Create bus and connect several handlers
		self.bus = self.pipeline.get_bus()
		self.bus.add_signal_watch()
		self.bus.connect('message::eos', self.OnEOS)
		self.bus.connect('message::tag', self.OnTag)
		self.bus.connect('message::error', self.OnError)
		
		# creating a gnlcomposition
		self.comp = gst.element_factory_make("gnlcomposition", "composition")
		self.pipeline.add(self.comp)
		self.comp.connect("pad-added", self.OnPad)
		
		# create an audioconvert
		self.audioconvert = gst.element_factory_make("audioconvert", "audioconvert")
		self.pipeline.add(self.audioconvert)
				
		# create an audioconvert
		self.videoconvert = gst.element_factory_make("ffmpegcolorspace")
		self.pipeline.add(self.videoconvert)

		# create an fakesink
		self.sink = gst.element_factory_make("fakesink", "fakesink")
		self.pipeline.add(self.sink)
		
		# create a gnlfilesource
		self.stream1 = gst.element_factory_make("gnlfilesource", "stream1")
		self.comp.add(self.stream1)

		# set the gnlfilesource properties
		self.stream1.set_property("location", "/transcoder/samples/video.ogv")
		# self.stream1.set_property("location",
"/transcoder/samples/Epoq-Lepidoptera.ogg")
		self.stream1.set_property("start", 0 * gst.SECOND)
		self.stream1.set_property("duration", 5 * gst.SECOND)
		self.stream1.set_property("media-start", 10 * gst.SECOND)
		self.stream1.set_property("media-duration", 5 * gst.SECOND)

		self.pipeline.set_state(gst.STATE_PLAYING)
		self.mainloop.run()	


	def OnPad(self, comp, pad):
		aCaps = pad.get_caps()
		aName = aCaps[0].get_name()
		print "pad added!", aName
		
		if aName == 'audio/x-raw-float' or aName == 'audio/x-raw-int':
			convpad = self.audioconvert.get_compatible_pad(pad, pad.get_caps())
			if not convpad.is_linked(): # Only link once
				print "linking audio pads"
				pad.link(convpad)
				self.audioconvert.link(self.mux)
		elif aName == 'video/x-raw-yuv':
			convpad = self.videoconvert.get_compatible_pad(pad, pad.get_caps())
			if not convpad.is_linked(): # Only link once
				print "linking video pads"
				pad.link(convpad)
				self.videoconvert.link(self.sink)


I am not sure this is the correct forum so please let me know if I
should post elsewhere.

Thanks,
Matt
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



More information about the gstreamer-devel mailing list