[gstreamermm] Added Gst::Bin::add_ghost_pad() to add a ghost pad to bin from an element's static pad.



commit 6dbf1327be936a66391c280169c18a52928c7587
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Thu Jul 30 15:15:34 2009 -0400

    Added Gst::Bin::add_ghost_pad() to add a ghost pad to bin from an element's static pad.

 ChangeLog             |    6 ++++++
 gstreamer/src/bin.ccg |   12 ++++++++++++
 gstreamer/src/bin.hg  |   11 +++++++++++
 3 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 638f4c0..2001350 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2009-07-30  José Alburquerque  <jaalburqu svn gnome org>
 
+	* gstreamer/src/bin.ccg:
+	* gstreamer/src/bin.hg: Added Gst::Bin::add_ghost_pad() to add a ghost
+	pad to bin from an element's static pad.
+
+2009-07-30  José Alburquerque  <jaalburqu svn gnome org>
+
 	* gstreamer/src/ghostpad.ccg:
 	* gstreamer/src/ghostpad.hg: Modify Gst::GhostPad constructors to not
 	require a name for the pads.
diff --git a/gstreamer/src/bin.ccg b/gstreamer/src/bin.ccg
index 0f4b806..6bfb6c4 100644
--- a/gstreamer/src/bin.ccg
+++ b/gstreamer/src/bin.ccg
@@ -21,6 +21,7 @@
 #include <gst/gstbin.h>
 #include <gst/gstutils.h>
 #include <gstreamermm/pad.h>
+#include <gstreamermm/ghostpad.h>
 #include <gstreamermm/iterator.h>
 
 #ifndef GLIBMM_EXCEPTIONS_ENABLED
@@ -80,6 +81,17 @@ Glib::RefPtr<Gst::Bin> Bin::remove(const Glib::RefPtr<Gst::Element>& element)
   return Glib::wrap(gobj(), true);
 }
 
+Glib::RefPtr<Gst::GhostPad> Bin::add_ghost_pad(const
+  Glib::RefPtr<Gst::Element>& element, const Glib::ustring& pad_name, const
+  Glib::ustring& name)
+{
+  Glib::RefPtr<Gst::Pad> static_pad = element->get_static_pad(pad_name);
+  Glib::RefPtr<Gst::GhostPad> ghost_pad = Gst::GhostPad::create(static_pad,
+    name);
+  add_pad(ghost_pad);
+  return ghost_pad;
+}
+
 void Bin::handle_error(const Glib::ustring& message)
 {
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
diff --git a/gstreamer/src/bin.hg b/gstreamer/src/bin.hg
index ea39d98..81679d6 100644
--- a/gstreamer/src/bin.hg
+++ b/gstreamer/src/bin.hg
@@ -27,6 +27,7 @@ namespace Gst
 {
 
 class Pad;
+class GhostPad;
 
 //Gst::Iterator<> forward declaration.
 template <class CppType>
@@ -194,6 +195,16 @@ public:
   _WRAP_METHOD(Glib::RefPtr<Gst::Element> get_element(GType interface), gst_bin_get_by_interface)
   _WRAP_METHOD(Glib::RefPtr<const Gst::Element> get_element(GType interface) const, gst_bin_get_by_interface, constversion)
 
+  /** Adds a ghost pad to the bin using an element's static pad as a target.
+   * @param element The element with the target static pad.
+   * @param pad_name The static pad to use as the target.
+   * @param name An optional name for the ghost pad.
+   * @return The newly created Gst::GhostPad.
+   */
+  Glib::RefPtr<Gst::GhostPad> add_ghost_pad(const Glib::RefPtr<Gst::Element>&
+    element, const Glib::ustring& pad_name, const Glib::ustring& name =
+    Glib::ustring());
+
   _WRAP_METHOD(Glib::RefPtr<Gst::Pad> find_unlinked_pad(PadDirection dir), gst_bin_find_unlinked_pad)
   _WRAP_METHOD(Glib::RefPtr<const Gst::Pad> find_unlinked_pad(PadDirection dir) const, gst_bin_find_unlinked_pad, constversion)
   _IGNORE(gst_bin_find_unconnected_pad)



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