Gst::QueryDuration issue

José Alburquerque jaalburquerque at cox.net
Thu Sep 6 12:50:57 PDT 2012


On Thu, 2012-09-06 at 19:14 +0300, Jiergir Ogoerg wrote:
> Hi,
> I'm using the C++ backend of gstreamer (0.10)
> 
> The problem is that Gst::QueryDuration::create(Format format) returns
> Glib::RefPtr<Gst::Query> instead of Glib::RefPtr<Gst::QueryDuration>
> which makes it impossible to use the parse() method of the returned
> object since parse() only exists in Gst::QueryDuration.

The create() methods of the Gst::Query* classes wrap the
gst_query_new_*() functions and they return a GstQuery so the create()
methods similarly return a Gst::Query.
> 
> As a workaround I thought I'd cast the returned value to
> Glib::RefPtr<Gst::QueryDuration> but the compiler refuses to do so.

The proper way to cast it would be something like:

Glib::RefPtr<Gst::QueryDuration> durQuery =
      Glib::RefPtr<Gst::QueryDuration>::cast_dynamic(query);

The ogg_player, ogg_player_gtkmm and the media_player_gtkmm examples
show how this is done when querying the pipeline for the position of the
stream.
> 
> Using Ubuntu 12.04 amd64, the documentation (libgstreamermm-0.10-doc)
> doesn't tell how to do it.
> 
> However, in Ubuntu 12.10 (yet to be released), the documentation is
> updated with an example but it doesn't compile because the example
> calls parse() on a Gst::Query object which doesn't have such a method.

Really?  What example would that be?  The gstreamermm examples should
compile and work fine with gstreamermm.
> 
> So how do I create a Gst::QueryDuration object to be able to call
> parse() to get the duration? Is it a broken C++ bindings design?
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

-- 
José



More information about the gstreamer-devel mailing list