hello all, i would like to implement a peak db meter through gstreamer (thanks to marcin for posting his meter module) - and i'm wondering about the use of the "level" plugin. i see from the gstreamer documentation ( http://gstreamer.freedesktop.org/data/doc/gstreame...) that the plugin emits a message called "level" at a given interval... unfortunately i really can't make heads nor tails of the documentation's example as it's written in C (i believe,) and i'm just a simple ruby guy... anyone have experience with this plugin and how to catch the messages? i've watched my bus for messages after creating the plugin and adding it to my pipeline, but don't see any of type "level". plugin.messages? returns true, and plugin.get_state shows it playing, so i assume it is correctly added to the pipeline, and sending messages - i just can't figure out how to catch and parse them. here's a code snippet: ..... @pipeline = Gst::ElementFactory.make("playbin2") @plugin = Gst::ElementFactory.make("level") @pipeline.add(@plugin) bus = @pipeline.bus bus.add_watch {|bus, message|p message; true} ..... truncated then i play the pipeline - i get state changed, element, stream status, and tag messages, but nothing that looks like "level" being regularly emitted. thanks in advance for any ideas, -j
on 2011-03-19 22:16
on 2011-03-20 14:22
2011/3/19 J. K. <ruby-forum-incoming@andreas-s.net>: > hello all, Hi > anyone have experience with this plugin and how to catch the messages? > i've watched my bus for messages after creating the plugin and adding it > to my pipeline, but don't see any of type "level". > The message_handler function in C sample code shows that level message are GST_MESSAGE_ELEMENT kind ones. Then infos are parsed from the structure retrieved from the message. Here is the same sample in ruby : require 'gst' audiotestsrc=Gst::ElementFactory.make("audiotestsrc") audioconvert=Gst::ElementFactory.make("audioconvert") level=Gst::ElementFactory.make("level") fakesink=Gst::ElementFactory.make("fakesink") pipeline=Gst::Pipeline.new pipeline.add(audiotestsrc, audioconvert, level, fakesink) #pipeline.add(audiotestsrc, audioconvert, fakesink) audiotestsrc >> audioconvert >> level >> fakesink pipeline.ready pipeline.bus.add_watch {|bus, message| case message when Gst::MessageError puts message.parse when Gst::MessageElement struc=message.structure if struc.name=="level" p struc["rms"][0] struc.each{|key, val| puts "#{key}=#{val}"} end end true } mainloop=GLib::MainLoop.new pipeline.play mainloop.run -- Vincent Carmona
on 2011-03-20 17:14
vincent - i saw that the message was of element type, but didn't know how to catch it - greatly appreciate the translation to ruby, i'm getting the hang of C, but it's still a bit tricky for me to translate from C to ruby. going to play around and see what i come up with... thanks again, -jk
on 2011-03-20 18:49
2011/3/20 J. K. <ruby-forum-incoming@andreas-s.net>: > vincent - > > i saw that the message was of element type, but didn't know how to > catch it - greatly appreciate the translation to ruby, i'm getting the > hang of C, but it's still a bit tricky for me to translate from C to > ruby. > > going to play around and see what i come up with... > > thanks again, You are welcome. > http://p.sf.net/sfu/internap-sfd2d > _______________________________________________ > ruby-gnome2-devel-en mailing list > ruby-gnome2-devel-en@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ruby-... > -- Vincent Carmona
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.