Created
December 14, 2011 03:44
-
-
Save driv3r/1475171 to your computer and use it in GitHub Desktop.
Ruby/Gstreamer error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'gst' | |
unless ARGV.length == 1 | |
$stderr.puts "Usage: #{__FILE__} <mp3 filename>" | |
exit 1 | |
end | |
# create a new pipeline to hold the elements | |
pipeline = Gst::Pipeline.new | |
# create a disk reader | |
httpsrc = Gst::ElementFactory.make("souphttpsrc") | |
httpsrc.location = ARGV.first | |
httpsrc.live = true | |
httpsrc.do_timestamp = true | |
demuxer = Gst::ElementFactory.make("multipartdemux") | |
#demuxer have only sink pad, we need to add src | |
tmp = Gst::ElementFactory.find("multipartdemux").pad_templates.first | |
tpl = Gst::PadTemplate.new caps: tmp.caps.to_caps, | |
name_template: tmp.name, | |
direction: tmp.direction, | |
presence: tmp.presence, | |
name: tmp.name | |
demuxer.add_pad Gst::Pad.new(template: tpl, direction: tpl.direction) | |
# now it's time to get the decoder | |
decoder = Gst::ElementFactory.make("jpegdec") | |
# and an video sink | |
audiosink = Gst::ElementFactory.make("xvimagesink") | |
# add objects to the main pipeline | |
pipeline.add(httpsrc, demuxer, decoder, audiosink) | |
# link elements | |
httpsrc >> demuxer >> decoder >> audiosink | |
# create the program's main loop | |
loop = GLib::MainLoop.new(GLib::MainContext.default, true) | |
# listen to playback events | |
pipeline.bus.add_watch do |bus, message| | |
case message.type | |
when Gst::Message::EOS | |
loop.quit | |
when Gst::Message::ERROR | |
puts message.parse | |
loop.quit | |
end | |
true | |
end | |
# start playing | |
pipeline.play | |
begin | |
loop.run | |
rescue Interrupt | |
ensure | |
pipeline.stop | |
end | |
# Error after trying to run this file | |
# Internal data flow error. | |
# gstbasesrc.c(2582): gst_base_src_loop (): /GstPipeline:pipeline0/GstSoupHTTPSrc:souphttpsrc0: | |
# streaming task paused, reason not-linked (-1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After few seconds from executing file, this error appears. I've checked if elements are linked, and all of them are.