Gst::QueryDuration issue

José Alburquerque jaalburquerque at cox.net
Fri Sep 7 05:03:30 PDT 2012


On Fri, 2012-09-07 at 07:20 +0300, Jiergir Ogoerg wrote:
> Thanks,
> your cast works!
> 
> The code I'm talking about which doesn't compile is at the bottom
> of this screenshot:
> http://f35f22fan.blogspot.com/2012/09/gstreamer.html
> 
> As one can see
> 1) The guy who wrote it calls "parse()" on a Gst::Query object
> 2) He uses "." to refer to the "parse()" method instead of "->"
> So clearly it wouldn't compile, so I didn't even try.

Ah, that's a beginner's attempt at a crude C++ translation of the usage
example found in GstQuery's description section.  It was placed in the
Gst::Query class docs as an attempt to also show how the class could be
used.  I guess little thought was put into the need to cast correctly
before using the parse() method as you describe.

The line which should cast has been fixed in this commit:
http://git.gnome.org/browse/gstreamermm/commit/?id=a6933d2012fbe626eb110320ab6c4338c583e7bc

Please feel free to report any errors you find here:
https://bugzilla.gnome.org/enter_bug.cgi?product=gstreamermm

> 
> I wish that create() method just returned
> Glib::RefPtr<Gst::QueryDuration>
> 
Feel free to file a bug about that also.

> 
> On Thu, Sep 6, 2012 at 10:50 PM, José Alburquerque
> <jaalburquerque at cox.net> wrote:
>         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é
>         
>         _______________________________________________
>         gstreamer-devel mailing list
>         gstreamer-devel at lists.freedesktop.org
>         http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> 
> _______________________________________________
> 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