After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 506639 - Wrapping Gst::Event classes along with a few other things
Wrapping Gst::Event classes along with a few other things
Status: RESOLVED FIXED
Product: gstreamermm
Classification: Bindings
Component: general
git master
Other All
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2008-01-01 00:29 UTC by José Alburquerque
Modified: 2011-01-16 23:37 UTC
See Also:
GNOME target: ---
GNOME version: 2.19/2.20


Attachments
Gst::Event wrapping patch (47.11 KB, patch)
2008-01-01 00:36 UTC, José Alburquerque
none Details | Review

Description José Alburquerque 2008-01-01 00:29:31 UTC
Please describe the problem:
I've been looking at the GStreamer C++ bindings (gstreamermm) as they are now and have become a bit familiar with the wrapping process so I thought I would contribute a bit (regularly) to advance the wrapping process.  This patch I'm submitting wraps the Gst::Event classes and replaces std::string usages where Glib::ustring might be a bit better.

I've made a few other changes which include adding a Bus::remove_watch() method and few fixes such as using _WRAP_METHOD instead of the handwritting of a couple of methods in Element.ccg

Steps to reproduce:
There is no real problem; This is just a patch submission

Actual results:


Expected results:


Does this happen every time?


Other information:
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 1264)
+++ ChangeLog	(working copy)
@@ -1,3 +1,45 @@
+2007-12-31  José Alburquerque  <jaalburquerque@cox.com>
+
+	* examples/ogg_player_gtkmm/PlayerWindow.cc: modified to remove bus
+	watch when PlayerWindow is destroyed (in destructor)
+	* examples/ogg_player_gtkmm/PlayerWindow.h: added destructor (to
+	remove bus watch) and watch_id variable definition (to store bus watch
+	id)
+	* gst/gstmm/gst_wrap_init.cc: Removed to fix build
+	* gst/gstmm/wrap_init.cc: Removed to fix build
+	* gst/src/bin.ccg: changed std::string usages to
+	* gst/src/bin.hg:  Glib::ustring
+	* gst/src/bus.ccg: added remove_watch() method and modified
+	add_watch() to return a watch_id
+	* gst/src/bus.hg: modified add_watch() declaration to return unsigned
+	int and added a remove_watch() method
+	* gst/src/caps.hg: used Glib::ustring instead of std::string
+	* gst/src/element.ccg: removed handwritten sate_get_name() and
+	state_change_return_get_name() methods to use _WRAP_METHOD .hg file
+	instead
+	* gst/src/element.hg: used _WRAP_METHOD for state_get_name() and
+	state_change_return_get_name(); used Glib::ustring instead of
+	std::string
+	* gst/src/enums.hg: alphabetized enums; added EventType, TagMergeMode
+	and TagFlag
+	* gst/src/event.ccg: wrapped GstEvent
+	* gst/src/event.hg: wrapped GstEvent
+	* gst/src/format.ccg: used Glib::ustring instead of
+	* gst/src/format.hg:  std::string
+	* gst/src/message.ccg: added MessageAsyncStart::parse() method
+	definition
+	* gst/src/message.hg: cleaned up spacing
+	* gst/src/pad.ccg: used Glib::ustring instead of
+	* gst/src/pad.hg:  std::string
+	* gst/src/padtemplate.ccg: used Glib::ustring instead of
+	* gst/src/padtemplate.hg:  std::string
+	* gst/src/pipeline.ccg: used Glib::ustring instead of
+	* gst/src/pipeline.hg:  std::string
+	* gst/src/structure.ccg: used Glib::ustring instead of
+	* gst/src/structure.hg:  std::string and added parameter names in .hg
+	file
+	* tools/m4/convert_gst.m4: added a GstEventType conversion macro
+
 2007-12-21  Murray Cumming  <murrayc@murrayc.com>
 
 	* configure.ac: Add an extra PKG_CHECK_MODULES check (and resulting 
Index: gst/gstmm/wrap_init.cc
===================================================================
--- gst/gstmm/wrap_init.cc	(revision 1264)
+++ gst/gstmm/wrap_init.cc	(working copy)
@@ -1,106 +0,0 @@
-
-#include <glib.h>
-
-// Disable the 'const' function attribute of the get_type() functions.
-// GCC would optimize them out because we don't use the return value.
-#undef  G_GNUC_CONST
-#define G_GNUC_CONST /* empty */
-
-#include <gstmm/wrap_init.h>
-#include <glibmm/error.h>
-#include <glibmm/object.h>
-
-// #include the widget headers so that we can call the get_type() static methods:
-
-#include "enums.h"
-#include "caps.h"
-#include "clock.h"
-#include "element.h"
-#include "error.h"
-#include "event.h"
-#include "iterator.h"
-#include "format.h"
-#include "pad.h"
-#include "padtemplate.h"
-#include "query.h"
-#include "structure.h"
-#include "systemclock.h"
-#include "xml.h"
-#include "bin.h"
-#include "pipeline.h"
-#include "bus.h"
-#include "message.h"
-
-extern "C"
-{
-
-//Declarations of the *_get_type() functions:
-
-GType gst_bin_get_type(void);
-GType gst_bus_get_type(void);
-GType gst_clock_get_type(void);
-GType gst_element_get_type(void);
-GType gst_pad_get_type(void);
-GType gst_pad_template_get_type(void);
-GType gst_pipeline_get_type(void);
-GType gst_system_clock_get_type(void);
-GType gst_xml_get_type(void);
-
-//Declarations of the *_error_quark() functions:
-
-GQuark gst_core_error_quark(void);
-GQuark gst_library_error_quark(void);
-GQuark gst_resource_error_quark(void);
-GQuark gst_stream_error_quark(void);
-} // extern "C"
-
-
-//Declarations of the *_Class::wrap_new() methods, instead of including all the private headers:
-
-namespace Gst {  class Bin_Class { public: static Glib::ObjectBase* wrap_new(GObject*); };  }
-namespace Gst {  class Bus_Class { public: static Glib::ObjectBase* wrap_new(GObject*); };  }
-namespace Gst {  class Clock_Class { public: static Glib::ObjectBase* wrap_new(GObject*); };  }
-namespace Gst {  class Element_Class { public: static Glib::ObjectBase* wrap_new(GObject*); };  }
-namespace Gst {  class Pad_Class { public: static Glib::ObjectBase* wrap_new(GObject*); };  }
-namespace Gst {  class PadTemplate_Class { public: static Glib::ObjectBase* wrap_new(GObject*); };  }
-namespace Gst {  class Pipeline_Class { public: static Glib::ObjectBase* wrap_new(GObject*); };  }
-namespace Gst {  class SystemClock_Class { public: static Glib::ObjectBase* wrap_new(GObject*); };  }
-namespace Gst {  class XML_Class { public: static Glib::ObjectBase* wrap_new(GObject*); };  }
-
-namespace Gst { 
-
-void wrap_init()
-{
-  // Register Error domains:
-  Glib::Error::register_domain(gst_core_error_quark(), &Gst::CoreError::throw_func);
-  Glib::Error::register_domain(gst_library_error_quark(), &Gst::LibraryError::throw_func);
-  Glib::Error::register_domain(gst_resource_error_quark(), &Gst::ResourceError::throw_func);
-  Glib::Error::register_domain(gst_stream_error_quark(), &Gst::StreamError::throw_func);
-
-// Map gtypes to gtkmm wrapper-creation functions:
-  Glib::wrap_register(gst_bin_get_type(), &Gst::Bin_Class::wrap_new);
-  Glib::wrap_register(gst_bus_get_type(), &Gst::Bus_Class::wrap_new);
-  Glib::wrap_register(gst_clock_get_type(), &Gst::Clock_Class::wrap_new);
-  Glib::wrap_register(gst_element_get_type(), &Gst::Element_Class::wrap_new);
-  Glib::wrap_register(gst_pad_get_type(), &Gst::Pad_Class::wrap_new);
-  Glib::wrap_register(gst_pad_template_get_type(), &Gst::PadTemplate_Class::wrap_new);
-  Glib::wrap_register(gst_pipeline_get_type(), &Gst::Pipeline_Class::wrap_new);
-  Glib::wrap_register(gst_system_clock_get_type(), &Gst::SystemClock_Class::wrap_new);
-  Glib::wrap_register(gst_xml_get_type(), &Gst::XML_Class::wrap_new);
-
-  // Register the gtkmm gtypes:
-  Gst::Bin::get_type();
-  Gst::Bus::get_type();
-  Gst::Clock::get_type();
-  Gst::Element::get_type();
-  Gst::Pad::get_type();
-  Gst::PadTemplate::get_type();
-  Gst::Pipeline::get_type();
-  Gst::SystemClock::get_type();
-  Gst::XML::get_type();
-
-} // wrap_init()
-
-} //Gst
-
-
Index: gst/gstmm/gst_wrap_init.cc
===================================================================
--- gst/gstmm/gst_wrap_init.cc	(revision 1264)
+++ gst/gstmm/gst_wrap_init.cc	(working copy)
@@ -1,73 +0,0 @@
-
-#include <glib.h>
-
-// Disable the 'const' function attribute of the get_type() functions.
-// GCC would optimize them out because we don't use the return value.
-#undef  G_GNUC_CONST
-#define G_GNUC_CONST /* empty */
-
-#include <gstmm/gst_wrap_init.h>
-#include <glibmm/error.h>
-#include <glibmm/object.h>
-
-// #include the widget headers so that we can call the get_type() static methods:
-
-#include "enums.h"
-#include "caps.h"
-#include "clock.h"
-#include "element.h"
-#include "error.h"
-#include "event.h"
-#include "iterator.h"
-#include "format.h"
-#include "pad.h"
-#include "padtemplate.h"
-#include "query.h"
-#include "structure.h"
-#include "systemclock.h"
-#include "xml.h"
-#include "bin.h"
-#include "pipeline.h"
-#include "bus.h"
-#include "message.h"
-
-extern "C"
-{
-
-//Declarations of the *_get_type() functions:
-
-GType gst_event_get_type(void);
-GType gst_message_get_type(void);
-GType gst_query_get_type(void);
-
-//Declarations of the *_error_quark() functions:
-
-} // extern "C"
-
-
-//Declarations of the *_Class::wrap_new() methods, instead of including all the private headers:
-
-namespace Gst {  class Event_Class { public: static Gst::MiniObject* wrap_new(GstMiniObject*); };  }
-namespace Gst {  class Message_Class { public: static Gst::MiniObject* wrap_new(GstMiniObject*); };  }
-namespace Gst {  class Query_Class { public: static Gst::MiniObject* wrap_new(GstMiniObject*); };  }
-
-namespace Gst { 
-
-void gst_wrap_init()
-{
-
-// Map gtypes to gstmm wrapper-creation functions:
-  Gst::wrap_register(gst_event_get_type(), &Gst::Event_Class::wrap_new);
-  Gst::wrap_register(gst_message_get_type(), &Gst::Message_Class::wrap_new);
-  Gst::wrap_register(gst_query_get_type(), &Gst::Query_Class::wrap_new);
-
-  // Register the gtkmm gtypes:
-  Gst::Event::get_type();
-  Gst::Message::get_type();
-  Gst::Query::get_type();
-
-} // gst_wrap_init()
-
-} //Gst
-
-
Index: gst/src/message.ccg
===================================================================
--- gst/src/message.ccg	(revision 1264)
+++ gst/src/message.ccg	(working copy)
@@ -265,7 +265,14 @@
   return Gst::Message::wrap(message, false);
 }
 
+void MessageAsyncStart::parse(bool& base_time)
+{
+  gboolean result;
+  gst_message_parse_async_start(gobj(), &result);
+  base_time = result;
+}
 
+
 MessageAsyncDone::MessageAsyncDone(GstMessage* castitem)
 : Message(castitem)
 {
@@ -351,12 +358,10 @@
     case GST_MESSAGE_ASYNC_DONE:
       result = Glib::RefPtr<Message>( new Gst::MessageAsyncDone(message) );
       break;
-    //TODO: case GST_MESSAGE_UNKNOWN:
-    //TODO: case GST_MESSAGE_TAG:
-    //TODO: case GST_MESSAGE_STEP_DONE:
-    //TODO: case GST_MESSAGE_STRUCTURE_CHANGE:
-    //TODO: case GST_MESSAGE_STREAM_STATUS:
-    //TODO: case GST_MESSAGE_ANY:
+    //TODO?: case GST_MESSAGE_TAG:
+    //TODO?: case GST_MESSAGE_STEP_DONE:
+    //TODO?: case GST_MESSAGE_STRUCTURE_CHANGE:
+    //TODO?: case GST_MESSAGE_STREAM_STATUS:
     default:
       result = Gst::wrap(message, false);
   }
Index: gst/src/element.ccg
===================================================================
--- gst/src/element.ccg	(revision 1264)
+++ gst/src/element.ccg	(working copy)
@@ -1,5 +1,4 @@
 #include <stdexcept>
-#include <iostream>
 
 namespace Gst
 {
@@ -22,18 +21,6 @@
     throw std::runtime_error("failed to link: " + get_name() + "->" + other_element->get_name() + "!\n");
 }
 
-std::string
-Element::state_get_name(State state)
-{
-  return gst_element_state_get_name(GstState(state));
-}
-
-std::string
-Element::state_change_return_get_name(StateChangeReturn state_ret)
-{
-  return gst_element_state_change_return_get_name(GstStateChangeReturn(state_ret));
-}
-
 Glib::RefPtr<Pad> Element::get_compatible_pad(const Glib::RefPtr<Pad>& pad, const Glib::RefPtr<Caps>& caps)
 {
   GstPad* c_pad = gst_element_get_compatible_pad(gobj(), pad->gobj(), caps->gobj());
Index: gst/src/enums.hg
===================================================================
--- gst/src/enums.hg	(revision 1264)
+++ gst/src/enums.hg	(working copy)
@@ -1,3 +1,4 @@
+#include <gst/gstevent.h>
 _DEFS(gstmm,gst)
 
 namespace Gst
@@ -6,14 +7,34 @@
 _WRAP_ENUM(BusSyncReply, GstBusSyncReply)
 _WRAP_ENUM(ClockEntryType, GstClockEntryType)
 _WRAP_ENUM(ClockReturn, GstClockReturn)
-_WRAP_ENUM(State, GstState)
-_WRAP_ENUM(StateChangeReturn, GstStateChangeReturn)
+
+enum EventType {
+  EVENT_UNKNOWN = GST_EVENT_UNKNOWN,
+  /* bidirectional events */
+  EVENT_FLUSH_START = GST_EVENT_FLUSH_START,
+  EVENT_FLUSH_STOP = GST_EVENT_FLUSH_STOP,
+  /* downstream serialized events */
+  EVENT_EOS = GST_EVENT_EOS,
+  EVENT_NEWSEGMENT = GST_EVENT_NEWSEGMENT,
+  EVENT_TAG = GST_EVENT_TAG,
+  EVENT_BUFFERSIZE = GST_EVENT_BUFFERSIZE,
+  /* upstream events */
+  EVENT_QOS = GST_EVENT_QOS,
+  EVENT_SEEK = GST_EVENT_SEEK,
+  EVENT_NAVIGATION = GST_EVENT_NAVIGATION,
+  EVENT_LATENCY = GST_EVENT_LATENCY,
+
+  /* custom events start here */
+  EVENT_CUSTOM_UPSTREAM = GST_EVENT_CUSTOM_UPSTREAM,
+  EVENT_CUSTOM_DOWNSTREAM = GST_EVENT_CUSTOM_DOWNSTREAM,
+  EVENT_CUSTOM_DOWNSTREAM_OOB = GST_EVENT_CUSTOM_DOWNSTREAM_OOB,
+  EVENT_CUSTOM_BOTH = GST_EVENT_CUSTOM_BOTH,
+  EVENT_CUSTOM_BOTH_OOB = GST_EVENT_CUSTOM_BOTH_OOB
+};
+
 _WRAP_ENUM(Format, GstFormat)
+_WRAP_ENUM(IteratorItem, GstIteratorItem)
 _WRAP_ENUM(IteratorResult, GstIteratorResult)
-_WRAP_ENUM(IteratorItem, GstIteratorItem)
-_WRAP_ENUM(PadDirection, GstPadDirection)
-_WRAP_ENUM(PadLinkReturn, GstPadLinkReturn)
-_WRAP_ENUM(PadPresence, GstPadPresence)
 
 enum MessageType
 {
@@ -138,7 +159,9 @@
    DUMMY_MESSAGE_WARNING   = (1 << 2)
 };
 
-_WRAP_ENUM(SeekType, GstSeekType)
+_WRAP_ENUM(PadDirection, GstPadDirection)
+_WRAP_ENUM(PadLinkReturn, GstPadLinkReturn)
+_WRAP_ENUM(PadPresence, GstPadPresence)
 
 enum SeekFlags
 {
@@ -149,4 +172,10 @@
    SEEK_FLAG_SEGMENT  = (1 << 3)
 };
 
+_WRAP_ENUM(SeekType, GstSeekType)
+_WRAP_ENUM(State, GstState)
+_WRAP_ENUM(StateChangeReturn, GstStateChangeReturn)
+_WRAP_ENUM(TagMergeMode, GstTagMergeMode)
+_WRAP_ENUM(TagFlag, GstTagFlag)
+
 } //namespace Gst
Index: gst/src/format.hg
===================================================================
--- gst/src/format.hg	(revision 1264)
+++ gst/src/format.hg	(working copy)
@@ -5,18 +5,18 @@
 {
   struct FormatDefinition
   {
-    Format	value;
-    std::string	nick;
-    std::string description;
-    GQuark	quark;
+    Format              value;
+    Glib::ustring       nick;
+    Glib::ustring       description;
+    GQuark              quark;
   };
 
   //Note that GstFormat is an enum. That's why these are not member functions of a class.
 
-  std::string get_format_name(Format format);
+  Glib::ustring get_format_name(Format format);
   GQuark get_format_quark(Format format);
-  Format register_format(const std::string& nick, const std::string&description);
-  Format get_format_by_nick(const std::string& nick);
+  Format register_format(const Glib::ustring& nick, const Glib::ustring&description);
+  Format get_format_by_nick(const Glib::ustring& nick);
   bool formats_contain_format(const Format& formats, Format format);
   bool get_format_details(FormatDefinition& def, Format format);
 
Index: gst/src/element.hg
===================================================================
--- gst/src/element.hg	(revision 1264)
+++ gst/src/element.hg	(working copy)
@@ -31,8 +31,8 @@
 
   static Glib::RefPtr<Element> create(const Glib::ustring& factoryname, const Glib::ustring& name);
   Glib::RefPtr<Element> link(const Glib::RefPtr<Element>& other_element);
-  static std::string state_get_name(State state);
-  static std::string state_change_return_get_name(StateChangeReturn state_ret);
+  _WRAP_METHOD(static Glib::ustring state_get_name(State state), gst_element_state_get_name)
+  _WRAP_METHOD(static Glib::ustring state_change_return_get_name(StateChangeReturn state_ret), gst_element_state_change_return_get_name)
   _WRAP_METHOD(bool add_pad(const Glib::RefPtr<Pad>& pad), gst_element_add_pad)
   _WRAP_METHOD(Glib::RefPtr<Pad> get_pad(const Glib::ustring& name), gst_element_get_pad)
   _WRAP_METHOD(void create_all_pads(), gst_element_create_all_pads)
Index: gst/src/padtemplate.ccg
===================================================================
--- gst/src/padtemplate.ccg	(revision 1264)
+++ gst/src/padtemplate.ccg	(working copy)
@@ -4,7 +4,7 @@
 namespace Gst
 {
 
-Glib::RefPtr<PadTemplate> PadTemplate::create(const std::string& name_template, PadDirection direction, PadPresence presence, const Glib::RefPtr<Caps>& caps)
+Glib::RefPtr<PadTemplate> PadTemplate::create(const Glib::ustring& name_template, PadDirection direction, PadPresence presence, const Glib::RefPtr<Caps>& caps)
 {
   return Glib::wrap(gst_pad_template_new(name_template.c_str(), GstPadDirection(direction), GstPadPresence(presence), caps->gobj()));
 }
Index: gst/src/structure.ccg
===================================================================
--- gst/src/structure.ccg	(revision 1264)
+++ gst/src/structure.ccg	(working copy)
@@ -5,14 +5,14 @@
 {
 // StructureValueProxy
 
-StructureValueProxy::StructureValueProxy(Structure& structure, const std::string& name)
+StructureValueProxy::StructureValueProxy(Structure& structure, const Glib::ustring& name)
 : m_Structure(structure)
 , m_Name(name)
 {
 }
 
 void
-StructureValueProxy::operator=(const std::string& value)
+StructureValueProxy::operator=(const Glib::ustring& value)
 {
   gst_structure_set(m_Structure.gobj(), m_Name.c_str(), G_TYPE_STRING, value.c_str(), NULL);
 }
@@ -47,7 +47,7 @@
 
 // Structure
 
-Structure::Structure(const std::string& name)
+Structure::Structure(const Glib::ustring& name)
 {
   gobject_ = gst_structure_empty_new(name.c_str());
 }
@@ -58,7 +58,7 @@
 }
 
 StructureValueProxy
-Structure::operator[](const std::string& name)
+Structure::operator[](const Glib::ustring& name)
 {
   return StructureValueProxy(*this, name);
 }
@@ -79,7 +79,7 @@
 //TODO: ValueBase should be used as an output paramter in getters because it is a base type.
 /*
 Glib::ValueBase
-Structure::get_value(const std::string& name) const
+Structure::get_value(const Glib::ustring& name) const
 {
   Glib::ValueBase v;
   v.init(gst_structure_get_value(gobject_, name.c_str()));
@@ -88,7 +88,7 @@
 */
 
 bool
-Structure::get_boolean(const std::string& name, bool& value) const
+Structure::get_boolean(const Glib::ustring& name, bool& value) const
 {
   gboolean val_ = false;
   const bool has = gst_structure_get_boolean(gobject_, name.c_str(), &val_);
@@ -101,38 +101,38 @@
 }
 
 bool
-Structure::get_int(const std::string& name, int& value) const
+Structure::get_int(const Glib::ustring& name, int& value) const
 {
   return gst_structure_get_int(gobject_, name.c_str(), &value);
 }
 
 bool
-Structure::get_uint(const std::string& name, guint& value) const
+Structure::get_uint(const Glib::ustring& name, guint& value) const
 {
   return gst_structure_get_uint(gobject_, name.c_str(), &value);
 }
 
 bool
-Structure::get_fourcc(const std::string& name, guint32& value) const
+Structure::get_fourcc(const Glib::ustring& name, guint32& value) const
 {
   return gst_structure_get_fourcc(gobject_, name.c_str(), &value);
 }
 
 
 bool
-Structure::get_double(const std::string& name, gdouble& value) const
+Structure::get_double(const Glib::ustring& name, gdouble& value) const
 {
   return gst_structure_get_double(gobject_, name.c_str(), &value);
 }
 
-std::string
-Structure::get_string(const std::string& name) const
+Glib::ustring
+Structure::get_string(const Glib::ustring& name) const
 {
   return gst_structure_get_string(gobject_, name.c_str());
 }
 
 bool
-Structure::get_date (const std::string& name, Glib::Date& value) const
+Structure::get_date (const Glib::ustring& name, Glib::Date& value) const
 {
   GDate *date = 0;
   const bool has = gst_structure_get_date(gobject_, name.c_str(), &date);
@@ -142,21 +142,21 @@
 
 
 bool
-Structure::get_clock_time(const std::string& name, ClockTime& value) const
+Structure::get_clock_time(const Glib::ustring& name, ClockTime& value) const
 {
   return gst_structure_get_clock_time(gobject_, name.c_str(), &value);
 }
 
 
 bool
-Structure::get_enum(const std::string& name, GType enumtype, int& value) const
+Structure::get_enum(const Glib::ustring& name, GType enumtype, int& value) const
 {
   return gst_structure_get_enum(gobject_, name.c_str(), enumtype, &value);
 }
 
 
 bool
-Structure::get_fraction(const std::string& name, int& value_numerator, int& value_denominator) const
+Structure::get_fraction(const Glib::ustring& name, int& value_numerator, int& value_denominator) const
 {
   return gst_structure_get_fraction(gobject_, name.c_str(), &value_numerator, &value_denominator);
 }
@@ -190,7 +190,7 @@
 }
 
 Structure
-Structure::create_from_string(const std::string& the_string)
+Structure::create_from_string(const Glib::ustring& the_string)
 {
   return Structure(gst_structure_from_string(the_string.c_str(), NULL)); 
 }
Index: gst/src/pad.ccg
===================================================================
--- gst/src/pad.ccg	(revision 1264)
+++ gst/src/pad.ccg	(working copy)
@@ -5,7 +5,7 @@
 
 // The C API has gst_pad_new, we just use the very common ::create() here
 Glib::RefPtr<Pad>
-Pad::create(const std::string& name, PadDirection direction)
+Pad::create(const Glib::ustring& name, PadDirection direction)
 {
   GstPad * pad = gst_pad_new(name.c_str(), GstPadDirection(direction));
   return Glib::wrap(pad, false);
Index: gst/src/pipeline.ccg
===================================================================
--- gst/src/pipeline.ccg	(revision 1264)
+++ gst/src/pipeline.ccg	(working copy)
@@ -3,7 +3,7 @@
 namespace Gst
 {
 
-Glib::RefPtr<Pipeline> Pipeline::create(const std::string& name)
+Glib::RefPtr<Pipeline> Pipeline::create(const Glib::ustring& name)
 {
   GstElement* pipeline = gst_pipeline_new(name.c_str());
   return Glib::wrap((GstPipeline*) pipeline);
Index: gst/src/pipeline.hg
===================================================================
--- gst/src/pipeline.hg	(revision 1264)
+++ gst/src/pipeline.hg	(working copy)
@@ -19,7 +19,7 @@
 
 public:
 
-  static Glib::RefPtr<Pipeline> create(const std::string& name);
+  static Glib::RefPtr<Pipeline> create(const Glib::ustring& name);
 
   _WRAP_METHOD(Glib::RefPtr<Bus> get_bus(), gst_pipeline_get_bus)
   _WRAP_METHOD(Glib::RefPtr<const Bus> get_bus() const, gst_pipeline_get_bus, constversion)
Index: gst/src/bin.ccg
===================================================================
--- gst/src/bin.ccg	(revision 1264)
+++ gst/src/bin.ccg	(working copy)
@@ -3,7 +3,7 @@
 namespace Gst
 {
 
-Glib::RefPtr<Bin> Bin::create(const std::string& name)
+Glib::RefPtr<Bin> Bin::create(const Glib::ustring& name)
 {
   GstElement* bin = gst_bin_new(name.c_str());
   return Glib::wrap((GstBin*) bin);
@@ -29,7 +29,7 @@
     throw std::runtime_error("Bin '" + get_name() + "' does not want to remove Element '" + element->get_name() + "'");
 }
 
-Glib::RefPtr<Element> Bin::get_by_name(const std::string& element_name)
+Glib::RefPtr<Element> Bin::get_by_name(const Glib::ustring& element_name)
 {
   GstElement* element = gst_bin_get_by_name(gobj(), element_name.c_str());
 
@@ -39,7 +39,7 @@
     throw std::runtime_error("Bin '" + get_name() + "' contains no Element '" + element_name + "'");
 }
 
-Glib::RefPtr<Element> Bin::get_by_name_recurse_up(const std::string& element_name)
+Glib::RefPtr<Element> Bin::get_by_name_recurse_up(const Glib::ustring& element_name)
 {
   GstElement* element = gst_bin_get_by_name_recurse_up(gobj(), element_name.c_str());
 
Index: gst/src/event.ccg
===================================================================
--- gst/src/event.ccg	(revision 1264)
+++ gst/src/event.ccg	(working copy)
@@ -1,3 +1,231 @@
+namespace Gst
+{
+
+Event::Event()
+{
+}
+
+const Structure& Event::get_structure()
+{
+  structure_ = Structure(const_cast<GstStructure*>(gst_event_get_structure(gobj())), false);
+  return structure_;
+}
+
+EventBufferSize::EventBufferSize(GstEvent* castitem) :
+Event(castitem)
+{
+}
+
+Glib::RefPtr<Event> EventBufferSize::create(Format format, gint64 minsize, gint64 maxsize, bool async)
+{
+  GstEvent* event = gst_event_new_buffer_size(GstFormat(format), minsize, maxsize, async);
+  return Gst::Event::wrap(event, false);
+}
+
+void EventBufferSize::parse(Format& format, gint64& minsize, gint64& maxsize, bool& async)
+{
+  gboolean result;
+  gst_event_parse_buffer_size(gobj(), (GstFormat*)&format, &minsize, &maxsize, &result);
+  async = result;
+}
+
+EventCustom::EventCustom(GstEvent* castitem) :
+Event(castitem)
+{
+}
+
+Glib::RefPtr<Event> EventCustom::create(EventType type, Structure& structure)
+{
+  GstEvent* event = gst_event_new_custom(GstEventType(type), structure.gobj());
+  return Gst::Event::wrap(event, false);
+}
+
+EventEos::EventEos(GstEvent* castitem) :
+Event(castitem)
+{
+}
+
+Glib::RefPtr<Event> EventEos::create()
+{
+  GstEvent* event = gst_event_new_eos();
+  return Gst::Event::wrap(event, false);
+}
+
+EventFlushStart::EventFlushStart(GstEvent* castitem) :
+Event(castitem)
+{
+}
+
+Glib::RefPtr<Event> EventFlushStart::create()
+{
+  GstEvent* event = gst_event_new_flush_start();
+  return Gst::Event::wrap(event, false);
+}
+
+EventFlushStop::EventFlushStop(GstEvent* castitem) :
+Event(castitem)
+{
+}
+
+Glib::RefPtr<Event> EventFlushStop::create()
+{
+  GstEvent* event = gst_event_new_flush_stop();
+  return Gst::Event::wrap(event, false);
+}
+
+EventLatency::EventLatency(GstEvent* castitem) :
+Event(castitem)
+{
+}
+
+void EventLatency::parse(ClockTime& latency)
+{
+  gst_event_parse_latency(gobj(), &latency);
+}
+
+Glib::RefPtr<Event> EventLatency::create(ClockTime time)
+{
+  GstEvent* event = gst_event_new_latency(GstClockTime(time));
+  return Gst::Event::wrap(event, false);
+}
+
+EventNavigation::EventNavigation(GstEvent* castitem) :
+Event(castitem)
+{
+}
+
+Glib::RefPtr<Event> EventNavigation::create(Structure& structure)
+{
+  GstEvent* event = gst_event_new_navigation(structure.gobj());
+  return Gst::Event::wrap(event, false);
+}
+
+EventNewSegment::EventNewSegment(GstEvent* castitem) :
+Event(castitem)
+{
+}
+
+Glib::RefPtr<Event> EventNewSegment::create(bool update, double rate, Format format, gint64 start, gint64 stop, gint64 position, double applied_rate)
+{
+  GstEvent* event = gst_event_new_new_segment_full(update, rate, applied_rate, GstFormat(format), start, stop, position);
+  return Gst::Event::wrap(event, false);
+}
+
+void EventNewSegment::parse(bool& update, double& rate, Format& format, gint64& start, gint64& stop, gint64& position)
+{
+  gboolean result;
+  gst_event_parse_new_segment(gobj(), &result, &rate, (GstFormat*)&format, &start, &stop, &position);
+  update = result;
+}
+
+void EventNewSegment::parse(bool& update, double& rate, Format& format, gint64& start, gint64& stop, gint64& position, double& applied_rate)
+{
+  gboolean result;
+  gst_event_parse_new_segment_full(gobj(), &result, &rate, &applied_rate, (GstFormat*)&format, &start, &stop, &position);
+  update = result;
+}
+
+EventQos::EventQos(GstEvent* castitem) :
+Event(castitem)
+{
+}
+
+Glib::RefPtr<Event> EventQos::create(double proportion, ClockTimeDiff diff, ClockTime timestamp)
+{
+  GstEvent* event = gst_event_new_qos(proportion, GstClockTimeDiff(diff), GstClockTime(timestamp));
+  return Gst::Event::wrap(event, false);
+}
+
+void EventQos::parse(double& proportion, ClockTimeDiff& diff, ClockTime& timestamp)
+{
+  gst_event_parse_qos(gobj(), &proportion, &diff, &timestamp);
+}
+
+EventSeek::EventSeek(GstEvent* castitem) :
+Event(castitem)
+{
+}
+
+Glib::RefPtr<Event> EventSeek::create(double rate, Format format, SeekFlags flags, SeekType start_type, gint64 start, SeekType stop_type, gint64 stop)
+{
+  GstEvent* event = gst_event_new_seek(rate, GstFormat(format), GstSeekFlags(flags), GstSeekType(start_type), start, GstSeekType(stop_type), stop);
+  return Gst::Event::wrap(event, false);
+}
+
+void EventSeek::parse(double& rate, Format& format, SeekFlags& flags, SeekType& start_type, gint64& start, SeekType& stop_type, gint64& stop)
+{
+  gst_event_parse_seek(gobj(), &rate, (GstFormat*)&format, (GstSeekFlags*)&flags, (GstSeekType*)&start_type, &start, (GstSeekType*)&stop_type, &stop);
+}
+
+EventTag::EventTag(GstEvent* castitem) :
+Event(castitem)
+{
+}
+
+//TODO: Glib::RefPtr<Event> EventTag::create(TagList& taglist)
+//TODO: {
+//TODO: }
+
+//TODO: void EventTag::parse(TagList& taglist)
+//TODO: {
+//TODO: }
+
+Glib::RefPtr<Event> Event::wrap(GstEvent* event, bool take_copy) {
+
+  Glib::RefPtr<Event> result;
+
+  if(!event)
+    return result;
+
+  switch (GST_EVENT_TYPE(event)) {
+    case GST_EVENT_FLUSH_START:
+      result = Glib::RefPtr<Event>( new Gst::EventFlushStart(event) );
+      break;
+    case GST_EVENT_FLUSH_STOP:
+      result = Glib::RefPtr<Event>( new Gst::EventFlushStop(event) );
+      break;
+    case GST_EVENT_EOS:
+      result = Glib::RefPtr<Event>( new Gst::EventEos(event) );
+      break;
+    case GST_EVENT_NEWSEGMENT:
+      result = Glib::RefPtr<Event>( new Gst::EventNewSegment(event) );
+      break;
+    case GST_EVENT_TAG:
+      result = Glib::RefPtr<Event>( new Gst::EventTag(event) );
+      break;
+    case GST_EVENT_BUFFERSIZE:
+      result = Glib::RefPtr<Event>( new Gst::EventBufferSize(event) );
+      break;
+    case GST_EVENT_QOS:
+      result = Glib::RefPtr<Event>( new Gst::EventQos(event) );
+      break;
+    case GST_EVENT_SEEK:
+      result = Glib::RefPtr<Event>( new Gst::EventSeek(event) );
+      break;
+    case GST_EVENT_NAVIGATION:
+      result = Glib::RefPtr<Event>( new Gst::EventNavigation(event) );
+      break;
+    case GST_EVENT_LATENCY:
+      result = Glib::RefPtr<Event>( new Gst::EventLatency(event) );
+      break;
+    case GST_EVENT_CUSTOM_UPSTREAM:
+    case GST_EVENT_CUSTOM_DOWNSTREAM:
+    case GST_EVENT_CUSTOM_DOWNSTREAM_OOB:
+    case GST_EVENT_CUSTOM_BOTH:
+    case GST_EVENT_CUSTOM_BOTH_OOB:
+      result = Glib::RefPtr<Event>( new Gst::EventCustom(event) );
+      break;
+    default:
+      result = Gst::wrap(event, false);
+  }
+
+  if(result && take_copy)
+    result->reference();
+
+  return result;
+}
+
+} //namespace Gst
 #include <gst/gstevent.h>
 
 namespace Gst
Index: gst/src/event.hg
===================================================================
--- gst/src/event.hg	(revision 1264)
+++ gst/src/event.hg	(working copy)
@@ -6,10 +6,124 @@
 
 namespace Gst
 {
+
 class Event : public MiniObject
 {
 protected:
   _CLASS_GSTMINIOBJECT(Event, GstEvent, GST_EVENT, Gst::MiniObject, GstMiniObject)
+
+public:
+  Event();
+  const Structure& get_structure();
+
+public:
+  _MEMBER_GET(event_type, type, EventType, GstEventType)
+
+  /** Wrap a GstEvent* in a C++ instance, creating an instance of a derived
+   * Gst::Event. Gst::wrap() would just create a Gst::Message (rather than a
+   * derived one) because the derived Gst::Event classes do not correspond
+   * to GType types in the GStreamer API.
+   */
+  static Glib::RefPtr<Event> wrap(GstEvent* event, bool take_copy=false);
+
+
+protected:
+  Structure structure_;
 };
 
+class EventBufferSize : public Event
+{
+public:
+  explicit EventBufferSize(GstEvent* event);
+
+  static Glib::RefPtr<Event> create(Format format, gint64 minsize, gint64 maxsize, bool async);
+  void parse(Format& format, gint64& minsize, gint64& maxsize, bool& async);
+};
+
+class EventCustom : public Event
+{
+public:
+  explicit EventCustom(GstEvent* event);
+
+  Glib::RefPtr<Event> create(EventType type, Structure& structure);
+};
+
+class EventEos : public Event
+{
+public:
+  explicit EventEos(GstEvent* event);
+
+  Glib::RefPtr<Event> create();
+};
+
+class EventFlushStart : public Event
+{
+public:
+  explicit EventFlushStart(GstEvent* event);
+
+  Glib::RefPtr<Event> create();
+};
+
+class EventFlushStop : public Event
+{
+public:
+  explicit EventFlushStop(GstEvent* event);
+
+  Glib::RefPtr<Event> create();
+};
+
+class EventLatency : public Event
+{
+public:
+  explicit EventLatency(GstEvent* event);
+
+  Glib::RefPtr<Event> create(ClockTime time);
+  void parse(ClockTime& latency);
+};
+
+class EventNavigation : public Event
+{
+public:
+  explicit EventNavigation(GstEvent* event);
+
+  Glib::RefPtr<Event> create(Structure& structure);
+};
+
+class EventNewSegment : public Event
+{
+public:
+  explicit EventNewSegment(GstEvent* event);
+
+  Glib::RefPtr<Event> create(bool update, double rate, Format format, gint64 strat, gint64 stop, gint64 position, double applied_rate=1.0);
+  void parse(bool& update, double& rate, Format& format, gint64& start, gint64& stop, gint64& position);
+  void parse(bool& update, double& rate, Format& format, gint64& start, gint64& stop, gint64& position, double& applied_rate);
+};
+
+class EventQos : public Event
+{
+public:
+  explicit EventQos(GstEvent* event);
+
+  Glib::RefPtr<Event> create(double proportion, ClockTimeDiff diff, ClockTime timestamp);
+  void parse(double& proportion, ClockTimeDiff& diff, ClockTime& timestamp);
+};
+
+class EventSeek : public Event
+{
+public:
+  explicit EventSeek(GstEvent* event);
+
+  Glib::RefPtr<Event> create(double rate, Format format, SeekFlags flags, SeekType start_type, gint64 start, SeekType stop_type, gint64 stop);
+  void parse(double& rate, Format& format, SeekFlags& flags, SeekType& start_type, gint64& start, SeekType& stop_type, gint64& stop);
+};
+
+class EventTag : public Event
+{
+public:
+  explicit EventTag(GstEvent* event);
+
+  //TODO: Glib::RefPtr<Event> create(TagList& taglist);
+  //TODO: void parse(TagList& taglist);
+};
+
 }//namespace Gst
Index: gst/src/message.hg
===================================================================
--- gst/src/message.hg	(revision 1264)
+++ gst/src/message.hg	(working copy)
@@ -16,21 +16,18 @@
  _IGNORE(gst_message_ref, gst_message_unref)
 public:
   Message();
-
   const Structure& get_structure();
 
 public:
   _MEMBER_GET(message_type, type, MessageType, GstMessageType)
 
-  /** Wrap a GtkMessage* in a C++ instance, creating an instance of a derived Gst::Message.
+  /** Wrap a GstMessage* in a C++ instance, creating an instance of a derived Gst::Message.
    * Gst::wrap() would just create a Gst::Message (rather than a derived one) because 
    * the derived Gst::Message classes do not correspond to GType types in the GStreamer API.
    */
   static Glib::RefPtr<Message> wrap(GstMessage* message, bool take_copy=false);
 
 protected: 
-
-  GstMessage * cobj_;
   Structure structure_;
 };
 
@@ -139,6 +136,10 @@
   void parse(State& oldstate, State& newstate, State& pending);
 };
 
+//TODO:class MessageTag : public Message
+//TODO:{
+//TODO:}
+
 class MessageBuffering : public Message
 {
 public:
Index: gst/src/format.ccg
===================================================================
--- gst/src/format.ccg	(revision 1264)
+++ gst/src/format.ccg	(working copy)
@@ -3,7 +3,7 @@
 namespace Gst
 {
 
-std::string get_format_name(Format format)
+Glib::ustring get_format_name(Format format)
 {
   return gst_format_get_name(GstFormat(format));
 }
@@ -13,12 +13,12 @@
   return gst_format_to_quark(GstFormat(format));
 }
 
-Format register_format(const std::string& nick, const std::string& description)
+Format register_format(const Glib::ustring& nick, const Glib::ustring& description)
 {
   return Format(gst_format_register(nick.c_str(), description.c_str()));
 }
 
-Format get_format_by_nick(const std::string& nick)
+Format get_format_by_nick(const Glib::ustring& nick)
 {
   return Format(gst_format_get_by_nick(nick.c_str()));
 }
Index: gst/src/caps.hg
===================================================================
--- gst/src/caps.hg	(revision 1264)
+++ gst/src/caps.hg	(working copy)
@@ -46,10 +46,9 @@
   _WRAP_METHOD(xmlNodePtr save_thyself(const xmlNodePtr& parent), gst_caps_save_thyself)
   _WRAP_METHOD(static Glib::RefPtr<Caps> load_thyself(xmlNodePtr parent), gst_caps_load_thyself)
 
-  //TODO: Shouldn't this use Glib::ustring?
-  _WRAP_METHOD(std::string to_string() const, gst_caps_to_string)
+  _WRAP_METHOD(Glib::ustring to_string() const, gst_caps_to_string)
 
-  _WRAP_METHOD(static Glib::RefPtr<Caps> from_string(const std::string& string), gst_caps_from_string)
+  _WRAP_METHOD(static Glib::RefPtr<Caps> from_string(const Glib::ustring& string), gst_caps_from_string)
 
   _WRAP_METHOD(Glib::RefPtr<Caps> subtract(const Glib::RefPtr<Caps>& subtrahend_caps), gst_caps_subtract)
   _WRAP_METHOD(Glib::RefPtr<Caps> make_writable(), gst_caps_make_writable)
Index: gst/src/bus.ccg
===================================================================
--- gst/src/bus.ccg	(revision 1264)
+++ gst/src/bus.ccg	(working copy)
@@ -1,5 +1,5 @@
 
-static gboolean SignalProxy_Watch_glib_callback(GstBus* bus, GstMessage* message, void* data)
+static gboolean SignalProxy_Watch_gstmm_callback(GstBus* bus, GstMessage* message, void* data)
 {
   Gst::Bus::SlotWatch* the_slot = static_cast<Gst::Bus::SlotWatch*>(data);
 
@@ -19,7 +19,7 @@
   #endif //GLIBMM_EXCEPTIONS_ENABLED
 }
 
-static void SignalProxy_Watch_glib_callback_destroy(void* data)
+static void SignalProxy_Watch_gstmm_callback_destroy(void* data)
 {
   delete static_cast<Gst::Bus::SlotWatch*>(data);
 }
@@ -33,14 +33,20 @@
   return Glib::wrap(bus, false);
 }
 
-void Bus::add_watch(const SlotWatch& slot, int priority) {
+unsigned int Bus::add_watch(const SlotWatch& slot, int priority)
+{
   //Create a copy of the slot. A pointer to this will be passed through the callback's data parameter.
-  //It will be deleted when SignalProxy_Watch_glib_callback_destroy() is called.
+  //It will be deleted when SignalProxy_Watch_gstmm_callback_destroy() is called.
   SlotWatch* slot_copy = new SlotWatch(slot);
-  gst_bus_add_watch_full(gobj(), priority,
-        &SignalProxy_Watch_glib_callback, slot_copy,
-        &SignalProxy_Watch_glib_callback_destroy);
+  return gst_bus_add_watch_full(gobj(), priority,
+    &SignalProxy_Watch_gstmm_callback, slot_copy,
+    &SignalProxy_Watch_gstmm_callback_destroy);
 
 }
 
+bool Bus::remove_watch(unsigned int id)
+{
+  return g_source_remove(id);
+}
+
 } //namespace Gst
Index: gst/src/bus.hg
===================================================================
--- gst/src/bus.hg	(revision 1264)
+++ gst/src/bus.hg	(working copy)
@@ -35,7 +35,8 @@
    * bool on_bus_watch(const Glib::RefPtr<Bus>& bus, const Glib::RefPtr<Message>& message);
    */
   typedef sigc::slot<bool, const Glib::RefPtr<Bus>&, const Glib::RefPtr<Message>& > SlotWatch;
-  void add_watch(const SlotWatch& slot, int priority = G_PRIORITY_DEFAULT);
+  unsigned int add_watch(const SlotWatch& slot, int priority = G_PRIORITY_DEFAULT);
+  bool remove_watch(unsigned int watch_id);
   _IGNORE(gst_bus_add_watch, gst_bus_add_watch_full)
 
   _WRAP_METHOD(void disable_sync_message_emission(), gst_bus_disable_sync_message_emission)
Index: gst/src/padtemplate.hg
===================================================================
--- gst/src/padtemplate.hg	(revision 1264)
+++ gst/src/padtemplate.hg	(working copy)
@@ -19,7 +19,7 @@
   _CTOR_DEFAULT
 
 public:
-  Glib::RefPtr<PadTemplate> create(const std::string& name_template, PadDirection direction, PadPresence presence, const Glib::RefPtr<Caps>& caps);
+  Glib::RefPtr<PadTemplate> create(const Glib::ustring& name_template, PadDirection direction, PadPresence presence, const Glib::RefPtr<Caps>& caps);
   _WRAP_METHOD(Glib::RefPtr<Caps> get_caps(), gst_pad_template_get_caps)
   _WRAP_METHOD(Glib::RefPtr<const Caps> get_caps() const, gst_pad_template_get_caps, constversion)
 
Index: gst/src/structure.hg
===================================================================
--- gst/src/structure.hg	(revision 1264)
+++ gst/src/structure.hg	(working copy)
@@ -25,8 +25,6 @@
   int denominator;
 };
 
-//TODO: Use parameter names in method declarations in all these classes.
-
 class Structure;
 
 //TODO: What is this?
@@ -34,9 +32,9 @@
 {
 public:
 
-  StructureValueProxy(Structure&, const std::string&);
+  StructureValueProxy(Structure& structure, const Glib::ustring& name);
 
-  void operator=(const std::string& src);
+  void operator=(const Glib::ustring& src);
   void operator=(bool src);
   void operator=(double src);
   void operator=(int src);
@@ -45,7 +43,7 @@
 private:
 
   Structure& m_Structure;
-  std::string m_Name;
+  Glib::ustring m_Name;
 };
 
 class Structure
@@ -64,11 +62,11 @@
 
 public:
 
-  Structure(const std::string& name);
+  Structure(const Glib::ustring& name);
   Structure(GQuark quark);
-  Structure(const GstStructure*); // for Message::get_structure()
+  Structure(const GstStructure* castitem); // for Message::get_structure()
 
-  StructureValueProxy operator[](const std::string&);
+  StructureValueProxy operator[](const Glib::ustring& fieldname);
 
   void clear(); // remove_all_fields in C API
   int size() const;
@@ -76,54 +74,52 @@
 
   //TODO: ValueBase should be used as an output paramter in getters because it is a base type.
   //See Gtk::TreeModel, for instance. murrayc.
-  //Glib::ValueBase id_get_value(GQuark);
+  //Glib::ValueBase id_get_value(GQuark field);
 
-  _WRAP_METHOD(void id_set_value(GQuark, const Glib::ValueBase&), gst_structure_id_set_value)
+  _WRAP_METHOD(void id_set_value(GQuark field, const Glib::ValueBase& value), gst_structure_id_set_value)
 
   //TODO: ValueBase should be used as an output paramter in getters because it is a base type.
-  //Glib::ValueBase get_value(const std::string& fieldname) const;
+  //Glib::ValueBase get_value(const Glib::ustring& fieldname) const;
 
-  void set_value(const std::string& fieldname, const Glib::ValueBase& value);
+  void set_value(const Glib::ustring& fieldname, const Glib::ValueBase& value);
 
-  _WRAP_METHOD(void remove_field(const std::string& fieldname), gst_structure_remove_field)
-  _WRAP_METHOD(GType get_field_type(const std::string& fieldname) const, gst_structure_get_field_type)
+  _WRAP_METHOD(void remove_field(const Glib::ustring& fieldname), gst_structure_remove_field)
+  _WRAP_METHOD(GType get_field_type(const Glib::ustring& fieldname) const, gst_structure_get_field_type)
   bool foreach(const ForeachSlot& slot);
 
-  _WRAP_METHOD(bool has_field(const std::string& fieldname) const, gst_structure_has_field)
-  _WRAP_METHOD(bool has_field_typed(const std::string& fieldname, GType type) const, gst_structure_has_field_typed)
+  _WRAP_METHOD(bool has_field(const Glib::ustring& fieldname) const, gst_structure_has_field)
+  _WRAP_METHOD(bool has_field_typed(const Glib::ustring& fieldname, GType type) const, gst_structure_has_field_typed)
 
-  //TODO: Should these use Glib::ustring?
+  bool get_boolean(const Glib::ustring& fieldname, bool& value) const;
 
-  bool get_boolean(const std::string&, bool& value) const;
+  bool get_int(const Glib::ustring& fieldname, int& value) const;
 
-  bool get_int(const std::string&, int& value) const;
+  bool get_uint(const Glib::ustring& fieldname, guint& value) const;
 
-  bool get_uint(const std::string&, guint& value) const;
+  bool get_fourcc(const Glib::ustring& fieldname, guint32& value) const;
 
-  bool get_fourcc(const std::string&, guint32& value) const;
+  bool get_double(const Glib::ustring& fieldname, double& value) const;
 
-  bool get_double(const std::string&, double& value) const;
+  Glib::ustring get_string(const Glib::ustring& fieldname) const;
 
-  std::string get_string(const std::string& value) const;
+  bool get_date(const Glib::ustring& fieldname, Glib::Date& value) const;
 
-  bool get_date(const std::string&, Glib::Date& value) const;
+  bool get_clock_time(const Glib::ustring& fieldname, ClockTime& value) const;
 
-  bool get_clock_time(const std::string&, ClockTime& value) const;
+  bool get_enum(const Glib::ustring& fieldname, GType enumtype, int& value) const;
 
-  bool get_enum(const std::string&, GType enumtype, int& value) const;
+  bool get_fraction(const Glib::ustring& fieldname, int& value_numerator, int& value_denominator) const;
 
-  bool get_fraction(const std::string&, int& value_numerator, int& value_denominator) const;
-
   bool map_in_place(const MapSlot& slot);
 
-  static Structure create_from_string(const std::string& the_string);
+  static Structure create_from_string(const Glib::ustring& the_string);
 
   _WRAP_METHOD(GQuark get_name_id() const, gst_structure_get_name_id)
-  _WRAP_METHOD(std::string get_name() const, gst_structure_get_name)
-  _WRAP_METHOD(bool has_name(const std::string& name) const, gst_structure_has_name)
-  _WRAP_METHOD(void set_name(const std::string& name), gst_structure_set_name)
-  _WRAP_METHOD(std::string to_string() const, gst_structure_to_string)
-  _WRAP_METHOD(std::string nth_field_name(guint index) const, gst_structure_nth_field_name)
+  _WRAP_METHOD(Glib::ustring get_name() const, gst_structure_get_name)
+  _WRAP_METHOD(bool has_name(const Glib::ustring& name) const, gst_structure_has_name)
+  _WRAP_METHOD(void set_name(const Glib::ustring& name), gst_structure_set_name)
+  _WRAP_METHOD(Glib::ustring to_string() const, gst_structure_to_string)
+  _WRAP_METHOD(Glib::ustring nth_field_name(guint index) const, gst_structure_nth_field_name)
   _IGNORE(
       gst_structure_get_date,
       gst_structure_id_set,
Index: gst/src/pad.hg
===================================================================
--- gst/src/pad.hg	(revision 1264)
+++ gst/src/pad.hg	(working copy)
@@ -24,7 +24,7 @@
 
 
   // The C API has gst_pad_new, we just use the very common ::create() here
-  static Glib::RefPtr<Pad> create(const std::string& name, PadDirection direction);
+  static Glib::RefPtr<Pad> create(const Glib::ustring& name, PadDirection direction);
 
   _WRAP_METHOD(PadDirection get_direction() const, gst_pad_get_direction)
   _WRAP_METHOD(Glib::RefPtr<Element> get_parent_element(), gst_pad_get_parent_element)
Index: gst/src/bin.hg
===================================================================
--- gst/src/bin.hg	(revision 1264)
+++ gst/src/bin.hg	(working copy)
@@ -20,17 +20,15 @@
 public:
 
   //TODO: Why doesn't this use _WRAP_CREATE()?
-  //TODO: If this is always ASCII or UTF-8 (not raw data) then use Glib::ustring:
-  static Glib::RefPtr<Bin> create(const std::string& name);
+  static Glib::RefPtr<Bin> create(const Glib::ustring& name);
 
   //TODO: Why do these throw exceptions?
   //If there is a good reason for it, document that in comments and doxygen documentation. murrayc.
   Glib::RefPtr<Bin> add(const Glib::RefPtr<Element>& element);
   Glib::RefPtr<Bin> remove(const Glib::RefPtr<Element>& element);
 
-  //TODO: Why don't these use Glib::ustring? murrayc
-  Glib::RefPtr<Element> get_by_name(const std::string& element_name);
-  Glib::RefPtr<Element> get_by_name_recurse_up(const std::string& element_name);
+  Glib::RefPtr<Element> get_by_name(const Glib::ustring& element_name);
+  Glib::RefPtr<Element> get_by_name_recurse_up(const Glib::ustring& element_name);
   _WRAP_METHOD(Glib::RefPtr<Element> get_by_interface(GType interface), gst_bin_get_by_interface)
 
   Glib::RefPtr<Pad> find_unconnected_pad(PadDirection direction);
Index: tools/m4/convert_gst.m4
===================================================================
--- tools/m4/convert_gst.m4	(revision 1264)
+++ tools/m4/convert_gst.m4	(working copy)
@@ -56,6 +56,7 @@
 _CONVERSION(`gint64&',`gint64*',`&($3)')
 _CONVERSION(`const double&',`gdouble',`$3')
 _CONVERSION(`GstMessageType',`MessageType',`MessageType($3)')
+_CONVERSION(`GstEventType',`EventType',`EventType($3)')
 
 _CONV_ENUM(Gst,State)
 _CONV_ENUM(Gst,StateChangeReturn)
Index: examples/ogg_player_gtkmm/PlayerWindow.cc
===================================================================
--- examples/ogg_player_gtkmm/PlayerWindow.cc	(revision 1264)
+++ examples/ogg_player_gtkmm/PlayerWindow.cc	(working copy)
@@ -70,11 +70,12 @@
     openButton.signal_clicked().connect(sigc::mem_fun(*this,
                                           &PlayerWindow::on_open));
 
-	// get the bus from the pipeline
-	Glib::RefPtr<Gst::Bus> bus = mainPipeline->get_bus();
+    // get the bus from the pipeline
+    Glib::RefPtr<Gst::Bus> bus = mainPipeline->get_bus();
 
-	// Add a bus watch to receive messages from pipeline's bus
-	bus->add_watch( sigc::mem_fun( *this, &PlayerWindow::on_bus_message) );
+    // Add a bus watch to receive messages from pipeline's bus
+    watch_id = bus->add_watch(
+        sigc::mem_fun( *this, &PlayerWindow::on_bus_message) );
 
     progressScale.set_sensitive(false);
     playButton.set_sensitive(false);
@@ -283,7 +284,8 @@
    return true;
 }
 
-void PlayerWindow::display_label_progress(gint64 pos, gint64 len) {
+void PlayerWindow::display_label_progress(gint64 pos, gint64 len)
+{
     std::ostringstream locationStream (std::ostringstream::out);
     std::ostringstream durationStream (std::ostringstream::out);
 
@@ -301,3 +303,8 @@
 
     progressLabel.set_text(locationStream.str() + " / " + durationStream.str());
 }
+
+PlayerWindow::~PlayerWindow()
+{
+  mainPipeline->get_bus()->remove_watch(watch_id);
+}
Index: examples/ogg_player_gtkmm/PlayerWindow.h
===================================================================
--- examples/ogg_player_gtkmm/PlayerWindow.h	(revision 1264)
+++ examples/ogg_player_gtkmm/PlayerWindow.h	(working copy)
@@ -39,6 +39,7 @@
 public:
     PlayerWindow(Glib::RefPtr<Gst::Element> sourceElement,
                  Glib::RefPtr<Gst::Pipeline> mainPipeline);
+    ~PlayerWindow();
 protected:
     Gtk::VBox vBox;
     Gtk::HButtonBox buttonBox;
@@ -66,8 +67,9 @@
 private:
     Glib::RefPtr<Gst::Element> sourceElement;
     Glib::RefPtr<Gst::Pipeline> mainPipeline;
+    sigc::connection progressConnection;
+    unsigned int watch_id;
     gint64 duration;
-    sigc::connection progressConnection;
 };
 
 #endif /* _PLAYERWINDOW_H */
Comment 1 José Alburquerque 2008-01-01 00:36:21 UTC
Created attachment 101927 [details] [review]
Gst::Event wrapping patch

Sorry for including patch in bug report (it's my first bug filing)
Comment 2 Murray Cumming 2008-01-01 08:57:22 UTC
Committed. Thanks.

You should probably ask for svn write access:
http://live.gnome.org/NewAccounts
(And tell me about any problems/confusion while doing that.)