gnomemm r1796 - in gstreamermm/trunk: . build_shared examples/element_link examples/ogg_player examples/optiongroup gstreamer gstreamer/gstreamermm gstreamer/src gstreamerbase/gstreamerbasemm gstreamerbase/src tests tools/extra_defs_gen



Author: jaalburqu
Date: Tue Nov 18 03:34:52 2008
New Revision: 1796
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1796&view=rev

Log:
2008-11-17  Josà Alburquerque  <jaalburqu svn gnome org>

	* configure.ac:
	* gstreamer/gstreamermm-0.10.pc.in: Restore gstreamermm dependency on
	gstreamer-base-0.10 because it is in fact needed to build elements
	like Gst::BaseSrc, Gst::BaseSink and Gst::BaseTransform.

Modified:
   gstreamermm/trunk/   (props changed)
   gstreamermm/trunk/AUTHORS
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/build_shared/   (props changed)
   gstreamermm/trunk/build_shared/Makefile_gensrc.am_fragment
   gstreamermm/trunk/configure.ac
   gstreamermm/trunk/examples/element_link/   (props changed)
   gstreamermm/trunk/examples/ogg_player/   (props changed)
   gstreamermm/trunk/examples/optiongroup/   (props changed)
   gstreamermm/trunk/gstreamer/gstreamermm/   (props changed)
   gstreamermm/trunk/gstreamer/gstreamermm-0.10.pc.in
   gstreamermm/trunk/gstreamer/gstreamermm.h
   gstreamermm/trunk/gstreamer/gstreamermm/init.cc
   gstreamermm/trunk/gstreamer/gstreamermm/init.h
   gstreamermm/trunk/gstreamer/src/   (props changed)
   gstreamermm/trunk/gstreamer/src/basesink.hg
   gstreamermm/trunk/gstreamer/src/ghostpad.ccg
   gstreamermm/trunk/gstreamerbase/gstreamerbasemm/   (props changed)
   gstreamermm/trunk/gstreamerbase/gstreamerbasemm/init.cc
   gstreamermm/trunk/gstreamerbase/gstreamerbasemm/init.h
   gstreamermm/trunk/gstreamerbase/src/   (props changed)
   gstreamermm/trunk/tests/   (props changed)
   gstreamermm/trunk/tests/test-init.cc
   gstreamermm/trunk/tools/extra_defs_gen/   (props changed)

Modified: gstreamermm/trunk/AUTHORS
==============================================================================
--- gstreamermm/trunk/AUTHORS	(original)
+++ gstreamermm/trunk/AUTHORS	Tue Nov 18 03:34:52 2008
@@ -1,10 +1,9 @@
 Please use the mailing list (gtkmm-list gnome org) instead of emailing
 developers directly.  See the ChangeLog for up-to-date information.
 
-Josà Alburquerque <jaalburquerque cox net>
+Josà Alburquerque <jaalburqu svn gnome org>
 Murray Cumming <murrayc murrayc com>
-Milosz Derezynski <internalerror gmail com>
-Siavash Safi <siavash safi gmail com>
 
 Some former contributors:
-
+Milosz Derezynski <internalerror gmail com>
+Siavash Safi <siavash safi gmail com>

Modified: gstreamermm/trunk/build_shared/Makefile_gensrc.am_fragment
==============================================================================
--- gstreamermm/trunk/build_shared/Makefile_gensrc.am_fragment	(original)
+++ gstreamermm/trunk/build_shared/Makefile_gensrc.am_fragment	Tue Nov 18 03:34:52 2008
@@ -65,6 +65,7 @@
 $(files_plugin_hg): $(generate_plugin_gmmproc_file_path)
 	$(run_generate_plugin_gmmproc_file) --hg $(subst .hg,,$@) > $@
 	$(run_generate_plugin_gmmproc_file) --ccg $(subst .hg,,$@) > $(subst .hg,.ccg,$@)
+	if [ `ls -s $@ | cut -d' ' -f 1` -eq 0 ]; then rm -f $@ $(subst .hg,.ccg,$@); fi
 
 
 $(stamp_dir)/stamp-%: %.hg %.ccg $(tools_m4) $(files_defs)

Modified: gstreamermm/trunk/configure.ac
==============================================================================
--- gstreamermm/trunk/configure.ac	(original)
+++ gstreamermm/trunk/configure.ac	Tue Nov 18 03:34:52 2008
@@ -133,6 +133,7 @@
 PKG_CHECK_MODULES(GSTREAMERMM, \
         glibmm-2.4 >= ${gstreamermm_min_glibmm_version} \
         gstreamer-0.10 >= ${gstreamermm_min_gst_version} \
+        gstreamer-base-0.10 >= ${gstreamermm_min_gst_version} \
         libxml++-2.6 >= ${gstreamermm_min_libxmlpp_version} \
         )
 AC_SUBST(GSTREAMERMM_CFLAGS)

Modified: gstreamermm/trunk/gstreamer/gstreamermm-0.10.pc.in
==============================================================================
--- gstreamermm/trunk/gstreamer/gstreamermm-0.10.pc.in	(original)
+++ gstreamermm/trunk/gstreamer/gstreamermm-0.10.pc.in	Tue Nov 18 03:34:52 2008
@@ -5,7 +5,7 @@
 
 Name: gstreamermm
 Description: C++ wrapper for GStreamer 
-Requires: glibmm-2.4 gstreamer-0.10 libxml++-2.6
+Requires: glibmm-2.4 gstreamer-0.10 gstreamer-base-0.10 libxml++-2.6
 Version: @VERSION@
 Libs: -L${libdir} -lgstreamermm-0.10 -lgstreamerbasemm-0.10
 Cflags: -I${includedir}/gstreamermm-0.10 -I${libdir}/gstreamermm-0.10/include

Modified: gstreamermm/trunk/gstreamer/gstreamermm.h
==============================================================================
--- gstreamermm/trunk/gstreamer/gstreamermm.h	(original)
+++ gstreamermm/trunk/gstreamer/gstreamermm.h	Tue Nov 18 03:34:52 2008
@@ -1,6 +1,10 @@
 #ifndef _GSTREAMERMM_H_
 #define _GSTREAMERMM_H_
 
+#include <gstreamermm/init.h>
+#include <gstreamermm/version.h>
+#include <gstreamermm/wrap_init.h>
+
 // Core includes
 #include <gstreamermm/bin.h>
 #include <gstreamermm/buffer.h>
@@ -15,7 +19,7 @@
 #include <gstreamermm/event.h>
 #include <gstreamermm/filter.h>
 #include <gstreamermm/format.h>
-//TODO: #include <gstreamermm/ghostpad.h> (when bug #539108 is fixed)
+#include <gstreamermm/ghostpad.h>
 #include <gstreamermm/index.h>
 #include <gstreamermm/indexfactory.h>
 #include <gstreamermm/interface.h>
@@ -45,9 +49,4 @@
 #include <gstreamermm/basetransform.h>
 #include <gstreamermm/pushsrc.h>
 
-#include <gstreamermm/init.h>
-#include <gstreamermm/version.h>
-#include <gstreamermm/wrap_init.h>
-
 #endif // _GSTREAMERMM_H
-

Modified: gstreamermm/trunk/gstreamer/gstreamermm/init.cc
==============================================================================
--- gstreamermm/trunk/gstreamer/gstreamermm/init.cc	(original)
+++ gstreamermm/trunk/gstreamer/gstreamermm/init.cc	Tue Nov 18 03:34:52 2008
@@ -21,7 +21,6 @@
 #include <gstreamermm/wrap.h>
 #include <gstreamermm/wrap_init.h>
 #include <gstreamermm/gst_wrap_init.h>
-#include <gstreamerbasemm/wrap_init.h>
 #include <glibmm/init.h>
 #include <gst/gst.h>
 
@@ -40,9 +39,6 @@
     Gst::wrap_register_init();
     Gst::gst_wrap_init();
 
-    //Initialize wraping for gstreamerbasemm co-library
-    GstBase::wrap_init();
-
     s_init = true;
   }
 }
@@ -80,23 +76,23 @@
 #endif //GLIBMM_EXCEPTIONS_ENABLED
 {
   static bool s_init = false;
+  static bool result = false;
 
   if(!s_init)
+  {
     Glib::init();
 
-  GError* gerror = 0;
-  bool result = gst_init_check(&argc, &argv, &gerror);
+    GError* gerror = 0;
+    result = gst_init_check(&argc, &argv, &gerror);
 
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  if(gerror)
-    ::Glib::Error::throw_exception(gerror);
+    if(gerror)
+      ::Glib::Error::throw_exception(gerror);
 #else
-  if(gerror)
-    error = ::Glib::Error::throw_exception(gerror);
+    if(gerror)
+      error = ::Glib::Error::throw_exception(gerror);
 #endif //GLIBMM_EXCEPTIONS_ENABLED
 
-  if(!s_init)
-  {
     initialize_wrap_system();
     s_init = true;
   }
@@ -111,23 +107,23 @@
 #endif //GLIBMM_EXCEPTIONS_ENABLED
 {
   static bool s_init = false;
+  static bool result = false;
 
   if(!s_init)
+  {
     Glib::init();
 
-  GError* gerror = 0;
-  bool result = gst_init_check(NULL, NULL, &gerror);
+    GError* gerror = 0;
+    result = gst_init_check(NULL, NULL, &gerror);
 
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  if(gerror)
-    ::Glib::Error::throw_exception(gerror);
+    if(gerror)
+      ::Glib::Error::throw_exception(gerror);
 #else
-  if(gerror)
-    error = ::Glib::Error::throw_exception(gerror);
+    if(gerror)
+      error = ::Glib::Error::throw_exception(gerror);
 #endif //GLIBMM_EXCEPTIONS_ENABLED
 
-  if(!s_init)
-  {
     initialize_wrap_system();
     s_init = true;
   }

Modified: gstreamermm/trunk/gstreamer/gstreamermm/init.h
==============================================================================
--- gstreamermm/trunk/gstreamer/gstreamermm/init.h	(original)
+++ gstreamermm/trunk/gstreamer/gstreamermm/init.h	Tue Nov 18 03:34:52 2008
@@ -34,9 +34,11 @@
  * be called to initialize gstreamermm before calling any other GLib functions.
  * If this is not an option, your program must initialize the GLib thread
  * system using Glib::thread_init() before any other GLib functions are called
- * and use either Gst::init() or Gst::init_check() with no arguments before
- * calling any gstreamermm functions.  GLib thread initialization can be done
- * as follows:
+ * and use either Gst::init(), or Gst::init_check() without the argc and argv
+ * arguments before calling any gstreamermm functions.  The GstBase::init()
+ * function with the argc and argv arguments calls this function if it has not
+ * been called already so that function may be used instead of this one.  GLib
+ * thread initialization can be done as follows:
  *
  * @code
  * if (!Glib::thread_supported ())
@@ -64,9 +66,11 @@
  * parsing should be called to initalize gstreamermm before calling any other
  * GLib functions. If this is not an option, your program must initialize the
  * GLib thread system using Glib::thread_init() before any other GLib functions
- * are called and use either this function or Gst::init_check() with no
- * arguments before calling any gstreamermm functions.  GLib thread
- * initialization can be done as follows:
+ * are called and use either this function or Gst::init_check() without the
+ * argc and argv arguments before calling any gstreamermm functions.  The
+ * GstBase::init() function without the argc and argv arguments calls this
+ * function if it has not been called already so that function may be used
+ * instead of this one.  GLib thread initialization can be done as follows:
  *
  * @code
  * if (!Glib::thread_supported ())
@@ -75,7 +79,7 @@
  * @endcode
  *
  * Note: This function will terminate your program if it was unable to
- * initialize gstreamermm for some reason. If you want your program to fall
+ * initialize GStreamer for some reason. If you want your program to fall
  * back, use Gst::init_check() instead.
  */
 void init();
@@ -86,9 +90,11 @@
  * called to initialize gstreamermm before calling any other GLib functions.
  * If this is not an option, your program must initialize the GLib thread
  * system using Glib::thread_init() before any other GLib functions are called
- * and use either Gst::init() or Gst::init_check() with no arguments before
- * calling any gstreamermm functions.  GLib thread initialization can be done
- * as follows:
+ * and use either Gst::init() or Gst::init_check() without the argc and argv
+ * arguments before calling any gstreamermm functions.  The
+ * GstBase::init_check() function with the argc and argv arguments calls this
+ * function if it has not been called already so that function may be used
+ * instead of this one.  GLib thread initialization can be done as follows:
  *
  * @code
  * if (!Glib::thread_supported ())
@@ -96,13 +102,13 @@
  * ...
  * @endcode
  * 
- * This function will return false if gstreamermm could not be initialized for
+ * This function will return false if GStreamer could not be initialized for
  * some reason. If you want your program to fail fatally, use Gst::init()
  * instead.
  *
  * @param argc Pointer to application's argc.
  * @param argv Pointer to application's argv.
- * @return true if gstreamermm could be initialized.
+ * @return true if GStreamer could be initialized.
  * @throw Glib::Error
  */
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
@@ -117,9 +123,12 @@
  * parsing should be called to initalize gstreamermm before calling any other
  * GLib functions. If this is not an option, your program must initialize the
  * GLib thread system using Glib::thread_init() before any other GLib functions
- * are called and use either this function or Gst::init() with no arguments
- * before calling any gstreamermm functions.  GLib thread initialization can be
- * done as follows:
+ * are called and use either this function or Gst::init() without the argc and
+ * argv arguments before calling any gstreamermm functions.  The
+ * GstBase::init_check() function without the argc and argv arguments calls
+ * this function if it has not been called * already so that function may be
+ * used instead of this one.  GLib thread initialization can be done as
+ * follows:
  *
  * @code
  * if (!Glib::thread_supported ())
@@ -127,11 +136,11 @@
  * ...
  * @endcode
  * 
- * This function will return false if gstreamermm could not be initialized for
+ * This function will return false if GStreamer could not be initialized for
  * some reason. If you want your program to fail fatally, use Gst::init()
  * instead.
  *
- * @return true if gstreamermm could be initialized.
+ * @return true if GStreamer could be initialized.
  * @throw Glib::Error
  */
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
@@ -154,7 +163,7 @@
  * @return A pointer to GStreamer's option group.
  */
 Glib::OptionGroup get_option_group();
-  
+
 }//end namespace Gst
 
 #endif //_GSTREAMERMM_INIT_H

Modified: gstreamermm/trunk/gstreamer/src/basesink.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/basesink.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/basesink.hg	Tue Nov 18 03:34:52 2008
@@ -149,13 +149,8 @@
   _WRAP_METHOD(bool is_async_enabled(), gst_base_sink_is_async_enabled)
   _WRAP_METHOD(void set_ts_offset(ClockTimeDiff offset), gst_base_sink_set_ts_offset)
   _WRAP_METHOD(ClockTimeDiff get_ts_offset(), gst_base_sink_get_ts_offset)
-
-  //TODO: Doesn't compile with GStreamer 0.10.20:
-  //_WRAP_METHOD(void set_render_delay(ClockTime delay), gst_base_sink_set_render_delay)
-
-  //TODO: Doesn't compile with GStreamer 0.10.20:
-  //_WRAP_METHOD(ClockTime get_render_delay(), gst_base_sink_get_render_delay)
-
+  _WRAP_METHOD(void set_render_delay(ClockTime delay), gst_base_sink_set_render_delay)
+  _WRAP_METHOD(ClockTime get_render_delay(), gst_base_sink_get_render_delay)
   _WRAP_METHOD(Glib::RefPtr<Buffer> get_last_buffer(), gst_base_sink_get_last_buffer)
 
   /** Gets the sink Gst::Pad object of the element.

Modified: gstreamermm/trunk/gstreamer/src/ghostpad.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/ghostpad.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/ghostpad.ccg	Tue Nov 18 03:34:52 2008
@@ -31,7 +31,7 @@
   : _CONSTRUCT("name", name.c_str(),
       "direction", (GstPadDirection) target->get_direction())
 {
-  if (!gst_ghost_pad_construct(gobj(), name.c_str(), target->gobj()))
+  if (!gst_ghost_pad_construct(gobj()))
     g_warning("Gst::GhostPad::GhostPad(const Glib::ustring&,"
       " const Glib::RefPtr<Pad>&): Unsuccessful construction of ghost pad.");
 }
@@ -39,7 +39,7 @@
 GhostPad::GhostPad(const Glib::ustring& name, PadDirection direction)
   : _CONSTRUCT("name", name.c_str(), "direction", (GstPadDirection) direction)
 {
-  if (!gst_ghost_pad_construct_no_target(gobj(), name.c_str(), (GstPadDirection) direction))
+  if (!gst_ghost_pad_construct(gobj()))
   {
     g_warning("Gst::GhostPad::GhostPad(const Glib::ustring&, PadDirection):"
     " Unsuccessful construction of ghost pad.");
@@ -51,7 +51,7 @@
     : _CONSTRUCT("name", name.c_str(), "direction",
         (GstPadDirection) target->get_direction(), "template", templ->gobj())
 {
-  if (!gst_ghost_pad_construct_from_template(gobj(), name.c_str(), target->gobj(), templ->gobj()))
+  if (!gst_ghost_pad_construct(gobj()))
   {
     g_warning("Gst::GhostPad::GhostPad(const Glib::ustring&,"
       " const Glib::RefPtr<Pad>&, const Glib::RefPtr<PadTemplate>&):"
@@ -63,7 +63,7 @@
     : _CONSTRUCT("name", name.c_str(), "direction", 
         (GstPadDirection) templ->get_direction(), "template", templ->gobj())
 {
-  if (!gst_ghost_pad_construct_no_target_from_template(gobj(), name.c_str(), templ->gobj()))
+  if (!gst_ghost_pad_construct(gobj()))
   {
     g_warning("Gst::GhostPad::GhostPad(const Glib::ustring&,"
       " const Glib::RefPtr<PadTemplate>&): Unsuccessful construction of ghost"

Modified: gstreamermm/trunk/gstreamerbase/gstreamerbasemm/init.cc
==============================================================================
--- gstreamermm/trunk/gstreamerbase/gstreamerbasemm/init.cc	(original)
+++ gstreamermm/trunk/gstreamerbase/gstreamerbasemm/init.cc	Tue Nov 18 03:34:52 2008
@@ -20,16 +20,31 @@
 #include <glibmm/init.h>
 #include <gstreamerbasemm/init.h>
 #include <gstreamerbasemm/wrap_init.h>
+#include <gstreamermm/init.h>
 
 namespace GstBase
 {
 
+void init(int& argc, char**& argv)
+{
+  static bool s_init = false;
+  if(!s_init)
+  {
+    Gst::init(argc, argv);
+
+    //For Glib::wrap(), for Glib::Object-derived classes.
+    GstBase::wrap_init(); 
+
+    s_init = true;
+  }
+}
+
 void init()
 {
   static bool s_init = false;
   if(!s_init)
   {
-    Glib::init();
+    Gst::init();
 
     //For Glib::wrap(), for Glib::Object-derived classes.
     GstBase::wrap_init(); 
@@ -38,4 +53,57 @@
   }
 }
 
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+bool init_check(int& argc, char**& argv)
+#else
+bool init_check(int& argc, char**& argv, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  static bool s_init = false;
+  static bool result = false;
+
+  if(!s_init)
+  {
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+    result = Gst::init_check(argc, argv);
+#else
+    result = Gst::init_check(argc, argv, error);
+#endif
+
+    //For Glib::wrap(), for Glib::Object-derived classes.
+    GstBase::wrap_init(); 
+
+    s_init = true;
+  }
+
+  return result;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+bool init_check()
+#else
+bool init_check(std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  static bool s_init = false;
+  static bool result = false;
+
+  if(!s_init)
+  {
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+    result = Gst::init_check();
+#else
+    result = Gst::init_check(error);
+#endif
+
+    //For Glib::wrap(), for Glib::Object-derived classes.
+    GstBase::wrap_init(); 
+
+    s_init = true;
+  }
+
+  return result;
+}
+
 } //namespace GstBase

Modified: gstreamermm/trunk/gstreamerbase/gstreamerbasemm/init.h
==============================================================================
--- gstreamermm/trunk/gstreamerbase/gstreamerbasemm/init.h	(original)
+++ gstreamermm/trunk/gstreamerbase/gstreamerbasemm/init.h	Tue Nov 18 03:34:52 2008
@@ -22,15 +22,140 @@
 #ifndef _GSTREAMERBASEMM_INIT_H
 #define _GSTREAMERBASEMM_INIT_H
 
+#include <glibmm/error.h>
+
 namespace GstBase
 {
 
-/** Initialize gstreamerbasemm.  This function may be called more than once.
- * There's no no need to use this function if Gst::init() or Gst::init_check()
- * is used because they already call this function.
+/** Initializes gstreamerbasemm parsing command line arguments.
+ *
+ * Either this function or GstBase::init_check() with command line parsing
+ * should be called to initialize gstreamerbasemm before instantiating any of
+ * its classes.  This function calls Gst::init() with the argc and argv
+ * arguments if it has not been called already so this function may be used
+ * instead of that one.  If this function is used to initialize gstreamermm it
+ * must be used before any other GLib functions.  If this is not an option,
+ * your program must initialize the GLib thread system using
+ * Glib::thread_init() before any other GLib functions are called and use
+ * either GstBase::init(), or GstBase::init_check() without the argc and argv
+ * arguments before calling any gstreamerbasemm functions.  GLib thread
+ * initialization can be done as follows:
+ *
+ * @code
+ * if (!Glib::thread_supported ())
+ *   Glib::thread_init ();
+ * ...
+ * @endcode
+ * 
+ *
+ * Note: This function will terminate your program if it was unable to
+ * initialize GStreamer for some reason. If you want your program to fall back,
+ * use GstBase::init_check() instead.
+ *
+ * WARNING: This function does not work in the same way as corresponding
+ * functions in other glib-style libraries, such as gtk_init(). In particular,
+ * unknown command line options cause this function to abort program execution.
+ *
+ * @param argc Pointer to application's argc.
+ * @param argv Pointer to application's argv.
+ */
+void init(int& argc, char**& argv);
+
+/** Initializes gstreamerbasemm without parsing command line options.
+ *
+ * Either the GstBase::init() or GstBase::init_check() functions with command
+ * line parsing should be called to initalize gstreamerbasemm before
+ * instantiating any of its classes.  This function calls Gst::init() if it has
+ * not been called already so this function may be used instead of that one.
+ * If this function is used to initialize gstreamermm it must be used before
+ * any other GLib functions.  If this is not an option, your program must
+ * initialize the GLib thread system using Glib::thread_init() before any other
+ * GLib functions are called and use either this function or
+ * GstBase::init_check() without the argc and argv arguments before calling any
+ * gstreamerbasemm functions.  GLib thread initialization can be done as
+ * follows:
+ *
+ * @code
+ * if (!Glib::thread_supported ())
+ *   Glib::thread_init ();
+ * ...
+ * @endcode
+ *
+ * Note: This function will terminate your program if it was unable to
+ * initialize gstreamerbasemm for some reason. If you want your program to fall
+ * back, use GstBase::init_check() instead.
  */
 void init();
-  
+
+/** Initializes gstreamerbasemm gracefully parsing command line arguments.
+ *
+ * Either this function or GstBase::init() with command line parsing should be
+ * called to initialize gstreamerbasemm before instantiating any of
+ * its classes.  This function calls Gst::init_check() with the argc and argv
+ * arguments if it has not been called already so this function may be used
+ * instead of that one.  If this function is used to initialize gstreamermm it
+ * must be used before any other GLib functions.  If this is not an option,
+ * your program must initialize the GLib thread system using
+ * Glib::thread_init() before any other GLib functions are called and use
+ * either GstBase::init() or GstBase::init_check() without the argc and argv
+ * arguments before calling any gstreamerbasemm functions.  GLib thread
+ * initialization can be done as follows:
+ *
+ * @code
+ * if (!Glib::thread_supported ())
+ *   Glib::thread_init ();
+ * ...
+ * @endcode
+ * 
+ * This function will return false if GStreamer could not be initialized for
+ * some reason. If you want your program to fail fatally, use GstBase::init()
+ * instead.
+ *
+ * @param argc Pointer to application's argc.
+ * @param argv Pointer to application's argv.
+ * @return true if GStreamer could be initialized.
+ * @throw Glib::Error
+ */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  bool init_check(int& argc, char**& argv);
+#else
+  bool init_check(int& argc, char**& argv, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+/** Initializes gstreamerbasemm gracefully without parsing command line
+ * arguments.
+ *
+ * Either the GstBase::init() or GstBase::init_check() functions with command
+ * line parsing should be called to initalize gstreamerbasemm before
+ * instantiating any of its classes.  This function calls Gst::init_check()
+ * if it has not been called already so this function may be used instead of
+ * that one.  If this function is used to initialize gstreamermm it
+ * must be used before any other GLib functions.  If this is not an option,
+ * your program must initialize the GLib thread system using
+ * Glib::thread_init() before any other GLib functions are called and use
+ * either this function or GstBase::init() without the argc and
+ * argv arguments before calling any gstreamerbasemm functions.  GLib thread
+ * initialization can be done as follows:
+ *
+ * @code
+ * if (!Glib::thread_supported ())
+ *   Glib::thread_init ();
+ * ...
+ * @endcode
+ * 
+ * This function will return false if GStreamer could not be initialized for
+ * some reason. If you want your program to fail fatally, use GstBase::init()
+ * instead.
+ *
+ * @return true if GStreamer could be initialized.
+ * @throw Glib::Error
+ */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  bool init_check();
+#else
+  bool init_check(std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
 } //namespace GstBase
 
 #endif //_GSTREAMERBASEMM_INIT_H

Modified: gstreamermm/trunk/tests/test-init.cc
==============================================================================
--- gstreamermm/trunk/tests/test-init.cc	(original)
+++ gstreamermm/trunk/tests/test-init.cc	Tue Nov 18 03:34:52 2008
@@ -23,10 +23,24 @@
 #include <gstreamerbasemm.h>
 #include <iostream>
 
+Gst::ClockTime on_get_time(const Glib::RefPtr<Gst::Clock>& clock)
+{
+  return Gst::CLOCK_TIME_NONE;
+}
+
 int main (int argc, char* argv[])
 {
   Gst::init(argc, argv);
 
+  Glib::RefPtr<GstBase::AudioClock> clock = GstBase::AudioClock::create("my-clock", sigc::ptr_fun(on_get_time));
+
+  if (clock)
+  {
+    Gst::ClockTime resolution = clock->get_resolution();
+    std::cout << "GstBase::AudioClock resolution = " << resolution << "." <<
+       std::endl;
+  }
+
   Glib::RefPtr<Gst::Element> element = Gst::ElementFactory::create_element("ximagesink", "videosink");
 
   if (element)
@@ -44,5 +58,6 @@
     xoverlay->handle_events(false);
   }
 
+
   return 0;
 }



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