gnomemm r1651 - in gstreamermm/trunk: . examples/media_player_gtkmm examples/ogg_player examples/ogg_player_gtkmm gstreamer/src



Author: jaalburqu
Date: Tue Jul 29 02:48:27 2008
New Revision: 1651
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1651&view=rev

Log:
2008-07-28  Josà Alburquerque  <jaalburqu svn gnome org>

	* gstreamer/src/message.ccg:
	* gstreamer/src/message.hg:
	- Reordered class declarations according to the C API docs.

	- Added class and method docs.

	- Rewrote parse() method of classes so that there is a void one named
	parse() which parses all the relevant message members, another also
	named parse() which returns the most prominent member of the message
	and others parse methods named parse_*() for the less prominent ones.
	This organization and naming of parse() methods can change to be more
	intuitive if there is a better way, in particular the parse() methods
	which return the prominent members may be better named parse_*() also.
	
	- Added Gst::MessageBuffering::{set/get}_stats*() methods based on new
	in GStreamer 0.10.20.

	* gstreamer/src/query.hg: Wrapped enum BufferingMode.

	* examples/media_player_gtkmm/player_window.cc:
	* examples/ogg_player/main.cc:
	* examples/ogg_player_gtkmm/player_window.cc: Fixed examples to use
	new Gst::MessageError::parse() methods correctly.

Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/examples/media_player_gtkmm/player_window.cc
   gstreamermm/trunk/examples/ogg_player/main.cc
   gstreamermm/trunk/examples/ogg_player_gtkmm/player_window.cc
   gstreamermm/trunk/gstreamer/src/message.ccg
   gstreamermm/trunk/gstreamer/src/message.hg
   gstreamermm/trunk/gstreamer/src/query.hg

Modified: gstreamermm/trunk/examples/media_player_gtkmm/player_window.cc
==============================================================================
--- gstreamermm/trunk/examples/media_player_gtkmm/player_window.cc	(original)
+++ gstreamermm/trunk/examples/media_player_gtkmm/player_window.cc	Tue Jul 29 02:48:27 2008
@@ -152,8 +152,7 @@
       if(msgError)
       {
         Glib::Error err;
-        std::string debug; //TODO: Maybe this should be an optional parameter.
-        msgError->parse(err, debug);
+        err = msgError->parse();
         std::cerr << "Error: " << err.what() << std::endl;
       }
       else

Modified: gstreamermm/trunk/examples/ogg_player/main.cc
==============================================================================
--- gstreamermm/trunk/examples/ogg_player/main.cc	(original)
+++ gstreamermm/trunk/examples/ogg_player/main.cc	Tue Jul 29 02:48:27 2008
@@ -77,8 +77,7 @@
       if(msgError)
       {
         Glib::Error err;
-        std::string debug; //TODO: Maybe this should be an optional parameter.
-        msgError->parse(err, debug);
+        err = msgError->parse();
         std::cerr << "Error: " << err.what() << std::endl;
       }
       else

Modified: gstreamermm/trunk/examples/ogg_player_gtkmm/player_window.cc
==============================================================================
--- gstreamermm/trunk/examples/ogg_player_gtkmm/player_window.cc	(original)
+++ gstreamermm/trunk/examples/ogg_player_gtkmm/player_window.cc	Tue Jul 29 02:48:27 2008
@@ -115,7 +115,7 @@
       if(error_message)
       {
         Glib::Error err;
-        error_message->parse(err); //TODO: Make err the return type?
+        err = error_message->parse();
         std::cerr << "Error: " << err.what() << std::endl;
       }
       else

Modified: gstreamermm/trunk/gstreamer/src/message.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/message.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/message.ccg	Tue Jul 29 02:48:27 2008
@@ -50,182 +50,336 @@
   return Structure(gst_structure, true /* take_copy */);
 }
 
-MessageApplication::MessageApplication(GstMessage* castitem)
+MessageEos::MessageEos(GstMessage* castitem)
 : Message(castitem)
 {
 }
 
-// MessageApplication
-Glib::RefPtr<Message> MessageApplication::create(const Glib::RefPtr<Object>& src, Structure& structure)
+Glib::RefPtr<Message> MessageEos::create(const Glib::RefPtr<Object>& src)
 {
-  GstMessage* message = gst_message_new_application(src->gobj(), structure.gobj());
+  GstMessage* message = gst_message_new_eos(src->gobj());
   return Gst::Message::wrap(message, false);
 }
 
-
-MessageClockProvide::MessageClockProvide(GstMessage* castitem)
+MessageError::MessageError(GstMessage* castitem)
 : Message(castitem)
 {
 }
 
-Glib::RefPtr<Message> MessageClockProvide::create(const Glib::RefPtr<Object>& src, const Glib::RefPtr<Clock>& clock, bool ready)
+Glib::RefPtr<Message> MessageError::create(const Glib::RefPtr<Object>& src, Glib::Error& error, const std::string& debug)
 {
-  GstMessage* message = gst_message_new_clock_provide(src->gobj(), clock->gobj(), ready);
+  GstMessage* message = gst_message_new_error(src->gobj(), error.gobj(),(gchar*)(debug.c_str()));
   return Gst::Message::wrap(message, false);
 }
 
+void MessageError::parse(Glib::Error& error, std::string& debug)
+{
+  GError* c_error = 0;
+  gchar* c_debug = 0;
+  gst_message_parse_error(gobj(), &c_error, &c_debug);
 
-void MessageClockProvide::parse(Glib::RefPtr<Clock>& clock, bool& ready)
+  debug = c_debug;
+  if(c_debug)
+    g_free(c_debug);
+
+  error = Glib::Error(c_error);
+}
+
+Glib::Error MessageError::parse()
 {
-  GstClock* cclock = 0;
-  gboolean ready_ = false;
-  gst_message_parse_clock_provide(gobj(), &cclock, &ready_);
-  clock = Glib::wrap(cclock);
-  ready = ready_;
+  GError* c_error = 0;
+  gst_message_parse_error(gobj(), &c_error, NULL);
+
+  return Glib::Error(c_error);
 }
 
+std::string MessageError::parse_debug()
+{
+  gchar* c_debug = 0;
+  gst_message_parse_error(gobj(), NULL, &c_debug);
 
-MessageClockLost::MessageClockLost(GstMessage* castitem)
+  std::string result = c_debug;
+  if (c_debug)
+    g_free(c_debug);
+
+  return result;
+}
+
+MessageWarning::MessageWarning(GstMessage* castitem)
 : Message(castitem)
 {
 }
 
-Glib::RefPtr<Message> MessageClockLost::create(const Glib::RefPtr<Object>& src, const Glib::RefPtr<Clock>& clock)
+Glib::RefPtr<Message> MessageWarning::create(const Glib::RefPtr<Object>& src, Glib::Error& error, const std::string& debug)
 {
-  GstMessage* message = gst_message_new_clock_lost(src->gobj(), clock->gobj());
+  GstMessage* message = gst_message_new_warning(src->gobj(), error.gobj(),(gchar*)(debug.c_str()));
   return Gst::Message::wrap(message, false);
 }
 
-void MessageClockLost::parse(Glib::RefPtr<Clock>& clock)
+void MessageWarning::parse(Glib::Error& error, std::string& debug)
 {
-  GstClock* cclock = 0;
-  gst_message_parse_clock_lost(gobj(), &cclock);
-  clock = Glib::wrap(cclock, false);
+  GError* c_error = 0;
+  gchar* c_debug = 0;
+  gst_message_parse_warning(gobj(), &c_error, &c_debug);
+
+  debug = c_debug;
+  if(c_debug)
+    g_free(c_debug);
+
+  error = Glib::Error(c_error);
 }
 
+Glib::Error MessageWarning::parse()
+{
+  GError* c_error = 0;
+  gst_message_parse_warning(gobj(), &c_error, NULL);
 
-MessageCustom::MessageCustom(GstMessage* castitem)
+  return Glib::Error(c_error);
+}
+
+std::string MessageWarning::parse_debug()
+{
+  gchar* c_debug = 0;
+  gst_message_parse_warning(gobj(), NULL, &c_debug);
+
+  std::string result = c_debug;
+  if (c_debug)
+    g_free(c_debug);
+
+  return result;
+}
+
+MessageInfo::MessageInfo(GstMessage* castitem)
 : Message(castitem)
 {
 }
 
-Glib::RefPtr<Message> MessageCustom::create(MessageType type, const Glib::RefPtr<Object>& src, Structure& structure)
+Glib::RefPtr<Message> MessageInfo::create(const Glib::RefPtr<Object>& src, Glib::Error& error, const std::string& debug)
 {
-  GstMessage* message = gst_message_new_custom(GstMessageType(type), src->gobj(), structure.gobj());
+  GstMessage* message = gst_message_new_info(src->gobj(), error.gobj(),(gchar*)(debug.c_str()));
   return Gst::Message::wrap(message, false);
 }
 
 
-MessageElement::MessageElement(GstMessage* castitem)
+void MessageInfo::parse(Glib::Error& error, std::string& debug)
+{
+  GError* c_error = 0;
+  gchar* c_debug = 0;
+  gst_message_parse_info(gobj(), &c_error, &c_debug);
+
+  debug = c_debug;
+  if(c_debug)
+    g_free(c_debug);
+
+  error = Glib::Error(c_error);
+}
+
+Glib::Error MessageInfo::parse()
+{
+  GError* c_error = 0;
+  gst_message_parse_info(gobj(), &c_error, NULL);
+
+  return Glib::Error(c_error);
+}
+
+std::string MessageInfo::parse_debug()
+{
+  gchar* c_debug = 0;
+  gst_message_parse_info(gobj(), NULL, &c_debug);
+
+  std::string result = c_debug;
+  if (c_debug)
+    g_free(c_debug);
+
+  return result;
+}
+
+MessageTag::MessageTag(GstMessage* castitem)
 : Message(castitem)
 {
 }
 
-Glib::RefPtr<Message> MessageElement::create(const Glib::RefPtr<Object>& src, Structure& structure)
+Glib::RefPtr<Message> MessageTag::create(const Glib::RefPtr<Object>& src, const TagList& taglist)
 {
-  GstMessage* message = gst_message_new_element(src->gobj(), structure.gobj());
+  //We create a copy because gst_message_new_tag() takes ownership:
+  GstTagList* c_taglist = gst_tag_list_copy(taglist.gobj());
+  GstMessage* message = gst_message_new_tag(src->gobj(), c_taglist);
   return Gst::Message::wrap(message, false);
 }
 
+TagList MessageTag::parse()
+{
+  GstTagList* gst_tag_list = gst_tag_list_new();
+  gst_message_parse_tag(gobj(), &gst_tag_list);
+  return TagList(gst_tag_list);
+}
 
-MessageEos::MessageEos(GstMessage* castitem)
+MessageBuffering::MessageBuffering(GstMessage* castitem)
 : Message(castitem)
 {
 }
 
-Glib::RefPtr<Message> MessageEos::create(const Glib::RefPtr<Object>& src)
+Glib::RefPtr<Message> MessageBuffering::create(const Glib::RefPtr<Object>& src, int percent)
 {
-  GstMessage* message = gst_message_new_eos(src->gobj());
+  GstMessage* message = gst_message_new_buffering(src->gobj(), percent);
   return Gst::Message::wrap(message, false);
 }
 
+int MessageBuffering::parse()
+{
+  int percent;
+  gst_message_parse_buffering(gobj(), &percent);
+  return percent;
+}
 
-MessageError::MessageError(GstMessage* castitem)
+void MessageBuffering::set_stats(BufferingMode mode, int avg_in, int avg_out,
+gint64 buffering_left)
+{
+  gst_message_set_buffering_stats(gobj(), (GstBufferingMode) mode, avg_in,
+    avg_out, buffering_left);
+}
+
+void MessageBuffering::get_stats(BufferingMode& mode, int& avg_in, int& avg_out,
+gint64& buffering_left)
+{
+  gst_message_parse_buffering_stats(gobj(), (GstBufferingMode*)(&mode),
+    &avg_in, &avg_out, &buffering_left);
+}
+
+BufferingMode MessageBuffering::get_stats_buffering_mode()
+{
+  GstBufferingMode mode;
+
+  gst_message_parse_buffering_stats(gobj(), (GstBufferingMode*)(&mode),
+    NULL, NULL, NULL);
+  return (BufferingMode)(mode);
+}
+
+int MessageBuffering::get_stats_avg_in()
+{
+  int avg_in;
+
+  gst_message_parse_buffering_stats(gobj(), NULL, &avg_in, NULL, NULL);
+  return avg_in;
+}
+
+int MessageBuffering::get_stats_avg_out()
+{
+  int avg_out;
+
+  gst_message_parse_buffering_stats(gobj(), NULL, NULL, &avg_out, NULL);
+  return avg_out;
+}
+
+gint64 MessageBuffering::get_stats_buffering_left()
+{
+  gint64 buffering_left;
+
+  gst_message_parse_buffering_stats(gobj(), NULL, NULL, NULL, &buffering_left);
+  return buffering_left;
+}
+
+MessageStateChanged::MessageStateChanged(GstMessage* castitem)
 : Message(castitem)
 {
 }
 
-Glib::RefPtr<Message> MessageError::create(const Glib::RefPtr<Object>& src, Glib::Error& error, const std::string& debug)
+Glib::RefPtr<Message> MessageStateChanged::create(const Glib::RefPtr<Object>& src, State oldstate, State newstate, State pending)
 {
-  GstMessage* message = gst_message_new_error(src->gobj(), error.gobj(),(gchar*)(debug.c_str()));
+  GstMessage* message = gst_message_new_state_changed(src->gobj(), GstState(oldstate), GstState(newstate), GstState(pending));
   return Gst::Message::wrap(message, false);
 }
 
-void MessageError::parse(Glib::Error& error, std::string& debug)
+void MessageStateChanged::parse(State& oldstate, State& newstate,
+State& pending)
 {
-  GError* c_error = 0;
-  gchar* c_debug = 0;
-  gst_message_parse_error(gobj(), &c_error, &c_debug);
+  gst_message_parse_state_changed(gobj(), (GstState*)(&oldstate),
+    (GstState*)(&newstate), (GstState*)(&pending));
+}
 
-  if(c_debug)
-  {
-    debug = c_debug;
-    g_free(c_debug);
-  }
+State MessageStateChanged::parse()
+{
+  GstState* new_state;
+  gst_message_parse_state_changed(gobj(), NULL, new_state, NULL);
+  return (State)(*new_state);
+}
 
-  if(c_error)
-  {
-    error = Glib::Error(c_error); 
-    g_error_free(c_error);
-  }
+State MessageStateChanged::parse_old()
+{
+  GstState* old_state;
+  gst_message_parse_state_changed(gobj(), old_state, NULL, NULL);
+  return (State)(*old_state);
 }
 
-void MessageError::parse(Glib::Error& error)
+State MessageStateChanged::parse_pending()
 {
-  GError* c_error = 0;
-  gst_message_parse_error(gobj(), &c_error, NULL);
+  GstState* pending_state;
+  gst_message_parse_state_changed(gobj(), NULL, NULL, pending_state);
+  return (State)(*pending_state);
+}
 
-  if(c_error)
-  {
-    error = Glib::Error(c_error); 
-    g_error_free(c_error);
-  }
+MessageStateDirty::MessageStateDirty(GstMessage* castitem)
+: Message(castitem)
+{
 }
 
+Glib::RefPtr<Message> MessageStateDirty::create(const Glib::RefPtr<Object>& src)
+{
+  GstMessage* message = gst_message_new_state_dirty(src->gobj());
+  return Gst::Message::wrap(message, false);
+}
 
-MessageInfo::MessageInfo(GstMessage* castitem)
+MessageClockProvide::MessageClockProvide(GstMessage* castitem)
 : Message(castitem)
 {
 }
 
-Glib::RefPtr<Message> MessageInfo::create(const Glib::RefPtr<Object>& src, Glib::Error& error, const std::string& debug)
+Glib::RefPtr<Message> MessageClockProvide::create(const Glib::RefPtr<Object>& src, const Glib::RefPtr<Clock>& clock, bool ready)
 {
-  GstMessage* message = gst_message_new_info(src->gobj(), error.gobj(),(gchar*)(debug.c_str()));
+  GstMessage* message = gst_message_new_clock_provide(src->gobj(), clock->gobj(), ready);
   return Gst::Message::wrap(message, false);
 }
 
-
-void MessageInfo::parse(Glib::Error& error, std::string& debug)
+void MessageClockProvide::parse(Glib::RefPtr<Clock>& clock, bool& ready)
 {
-  GError* c_error = 0;
-  gchar* c_debug = 0;
-  gst_message_parse_info(gobj(), &c_error, &c_debug);
+  GstClock* cclock = 0;
+  gboolean ready_ = false;
+  gst_message_parse_clock_provide(gobj(), &cclock, &ready_);
+  clock = Glib::wrap(cclock);
+  ready = ready_;
+}
 
-  if(c_debug)
-  {
-    debug = c_debug;
-    g_free(c_debug);
-  }
+Glib::RefPtr<Clock> MessageClockProvide::parse()
+{
+  GstClock* cclock = 0;
+  gst_message_parse_clock_provide(gobj(), &cclock, NULL);
+  return Glib::wrap(cclock);
+}
 
-  if(c_error)
-  {
-    error = Glib::Error(c_error); 
-    g_error_free(c_error);
-  }
+bool MessageClockProvide::parse_ready()
+{
+  gboolean ready = false;
+  gst_message_parse_clock_provide(gobj(), NULL, &ready);
+  return ready;
 }
 
-void MessageInfo::parse(Glib::Error& error)
+MessageClockLost::MessageClockLost(GstMessage* castitem)
+: Message(castitem)
 {
-  GError* c_error = 0;
-  gst_message_parse_info(gobj(), &c_error, NULL);
+}
 
-  if(c_error)
-  {
-    error = Glib::Error(c_error); 
-    g_error_free(c_error);
-  }
+Glib::RefPtr<Message> MessageClockLost::create(const Glib::RefPtr<Object>& src, const Glib::RefPtr<Clock>& clock)
+{
+  GstMessage* message = gst_message_new_clock_lost(src->gobj(), clock->gobj());
+  return Gst::Message::wrap(message, false);
 }
 
+Glib::RefPtr<Clock> MessageClockLost::parse()
+{
+  GstClock* cclock = 0;
+  gst_message_parse_clock_lost(gobj(), &cclock);
+  return Glib::wrap(cclock, false);
+}
 
 MessageNewClock::MessageNewClock(GstMessage* castitem)
 : Message(castitem)
@@ -238,87 +392,128 @@
   return Gst::Message::wrap(message, false);
 }
 
+Glib::RefPtr<Clock> MessageNewClock::parse()
+{
+  GstClock* cclock = 0;
+  gst_message_parse_new_clock(gobj(), &cclock);
+  return Glib::wrap(cclock, false);
+}
 
-MessageSegmentDone::MessageSegmentDone(GstMessage* castitem)
+MessageApplication::MessageApplication(GstMessage* castitem)
 : Message(castitem)
 {
 }
 
-Glib::RefPtr<Message> MessageSegmentDone::create(const Glib::RefPtr<Object>& src, Format format, gint64 position)
+Glib::RefPtr<Message> MessageApplication::create(const Glib::RefPtr<Object>& src, Structure& structure)
 {
-  GstMessage* message = gst_message_new_segment_done(src->gobj(), GstFormat(format), position);
+  GstStructure* copy_struct = gst_structure_copy(structure.gobj());
+  GstMessage* message = gst_message_new_application(src->gobj(), copy_struct);
   return Gst::Message::wrap(message, false);
 }
 
+Glib::RefPtr<Message> MessageApplication::create(const Glib::RefPtr<Object>& src)
+{
+  GstMessage* message = gst_message_new_application(src->gobj(), NULL);
+  return Gst::Message::wrap(message, false);
+}
 
-MessageSegmentStart::MessageSegmentStart(GstMessage* castitem)
+MessageElement::MessageElement(GstMessage* castitem)
 : Message(castitem)
 {
 }
 
-Glib::RefPtr<Message> MessageSegmentStart::create(const Glib::RefPtr<Object>& src, Format format, gint64 position)
+Glib::RefPtr<Message> MessageElement::create(const Glib::RefPtr<Object>& src, Structure& structure)
 {
-  GstMessage* message = gst_message_new_segment_start(src->gobj(), GstFormat(format), position);
+  GstStructure* copy_struct = gst_structure_copy(structure.gobj());
+  GstMessage* message = gst_message_new_element(src->gobj(), copy_struct);
   return Gst::Message::wrap(message, false);
 }
 
+Glib::RefPtr<Message> MessageElement::create(const Glib::RefPtr<Object>& src)
+{
+  GstMessage* message = gst_message_new_element(src->gobj(), NULL);
+  return Gst::Message::wrap(message, false);
+}
 
-MessageStateChanged::MessageStateChanged(GstMessage* castitem)
+MessageCustom::MessageCustom(GstMessage* castitem)
 : Message(castitem)
 {
 }
 
-Glib::RefPtr<Message> MessageStateChanged::create(const Glib::RefPtr<Object>& src, State oldstate, State newstate, State pending)
+Glib::RefPtr<Message> MessageCustom::create(MessageType type, const Glib::RefPtr<Object>& src, Structure& structure)
 {
-  GstMessage* message = gst_message_new_state_changed(src->gobj(), GstState(oldstate), GstState(newstate), GstState(pending));
+  GstStructure* copy_struct = gst_structure_copy(structure.gobj());
+  GstMessage* message = gst_message_new_custom(GstMessageType(type),
+    src->gobj(), copy_struct);
   return Gst::Message::wrap(message, false);
 }
 
-
-MessageBuffering::MessageBuffering(GstMessage* castitem)
-: Message(castitem)
+Glib::RefPtr<Message> MessageCustom::create(MessageType type, const Glib::RefPtr<Object>& src)
 {
+  GstMessage* message = gst_message_new_custom(GstMessageType(type),
+    src->gobj(), NULL);
+  return Gst::Message::wrap(message, false);
 }
 
-MessageTag::MessageTag(GstMessage* castitem)
+MessageSegmentStart::MessageSegmentStart(GstMessage* castitem)
 : Message(castitem)
 {
 }
 
-Glib::RefPtr<Message> MessageTag::create(const Glib::RefPtr<Object>& src, const TagList& taglist)
+Glib::RefPtr<Message> MessageSegmentStart::create(const Glib::RefPtr<Object>& src, Format format, gint64 position)
 {
-  //We create a copy because gst_message_new_tag() takes ownership:
-  GstTagList* c_taglist = gst_tag_list_copy(taglist.gobj());
-  GstMessage* message = gst_message_new_tag(src->gobj(), c_taglist);
+  GstMessage* message = gst_message_new_segment_start(src->gobj(), GstFormat(format), position);
   return Gst::Message::wrap(message, false);
 }
 
-void MessageTag::parse(TagList& taglist)
+void MessageSegmentStart::parse(Format& format, gint64& position)
 {
-  GstTagList* gst_tag_list = gst_tag_list_new();
-  gst_message_parse_tag(gobj(), &gst_tag_list);
-  TagList result(gst_tag_list);
-  taglist.swap(result);
+  gst_message_parse_segment_start(gobj(), (GstFormat*)(&format), &position);
 }
 
-Glib::RefPtr<Message> MessageBuffering::create(const Glib::RefPtr<Object>& src, int percent)
+gint64 MessageSegmentStart::parse()
 {
-  GstMessage* message = gst_message_new_buffering(src->gobj(), percent);
-  return Gst::Message::wrap(message, false);
+  gint64 position;
+  gst_message_parse_segment_start(gobj(), NULL, &position);
+  return position;
 }
 
+Format MessageSegmentStart::parse_format()
+{
+  Format format;
+  gst_message_parse_segment_start(gobj(), (GstFormat*)(&format), NULL);
+  return format;
+}
 
-MessageWarning::MessageWarning(GstMessage* castitem)
+MessageSegmentDone::MessageSegmentDone(GstMessage* castitem)
 : Message(castitem)
 {
 }
 
-Glib::RefPtr<Message> MessageWarning::create(const Glib::RefPtr<Object>& src, Glib::Error& error, const std::string& debug)
+Glib::RefPtr<Message> MessageSegmentDone::create(const Glib::RefPtr<Object>& src, Format format, gint64 position)
 {
-  GstMessage* message = gst_message_new_warning(src->gobj(), error.gobj(),(gchar*)(debug.c_str()));
+  GstMessage* message = gst_message_new_segment_done(src->gobj(), GstFormat(format), position);
   return Gst::Message::wrap(message, false);
 }
 
+void MessageSegmentDone::parse(Format& format, gint64& position)
+{
+  gst_message_parse_segment_done(gobj(), (GstFormat*)(&format), &position);
+}
+
+gint64 MessageSegmentDone::parse()
+{
+  gint64 position;
+  gst_message_parse_segment_done(gobj(), NULL, &position);
+  return position;
+}
+
+Format MessageSegmentDone::parse_format()
+{
+  Format format;
+  gst_message_parse_segment_done(gobj(), (GstFormat*)(&format), NULL);
+  return format;
+}
 
 MessageDuration::MessageDuration(GstMessage* castitem)
 : Message(castitem)
@@ -331,19 +526,36 @@
   return Gst::Message::wrap(message, false);
 }
 
+void MessageDuration::parse(Format& format, gint64& position)
+{
+  gst_message_parse_duration(gobj(), (GstFormat*)(&format), &position);
+}
+
+gint64 MessageDuration::parse()
+{
+  gint64 position;
+  gst_message_parse_duration(gobj(), NULL, &position);
+  return position;
+}
 
-MessageStateDirty::MessageStateDirty(GstMessage* castitem)
+Format MessageDuration::parse_format()
+{
+  Format format;
+  gst_message_parse_duration(gobj(), (GstFormat*)(&format), NULL);
+  return format;
+}
+
+MessageLatency::MessageLatency(GstMessage* castitem)
 : Message(castitem)
 {
 }
 
-Glib::RefPtr<Message> MessageStateDirty::create(const Glib::RefPtr<Object>& src)
+Glib::RefPtr<Message> MessageLatency::create(const Glib::RefPtr<Object>& src)
 {
-  GstMessage* message = gst_message_new_state_dirty(src->gobj());
+  GstMessage* message = gst_message_new_latency(src->gobj());
   return Gst::Message::wrap(message, false);
 }
 
-
 MessageAsyncStart::MessageAsyncStart(GstMessage* castitem)
 : Message(castitem)
 {
@@ -355,14 +567,13 @@
   return Gst::Message::wrap(message, false);
 }
 
-void MessageAsyncStart::parse(bool& base_time)
+bool MessageAsyncStart::parse()
 {
-  gboolean result;
-  gst_message_parse_async_start(gobj(), &result);
-  base_time = result;
+  gboolean new_base_time;
+  gst_message_parse_async_start(gobj(), &new_base_time);
+  return new_base_time;
 }
 
-
 MessageAsyncDone::MessageAsyncDone(GstMessage* castitem)
 : Message(castitem)
 {
@@ -374,20 +585,8 @@
   return Gst::Message::wrap(message, false);
 }
 
-
-MessageLatency::MessageLatency(GstMessage* castitem)
-: Message(castitem)
-{
-}
-
-Glib::RefPtr<Message> MessageLatency::create(const Glib::RefPtr<Object>& src)
+Glib::RefPtr<Message> Message::wrap(GstMessage* message, bool take_copy)
 {
-  GstMessage* message = gst_message_new_latency(src->gobj());
-  return Gst::Message::wrap(message, false);
-}
-
-Glib::RefPtr<Message> Message::wrap(GstMessage* message, bool take_copy) {
-
   Glib::RefPtr<Message> result;
 
   if(!message)
@@ -451,9 +650,6 @@
     case GST_MESSAGE_ASYNC_DONE:
       result = Glib::RefPtr<Message>( new Gst::MessageAsyncDone(message) );
       break;
-    //TODO?: case GST_MESSAGE_STEP_DONE:
-    //TODO?: case GST_MESSAGE_STRUCTURE_CHANGE:
-    //TODO?: case GST_MESSAGE_STREAM_STATUS:
     default:
       result = Gst::wrap(message, false);
   }

Modified: gstreamermm/trunk/gstreamer/src/message.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/message.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/message.hg	Tue Jul 29 02:48:27 2008
@@ -23,7 +23,7 @@
 #include <gstreamermm/wrap.h>
 #include <gstreamermm/format.h>
 #include <gstreamermm/clock.h>
-#include <gstreamermm/enums.h>
+#include <gstreamermm/query.h>
 
 _DEFS(gstreamermm,gst)
 
@@ -89,204 +89,746 @@
 //Glib::RefPtrs references the objects which causes problems when GStreamer API
 //tries to modify the GstStructures of the objects.
 
-class MessageApplication : public Message
+/** An end of stream message.
+ * See create() for more details.
+ */
+class MessageEos : public Message
 {
 public:
-  explicit MessageApplication(GstMessage *message);
+  explicit MessageEos(GstMessage* castitem);
 
-  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Structure& structure);
+  /** Create a new eos message. This message is generated and posted in the
+   * sink elements of a Gst::Bin. The bin will only forward the EOS message to
+   * the application if all sinks have posted an EOS message.
+   * 
+   * @param src The object originating the message.
+   * @return The new eos message. MT safe. 
+   */
+  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src);
 };
 
-class MessageClockProvide : public Message
+/** An error message.
+ * See create() for more details.
+ */
+class MessageError : public Message
 {
 public:
-  explicit MessageClockProvide(GstMessage *message);
+  explicit MessageError(GstMessage* castitem);
 
-  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, const Glib::RefPtr<Clock>& clock, bool ready);
+  /** Create a new error message. The message will copy error and debug. This
+   * message is posted by elements when a fatal event occured. The pipeline
+   * will probably (partially) stop. The application receiving this message
+   * should stop the pipeline.
+   *
+   * @param src The object originating the message.
+   * @param error The Glib::Error for this message.
+   * @param debug A debugging string for something or other.
+   * @return The new error message. MT safe. 
+   */
+  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Glib::Error& error, const std::string& debug);
 
-  //TODO: Use clock as return type?
-  void parse(Glib::RefPtr<Clock>& clock, bool& ready);
+  /** Extracts the Glib::Error and debug string from the Gst::MessageError.
+   *
+   * MT safe.
+   *
+   * @param error Location for the Glib::Error.
+   * @param debug Location for the debug message.
+   */
+  void parse(Glib::Error& error, std::string& debug);
+
+  /** Extracts and returns the Glib::Error from the Gst::MessageError.
+   *
+   * MT safe.
+   *
+   * @return The Glib::Error.
+   */
+  Glib::Error parse();
+
+  /** Extracts and returns the debug message from the Gst::MessageError.
+   *
+   * MT safe.
+   *
+   * @return The debug message.
+   */
+  std::string parse_debug();
 };
 
-class MessageClockLost : public Message
+/** A warning message.
+ * See create() for more details.
+ */
+class MessageWarning : public Message
 {
 public:
-  explicit MessageClockLost(GstMessage* castitem);
+  explicit MessageWarning(GstMessage* castitem);
 
-  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, const Glib::RefPtr<Clock>& clock);
+  /** Create a new warning message. The message will make copies of error and
+   * debug.
+   *
+   * @param src The object originating the message.
+   * @param error The Glib::Error for this message.
+   * @param debug A debugging string for something or other.
+   * @return The new warning message. MT safe. 
+   */
+  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Glib::Error& error, const std::string& debug);
+
+  /** Extracts the Glib::Error and debug string from the Gst::MessageWarning.
+   *
+   * MT safe.
+   *
+   * @param error Location for the Glib::Error.
+   * @param debug Location for the debug message.
+   */
+  void parse(Glib::Error& error, std::string& debug);
+
+  /** Extracts and returns the Glib::Error from the Gst::MessageWarning.
+   *
+   * MT safe.
+   *
+   * @return The Glib::Error.
+   */
+  Glib::Error parse();
 
-  //TODO: Use clock as return type?
-  void parse(Glib::RefPtr<Clock>& clock);
+  /** Extracts and returns the debug message from the Gst::MessageWarning.
+   *
+   * MT safe.
+   *
+   * @return The debug message.
+   */
+  std::string parse_debug();
 };
 
-class MessageCustom : public Message
+/** An informational message.
+ * See create() for more details.
+ */
+class MessageInfo : public Message
 {
 public:
-  explicit MessageCustom(GstMessage* castitem);
+  explicit MessageInfo(GstMessage* castitem);
 
-  static Glib::RefPtr<Message> create(MessageType type, const Glib::RefPtr<Object>& src, Structure& structure);
+  /** Create a new info message.
+   *
+   * @param src The object originating the message.
+   * @param error The Glib::Error for this message.
+   * @param debug A debugging string for something or other.
+   * @return The new info message.
+   *
+   * Since 0.10.12 MT safe.
+   */
+  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Glib::Error& error, const std::string& debug);
+
+  /** Extracts the Glib::Error and debug string from the Gst::MessageInfo.
+   *
+   * MT safe.
+   *
+   * @param error Location for the Glib::Error.
+   * @param debug Location for the debug message.
+   */
+  void parse(Glib::Error& error, std::string& debug);
+
+  /** Extracts and returns the Glib::Error from the Gst::MessageInfo.
+   *
+   * MT safe.
+   *
+   * @return The Glib::Error.
+   */
+  Glib::Error parse();
+
+  /** Extracts and returns the debug message from the Gst::MessageInfo.
+   *
+   * MT safe.
+   *
+   * @return The debug message.
+   */
+  std::string parse_debug();
 };
 
-class MessageElement : public Message
+/** A tag message.
+ * See create() for more details.
+ */
+class MessageTag : public Message
 {
 public:
-  explicit MessageElement(GstMessage* castitem);
+  explicit MessageTag(GstMessage* castitem);
 
-  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Structure& structure);
+  /** Create a new tag message. The taglist will be copied.  The message is
+   * posted by elements that discovered a new taglist.
+   *
+   * @param src The object originating the message.
+   * @param tag_list The tag list for the message.
+   * @return The new tag message. MT safe.
+   */
+  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, const TagList& taglist);
+
+  /** Extracts and returns the Gst::TagList from the Gst::MessageTag.
+   *
+   * MT safe.
+   *
+   * @return A copy of the Gst::TagList.
+   */
+  TagList parse();
 };
 
-class MessageEos : public Message
+/** A buffering message.
+ * See create() for more details.
+ */
+class MessageBuffering : public Message
 {
 public:
-  explicit MessageEos(GstMessage* castitem);
+  explicit MessageBuffering(GstMessage* castitem);
 
-  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src);
+  /** Create a new buffering message. This message can be posted by an element
+   * that needs to buffer data before it can continue processing. @a percent
+   * should be a value between 0 and 100. A value of 100 means that the
+   * buffering completed.
+   *
+   * When @a percent is < 100 the application should PAUSE a PLAYING pipeline.
+   * When @a percent is 100, the application can set the pipeline (back) to
+   * PLAYING. The application must be prepared to receive BUFFERING messages in
+   * the PREROLLING state and may only set the pipeline to PLAYING after
+   * receiving a message with @a percent set to 100, which can happen after the
+   * pipeline completed prerolling.
+   *
+   * @param src The object originating the message.  
+   * @param percent The buffering percent.
+   * @return The new buffering message.
+   *
+   * Since 0.10.11 MT safe.
+   */
+  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, int percent);
+
+  /** Extracts and returns the buffering percent from the
+   * Gst::MessageBuffering.
+   * @return The percent as an integer.
+   */
+  int parse();
+
+  /** Configures the buffering stats values in message.
+   *
+   * @param mode A buffering mode.
+   * @param avg_in The average input rate.
+   * @param avg_out The average output rate.
+   * @param buffering_left Amount of buffering time left in milliseconds.
+   *
+   * Since 0.10.20.
+   */
+  void set_stats(BufferingMode mode, int avg_in, int avg_out, gint64 buffering_left);
+
+  /** Extracts the buffering stats values from message.
+   *
+   * @param mode Location for the buffering mode.
+   * @param avg_in Location for the average input rate.
+   * @param avg_out Location for the average output rate.
+   * @param buffering_left Location for the amount of buffering time left.
+   *
+   * Since 0.10.20.
+   */
+  void get_stats(BufferingMode& mode, int& avg_in, int& avg_out, gint64& buffering_left);
+
+  /** Extracts and returns the buffering mode from message.
+   *
+   * @return The buffering mode.
+   */
+  BufferingMode get_stats_buffering_mode();
+
+  /** Extracts and returns the average input rate from message.
+   *
+   * @return The average input rate.
+   */
+  int get_stats_avg_in();
+
+  /** Extracts and returns the average output rate from message.
+   *
+   * @return The average output rate.
+   */
+  int get_stats_avg_out();
+
+  /** Extracts and returns the buffering time in milliseconds remaining from
+   * message.
+   *
+   * @return The buffering time remaining.
+   */
+  gint64 get_stats_buffering_left();
 };
 
-class MessageError : public Message
+/** A state change message.
+ * See create() for more details.
+ */
+class MessageStateChanged : public Message
 {
 public:
-  explicit MessageError(GstMessage* castitem);
+  explicit MessageStateChanged(GstMessage* castitem);
 
-  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Glib::Error& error, const std::string& debug);
+  /** Create a state change message. This message is posted whenever an element
+   * changed its state.
+   *
+   * @param src The object originating the message.
+   * @param oldstate The previous state.
+   * @param newstate The new (current) state.
+   * @param pending The pending (target) state.
+   * @return The new state change message. MT safe.
+   */
+  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, State oldstate, State newstate, State pending);
 
-  //TODO: Use error as return type?
-  void parse(Glib::Error& error, std::string& debug);
-  void parse(Glib::Error& error);
+  /** Extracts the old, new and pending states from the
+   * Gst::MessageStateChanged.
+   *
+   * MT safe.
+   *
+   * @param oldstate The previous state.
+   * @param newstate The new (current) state.
+   * @param pending The pending (target) state.
+   */
+  void parse(State& oldstate, State& newstate, State& pending);
+
+  /** Extracts and returns the new state from the Gst::MessageStateChanged.
+   *
+   * MT safe.
+   *
+   * @return The new (current) state.
+   */
+  State parse();
+
+  /** Extracts and returns the old state from the Gst::MessageStateChanged.
+   *
+   * MT safe.
+   *
+   * @return The old state.
+   */
+  State parse_old();
+
+  /** Extracts and returns the pending state from the Gst::MessageStateChanged.
+   *
+   * MT safe.
+   *
+   * @return The pending state.
+   */
+  State parse_pending();
 };
 
-class MessageInfo : public Message
+/** A state dirty message.
+ * See create() for more details.
+ */
+class MessageStateDirty : public Message
 {
 public:
-  explicit MessageInfo(GstMessage* castitem);
+  explicit MessageStateDirty(GstMessage* castitem);
 
-  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Glib::Error& error, const std::string& debug);
+  /** Create a state dirty message. This message is posted whenever an element
+   * changed its state asynchronously and is used internally to update the
+   * states of container objects.
+   *
+   * @param src The object originating the message.
+   * @return The new state dirty message. MT safe.
+   */
+  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src);
+};
 
-  //TODO: Use error as return type?
-  void parse(Glib::Error& error, std::string& debug);
-  void parse(Glib::Error& error);
+/** A clock provide message.
+ * See create() for more details.
+ */
+class MessageClockProvide : public Message
+{
+public:
+  explicit MessageClockProvide(GstMessage *message);
+
+  /** Create a clock provide message. This message is posted whenever an
+   * element is ready to provide a clock or lost its ability to provide a clock
+   * (maybe because it paused or became EOS).
+   *
+   * This message is mainly used internally to manage the clock selection.
+   *
+   * @param src The object originating the message.
+   * @param clock The clock it provides.
+   * @param ready true if the sender can provide a clock.
+   * @return The new provide clock message. MT safe.
+   */
+  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, const Glib::RefPtr<Clock>& clock, bool ready);
+
+  /** Extracts the clock and ready flag from the Gst::MessageClockProvide. The
+   * clock object returned remains valid until the message is freed.
+   *
+   * MT safe.
+   *
+   * @param clock Location in which to hold a clock object.
+   * @param ready Location in which to hold the ready flag.
+   */
+  void parse(Glib::RefPtr<Clock>& clock, bool& ready);
+
+  /** Extracts and returns the clock from the Gst::MessageClockProvide. The
+   * clock object returned remains valid until the message is freed.
+   *
+   * MT safe.
+   *
+   * @return The clock object of the message.
+   */
+  Glib::RefPtr<Clock> parse();
+
+  /** Extracts and returns the ready flag from the Gst::MessageClockProvide.
+   *
+   * MT safe.
+   *
+   * @return The ready flag of the message.
+   */
+  bool parse_ready();
 };
 
-class MessageNewClock: public Message
+/** A clock lost message.
+ * See create() for more details.
+ */
+class MessageClockLost : public Message
 {
 public:
-  explicit MessageNewClock(GstMessage* castitem);
+  explicit MessageClockLost(GstMessage* castitem);
 
+  /** Create a clock lost message. This message is posted whenever the clock is
+   * not valid anymore.  If this message is posted by the pipeline, the
+   * pipeline will select a new clock again when it goes to PLAYING. It might
+   * therefore be needed to set the pipeline to PAUSED and PLAYING again.
+   *
+   * @param src The object originating the message.
+   * @param clock The clock that was lost.
+   * @return The new clock lost message. MT safe. 
+   */
   static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, const Glib::RefPtr<Clock>& clock);
 
-  //TODO: Use clock as return type?
-  void parse(Glib::RefPtr<Clock>& clock);
+  /** Extracts and returns the lost clock from the Gst::MessageClockLost. The
+   * clock object returned remains valid until the message is freed.
+   *
+   * MT safe.
+   * @return The lost clock.
+   */
+  Glib::RefPtr<Clock> parse();
 };
 
-class MessageSegmentDone : public Message
+/** A new clock message.
+ * See create() for more details.
+ */
+class MessageNewClock: public Message
 {
 public:
-  explicit MessageSegmentDone(GstMessage* castitem);
+  explicit MessageNewClock(GstMessage* castitem);
 
-  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Format format, gint64 position);
+  /** Create a new clock message. This message is posted whenever the pipeline
+   * selectes a new clock for the pipeline.
+   *
+   * @param src The object originating the message.
+   * @param clock The new selected clock.
+   * @return The new new clock message. MT safe.
+   */
+  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, const Glib::RefPtr<Clock>& clock);
 
-  //TODO: Use something as return type?
-  void parse(Format& format, gint64& position);
+  /** Extracts and returns the new clock from the Gst::MessageNewClock. The
+   * clock object returned remains valid until the message is freed.
+   *
+   * MT safe.
+   *
+   * @return The selected new clock.
+   */
+  Glib::RefPtr<Clock> parse();
 };
 
-class MessageSegmentStart : public Message
+/** An application message.
+ * See create() for more details.
+ */
+class MessageApplication : public Message
 {
 public:
-  explicit MessageSegmentStart(GstMessage* castitem);
+  explicit MessageApplication(GstMessage *message);
 
-  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Format format, gint64 position);
+  /** Create a new application-typed message. GStreamer will never create these
+   * messages; they are a gift from us to you. Enjoy.
+   *
+   * @param src The object originating the message.
+   * @param structure The structure for the message.  The structure will be
+   * copied.
+   * @return The new application message. MT safe.
+   */
+  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Structure& structure);
 
-  //TODO: Use something as return type?
-  void parse(Format& format, gint64& position);
+  /** Create a new application-typed message (no Gst::Structure is needed).
+   * GStreamer will never create these messages; they are a gift from us to
+   * you. Enjoy.
+   *
+   * @param src The object originating the message.
+   * @return The new application message. MT safe.
+   */
+  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src);
 };
 
-class MessageStateChanged : public Message
+/** An element specific message.
+ * See create() for more details.
+ */
+class MessageElement : public Message
 {
 public:
-  explicit MessageStateChanged(GstMessage* castitem);
+  explicit MessageElement(GstMessage* castitem);
 
-  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, State oldstate, State newstate, State pending);
+  /** Create a new element-specific message. This is meant as a generic way of
+   * allowing one-way communication from an element to an application, for
+   * example "the firewire cable was unplugged". The format of the message
+   * should be documented in the element's documentation.
+   *
+   * @param src The object originating the message.
+   * @param structure The structure for the message. The message will take a
+   * copy of the structure.
+   * @return The new element message. MT safe.
+   */
+  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Structure& structure);
 
-  //TODO: Use something as return type?
-  void parse(State& oldstate, State& newstate, State& pending);
+  /** Create a new element-specific message. This is meant as a generic way of
+   * allowing one-way communication from an element to an application, for
+   * example "the firewire cable was unplugged". The format of the message
+   * should be documented in the element's documentation. No Gst::Structure is
+   * needed.
+   *
+   * @param src The object originating the message.
+   * @return The new element message. MT safe.
+   */
+  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src);
 };
 
-class MessageTag : public Message
+/** A custom message.
+ * See create() for more details.
+ */
+class MessageCustom : public Message
 {
 public:
-  explicit MessageTag(GstMessage* castitem);
+  explicit MessageCustom(GstMessage* castitem);
 
-  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, const TagList& taglist);
+  /** Create a new custom-typed message. This can be used for anything not
+   * handled by other message-specific functions to pass a message to the app.
+   *
+   * @param type The Gst::MessageType to distinguish messages.
+   * @param src The object originating the message.
+   * @param structure The Gst::Structure for the message. The message will take
+   * a copy of the structure.
+   * @return The new message. MT safe.
+   */
+  static Glib::RefPtr<Message> create(MessageType type, const Glib::RefPtr<Object>& src, Structure& structure);
 
-  //TODO: Use something as return type?
-  void parse(TagList& taglist);
+  /** Create a new custom-typed message. This can be used for anything not
+   * handled by other message-specific functions to pass a message to the app.
+   * No Gst::Structure is needed.
+   *
+   * @param type The Gst::MessageType to distinguish messages.
+   * @param src The object originating the message.
+   * @return The new message. MT safe.
+   */
+  static Glib::RefPtr<Message> create(MessageType type, const Glib::RefPtr<Object>& src);
 };
 
-class MessageBuffering : public Message
+/** A segment start message.
+ * See create() for more details.
+ */
+class MessageSegmentStart : public Message
 {
 public:
-  explicit MessageBuffering(GstMessage* castitem);
+  explicit MessageSegmentStart(GstMessage* castitem);
 
-  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, int percent);
+  /** Create a new segment message. This message is posted by elements that
+   * start playback of a segment as a result of a segment seek. This message is
+   * not received by the application but is used for maintenance reasons in
+   * container elements.
+   *
+   * @param src The object originating the message.
+   * @param format The format of the position being played.
+   * @param position The position of the segment being played.
+   * @return The new segment start message. MT safe.
+   */
+  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Format format, gint64 position);
+
+  /** Extracts the position and format from the segment start message.
+   *
+   * MT safe.
+   *
+   * @param format Result location for the format.
+   * @param position Result location for the position.
+   */
+  void parse(Format& format, gint64& position);
+
+  /** Extracts and returns the position from the segment start message.
+   *
+   * MT safe.
+   *
+   * @return The position.
+   */
+  gint64 parse();
 
-  //TODO: Use percent as return type?
-  void parse(int& percent);
+  /** Extracts and returns the format from the segment start message.
+   *
+   * MT safe.
+   *
+   * @return The format.
+   */
+  Format parse_format();
 };
 
-class MessageWarning : public Message
+/** A segment done message.
+ * See create() for more details.
+ */
+class MessageSegmentDone : public Message
 {
 public:
-  explicit MessageWarning(GstMessage* castitem);
+  explicit MessageSegmentDone(GstMessage* castitem);
 
-  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Glib::Error& error, const std::string& debug);
+  /** Create a new segment done message. This message is posted by elements
+   * that finish playback of a segment as a result of a segment seek. This
+   * message is received by the application after all elements that posted a
+   * Gst::MessageSegmentStart have posted the Gst::MessageSegmentDone.
+   *
+   * @param src The object originating the message.  
+   * @param format The format of the position being done.
+   * @param position The position of the segment being done.
+   * @return The new segment done message. MT safe.
+   */
+  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Format format, gint64 position);
 
-  //TODO: Use error as return type?
-  void parse(Glib::Error& error, std::string& debug);
+  /** Extracts the position and format from the segment done message.
+   *
+   * MT safe.
+   *
+   * @param format Result location for the format.
+   * @param position Result location for the position.
+   */
+  void parse(Format& format, gint64& position);
+
+  /** Extracts and returns the position from the segment done message.
+   *
+   * MT safe.
+   *
+   * @return The position.
+   */
+  gint64 parse();
+
+  /** Extracts and returns the format from the segment done message.
+   *
+   * MT safe.
+   *
+   * @return The format.
+   */
+  Format parse_format();
 };
 
+/** A duration message.
+ * See create() for more details.
+ */
 class MessageDuration : public Message
 {
 public:
   explicit MessageDuration(GstMessage* castitem);
 
+  /** Create a new duration message. This message is posted by elements that
+   * know the duration of a stream in a specific format. This message is
+   * received by bins and is used to calculate the total duration of a
+   * pipeline. Elements may post a duration message with a duration of
+   * Gst::CLOCK_TIME_NONE to indicate that the duration has changed and the
+   * cached duration should be discarded. The new duration can then be
+   * retrieved via a query.
+   *
+   * @param src The object originating the message.
+   * @param format The format of the duration.  
+   * @param duration The new duration.  
+   * @return The new duration message. MT safe.
+   */
   static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, Format format, gint64 position);
 
-  //TODO: Use something as return type?
+  /** Extracts the duration and format from the duration message. The duration
+   * might be Gst::CLOCK_TIME_NONE, which indicates that the duration has
+   * changed. Applications should always use a query to retrieve the duration
+   * of a pipeline.
+   *
+   * MT safe.
+   *
+   * @param format Result location for the format.
+   * @param position Result location for the position.
+   */
   void parse(Format& format, gint64& position);
+
+  /** Extracts and returns the duration from the duration message. The duration
+   * might be Gst::CLOCK_TIME_NONE, which indicates that the duration has
+   * changed. Applications should always use a query to retrieve the duration
+   * of a pipeline.
+   *
+   * MT safe.
+   *
+   * @return The position.
+   */
+  gint64 parse();
+
+  /** Extracts and returns the format from the duration message. Applications
+   * should always use a query to retrieve the duration
+   * of a pipeline.
+   *
+   * MT safe.
+   *
+   * @return The format.
+   */
+  Format parse_format();
 };
 
-class MessageStateDirty : public Message
+/** A latency message.
+ * See create() for more details.
+ */
+class MessageLatency : public Message
 {
 public:
-  explicit MessageStateDirty(GstMessage* castitem);
+  explicit MessageLatency(GstMessage* castitem);
 
+  /** Creates a new latency message.  This message can be posted by elements
+   * when their latency requirements have changed.
+   *
+   * @param src The object originating the message.
+   * @return The new latency message. MT safe.
+   *
+   * Since 0.10.12.
+   */
   static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src);
 };
 
+/** An asynchronous start message.
+ * See create() for more details.
+ */
 class MessageAsyncStart : public Message
 {
 public:
   explicit MessageAsyncStart(GstMessage* castitem);
 
+  /** Creates a new async message.  This message is posted by elements when they start an ASYNC state change. new_base_time is set to true when the element lost its state when it was PLAYING.
+   *
+   * @param src The object originating the message.
+   * @param new_base_time If a new base_time should be set on the element.
+   * @return The new async_start message. MT safe.
+   *
+   * Since 0.10.13 
+   */
   static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, bool new_base_time);
 
-  //TODO: Use new_base_time as return type?
-  void parse(bool& new_base_time);
+  /** Extract and return the boolean new_base_time from the async_start
+   * message.
+   *
+   * MT safe.
+   *
+   * @return The new_base_time boolean.
+   *
+   * Since 0.10.13.
+   */
+  bool parse();
 };
 
+/** An asynchronous done message.
+ * See create() for more details.
+ */
 class MessageAsyncDone : public Message
 {
 public:
   explicit MessageAsyncDone(GstMessage* castitem);
 
-  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src);
-};
-
-class MessageLatency : public Message
-{
-public:
-  explicit MessageLatency(GstMessage* castitem);
-
+  /** Create an async done message. The message is posted when elements
+   * completed an ASYNC state change.
+   *
+   * @param src The object originating the message.  
+   * @return The new async_done message. MT safe.
+   */
   static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src);
 };
 

Modified: gstreamermm/trunk/gstreamer/src/query.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/query.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/query.hg	Tue Jul 29 02:48:27 2008
@@ -31,6 +31,7 @@
 {
 
 _WRAP_ENUM(QueryType, GstQueryType)
+_WRAP_ENUM(BufferingMode, GstBufferingMode)
 
 namespace Enums
 {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]