Problem with queries in Ruby/GStreamer

Hi,

I’m writing a multimedia app using ruby 1.8.6 and Ruby/GStreamer
bindings
from ruby-gnome2 0.19.3.

A lot of things works very well, as you can see at hiki’s Samples page -
i’ve uploaded a few basic scripts that could be valuable for the
beginners.
Maybe if I found a short time, I could update Ruby/GStreamer tutorial.

But now I have problem with querying total duration of the stream. See
the
following example code:

class Discoverer
def initialize(infile)
@mainloop = GLib::MainLoop.new(GLib::MainContext.default, true);
@pipeline = Gst::Pipeline.new(“discoverer”)
@source = Gst::ElementFactory.make(“filesrc”)
@source.location = infile
@sink = Gst::ElementFactory.make(“fakesink”)
@decoder = Gst::ElementFactory.make(“decodebin”)

@typefind = @decoder.get_child("typefind")
@typefind.signal_connect("have-type") do | typefind, prob, caps |
  @mimetype = caps.get_structure(0)
  puts "Mimetype: #{@mimetype}"
end

@decoder.signal_connect("new-decoded-pad") do | dbin, pad, is_last |
  pad.link @decoder.get_pad("sink")
  @decoder >> @sink

  pad.query_types.each{ |x| puts "#{x.nick} #{x.description}

#{x.type_id}" }
puts pad.query Gst::QueryType.find(“duration”) # does not work
puts pad.query Gst::QueryType::DURATION # also does not work
end

@pipeline.add @source, @decoder, @sink
@source >> @decoder

@pipeline.bus.add_watch do | bus, message |
  case message.type
    when Gst::Message::Type::ERROR
      $stderr.puts "Error"
      @mainloop.quit
      exit 1

    when Gst::Message::Type::EOS
      @pipeline.stop
      @mainloop.quit
      exit 0
  end
  true
end

end

def play
@pipeline.play
@mainloop.run
end

def stop
@pipeline.stop
end
end

especially please notice the lines
puts pad.query Gst::QueryType.find(“duration”) # does not work
puts pad.query Gst::QueryType::DURATION # also does not work

previous line, that reads all supported query types for this pad results
in:
position Current position 1
duration Total duration 2
convert Converting between formats 8

No matter what I pass to pad.query i receive an error like that:

./discoverer.rb:30:in query': Gst::QueryType isn't supported from ./discoverer.rb:30:ininitialize’
from /usr/local/lib/site_ruby/1.8/gst.rb:5:in call' from /usr/local/lib/site_ruby/1.8/gst.rb:5:ininit’
from /usr/local/lib/site_ruby/1.8/gst.rb:5
from ./discoverer.rb:2:in `require’
from ./discoverer.rb:2

could you help me in solving that?

Thanks,

m.