Jake,
Thanks for the response. I have made some headway on this. I have
mostly working code now. I say MOSTLY because this all works EXCEPT for
when the the signal handler for the ICYdemux src pad added event is
fired. When that happens, all audio stops playing and I still don’t get
any TAG messages from the ICYdemux. Take a peek, I appreciate any and
all help! BTW: Changing Gst::Message::Type::TAG to Gst::Message::TAG
had no effect. They are identical anyway, just run
Gst::Message::Type::TAG == Gst::Message::TAG in ruby
Here is my current code:
require ‘thread’
require ‘gst’
Gst.init
#create a thread for a glib main loop
thread = Thread.new() do
@mainloop = GLib::MainLoop.new
@mainloop.run
end
Here is the gst-launch we are going for:
gst-launch souphttpsrc
location=http://streampoint.radioio.com/streams/56/47bf578c13be7/
iradio-mode=true ! tee name=t ! queue2 ! decodebin2 ! audioconvert !
autoaudiosink t. ! queue2 ! icydemux ! fakesink -t
To do this we’ll do 4 things:
1. Create a SRC element that feeds a TEE
2. Create an AUDIO OUT element array
3. Create a DECODER for the audio
4. Create an ICYDEMUX element to decode ICY messages
5. Link the TEE src pads to the DECODER and the ICYDEMUX
respectively
apipeline = Gst::Pipeline.new(“ArydioPipeline”)
########## Step 1, create the SRC Bin
httpsrc = Gst::ElementFactory.make(“souphttpsrc”)
httpsrc.location =
“http://streampoint.radioio.com/streams/56/47bf578c13be7/”
httpsrc.live = true
httpsrc.do_timestamp = false
httpsrc.iradio_mode = true
audiotee = Gst::ElementFactory.make(“tee”)
audiotee.name = “audiotee”
apipeline.add(httpsrc)
apipeline.add(audiotee)
########### Step 2, create the audio out pipeline. We’ll link to the
decoder with the src is ready
audioconv = Gst::ElementFactory.make(“audioconvert”)
@eq = Gst::ElementFactory.make(“equalizer-10bands”)
autosink = Gst::ElementFactory.make(“autoaudiosink”)
apipeline.add(audioconv)
apipeline.add(@eq)
apipeline.add(autosink)
audioconv >> @eq >> autosink
########### Step 3, create the DECODER bin
queue1 = Gst::ElementFactory.make(“queue2”)
decoder = Gst::ElementFactory.make(“decodebin2”)
decodebin2 does not expose a SRC pad by default, we need to look for
the signal and then construct the pipeline
decoder.signal_connect(“pad-added”) do |element, pad, data|
puts “a new pad #{pad.name} was created!”
if pad.caps.to_s.match(‘audio’)
element >> audioconv
else
fakesink = Gst::ElementFactory.make(‘fakesink’)
apipeline.add(fakesink)
element >> fakesink
end
true
end
apipeline.add(queue1)
apipeline.add(decoder)
httpsrc >> audiotee
queue1 >> decoder
########### Step 4, create the ICYDEMUX element
queue2 = Gst::ElementFactory.make(“queue2”)
icydemx = Gst::ElementFactory.make(“icydemux”)
icydemx.signal_connect(“pad-added”) do |element, pad, data|
puts “a new pad #{pad.name} was created for
ICY!!!”
fakesink = Gst::ElementFactory.make(‘fakesink’)
fakesink.set_property(“dump”, true)
apipeline.add(fakesink)
element >> fakesink
true
end
apipeline.add(queue2)
apipeline.add(icydemx)
queue2 >> icydemx
############ Step 5, Link the TEE to the two paths
teesrc0 = audiotee.get_request_pad(“src%d”)
queue1sink = queue1.get_pad(“sink”)
teesrc0.link(queue1sink)
teesrc1 = audiotee.get_request_pad(“src%d”)
queue2sink = queue2.get_pad(“sink”)
teesrc1.link(queue2sink)
#get the apipeline bus
bus = apipeline.bus
#watch the bus for messages
bus.add_watch do |bus, message|
case message.type
when Gst::Message::TAG
puts ("Got a TAG!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
tag_list = message.parse()
#we need to get the key and value from the tag
tag_list.each do |key,val|
p "key: " + key
p "val: " + val
#handle this
end
end
true
end
apipeline.play
loop = true
sleep 1
while loop
puts “type ‘quit’ to quit”
s = $stdin.gets.chomp
if s.eql? “quit”
loop = false
end
if s.eql? “rock”
@eq.band0 = 10
@eq.band1 = 10
@eq.band2 = 10
@eq.band3 = 10
@eq.band4 = 5
@eq.band5 = 0
@eq.band6 = -3
@eq.band7 = -3
@eq.band8 = -3
@eq.band9 = -3
end
if s.eql? “jazz”
@eq.band0 = 10
@eq.band1 = 10
@eq.band2 = 5
@eq.band3 = 0
@eq.band4 = -5
@eq.band5 = -5
@eq.band6 = -5
@eq.band7 = 5
@eq.band8 = 10
@eq.band9 = 10
end
if s.eql? “normal”
@eq.band0 = 0
@eq.band1 = 0
@eq.band2 = 0
@eq.band3 = 0
@eq.band4 = 0
@eq.band5 = 0
@eq.band6 = 0
@eq.band7 = 0
@eq.band8 = 0
@eq.band9 = 0
end
end