Skip to content

Instantly share code, notes, and snippets.

@driv3r
Created December 14, 2011 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save driv3r/1475171 to your computer and use it in GitHub Desktop.
Save driv3r/1475171 to your computer and use it in GitHub Desktop.
Ruby/Gstreamer error
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)
@driv3r
Copy link
Author

driv3r commented Dec 14, 2011

After few seconds from executing file, this error appears. I've checked if elements are linked, and all of them are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment