gnomemm r1507 - in gstreamermm/trunk: . gstreamer/src tools/m4



Author: murrayc
Date: Mon May 19 13:52:29 2008
New Revision: 1507
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1507&view=rev

Log:
2008-05-19  Murray Cumming  <murrayc murrayc com>

* gstreamer/src/bin.hg:
* gstreamer/src/buffer.hg:
* gstreamer/src/caps.ccg:
* gstreamer/src/caps.hg:
* gstreamer/src/childproxy.ccg:
* gstreamer/src/childproxy.hg:
* gstreamer/src/element.ccg:
* gstreamer/src/element.hg:
* tools/m4/convert_gst.m4: Some minor API cleanups.

Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/gstreamer/src/bin.hg
   gstreamermm/trunk/gstreamer/src/buffer.hg
   gstreamermm/trunk/gstreamer/src/caps.ccg
   gstreamermm/trunk/gstreamer/src/caps.hg
   gstreamermm/trunk/gstreamer/src/childproxy.ccg
   gstreamermm/trunk/gstreamer/src/childproxy.hg
   gstreamermm/trunk/gstreamer/src/element.ccg
   gstreamermm/trunk/gstreamer/src/element.hg
   gstreamermm/trunk/tools/m4/convert_gst.m4

Modified: gstreamermm/trunk/gstreamer/src/bin.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/bin.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/bin.hg	Mon May 19 13:52:29 2008
@@ -172,7 +172,9 @@
    */
   Glib::RefPtr<Bin> remove(const Glib::RefPtr<Element>& element);
 
-  //TODO: Just add a bool recurse_up = false parameter? 
+  //We could add a bool recurse_up = false parameter, 
+  //but get_element() and get_element_recurse_up() seem different enough to be separate.
+  //One recurses down and the other recurses up, so it's not just additional behaviour. 
   _WRAP_METHOD(Glib::RefPtr<Element> get_element(const Glib::ustring& name), gst_bin_get_by_name)
   _WRAP_METHOD(Glib::RefPtr<const Element> get_element(const Glib::ustring& name) const, gst_bin_get_by_name)
 

Modified: gstreamermm/trunk/gstreamer/src/buffer.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/buffer.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/buffer.hg	Mon May 19 13:52:29 2008
@@ -80,13 +80,16 @@
   //This is const because it always returns a new buffer:
   _WRAP_METHOD(Glib::RefPtr<Buffer> span(const guint32& offset, const Glib::RefPtr<Buffer>& other_buffer, const guint32& len) const, gst_buffer_span)
 
-  _WRAP_METHOD(Glib::RefPtr<Buffer> join(const Glib::RefPtr<Buffer>& other_buffer), gst_buffer_join)
+  //Hand-code this because the C function unrefs the input parameters? Can it be const?
+  //I asked in http://bugzilla.gnome.org/show_bug.cgi?id=533856
+  //Glib::RefPtr<Buffer> join(const Glib::RefPtr<Buffer>& other_buffer);
+  //_IGNORE(gst_buffer_join)
 
   //This is const because it always returns a new buffer:
   _WRAP_METHOD(Glib::RefPtr<Buffer> join(const Glib::RefPtr<Buffer>& other_buffer) const, gst_buffer_join)
 
-  //This is const because it always returns a new buffer: (TODO: though maybe not: see the documentation. murrayc)
-  _WRAP_METHOD(Glib::RefPtr<Buffer> merge(const Glib::RefPtr<Buffer>& other_buffer) const, gst_buffer_merge)
+  //This is const because it always returns a new buffer:
+  _WRAP_METHOD(Glib::RefPtr<Buffer> merge(const Glib::RefPtr<const Buffer>& other_buffer) const, gst_buffer_merge)
 
   /** Get the data element of this buffer.
    * @returns a pointer to the data element of this buffer.

Modified: gstreamermm/trunk/gstreamer/src/caps.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/caps.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/caps.ccg	Mon May 19 13:52:29 2008
@@ -76,9 +76,9 @@
 }
 
 //TODO: Want to return RefPtr to Caps but using RefPtr in expressions such
-//TODO: as 'caps->set_simple(name1, value1)->set_simple(name2, value2)' a
-//TODO: causes gstreamer Structure immutability warnings because the Caps is referenced
-//TODO: more than once in the expression
+// as 'caps->set_simple(name1, value1)->set_simple(name2, value2)' a
+// causes gstreamer Structure immutability warnings because the Caps is referenced
+// more than once in the expression
 /*
   This method is implemented in place of gst_caps_set_simple which is a
   variable argument function and cannot be wrapped.  We don't call

Modified: gstreamermm/trunk/gstreamer/src/caps.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/caps.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/caps.hg	Mon May 19 13:52:29 2008
@@ -46,7 +46,15 @@
  *
  * A Gst::Caps can be constructed with the following code fragment:
  *
- * TODO: Insert C++ translated code fragment from C API docs
+ * @code
+ * Glib::RefPtr<Gst::Caps> caps = Gst::Caps::create_simple("video/x-raw-yuv");
+ * //TODO: Add method overloads so we don't need to specify the type, and so we don't need to use Glib::Value:
+ * caps->set_simple("format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'));
+ * caps->set_simple("framerate", GST_TYPE_FRACTION, 25, 1,
+ * caps->set_simple("pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
+ * caps->set_simple("width", G_TYPE_INT, 320,
+ * caps->set_simple("height", G_TYPE_INT, 240)
+ * @endcode
  */
 class Caps 
 {
@@ -129,7 +137,7 @@
   _WRAP_METHOD(bool is_always_compatible(const Glib::RefPtr<Caps>& other_caps) const, gst_caps_is_always_compatible)
   _WRAP_METHOD(bool is_subset(const Glib::RefPtr<Caps>& superset_caps) const, gst_caps_is_subset)
 
-  //TODO: Rename as create_*()?
+  //TODO: get_*() is not very nice for these, but create_*() is for static create_*() by convention:
   //This is const (returns a non const) because it always creates a new instance:
   _WRAP_METHOD(Glib::RefPtr<Caps> get_intersect(const Glib::RefPtr<Caps>& other_caps) const, gst_caps_intersect)
 
@@ -137,18 +145,17 @@
   _WRAP_METHOD(Glib::RefPtr<Caps> get_union(const Glib::RefPtr<Caps>& other_caps) const, gst_caps_union)
 
   //This is const (returns a non const) because it always creates a new instance:
-  _WRAP_METHOD(Glib::RefPtr<Caps> normalize() const, gst_caps_normalize)
+  _WRAP_METHOD(Glib::RefPtr<Caps> get_normalize() const, gst_caps_normalize)
 
   _WRAP_METHOD(bool simplify(), gst_caps_do_simplify)
 
   //TODO: Add overloads (and dependency) for libxml++?
-  _WRAP_METHOD(xmlNodePtr save(const xmlNodePtr& parent) const, gst_caps_save_thyself)
-  _WRAP_METHOD(static Glib::RefPtr<Caps> load(xmlNodePtr parent), gst_caps_load_thyself)
+  _WRAP_METHOD(xmlNodePtr save(xmlNodePtr parent) const, gst_caps_save_thyself)
+  _WRAP_METHOD(static Glib::RefPtr<Caps> load(const xmlNodePtr parent), gst_caps_load_thyself)
 
   _WRAP_METHOD(Glib::ustring to_string() const, gst_caps_to_string)
 
- //TODO: Rename as create_*()?
-  _WRAP_METHOD(Glib::RefPtr<Caps> subtract(const Glib::RefPtr<const Caps>& subtrahend_caps), gst_caps_subtract)
+  _WRAP_METHOD(Glib::RefPtr<Caps> get_subtract(const Glib::RefPtr<const Caps>& subtrahend_caps) const, gst_caps_subtract)
   _WRAP_METHOD(Glib::RefPtr<Caps> make_writable(), gst_caps_make_writable)
   _WRAP_METHOD(void truncate(), gst_caps_truncate)
   

Modified: gstreamermm/trunk/gstreamer/src/childproxy.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/childproxy.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/childproxy.ccg	Mon May 19 13:52:29 2008
@@ -28,22 +28,12 @@
   return Glib::wrap(gobj(), true);
 }
 
-void ChildProxy::get_proxy_valist(const Glib::ustring& first_prop_name, va_list& var_args)
-{
-  gst_child_proxy_get_valist(GST_OBJECT(gobj()), first_prop_name.c_str(), var_args);
-}
-
 Glib::RefPtr<ChildProxy> ChildProxy::set_proxy_property(const Glib::ustring& name, const Glib::ValueBase& value)
 {
   gst_child_proxy_set_property(GST_OBJECT(gobj()), name.c_str(), value.gobj());
   return Glib::wrap(gobj(), true);
 }
 
-void ChildProxy::set_proxy_valist(const Glib::ustring& first_prop_name, const va_list& var_args)
-{
-  gst_child_proxy_set_valist(GST_OBJECT(gobj()), first_prop_name.c_str(), const_cast<va_list&>(var_args));
-}
-
 void ChildProxy::child_added(const Glib::RefPtr<Gst::Object>& child)
 {
   gst_child_proxy_child_added(GST_OBJECT(gobj()), child->gobj());

Modified: gstreamermm/trunk/gstreamer/src/childproxy.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/childproxy.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/childproxy.hg	Mon May 19 13:52:29 2008
@@ -62,12 +62,8 @@
    */
   Glib::RefPtr<ChildProxy> get_proxy_property(const Glib::ustring& name, Glib::ValueBase& value);
 
-  /** Gets properties of the parent object and its children.
-   * @param first_prop_name Name of the first property to get
-   * @param var_args return Location for the first property, followed
-   * optionally by more name/return location pairs, followed by NULL
-   */
-  void get_proxy_valist(const Glib::ustring& first_prop_name, va_list& var_args);
+  //This doesn't seem useful: void get_proxy_valist(const Glib::ustring& first_prop_name, va_list& var_args);
+  _IGNORE(gst_child_proxy_get_proxy_valist)
 
   /** Sets a single property using the Gst::ChildProxy mechanism.
    * @param name The property to get
@@ -76,12 +72,8 @@
    */
   Glib::RefPtr<ChildProxy> set_proxy_property(const Glib::ustring& name, const Glib::ValueBase& value);
 
-  /** Sets properties of the parent object and its children.
-   * @param first_prop_name Name of the first property to set
-   * @param var_args Value for the first property, followed optionally by more
-   * name/value pairs, followed by NULL
-   */
-  void set_proxy_valist(const Glib::ustring& first_prop_name, const va_list& var_args);
+  //This doesn't seem useful: void set_proxy_valist(const Glib::ustring& first_prop_name, const va_list& var_args);
+  _IGNORE(gst_child_proxy_set_proxy_valist)
 
   /** Emits the "child-added" signal.
    * @param child The newly added child

Modified: gstreamermm/trunk/gstreamer/src/element.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/element.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/element.ccg	Mon May 19 13:52:29 2008
@@ -38,8 +38,7 @@
 namespace Gst
 {
 
-void ElementInterfaced_WeakNotify_gstreamermm_callback(void* data,
-GObject* where_the_object_was)
+void ElementInterfaced_WeakNotify_gstreamermm_callback(void* data, GObject* where_the_object_was)
 {
   delete (Gst::Element*) data;
 }
@@ -54,14 +53,14 @@
   return gst_element_state_change_return_get_name(GstStateChangeReturn(s));
 }
 
-Glib::RefPtr<Element> Element::link(const Glib::RefPtr<Element>& other_element)
+Glib::RefPtr<Element> Element::link(const Glib::RefPtr<Element>& dest)
 {
-  bool result = gst_element_link(gobj(), other_element->gobj());
+  const bool result = gst_element_link(gobj(), dest->gobj());
 
   if(result)
-    return other_element;
+    return dest;
   else
-    throw std::runtime_error("failed to link: " + get_name() + "->" + other_element->get_name());
+    throw std::runtime_error("failed to link: " + get_name() + "->" + dest->get_name());
 }
 
 Glib::RefPtr<Pad> Element::get_compatible_pad(const Glib::RefPtr<Pad>& pad, const Glib::RefPtr<Caps>& caps)

Modified: gstreamermm/trunk/gstreamer/src/element.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/element.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/element.hg	Mon May 19 13:52:29 2008
@@ -126,38 +126,54 @@
   _CTOR_DEFAULT
 
 public:
-  /** TODO: Documentation
+
+  /** Links this source element to the @dest element.
+   * The link must be from source to destination - the other direction will not be tried. 
+   * The function looks for existing pads that aren't linked yet. It will request new pads
+   * if necessary. Such pads need to be released manually when unlinking. 
+   * If multiple links are possible, only one is established.
+   *
+   * Make sure you have added your elements to a bin or pipeline with Gst::Bin::add() before 
+   * trying to link them.
    *
-   * @throws std::runtime_error
+   * @throws std::runtime_error If the elements could not be linked.
    */
-  Glib::RefPtr<Element> link(const Glib::RefPtr<Element>& other_element);
+  Glib::RefPtr<Element> link(const Glib::RefPtr<Element>& dest);
 
   _WRAP_METHOD(bool add_pad(const Glib::RefPtr<Pad>& pad), gst_element_add_pad)
 
   //TODO: Remove this (and make sure it is really deprecated in the C API),
   //because the C API says it should not be used because it has unclear refcounting:
+  //I asked for that in http://bugzilla.gnome.org/show_bug.cgi?id=533865
   _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)
 
   //TODO: If these get* functions are creators, then maybe rename to create*()? murrayc
+  //TODO: Can these be const?
   Glib::RefPtr<Pad> get_compatible_pad(const Glib::RefPtr<Pad>& pad, const Glib::RefPtr<Caps>& caps);
   Glib::RefPtr<PadTemplate> get_compatible_pad_template(const Glib::RefPtr<PadTemplate>& padtemplate);
 
+  //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)
+
   _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)
   _WRAP_METHOD(bool remove_pad(const Glib::RefPtr<Pad>& pad), gst_element_remove_pad)
  
   _WRAP_METHOD(void unlink(const Glib::RefPtr<Element>& other_element), gst_element_unlink)
 
+  //TODO: Make this like link()?
   _WRAP_METHOD(bool link_pads(const Glib::ustring& padname, const Glib::RefPtr<Element>& other_element, const Glib::ustring& others_padname), gst_element_link_pads)
 
   _WRAP_METHOD(void unlink_pads(const Glib::ustring& padname, const Glib::RefPtr<Element>& other_element, const Glib::ustring& other_padname), gst_element_unlink_pads)
 
+  //TODO: Make this like link()?
   _WRAP_METHOD(bool link_pads_filtered(const Glib::ustring& padname, const Glib::RefPtr<Element>& other_element, const Glib::ustring& others_padname, const Glib::RefPtr<Caps>& filter), gst_element_link_pads_filtered)
 
+  //TODO: Make this like link()?
+
   _WRAP_METHOD(bool link_filtered(const Glib::RefPtr<Element>& other_element, const Glib::RefPtr<Caps>& filter), gst_element_link_filtered)
   _WRAP_METHOD(void set_base_time(ClockTime time), gst_element_set_base_time)
   _WRAP_METHOD(ClockTime get_base_time() const, gst_element_get_base_time)

Modified: gstreamermm/trunk/tools/m4/convert_gst.m4
==============================================================================
--- gstreamermm/trunk/tools/m4/convert_gst.m4	(original)
+++ gstreamermm/trunk/tools/m4/convert_gst.m4	Mon May 19 13:52:29 2008
@@ -166,7 +166,7 @@
 _CONVERSION(`const gchar*',`const Glib::ustring&',__GCHARP_TO_USTRING)
 
 #Other Conversions
-_CONVERSION(`const xmlNodePtr&',`xmlNodePtr',`$3')
+_CONVERSION(`const xmlNodePtr',`xmlNodePtr',`const_cast<xmlNodePtr>($3)')
 
 #############################Enums####################################
 



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