gnomemm r1380 - in gstreamermm/trunk: . gstreamer/src tests tools/m4
- From: jaalburqu svn gnome org
- To: svn-commits-list gnome org
- Subject: gnomemm r1380 - in gstreamermm/trunk: . gstreamer/src tests tools/m4
- Date: Sun, 2 Mar 2008 06:24:12 +0000 (GMT)
Author: jaalburqu
Date: Sun Mar 2 06:24:12 2008
New Revision: 1380
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1380&view=rev
Log:
2008-03-02 Josà Alburquerque <jaalburqu svn gnome org>
* gstreamer/src/element.hg: Removed Gst::Interface derivation as not
all elements implement interface (see bug #519584)
* gstreamer/src/interface.hg: Made implements() static and renamed to
element_implements(); Added static cast() method
* tests/test-create-element.cc: Changed test to use
Gst::Interface::element_implements() method and Gst::Interface::cast()
methods (test two methods) though cast() method does not quite work
* tools/m4/convert_gst.m4: Added conversion for
Gst::Interface::element_implements() method (from const
Glib::RefPtr<const Element>& to GstElement*)
Modified:
gstreamermm/trunk/ChangeLog
gstreamermm/trunk/gstreamer/src/element.hg
gstreamermm/trunk/gstreamer/src/interface.hg
gstreamermm/trunk/tests/test-create-element.cc
gstreamermm/trunk/tools/m4/convert_gst.m4
Modified: gstreamermm/trunk/gstreamer/src/element.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/element.hg (original)
+++ gstreamermm/trunk/gstreamer/src/element.hg Sun Mar 2 06:24:12 2008
@@ -20,7 +20,6 @@
*/
#include <gstreamermm/object.h>
-#include <gstreamermm/interface.h>
#include <gstreamermm/clock.h>
#include <gstreamermm/enums.h>
@@ -79,12 +78,9 @@
*
* Last reviewed on 2006-03-12 (0.10.5)
*/
-class Element
-: public Gst::Object,
- public Gst::Interface
+class Element : public Gst::Object
{
_CLASS_GOBJECT(Element, GstElement, GST_ELEMENT, Gst::Object, GstObject)
- _IMPLEMENTS_INTERFACE(Gst::Interface)
public:
Glib::RefPtr<Element> link(const Glib::RefPtr<Element>& other_element);
Modified: gstreamermm/trunk/gstreamer/src/interface.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/interface.hg (original)
+++ gstreamermm/trunk/gstreamer/src/interface.hg Sun Mar 2 06:24:12 2008
@@ -20,6 +20,7 @@
*/
#include <glibmm/interface.h>
+#include <gstreamermm/element.h>
_DEFS(gstreamermm,gst)
@@ -36,8 +37,23 @@
_CLASS_INTERFACE(Interface, GstImplementsInterface, GST_IMPLEMENTS_INTERFACE, GstImplementsInterface)
public:
- _WRAP_METHOD(bool implements(GType iface_type), gst_implements_interface_check)
+ _WRAP_METHOD(static bool element_implements(const Glib::RefPtr<const Element>&element, GType iface_type), gst_element_implements_interface)
+
+ template <class T_CastTo> inline
+ static Glib::RefPtr<T_CastTo> cast(const Glib::RefPtr<Element>& element);
};
} // namespace Gst
+
+namespace Gst
+{
+
+template <class T_CastTo> inline
+Glib::RefPtr<T_CastTo> Interface::cast(const Glib::RefPtr<Element>& element)
+{
+ gpointer result = gst_implements_interface_cast(element->gobj(), T_CastTo::get_type());
+ return Glib::RefPtr<T_CastTo>( dynamic_cast<T_CastTo*> (Glib::wrap_auto_interface<T_CastTo> ((GObject*)(result), true)) );
+}
+
+} //namespace Gst
Modified: gstreamermm/trunk/tests/test-create-element.cc
==============================================================================
--- gstreamermm/trunk/tests/test-create-element.cc (original)
+++ gstreamermm/trunk/tests/test-create-element.cc Sun Mar 2 06:24:12 2008
@@ -32,6 +32,9 @@
std::cout << "Successfully created gst element '" <<
element->get_name() << "'." << std::endl;
- if(element->implements(Gst::URIHandler::get_type()))
+ if(Gst::Interface::element_implements(element, Gst::URIHandler::get_type())) {
std::cout << "element '" << element->get_name() << "' implements URIHandler interface." << std::endl;
+ Glib::RefPtr<Gst::URIHandler> handler = Gst::Interface::cast <Gst::URIHandler>(element);
+ std::cout << "handler memory = '" << handler << "'." << std::endl;
+ }
}
Modified: gstreamermm/trunk/tools/m4/convert_gst.m4
==============================================================================
--- gstreamermm/trunk/tools/m4/convert_gst.m4 (original)
+++ gstreamermm/trunk/tools/m4/convert_gst.m4 Sun Mar 2 06:24:12 2008
@@ -46,6 +46,7 @@
_CONVERSION(`GstElement*',`Glib::RefPtr<Element>',`Glib::wrap($3)')
_CONVERSION(`GstElement*',`Glib::RefPtr<const Element>',`Glib::wrap($3)')
_CONVERSION(`const Glib::RefPtr<Element>&',`GstElement*', `Glib::unwrap($3)')
+_CONVERSION(`const Glib::RefPtr<const Element>&',`GstElement*', `const_cast<GstElement*>(Glib::unwrap($3))')
_CONVERSION(`State&',`GstState*',`((GstState*) (&($3)))')
#ElementFactory
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]