gnomemm r1569 - in gstreamermm/trunk: . gstreamer/gstreamermm gstreamer/src tests



Author: jaalburqu
Date: Fri Jun 20 04:08:11 2008
New Revision: 1569
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1569&view=rev

Log:
2008-06-19  Josà Alburquerque  <jaalburqu svn gnome org>

	* gstreamer/gstreamermm/init.cc: Modified init_check() to initialize
	wrapping system in same manner as init() does.
	* gstreamer/src/ghostpad.hg:
	* gstreamer/src/pad.hg: Modified constructors that have a PadDirection
	to use the name "direction" which is the right name of the
	construction property (see bug #539055, filed in last commit).  Once
	the other constructor's construction properties are well known the
	construction properties warning should be fixed.
	* tests/Makefile.am:
	* tests/test-ghost-pad.cc:
	* tests/test-init-check.cc: Added tests for Gst::GhostPad and
	init_check().  Found that there are errors when running
	ghost pad test related to destruction (unreferencing). If the pad
	is given an extra reference, the errors disappear so it will probably
	be necessary to debug referencing in (some) Gst::*Pad* constructors.

Added:
   gstreamermm/trunk/tests/test-ghost-pad.cc
   gstreamermm/trunk/tests/test-init-check.cc
Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/gstreamer/gstreamermm/init.cc
   gstreamermm/trunk/gstreamer/src/ghostpad.hg
   gstreamermm/trunk/gstreamer/src/pad.hg
   gstreamermm/trunk/tests/Makefile.am

Modified: gstreamermm/trunk/gstreamer/gstreamermm/init.cc
==============================================================================
--- gstreamermm/trunk/gstreamer/gstreamermm/init.cc	(original)
+++ gstreamermm/trunk/gstreamer/gstreamermm/init.cc	Fri Jun 20 04:08:11 2008
@@ -56,7 +56,11 @@
 bool init_check(int& argc, char**& argv, std::auto_ptr<Glib::Error>& error)
 #endif //GLIBMM_EXCEPTIONS_ENABLED
 {
-  Glib::init();
+  static bool s_init = false;
+
+  if(!s_init)
+    Glib::init();
+
   GError* gerror = 0;
   bool result = gst_init_check(&argc, &argv, &gerror);
 
@@ -68,7 +72,20 @@
     error = ::Glib::Error::throw_exception(gerror);
 #endif //GLIBMM_EXCEPTIONS_ENABLED
 
-  Gst::wrap_init();
+  if(!s_init)
+  {
+    Gst::wrap_init();
+
+    //For Gst::wrap(), for Gst::MiniObject-derived classes.
+    Gst::wrap_register_init();
+    Gst::gst_wrap_init();
+
+    //Initialize wraping for gstreamerbasemm co-library
+    GstBase::wrap_init();
+
+    s_init = true;
+  }
+
   return result;
 }
 

Modified: gstreamermm/trunk/gstreamer/src/ghostpad.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/ghostpad.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/ghostpad.hg	Fri Jun 20 04:08:11 2008
@@ -50,7 +50,7 @@
 
 protected:
   _WRAP_CTOR(GhostPad(const Glib::ustring& name, const Glib::RefPtr<Pad>& target), gst_ghost_pad_new)
-  _WRAP_CTOR(GhostPad(const Glib::ustring& name, PadDirection dir), gst_ghost_pad_new_no_target)
+  _WRAP_CTOR(GhostPad(const Glib::ustring& name, PadDirection direction), gst_ghost_pad_new_no_target)
   _WRAP_CTOR(GhostPad(const Glib::ustring& name, const Glib::RefPtr<Pad>& target, const Glib::RefPtr<PadTemplate>& templ), gst_ghost_pad_new_from_template)
   _WRAP_CTOR(GhostPad(const Glib::ustring& name, const Glib::RefPtr<PadTemplate>& templ), gst_ghost_pad_new_no_target_from_template)
 

Modified: gstreamermm/trunk/gstreamer/src/pad.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/pad.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/pad.hg	Fri Jun 20 04:08:11 2008
@@ -78,7 +78,7 @@
   _CLASS_GOBJECT(Pad, GstPad, GST_PAD, Object, GstObject)
 
 protected:
-  _WRAP_CTOR(Pad(const Glib::ustring& name, PadDirection dir), gst_pad_new)
+  _WRAP_CTOR(Pad(const Glib::ustring& name, PadDirection direction), gst_pad_new)
   _WRAP_CTOR(Pad(const Glib::RefPtr<PadTemplate>& pad_template, const Glib::ustring& name), gst_pad_new_from_template)
 
 public:

Modified: gstreamermm/trunk/tests/Makefile.am
==============================================================================
--- gstreamermm/trunk/tests/Makefile.am	(original)
+++ gstreamermm/trunk/tests/Makefile.am	Fri Jun 20 04:08:11 2008
@@ -7,7 +7,8 @@
                   test-link-elements test-create-bin test-miniobject-wrap \
                   test-message-wrap test-event-wrap test-query-wrap \
 		  test-structure test-caps-structures test-interface \
-		  test-create-bus test-taglist test-tagsetter test-pad
+		  test-create-bus test-taglist test-tagsetter test-pad \
+		  test-ghost-pad test-init-check
 
 test_caps_SOURCES=test-caps.cc
 test_caps_LDFLAGS= GSTREAMERMM_LIBS@
@@ -57,6 +58,12 @@
 test_pad_SOURCES=test-pad.cc
 test_pad_LDFLAGS= GSTREAMERMM_LIBS@
 
+test_ghost_pad_SOURCES=test-ghost-pad.cc
+test_ghost_pad_LDFLAGS= GSTREAMERMM_LIBS@
+
+test_init_check_SOURCES=test-init-check.cc
+test_init_check_LDFLAGS= GSTREAMERMM_LIBS@
+
 #runtestbasic runtestlangs \
 #runtestsearch runtestmimetypes \
 #runtestgetbuffer

Added: gstreamermm/trunk/tests/test-ghost-pad.cc
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/tests/test-ghost-pad.cc	Fri Jun 20 04:08:11 2008
@@ -0,0 +1,33 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008 The gstreamermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gstreamermm.h>
+#include <iostream>
+
+int main (int argc, char* argv[])
+{
+  Gst::init (argc, argv);
+  Glib::RefPtr<Gst::GhostPad> gpad
+    = Gst::GhostPad::create ("gpad", Gst::PAD_SINK);
+  std::cout << "direction " << gpad->get_direction() << std::endl;
+  // gpad->reference();
+  return 0;
+}

Added: gstreamermm/trunk/tests/test-init-check.cc
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/tests/test-init-check.cc	Fri Jun 20 04:08:11 2008
@@ -0,0 +1,68 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008 The gstreamermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gstreamermm.h>
+#include <gstreamerbasemm.h>
+#include <iostream>
+
+int main (int argc, char* argv[])
+{
+  try
+  {
+    bool success = Gst::init_check(argc, argv);
+
+    if (!success)
+    {
+      std::cout << "Error initializing gstreamermm." << std::endl;
+      return -1;
+    }
+
+    success = Gst::init_check(argc, argv);
+
+    std::cout << "Second call to Gst::init_check() success = " << success <<
+      "." << std::endl;
+  }
+  catch (const Glib::Error& error)
+  {
+    std::cout << "Error initializing gstreamermm." << std::endl;
+    return -1;
+  }
+
+  Glib::RefPtr<Gst::Element> element = Gst::ElementFactory::create_element("ximagesink", "videosink");
+
+  if (element)
+    std::cout << "Successfully created gst element '" <<
+      element->get_name() << "'." << std::endl;
+
+  Glib::RefPtr< Gst::ElementInterfaced<GstBase::XOverlay> > xoverlay =
+    Gst::Interface::cast <GstBase::XOverlay>(element);
+
+  if(xoverlay)
+  {
+    std::cout << "element '" << element->get_name() <<
+      "' implements XOverlay interface." << std::endl;
+
+    // Use interface methods
+    xoverlay->handle_events(false);
+  }
+
+  return 0;
+}



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