gnomemm r1697 - in gstreamermm/trunk: . gstreamer/gstreamermm gstreamer/src



Author: jaalburqu
Date: Thu Sep 11 01:55:47 2008
New Revision: 1697
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1697&view=rev

Log:
2008-09-10  Josà Alburquerque  <jaalburqu svn gnome org>

	* gstreamer/gstreamermm/miniobject.cc:
	* gstreamer/gstreamermm/miniobject.h: Added get_flags(), flag_is_set()
	flag_set() and flag_unset().  Uncommented copy().  Included comments
	in docs about how copying works with Gst::MiniObjects.

	* gstreamer/src/buffer.ccg:
	* gstreamer/src/buffer.hg:
	* gstreamer/src/gst_others.defs: Removed *flag() methods (which are
	already defined in Gst::MiniObject).  Handwrote and renamed
	make_writable() to create_writable() as in Gst::MiniObject.

	* gstreamer/src/message.ccg:
	* gstreamer/src/message.hg:
	* gstreamer/src/query.ccg:
	* gstreamer/src/query.hg:
	* gstreamer/src/event.ccg:
	* gstreamer/src/event.hg: Added copy() and create_writable() methods. 

	* gstreamer/src/bin.hg: Renamed find_unconnected_pad() to
	find_unlinked_pad() and used gst_bin_find_unlinked_pad() instead of
	gst_bin_find_unconnected_pad() which is deprecated.

	* gstreamer/gstreamermm/object.h:
	* gstreamer/src/element.hg:
	* gstreamer/src/interface.hg:
	* gstreamer/src/pad.hg:
	* gstreamer/src/xml.hg: Typos and some _IGNOREs.

Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/gstreamer/gstreamermm/miniobject.cc
   gstreamermm/trunk/gstreamer/gstreamermm/miniobject.h
   gstreamermm/trunk/gstreamer/gstreamermm/object.h
   gstreamermm/trunk/gstreamer/src/bin.hg
   gstreamermm/trunk/gstreamer/src/buffer.ccg
   gstreamermm/trunk/gstreamer/src/buffer.hg
   gstreamermm/trunk/gstreamer/src/element.hg
   gstreamermm/trunk/gstreamer/src/event.ccg
   gstreamermm/trunk/gstreamer/src/event.hg
   gstreamermm/trunk/gstreamer/src/gst_others.defs
   gstreamermm/trunk/gstreamer/src/interface.hg
   gstreamermm/trunk/gstreamer/src/message.ccg
   gstreamermm/trunk/gstreamer/src/message.hg
   gstreamermm/trunk/gstreamer/src/pad.hg
   gstreamermm/trunk/gstreamer/src/query.ccg
   gstreamermm/trunk/gstreamer/src/query.hg
   gstreamermm/trunk/gstreamer/src/xml.hg

Modified: gstreamermm/trunk/gstreamer/gstreamermm/miniobject.cc
==============================================================================
--- gstreamermm/trunk/gstreamer/gstreamermm/miniobject.cc	(original)
+++ gstreamermm/trunk/gstreamer/gstreamermm/miniobject.cc	Thu Sep 11 01:55:47 2008
@@ -76,21 +76,32 @@
   gst_mini_object_unref(gobject_);
 }
 
-// TODO: Investigate how this works:
-// As far as I can tell, derived types must implement a
-// GstMiniObjectCopyFunction in a class structure.
-// gst_mini_object_class_init() sets the (*GstMiniObjectCopyFunction)(...)
-// to gst_mini_object_copy_default() which does nothing, but derived
-// types (like GstQuery, etc) have their own functions (like
-// gst_query_copy()) which do work. Jose
-/*
+guint MiniObject::get_flags() const
+{
+  return GST_MINI_OBJECT_FLAGS(gobj());
+}
+
+bool MiniObject::flag_is_set(guint flag) const
+{
+  return GST_MINI_OBJECT_FLAG_IS_SET(gobj(), flag);
+}
+
+void MiniObject::flag_set(guint flag)
+{
+  GST_MINI_OBJECT_FLAG_SET(gobj(), flag);
+}
+
+void MiniObject::flag_unset(guint flag)
+{
+  GST_MINI_OBJECT_FLAG_UNSET(gobj(), flag);
+}
+
 Glib::RefPtr<Gst::MiniObject>
-MiniObject::copy()
+MiniObject::copy() const
 {
   GstMiniObject * copy = gst_mini_object_copy(gobject_);
-  return Glib::wrap(copy, false);
+  return Gst::wrap(copy, false);
 }
-*/
 
 bool
 MiniObject::is_writable() const

Modified: gstreamermm/trunk/gstreamer/gstreamermm/miniobject.h
==============================================================================
--- gstreamermm/trunk/gstreamer/gstreamermm/miniobject.h	(original)
+++ gstreamermm/trunk/gstreamer/gstreamermm/miniobject.h	Thu Sep 11 01:55:47 2008
@@ -55,13 +55,57 @@
   //because it's just an equivalent for g_object_new(), 
   //which is just an equivalent for C++'s new(). 
 
-//private:
+//protected:
   // noncopyable
+  /** A copy constructor.  Please note that copying is actually only supported
+   * in sub-classes that define their own custom copy function in the C API
+   * such as Gst::Event, Gst::Buffer, etc. otherwise the copy is not
+   * successful and a warning is issued.
+   */
   MiniObject(const MiniObject&);
+
+  /** Assignment operator.  Please note that copying is actually only
+   * supported in sub-classes that define their own custom copy function in
+   * the C API such as Gst::Event, Gst::Buffer, etc. otherwise the copy
+   * is not successful and a warning is issued.
+   */
   MiniObject& operator=(const MiniObject&);
 
 public:
-  //Glib::RefPtr<Gst::MiniObject> copy();
+  /** Returns the entire set of flags for the mini-object.
+   * @return The Gst::MiniObject flags.
+   */
+  guint get_flags() const;
+
+  /** Checks to see if the given flag is set.
+
+   * @param flag The flag to check for.
+   */
+  bool flag_is_set(guint flag) const;
+
+  /** Sets the given bits.
+   * @param flag The flag to set, can by any number of bits in guint32. 
+   */
+  void flag_set(guint flag);
+
+  /** Unsets the given bits.
+   * @param flag The flag to unset, must be a single bit in guint32. 
+   */
+  void flag_unset(guint flag);
+
+  /** Creates a copy of the mini-object.  Please note that copying is
+   * supported only by sub-classes of Gst::MiniObject such as Gst::Event,
+   * Gst::Buffer, etc. that define their own custom copy function in the C API
+   * and not directly by Gst::MiniObject, a base class.  If used from only a
+   * Gst::MiniObject instance and not a sub-class instance the copy is not
+   * successful and a warning is issued.
+   *
+   * MT safe.
+   *
+   * @return A copy of the mini-object or warn if this object is only a
+   * Gst::MiniObject and not a sub-class that defines its own copy function.
+   */
+  Glib::RefPtr<Gst::MiniObject> copy() const;
 
   /** Checks if a mini-object is writable. A mini-object is writable if the
    * reference count is one and the Gst::MINI_OBJECT_FLAG_READONLY flag is not

Modified: gstreamermm/trunk/gstreamer/gstreamermm/object.h
==============================================================================
--- gstreamermm/trunk/gstreamer/gstreamermm/object.h	(original)
+++ gstreamermm/trunk/gstreamer/gstreamermm/object.h	Thu Sep 11 01:55:47 2008
@@ -206,7 +206,7 @@
 
   /** Saves object into the parent XML node.
    * @param parent The parent XML node to save object into.
-   * @return The new xmlpp::Node pointer with the saved object
+   * @return The new xmlpp::Node pointer with the saved object.
    */
   xmlpp::Node* save_thyself(xmlpp::Node* parent) const;
 

Modified: gstreamermm/trunk/gstreamer/src/bin.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/bin.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/bin.hg	Thu Sep 11 01:55:47 2008
@@ -186,8 +186,10 @@
   _WRAP_METHOD(Glib::RefPtr<Element> get_element(GType interface), gst_bin_get_by_interface)
   _WRAP_METHOD(Glib::RefPtr<const Element> get_element(GType interface) const, gst_bin_get_by_interface)
 
-  _WRAP_METHOD(Glib::RefPtr<Pad> find_unconnected_pad(PadDirection dir), gst_bin_find_unconnected_pad)
-  _WRAP_METHOD(Glib::RefPtr<const Pad> find_unconnected_pad(PadDirection dir) const, gst_bin_find_unconnected_pad)
+  _WRAP_METHOD(Glib::RefPtr<Pad> find_unlinked_pad(PadDirection dir), gst_bin_find_unlinked_pad)
+  _WRAP_METHOD(Glib::RefPtr<const Pad> find_unlinked_pad(PadDirection dir) const, gst_bin_find_unlinked_pad)
+  _IGNORE(gst_bin_find_unconnected_pad)
+
   _WRAP_METHOD(Iterator<Element> iterate_elements(), gst_bin_iterate_elements)
   _WRAP_METHOD(Iterator<Element> iterate_recurse(), gst_bin_iterate_recurse)
   _WRAP_METHOD(Iterator<Element> iterate_sorted(), gst_bin_iterate_sorted)

Modified: gstreamermm/trunk/gstreamer/src/buffer.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/buffer.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/buffer.ccg	Thu Sep 11 01:55:47 2008
@@ -24,3 +24,18 @@
 #include <gst/gstenumtypes.h>
 
 _PINCLUDE(gstreamermm/private/miniobject_p.h)
+
+namespace Gst
+{
+
+Glib::RefPtr<Buffer> Buffer::copy() const
+{
+  return Gst::wrap(gst_buffer_copy(gobj()));
+}
+
+Glib::RefPtr<Buffer> Buffer::create_writable()
+{
+  return Gst::wrap(gst_buffer_make_writable(gobj()));
+}
+
+} // namespace Gst

Modified: gstreamermm/trunk/gstreamer/src/buffer.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/buffer.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/buffer.hg	Thu Sep 11 01:55:47 2008
@@ -53,19 +53,23 @@
   _WRAP_METHOD(static Glib::RefPtr<Buffer> create(), gst_buffer_new)
   _WRAP_METHOD(static Glib::RefPtr<Buffer> create(guint size), gst_buffer_try_new_and_alloc)
 
-  _WRAP_METHOD(guint get_flags() const, GST_BUFFER_FLAGS)
-  _WRAP_METHOD(bool is_set_flag(BufferFlag flag) const, GST_BUFFER_FLAG_IS_SET)
-  _WRAP_METHOD(void set_flag(BufferFlag flag), GST_BUFFER_FLAG_SET)
-  _WRAP_METHOD(void unset_flag(BufferFlag flag), GST_BUFFER_FLAG_UNSET)
-
-  _WRAP_METHOD(Glib::RefPtr<Buffer> copy() const, gst_buffer_copy)
+  /** Create a copy of the given buffer. This will also make a newly allocated
+   * copy of the data the source buffer contains.
+   * @return The Gst::Buffer copy.
+   */
+  Glib::RefPtr<Buffer> copy() const;
 
   _WRAP_METHOD(void copy_metadata(const Glib::RefPtr<Buffer>& source_buffer, BufferCopyFlags flags), gst_buffer_copy_metadata)
 
   _WRAP_METHOD(bool is_metadata_writable() const, gst_buffer_is_metadata_writable)
 
   //This is not const because it sometimes returns the same buffer:
-  _WRAP_METHOD(Glib::RefPtr<Buffer> make_writable(), gst_buffer_make_writable)
+  /** Makes a writable buffer from the given buffer. If the source buffer is
+   * already writable, this will simply return the same buffer. A copy will
+   * otherwise be made.
+   * @return A buffer (possibly the same pointer) that is writable.
+   */
+  Glib::RefPtr<Buffer> create_writable();
 
   //This is const because it always returns a new buffer:
   _WRAP_METHOD(Glib::RefPtr<Buffer> make_metadata_writable() const, gst_buffer_make_metadata_writable)

Modified: gstreamermm/trunk/gstreamer/src/element.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/element.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/element.hg	Thu Sep 11 01:55:47 2008
@@ -99,8 +99,9 @@
  * source) pads.  Core and plug-in writers can add and remove pads with
  * add_pad() and remove_pad().
  *
- * A pad of an element can be retrieved by name with get_pad(). An iterator of
- * all pads can be retrieved with iterate_pads().
+ * A pad of an element can be retrieved by name with get_request_pad() or
+ * get_static_pad(). An iterator of all pads can be retrieved with
+ * iterate_pads().
  *
  * Gst::Elements can be linked through their pads. Use the link() function to
  * link elements. Use link_filtered() to link two elements constrained by a
@@ -157,6 +158,7 @@
   //TODO: The documentation says "The pad should be released with gst_element_release_request_pad().", which is odd. murrayc
   _WRAP_METHOD(Glib::RefPtr<Pad> get_request_pad(const Glib::ustring& name), gst_element_get_request_pad)
   _WRAP_METHOD(Glib::RefPtr<Pad> get_static_pad(const Glib::ustring& name), gst_element_get_static_pad)
+  _IGNORE(gst_element_get_pad)
 
   _WRAP_METHOD(void no_more_pads(), gst_element_no_more_pads)
   _WRAP_METHOD(void release_request_pad(const Glib::RefPtr<Pad>& pad), gst_element_release_request_pad)

Modified: gstreamermm/trunk/gstreamer/src/event.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/event.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/event.ccg	Thu Sep 11 01:55:47 2008
@@ -42,6 +42,11 @@
 
 } //namespace Enums
 
+Glib::RefPtr<Event> Event::copy() const
+{
+  return Gst::wrap(gst_event_copy(gobj()));
+}
+
 Structure Event::get_structure() const
 {
   static Structure structure;
@@ -50,6 +55,12 @@
   return Structure(gst_structure, true /* take_copy */);
 }
 
+Glib::RefPtr<Event> Event::create_writable()
+{
+  return
+   Gst::wrap(GST_EVENT(gst_mini_object_make_writable(GST_MINI_OBJECT(gobj()))));
+}
+
 bool Event::is_downstream() const
 {
   return GST_EVENT_IS_DOWNSTREAM(gobj());

Modified: gstreamermm/trunk/gstreamer/src/event.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/event.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/event.hg	Thu Sep 11 01:55:47 2008
@@ -123,11 +123,22 @@
    */
   static Glib::RefPtr<Event> wrap(GstEvent* event, bool take_copy=false);
 
+  /** Copy the event using the event specific copy function.
+   * @return The Gst::Event copy.
+   */
+  Glib::RefPtr<Event> copy() const;
+
   /** Get the structure of an event.
    * @return The Gst::Structure of the event.
    */
   Structure get_structure() const;
 
+  /** Checks if an event is writable.  If not, a writable copy is made and
+   * returned.
+   * @return A Gst::Event (possibly the same pointer) that is writable. 
+   */
+  Glib::RefPtr<Event> create_writable();
+
   /** Check if an event can travel downstream.
    */
   bool is_downstream() const;

Modified: gstreamermm/trunk/gstreamer/src/gst_others.defs
==============================================================================
--- gstreamermm/trunk/gstreamer/src/gst_others.defs	(original)
+++ gstreamermm/trunk/gstreamer/src/gst_others.defs	Thu Sep 11 01:55:47 2008
@@ -1,9 +1,3 @@
-(define-method copy
-  (of-object "GstBuffer")
-  (c-name "gst_buffer_copy")
-  (return-type "GstBuffer*")
-)
-
 (define-method copy_metadata
   (of-object "GstBuffer")
   (c-name "gst_buffer_copy_metadata")
@@ -14,45 +8,6 @@
   )
 )
 
-(define-method flags
-  (of-object "GstBuffer")
-  (c-name "GST_BUFFER_FLAGS")
-  (return-type "guint")
-)
-
-(define-method flag_is_set
-  (of-object "GstBuffer")
-  (c-name "GST_BUFFER_FLAG_IS_SET")
-  (return-type "gboolean")
-  (parameters
-    '("GstBufferFlag" "flag")
-  )
-)
-
-(define-method flag_set
-  (of-object "GstBuffer")
-  (c-name "GST_BUFFER_FLAG_SET")
-  (return-type "void")
-  (parameters
-    '("GstBufferFlag" "flag")
-  )
-)
-
-(define-method flag_unset
-  (of-object "GstBuffer")
-  (c-name "GST_BUFFER_FLAG_UNSET")
-  (return-type "void")
-  (parameters
-    '("GstBufferFlag" "flag")
-  )
-)
-
-(define-method make_writable
-  (of-object "GstBuffer")
-  (c-name "gst_buffer_make_writable")
-  (return-type "GstBuffer*")
-)
-
 (define-method is_readable
   (of-object "GstIndex")
   (c-name "GST_INDEX_IS_READABLE")

Modified: gstreamermm/trunk/gstreamer/src/interface.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/interface.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/interface.hg	Thu Sep 11 01:55:47 2008
@@ -97,7 +97,6 @@
           gst_element_get_query_types,
           gst_element_get_static_pad,
           gst_element_link_pads)
-
 };
 
 #ifndef DOXYGEN_SHOULD_SKIP_THIS

Modified: gstreamermm/trunk/gstreamer/src/message.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/message.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/message.ccg	Thu Sep 11 01:55:47 2008
@@ -42,6 +42,11 @@
 
 } //namespace Enums
 
+Glib::RefPtr<Message> Message::copy() const
+{
+  return Gst::wrap(gst_message_copy(gobj()));
+}
+
 Structure Message::get_structure() const
 {
   static Structure structure;
@@ -50,6 +55,11 @@
   return Structure(gst_structure, true /* take_copy */);
 }
 
+Glib::RefPtr<Message> Message::create_writable()
+{
+  return Gst::wrap(gst_message_make_writable(gobj()));
+}
+
 MessageEos::MessageEos(GstMessage* castitem)
 : Message(castitem)
 {

Modified: gstreamermm/trunk/gstreamer/src/message.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/message.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/message.hg	Thu Sep 11 01:55:47 2008
@@ -64,12 +64,22 @@
  _CLASS_GSTMINIOBJECT(Message, GstMessage, GST_MESSAGE, Gst::MiniObject, GstMiniObject)
  _IGNORE(gst_message_ref, gst_message_unref)
 public:
+  /** Creates a copy of the message.  MT safe.
+   * @return A copy of the message.
+   */
+   Glib::RefPtr<Message> copy() const;
 
   /** Get the structure of a message.
    * @return The Gst::Structure of the message.
    */
   Structure get_structure() const;
 
+  /** Checks if a message is writable. If not, a writable copy is made and
+   * returned.
+   * @return A Gst::Message (possibly the same pointer) that is writable.
+   */
+   Glib::RefPtr<Message> create_writable();
+
 public:
   /** Wrap a GstMessage* in a C++ instance, creating an instance of a
    *  derived Gst::Message.  Gst::wrap() would just create a Gst::Message
@@ -78,8 +88,17 @@
    */
   static Glib::RefPtr<Message> wrap(GstMessage* message, bool take_copy=false);
 
+  /** Get the GstMessageType of message.
+   */
   _MEMBER_GET(message_type, type, MessageType, GstMessageType)
+
+  /** Get the timestamp of message. This is the timestamp when the message was
+   * created.
+   */
   _MEMBER_GET(timestamp, timestamp, ClockTime, guint64)
+
+  /** Get the object that posted the message.
+   */
   _MEMBER_GET_GOBJECT(source, src, Gst::Object, GstObject*)
 };
 

Modified: gstreamermm/trunk/gstreamer/src/pad.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/pad.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/pad.hg	Thu Sep 11 01:55:47 2008
@@ -277,7 +277,8 @@
 	  gst_pad_set_query_type_function, gst_pad_set_checkgetrange_function,
 	  gst_pad_set_link_function, gst_pad_set_query_function,
 	  gst_pad_set_fixatecaps_function,gst_pad_set_chain_function,
-	  gst_pad_set_internal_link_function, gst_pad_get_pad_template_caps)
+	  gst_pad_set_internal_link_function, gst_pad_get_pad_template_caps,
+          gst_pad_get_fixed_caps_func)
 
 
 #m4 _CONVERSION(`GstPad*',`const Glib::RefPtr<Pad>&',`Glib::wrap($3, true)')

Modified: gstreamermm/trunk/gstreamer/src/query.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/query.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/query.ccg	Thu Sep 11 01:55:47 2008
@@ -59,6 +59,16 @@
 
 } //namespace Enums
 
+Glib::RefPtr<Query> Query::copy() const
+{
+  return Gst::wrap(gst_query_copy(gobj()));
+}
+
+Glib::RefPtr<Query> Query::create_writable()
+{
+  return Gst::wrap(gst_query_make_writable(gobj()));
+}
+
 Structure Query::get_structure() const
 {
   GstStructure* gst_structure = const_cast<GstStructure*>(gst_query_get_structure(const_cast<GstQuery*>(gobj())));

Modified: gstreamermm/trunk/gstreamer/src/query.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/query.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/query.hg	Thu Sep 11 01:55:47 2008
@@ -115,6 +115,16 @@
   _CLASS_GSTMINIOBJECT(Query, GstQuery, GST_QUERY, Gst::MiniObject, GstMiniObject)
 
 public:
+  /** Copies the given query using the query copy function.
+   * @return The Gst::Query copy.
+   */
+   Glib::RefPtr<Query> copy() const;
+
+   /** Makes a writable query from the given query.  Does exactly what
+    * Gst::MiniObject::create_writable() does for the Gst::Query.
+    * @return A Gst::Query (possibly the same pointer) that is writable.
+    */
+   Glib::RefPtr<Query> create_writable();
 
   /** Get the structure of a query.
    * @return The Structure of the query.

Modified: gstreamermm/trunk/gstreamer/src/xml.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/xml.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/xml.hg	Thu Sep 11 01:55:47 2008
@@ -59,7 +59,7 @@
    * open output stream.
    *
    * @param element The element to write out.
-   * @param out an open std::ostream, like std::cout.
+   * @param out An open std::ostream, like std::cout.
    */
   static void write_to_stream(const Glib::RefPtr<Element>& element, std::ostream& out);
 



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