[gstreamermm] Modify Gst::GhostPad constructors to not require a name for the pads.
- From: José Alburquerque <jaalburqu src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gstreamermm] Modify Gst::GhostPad constructors to not require a name for the pads.
- Date: Thu, 30 Jul 2009 18:43:34 +0000 (UTC)
commit b85c1422d54360f2922a1f74139d4d148630afaa
Author: José Alburquerque <jaalburqu svn gnome org>
Date: Thu Jul 30 12:50:03 2009 -0400
Modify Gst::GhostPad constructors to not require a name for the pads.
ChangeLog | 7 +++++++
gstreamer/src/ghostpad.ccg | 30 ++++++++++++++++--------------
gstreamer/src/ghostpad.hg | 39 +++++++++++++++++++++++----------------
tests/test-ghost-pad.cc | 8 ++++----
4 files changed, 50 insertions(+), 34 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 336bf70..638f4c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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.
+ * tests/test-ghost-pad.cc: Exemplify usage in test.
+
2009-07-29 José Alburquerque <jaalburqu svn gnome org>
* gstreamer/gstreamermm.h:
diff --git a/gstreamer/src/ghostpad.ccg b/gstreamer/src/ghostpad.ccg
index 6f9ed33..1ce915a 100644
--- a/gstreamer/src/ghostpad.ccg
+++ b/gstreamer/src/ghostpad.ccg
@@ -31,9 +31,9 @@ _PINCLUDE(gstreamermm/private/pad_p.h)
namespace Gst
{
-GhostPad::GhostPad(const Glib::ustring& name,
- const Glib::RefPtr<Gst::Pad>& target)
- : _CONSTRUCT("name", name.c_str(),
+GhostPad::GhostPad(const Glib::RefPtr<Gst::Pad>& target,
+ const Glib::ustring& name)
+ : _CONSTRUCT("name", (name.empty() ? 0 : name.c_str()),
"direction",
((target) ? ((GstPadDirection) target->get_direction()) : GST_PAD_UNKNOWN))
{
@@ -52,8 +52,9 @@ GhostPad::GhostPad(const Glib::ustring& name,
}
}
-GhostPad::GhostPad(const Glib::ustring& name, PadDirection direction)
- : _CONSTRUCT("name", name.c_str(), "direction", (GstPadDirection) direction)
+GhostPad::GhostPad( PadDirection direction, const Glib::ustring& name)
+ : _CONSTRUCT("name", (name.empty() ? 0 : name.c_str()),
+ "direction", (GstPadDirection) direction)
{
if(!gst_ghost_pad_construct(gobj()))
{
@@ -66,12 +67,13 @@ GhostPad::GhostPad(const Glib::ustring& name, PadDirection direction)
}
}
-GhostPad::GhostPad(const Glib::ustring& name,
- const Glib::RefPtr<Gst::Pad>& target,
- const Glib::RefPtr<Gst::PadTemplate>& templ)
- : _CONSTRUCT("name", name.c_str(), "direction",
- ((target) ? ((GstPadDirection) target->get_direction()) : GST_PAD_UNKNOWN),
- "template", ((templ) ? templ->gobj() : 0))
+GhostPad::GhostPad( const Glib::RefPtr<Gst::Pad>& target,
+ const Glib::RefPtr<Gst::PadTemplate>& templ,
+ const Glib::ustring& name)
+ : _CONSTRUCT("name", (name.empty() ? 0 : name.c_str()),
+ "direction",
+ ((target) ? ((GstPadDirection) target->get_direction()) : GST_PAD_UNKNOWN),
+ "template", ((templ) ? templ->gobj() : 0))
{
if(!target || !templ)
handle_error("Gst::GhostPad::GhostPad(const Glib::ustring&,"
@@ -90,9 +92,9 @@ GhostPad::GhostPad(const Glib::ustring& name,
}
}
-GhostPad::GhostPad(const Glib::ustring& name,
- const Glib::RefPtr<Gst::PadTemplate>& templ)
- : _CONSTRUCT("name", name.c_str(), "direction",
+GhostPad::GhostPad( const Glib::RefPtr<Gst::PadTemplate>& templ,
+ const Glib::ustring& name)
+ : _CONSTRUCT("name", (name.empty() ? 0 : name.c_str()), "direction",
((templ) ? ((GstPadDirection) templ->get_direction()) : GST_PAD_UNKNOWN),
"template", ((templ) ? templ->gobj() : 0))
{
diff --git a/gstreamer/src/ghostpad.hg b/gstreamer/src/ghostpad.hg
index 36d2f8d..f706940 100644
--- a/gstreamer/src/ghostpad.hg
+++ b/gstreamer/src/ghostpad.hg
@@ -49,48 +49,51 @@ class GhostPad : public Pad
protected:
/** Creates a Gst::GhostPad from a target pad.
- * @param name The name of the Gst::GhostPad.
* @param target The target pad.
+ * @param name The name of the Gst::GhostPad.
*
* @throws std::runtime_error if Gst::GhostPad construction fails.
*/
- GhostPad(const Glib::ustring& name, const Glib::RefPtr<Gst::Pad>& target);
+ GhostPad(const Glib::RefPtr<Gst::Pad>& target, const Glib::ustring& name);
/** Creates a Gst::GhostPad with a specified name and direction.
- * @param name The name of the Gst::GhostPad.
* @param direction The direction of the Gst::GhostPad.
+ * @param name The name of the Gst::GhostPad.
*
* @throws std::runtime_error if Gst::GhostPad construction fails.
*/
- GhostPad(const Glib::ustring& name, PadDirection direction);
+ GhostPad(PadDirection direction, const Glib::ustring& name);
/** Creates a Gst::GhostPad from a target pad and a pad template.
- * @param name The name of the Gst::GhostPad.
* @param target The target pad.
* @param templ The pad template.
+ * @param name The name of the Gst::GhostPad.
*
* @throws std::runtime_error if Gst::GhostPad construction fails.
*/
- GhostPad(const Glib::ustring& name, const Glib::RefPtr<Gst::Pad>& target, const Glib::RefPtr<Gst::PadTemplate>& templ);
+ GhostPad(const Glib::RefPtr<Gst::Pad>& target,
+ const Glib::RefPtr<Gst::PadTemplate>& templ, const Glib::ustring& name);
/** Creates a Gst::GhostPad from a pad template.
- * @param name The name of the Gst::GhostPad.
* @param templ The pad template.
+ * @param name The name of the Gst::GhostPad.
*
* @throws std::runtime_error if Gst::GhostPad construction fails.
*/
- GhostPad(const Glib::ustring& name, const Glib::RefPtr<Gst::PadTemplate>& templ);
+ GhostPad(const Glib::RefPtr<Gst::PadTemplate>& templ,
+ const Glib::ustring& name);
_IGNORE(gst_ghost_pad_construct)
public:
/** Create a new Gst::GhostPad with @a target as the target. The direction
* will be taken from the target pad. @a target must be unlinked.
*
- * @param name The name of the new pad.
* @param target The pad to ghost.
+ * @param name The (optional) name of the new pad.
* @returns A new Gst::GhostPad, or an empty RefPtr in case of an error.
*/
- _WRAP_CREATE(const Glib::ustring& name, const Glib::RefPtr<Gst::Pad>& target)
+ _WRAP_CREATE(const Glib::RefPtr<Gst::Pad>& target,
+ const Glib::ustring& name = Glib::ustring())
/** Create a new Gst::GhostPad without a target with the given direction. A
* target can be set on the Gst::GhostPad later with the set_target()
@@ -98,31 +101,35 @@ public:
*
* The created Gst::GhostPad will not have a padtemplate.
*
- * @param name The name of the new Gst::GhostPad.
* @param dir The direction of the Gst::GhostPad.
+ * @param name The (optional) name of the new Gst::GhostPad.
* @return A new Gst::GhostPad, or an empty RefPtr in case of an error.
*/
- _WRAP_CREATE(const Glib::ustring& name, PadDirection dir)
+ _WRAP_CREATE( PadDirection dir,
+ const Glib::ustring& name = Glib::ustring())
/** Create a new Gst::GhostPad with @a target as the target. The direction
* will be taken from the target pad. The template used on the Gst::GhostPad
* will be template.
*
- * @param name The name of the new Gst::GhostPad.
* @param target The pad to ghost.
* @param templ The Gst::PadTemplate to use on the Gst::GhostPad.
+ * @param name The (optional) name of the new Gst::GhostPad.
* @return A new Gst::GhostPad, or an empty RefPtr in case of an error.
*/
- _WRAP_CREATE(const Glib::ustring& name, const Glib::RefPtr<Gst::Pad>& target, const Glib::RefPtr<Gst::PadTemplate>& templ)
+ _WRAP_CREATE(const Glib::RefPtr<Gst::Pad>& target,
+ const Glib::RefPtr<Gst::PadTemplate>& templ,
+ const Glib::ustring& name = Glib::ustring())
/** Create a new Gst::GhostPad based on @a templ, without setting a target.
* The direction will be taken from @a templ.
*
- * @param name The name of the new Gst::GhostPad.
* @param templ The Gst::PadTemplate to create the Gst::GhostPad from.
+ * @param name The (optional) name of the new Gst::GhostPad.
* @return A new Gst::GhostPad, or an empty RefPtr in case of an error.
*/
- _WRAP_CREATE(const Glib::ustring& name, const Glib::RefPtr<Gst::PadTemplate>& templ)
+ _WRAP_CREATE(const Glib::RefPtr<Gst::PadTemplate>& templ,
+ const Glib::ustring& name = Glib::ustring())
_WRAP_METHOD(bool set_target(const Glib::RefPtr<Gst::Pad>& newtarget), gst_ghost_pad_set_target)
diff --git a/tests/test-ghost-pad.cc b/tests/test-ghost-pad.cc
index a5f33a5..4879d33 100644
--- a/tests/test-ghost-pad.cc
+++ b/tests/test-ghost-pad.cc
@@ -51,14 +51,14 @@ int main (int argc, char* argv[])
// Uncomment the following to get an exception of a failed target pad ghostpad
// construction.
/*
- Glib::RefPtr<Gst::GhostPad> gpad1 = Gst::GhostPad::create("gpad1", pad1);
+ Glib::RefPtr<Gst::GhostPad> gpad1 = Gst::GhostPad::create(pad1);
if(gpad1)
std::cout << "Successfully created pad '" << gpad1->get_name() <<
"'; direction = " << gpad1->get_direction() << "." << std::endl;
*/
Glib::RefPtr<Gst::GhostPad> gpad2 =
- Gst::GhostPad::create("gpad2", Gst::PAD_SRC);
+ Gst::GhostPad::create(Gst::PAD_SRC);
if(gpad2)
std::cout << "Successfully created pad '" << gpad2->get_name() <<
"'; direction = " << gpad2->get_direction() << "." << std::endl;
@@ -67,14 +67,14 @@ int main (int argc, char* argv[])
// construction.
/*
Glib::RefPtr<Gst::GhostPad> gpad3 =
- Gst::GhostPad::create("gpad3", pad1, templ);
+ Gst::GhostPad::create(pad1, templ);
if(gpad3)
std::cout << "Successfully created pad '" << gpad3->get_name() <<
"'; direction = " << gpad3->get_direction() << "." << std::endl;
*/
Glib::RefPtr<Gst::GhostPad> gpad4 =
- Gst::GhostPad::create("gpad4", templ);
+ Gst::GhostPad::create(templ);
if(gpad4)
std::cout << "Successfully created pad '" << gpad4->get_name() <<
"'; direction = " << gpad4->get_direction() << "." << std::endl;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]