[gstreamermm] Added Gst::MessageStructureChange and Gst::MessageRequestState.



commit c57d3a895825d9eac89cdd540fcc04a7919009b8
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Thu Jul 16 17:59:26 2009 -0400

    Added Gst::MessageStructureChange and Gst::MessageRequestState.

 ChangeLog                 |    6 +++
 gstreamer/src/message.ccg |   76 ++++++++++++++++++++++++++++++++++
 gstreamer/src/message.hg  |  101 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 183 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 224efcf..5d14ec7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-07-16  José Alburquerque  <jaalburqu svn gnome org>
+
+	* gstreamer/src/message.ccg:
+	* gstreamer/src/message.hg: Added Gst::MessageStructureChange and
+	Gst::MessageRequestState.
+
 2009-07-14  José Alburquerque  <jaalburqu svn gnome org>
 
 	* gstreamer/src/message.ccg:
diff --git a/gstreamer/src/message.ccg b/gstreamer/src/message.ccg
index ed4e27e..4d7e3a5 100644
--- a/gstreamer/src/message.ccg
+++ b/gstreamer/src/message.ccg
@@ -602,6 +602,76 @@ Glib::RefPtr<Gst::Message> MessageAsyncDone::create(const Glib::RefPtr<Gst::Obje
   return Gst::Message::wrap(message, false);
 }
 
+MessageStructureChange::MessageStructureChange(GstMessage* castitem)
+: Message(castitem)
+{}
+
+Glib::RefPtr<Gst::Message>
+  MessageStructureChange::create(const Glib::RefPtr<Gst::Object>& src,
+  Gst::StructureChangeType type, const Glib::RefPtr<Gst::Element>& owner,
+  bool busy)
+{
+  GstMessage* message = gst_message_new_structure_change(src->gobj(),
+    (GstStructureChangeType)(type), owner->gobj(), busy);
+  return Gst::Message::wrap(message, false);
+}
+
+void MessageStructureChange::parse(Gst::StructureChangeType& type,
+  Glib::RefPtr<Gst::Element>& owner, bool& busy) const
+{
+  GstElement* gst_element = 0;
+  gboolean gst_busy = false;
+  gst_message_parse_structure_change(const_cast<GstMessage*>(gobj()),
+    (GstStructureChangeType*)(&type), &gst_element, &gst_busy);
+  owner = Glib::wrap(gst_element, true);
+  busy = gst_busy;
+}
+
+Gst::StructureChangeType MessageStructureChange::parse() const
+{
+  GstStructureChangeType gst_type = GST_STRUCTURE_CHANGE_TYPE_PAD_LINK;
+  gst_message_parse_structure_change(const_cast<GstMessage*>(gobj()),
+    &gst_type, 0, 0);
+  return (Gst::StructureChangeType)(gst_type);
+}
+
+Glib::RefPtr<Gst::Element> MessageStructureChange::parse_owner() const
+{
+  GstElement* gst_element = 0;
+  gst_message_parse_structure_change(const_cast<GstMessage*>(gobj()), 0,
+    &gst_element, 0);
+  return Glib::wrap(gst_element, true);
+}
+
+bool MessageStructureChange::parse_busy() const
+{
+  gboolean gst_busy = false;
+  gst_message_parse_structure_change(const_cast<GstMessage*>(gobj()), 0, 0,
+    &gst_busy);
+  return gst_busy;
+}
+
+MessageRequestState::MessageRequestState(GstMessage* castitem)
+: Message(castitem)
+{}
+
+Glib::RefPtr<Gst::Message>
+  MessageRequestState::create(const Glib::RefPtr<Gst::Object>& src,
+  Gst::State state)
+{
+  GstMessage* message = gst_message_new_request_state(src->gobj(),
+    (GstState)(state));
+  return Gst::Message::wrap(message, false);
+}
+
+Gst::State MessageRequestState::parse() const
+{
+  GstState gst_state = GST_STATE_VOID_PENDING;
+  gst_message_parse_request_state(const_cast<GstMessage*>(gobj()),
+    &gst_state);
+  return (Gst::State)(gst_state);
+}
+
 //TODO: Include (by removing #if/#endif) when GStreamer 0.10.24 is released:
 #if 0
 MessageStreamStatus::MessageStreamStatus(GstMessage* castitem)
@@ -728,6 +798,12 @@ Glib::RefPtr<Gst::Message> Message::wrap(GstMessage* message, bool take_copy)
       case GST_MESSAGE_ASYNC_DONE:
         result = Glib::RefPtr<Gst::Message>( new Gst::MessageAsyncDone(message) );
         break;
+      case GST_MESSAGE_STRUCTURE_CHANGE:
+        result = Glib::RefPtr<Gst::Message>( new Gst::MessageStructureChange(message) );
+        break;
+      case GST_MESSAGE_REQUEST_STATE:
+        result = Glib::RefPtr<Gst::Message>( new Gst::MessageRequestState(message) );
+        break;
       //TODO: Include when GStreamer 0.10.24 is released:
       /*
       case GST_MESSAGE_STREAM_STATUS:
diff --git a/gstreamer/src/message.hg b/gstreamer/src/message.hg
index 8066fa4..21d8b8d 100644
--- a/gstreamer/src/message.hg
+++ b/gstreamer/src/message.hg
@@ -29,6 +29,8 @@ namespace Gst
 {
 
 _WRAP_ENUM(MessageType, GstMessageType)
+_WRAP_ENUM(StructureChangeType, GstStructureChangeType)
+
 //TODO: Include when GStreamer 0.10.24 is released:
 //_WRAP_ENUM(StreamStatusType, GstStreamStatusType)
 
@@ -905,6 +907,105 @@ public:
   static Glib::RefPtr<Gst::Message> create(const Glib::RefPtr<Gst::Object>& src);
 };
 
+/** A structure change message.
+ * See create() for more details.
+ */
+class MessageStructureChange : public Message
+{
+public:
+  explicit MessageStructureChange(GstMessage* castitem);
+
+  /** Create a new structure change message. This message is posted when the
+   * structure of a pipeline is in the process of being changed, for example
+   * when pads are linked or unlinked.
+   *
+   * @a src should be the srcpad that unlinked or linked.
+   *
+   * @param src The object originating the message.
+   * @param type The change type.
+   * @param owner The owner element of src.
+   * @param busy Whether the structure change is busy.
+   * @return The new structure change message. MT safe.
+   *
+   * Since 0.10.22.
+   */
+  static Glib::RefPtr<Gst::Message>
+    create(const Glib::RefPtr<Gst::Object>& src,
+    Gst::StructureChangeType type, const Glib::RefPtr<Gst::Element>& owner,
+    bool busy);
+
+  /** Extracts the change type and completion status from the Gst::Message.
+   * MT safe.
+   *
+   * @param type A reference to hold the change type.
+   * @param owner The owner element of the message source.
+   * @param busy A reference to hold whether the change is in progress or has
+   * been completed.
+   *
+   * Since 0.10.22.
+   */
+  void parse(Gst::StructureChangeType& type,
+    Glib::RefPtr<Gst::Element>& owner, bool& busy) const;
+  _IGNORE(gst_message_parse_structure_change)
+
+  /** Extracts the change type from the Gs::tMessage.
+   * MT safe.
+   *
+   * @return The change type.
+   *
+   * Since 0.10.22.
+   */
+  Gst::StructureChangeType parse() const;
+
+  /** Extracts the owner from the Gst::Message.
+   * MT safe.
+   *
+   * @return The owner element of the message source.
+   *
+   * Since 0.10.22.
+   */
+  Glib::RefPtr<Gst::Element> parse_owner() const;
+
+  /** Extracts the completion status from the Gst::Message.
+   * MT safe.
+   *
+   * @return whether the change is in progress or has been completed.
+   *
+   * Since 0.10.22.
+   */
+  bool parse_busy() const;
+};
+
+/** A request state message.
+ * See create() for more details.
+ */
+class MessageRequestState : public Message
+{
+public:
+  explicit MessageRequestState(GstMessage* castitem);
+
+  /** This message can be posted by elements when they want to have their
+   * state changed. A typical use case would be an audio server that wants to
+   * pause the pipeline because a higher priority stream is being played.
+   *
+   * @param src The object originating the message.
+   * @param state The new requested state.
+   * @return The new requst state message. MT safe.
+   *
+   * Since 0.10.23.
+   */
+  static Glib::RefPtr<Gst::Message>
+    create(const Glib::RefPtr<Gst::Object>& src, Gst::State state);
+
+  /** Extract the requested state from the request_state message.
+   * @return The state. MT safe.
+   *
+   * Since 0.10.23.
+   */
+  Gst::State parse() const;
+  _IGNORE(gst_message_parse_request_state)
+};
+
 //TODO: Include (by removing #if/#endif) when GStreamer 0.10.24 is released:
 #if 0
 /** A stream status message.



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