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



Author: jaalburqu
Date: Wed Jan 28 02:22:24 2009
New Revision: 2023
URL: http://svn.gnome.org/viewvc/gnomemm?rev=2023&view=rev

Log:
2009-01-27  Josà Alburquerque  <jaalburqu svn gnome org>

	* gstreamer/src/colorbalancechannel.hg:
	* gstreamer/src/mixeroptions.hg:
	* gstreamer/src/mixertrack.hg: Added these to the GstInterface group
	because they are used with interfaces.

	* gstreamer/src/value.ccg:
	* gstreamer/src/value.hg: Added GValue& constructors for GStreamer
	internal type helper classes.  Placed the classes in a Doxygen group.

	* gstreamer/gstreamermm.h:
	* gstreamer/src/Makefile_list_of_hg.am_fragment:
	* gstreamer/src/tuner.ccg:
	* gstreamer/src/tuner.hg:
	* gstreamer/src/tunerchannel.ccg:
	* gstreamer/src/tunerchannel.hg:
	* gstreamer/src/tunernorm.ccg:
	* gstreamer/src/tunernorm.hg:
	* tools/m4/convert_gst.m4: Added Gst::Tuner, Gst::TunerChannel and
	Gst::TunerNorm.  Added necessary conversions.

	* tests/test-caps.cc:
	* tests/test-taglist.cc: Use quotes when printing strings only in
	tests.
	* tests/test-structure.cc: Add clarification that values printed are
	values obtained from the Gst::Structure.

Added:
   gstreamermm/trunk/gstreamer/src/tuner.ccg
   gstreamermm/trunk/gstreamer/src/tuner.hg
   gstreamermm/trunk/gstreamer/src/tunerchannel.ccg
   gstreamermm/trunk/gstreamer/src/tunerchannel.hg
   gstreamermm/trunk/gstreamer/src/tunernorm.ccg
   gstreamermm/trunk/gstreamer/src/tunernorm.hg
Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/gstreamer/gstreamermm.h
   gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment
   gstreamermm/trunk/gstreamer/src/colorbalancechannel.hg
   gstreamermm/trunk/gstreamer/src/mixeroptions.hg
   gstreamermm/trunk/gstreamer/src/mixertrack.hg
   gstreamermm/trunk/gstreamer/src/value.ccg
   gstreamermm/trunk/gstreamer/src/value.hg
   gstreamermm/trunk/tests/test-caps.cc
   gstreamermm/trunk/tests/test-structure.cc
   gstreamermm/trunk/tests/test-taglist.cc
   gstreamermm/trunk/tools/m4/convert_gst.m4

Modified: gstreamermm/trunk/gstreamer/gstreamermm.h
==============================================================================
--- gstreamermm/trunk/gstreamer/gstreamermm.h	(original)
+++ gstreamermm/trunk/gstreamer/gstreamermm.h	Wed Jan 28 02:22:24 2009
@@ -65,6 +65,9 @@
 #include <gstreamermm/mixer.h>
 #include <gstreamermm/mixeroptions.h>
 #include <gstreamermm/mixertrack.h>
+#include <gstreamermm/tuner.h>
+#include <gstreamermm/tunerchannel.h>
+#include <gstreamermm/tunernorm.h>
 #include <gstreamermm/xoverlay.h>
 
 #endif // _GSTREAMERMM_H

Modified: gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment
==============================================================================
--- gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment	(original)
+++ gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment	Wed Jan 28 02:22:24 2009
@@ -15,7 +15,8 @@
 	audiofilter.hg audiosink.hg audiosrc.hg baseaudiosink.hg \
 	baseaudiosrc.hg cddabasesrc.hg videosink.hg \
    	colorbalance.hg colorbalancechannel.hg mixer.hg mixeroptions.hg \
-	mixertrack.hg navigation.hg xoverlay.hg
+	mixertrack.hg navigation.hg tuner.hg tunerchannel.hg tunernorm.hg \
+	xoverlay.hg
 
 files_general_deprecated_hg =
 

Modified: gstreamermm/trunk/gstreamer/src/colorbalancechannel.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/colorbalancechannel.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/colorbalancechannel.hg	Wed Jan 28 02:22:24 2009
@@ -26,12 +26,25 @@
 {
 
 /** Gst::ColorBalanceChannel - Represents a color balance channel.
+ * @ingroup GstInterfaces
  */
 class ColorBalanceChannel : public Glib::Object
 {
   _CLASS_GOBJECT(ColorBalanceChannel, GstColorBalanceChannel, GST_COLOR_BALANCE_CHANNEL, Glib::Object, GObject)
 
 public:
+  /** Get a string containing a descriptive name for this channel.
+   */
+  _MEMBER_GET(label, label, Glib::ustring, gchar*)
+
+  /** Get the minimum valid value for this channel.
+   */
+  _MEMBER_GET(min_value, min_value, int, gint)
+
+  /** Get the maximum valid value for this channel.
+   */
+  _MEMBER_GET(max_value, max_value, int, gint)
+
   /** Signals that the channel has changed.
    * @param value The new value of the channel.
    */

Modified: gstreamermm/trunk/gstreamer/src/mixeroptions.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/mixeroptions.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/mixeroptions.hg	Wed Jan 28 02:22:24 2009
@@ -26,6 +26,7 @@
 
 /** Gst::MixerOptions - Options for elements that implement the * Gst::Mixer
  * interface.
+ * @ingroup GstInterfaces
  */
 class MixerOptions : public Gst::MixerTrack
 {

Modified: gstreamermm/trunk/gstreamer/src/mixertrack.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/mixertrack.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/mixertrack.hg	Wed Jan 28 02:22:24 2009
@@ -28,12 +28,16 @@
 
 /** Gst::MixerTrack - A track in an element that implement the Gst::Mixer
  * interface.
+ * @ingroup GstInterfaces
  */
 class MixerTrack : public Glib::Object
 {
   _CLASS_GOBJECT(MixerTrack, GstMixerTrack, GST_MIXER_TRACK, Glib::Object, GObject)
 
 public:
+  /** Get a string containing a descriptive name for this track.
+   */
+  _MEMBER_GET(label, label, Glib::ustring, gchar*) 
   /** Get the number of channels in the Gst::MixerTrack.
    */
   _MEMBER_GET(num_channels, num_channels, guint32, guint32)

Added: gstreamermm/trunk/gstreamer/src/tuner.ccg
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/gstreamer/src/tuner.ccg	Wed Jan 28 02:22:24 2009
@@ -0,0 +1,22 @@
+/* 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 Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+ #include <gst/interfaces/tuner.h>
+ #include <gstreamermm/tunerchannel.h>
+ #include <gstreamermm/tunernorm.h>

Added: gstreamermm/trunk/gstreamer/src/tuner.hg
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/gstreamer/src/tuner.hg	Wed Jan 28 02:22:24 2009
@@ -0,0 +1,96 @@
+/* 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 Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gst/interfaces/tuner.h>
+#include <glibmm/interface.h>
+
+_DEFS(gstreamermm,gst)
+
+namespace Gst
+{
+
+class TunerChannel;
+class TunerNorm;
+
+/** Gst::Tuner - Interface for elements providing tuner operations.
+ * @ingroup GstInterfaces
+ */
+class Tuner : public Glib::Interface
+{
+  _CLASS_INTERFACE(Tuner, GstTuner, GST_TUNER, GstTunerClass)
+
+public:
+#m4 _CONVERSION(`const GList*', `Glib::ListHandle< Glib::RefPtr<Gst::TunerChannel> >', `$2(const_cast<GList*>($3), Glib::OWNERSHIP_NONE)')
+  _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Gst::TunerChannel> > list_channels(), gst_tuner_list_channels)
+
+#m4 _CONVERSION(`const GList*', `Glib::ListHandle< Glib::RefPtr<const Gst::TunerChannel> >', `$2(const_cast<GList*>($3), Glib::OWNERSHIP_NONE)')
+  _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<const Gst::TunerChannel> > list_channels() const, gst_tuner_list_channels)
+
+  _WRAP_METHOD(Glib::RefPtr<Gst::TunerChannel> get_channel(), gst_tuner_get_channel)
+  _WRAP_METHOD(Glib::RefPtr<const Gst::TunerChannel> get_channel() const, gst_tuner_get_channel)
+  _WRAP_METHOD(void set_channel(const Glib::RefPtr<Gst::TunerChannel>& channel), gst_tuner_set_channel)
+
+#m4 _CONVERSION(`const GList*', `Glib::ListHandle< Glib::RefPtr<Gst::TunerNorm> >', `$2(const_cast<GList*>($3), Glib::OWNERSHIP_NONE)')
+  _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Gst::TunerNorm> >  list_norms(), gst_tuner_list_norms)
+
+#m4 _CONVERSION(`const GList*', `Glib::ListHandle< Glib::RefPtr<const Gst::TunerNorm> >', `$2(const_cast<GList*>($3), Glib::OWNERSHIP_NONE)')
+  _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<const Gst::TunerNorm> >  list_norms() const, gst_tuner_list_norms)
+
+  _WRAP_METHOD(Glib::RefPtr<Gst::TunerNorm> get_norm(), gst_tuner_get_norm)
+  _WRAP_METHOD(Glib::RefPtr<const Gst::TunerNorm> get_norm() const, gst_tuner_get_norm)
+  _WRAP_METHOD(void set_norm(const Glib::RefPtr<Gst::TunerNorm>& norm), gst_tuner_set_norm)
+  _WRAP_METHOD(gulong get_frequency(const Glib::RefPtr<const Gst::TunerChannel>& channel) const, gst_tuner_get_frequency)
+  _WRAP_METHOD(void set_frequency(const Glib::RefPtr<Gst::TunerChannel>& channel, gulong frequency), gst_tuner_set_frequency)
+  _WRAP_METHOD(int get_signal_strength(const Glib::RefPtr<Gst::TunerChannel>& channel), gst_tuner_signal_strength)
+  _WRAP_METHOD(Glib::RefPtr<Gst::TunerNorm> find_norm(const Glib::ustring& norm), gst_tuner_find_norm_by_name)
+  _WRAP_METHOD(Glib::RefPtr<const Gst::TunerNorm> find_norm(const Glib::ustring& norm) const, gst_tuner_find_norm_by_name)
+  _WRAP_METHOD(Glib::RefPtr<Gst::TunerChannel> find_channel(const Glib::ustring& channel), gst_tuner_find_channel_by_name)
+  _WRAP_METHOD(Glib::RefPtr<const Gst::TunerChannel> find_channel(const Glib::ustring& channel) const, gst_tuner_find_channel_by_name)
+  _WRAP_METHOD(void channel_changed(const Glib::RefPtr<Gst::TunerChannel>& channel), gst_tuner_channel_changed)
+  _WRAP_METHOD(void norm_changed(const Glib::RefPtr<Gst::TunerNorm>& norm), gst_tuner_norm_changed)
+  _WRAP_METHOD(void frequency_changed(const Glib::RefPtr<Gst::TunerChannel>& channel, gulong frequency), gst_tuner_frequency_changed)
+  _WRAP_METHOD(void signal_changed(const Glib::RefPtr<Gst::TunerChannel>& channel, int signal), gst_tuner_signal_changed)
+
+#m4 _CONVERSION(`GstTunerChannel*', `const Glib::RefPtr<Gst::TunerChannel>&', `Glib::wrap($3, true)')
+
+  /** Reports that the current Gst::TunerChannel has changed.
+   * @param channel The Gst::TunerChannel that has changed.
+   */
+  _WRAP_SIGNAL(void channel_changed(const Glib::RefPtr<Gst::TunerChannel>& channel), "channel-changed")
+
+  /** Reports that the current frequency has changed.
+   * @param channel The Gst::TunerChannel who's frequency has changed.
+   * @param frequency The new frequency.
+   */
+  _WRAP_SIGNAL(void frequency_changed(const Glib::RefPtr<Gst::TunerChannel>& channel, gulong frequency), "frequency-changed")
+
+#m4 _CONVERSION(`GstTunerNorm*', `const Glib::RefPtr<Gst::TunerNorm>&', `Glib::wrap($3, true)')
+  /** Reports that the current Gst::TunerNorm has changed.
+   * @param norm The Gst::TunerNorm that has changed.
+   */
+  _WRAP_SIGNAL(void norm_changed(const Glib::RefPtr<Gst::TunerNorm>& norm), "norm-changed")
+
+  /** Reports that the signal strength has changed.
+   * @param channel The Gst::TunerChannel who's signal has changed.
+   * @param signal The new signal.
+   */
+  _WRAP_SIGNAL(void signal_changed(const Glib::RefPtr<Gst::TunerChannel>& channel, int signal), "signal-changed")
+};
+
+} // namespace Gst

Added: gstreamermm/trunk/gstreamer/src/tunerchannel.ccg
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/gstreamer/src/tunerchannel.ccg	Wed Jan 28 02:22:24 2009
@@ -0,0 +1,21 @@
+/* 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 Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gst/interfaces/tuner.h>
+_PINCLUDE(glibmm/private/object_p.h)

Added: gstreamermm/trunk/gstreamer/src/tunerchannel.hg
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/gstreamer/src/tunerchannel.hg	Wed Jan 28 02:22:24 2009
@@ -0,0 +1,83 @@
+/* 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 Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/object.h>
+
+_DEFS(gstreamermm,gst)
+
+namespace Gst
+{
+
+_WRAP_ENUM(TunerChannelFlags, GstTunerChannelFlags)
+
+/** Gst::TunerChannel - A channel from an element implementing the Gst::Tuner
+ * interface.
+ * The Gst::TunerChannel object is provided by an element implementing the
+ * Gst::Tuner interface.
+ *
+ * Gst::TunerChannel provides a name and flags to determine the type and
+ * capabilities of the channel. If the Gst::TUNER_CHANNEL_FREQUENCY flag is
+ * set, then the channel also information about the minimum and maximum
+ * frequency, and range of the reported signal strength.
+ */
+class TunerChannel : public Glib::Object
+{
+  _CLASS_GOBJECT(TunerChannel, GstTunerChannel, GST_TUNER_CHANNEL, Glib::Object, GObject)
+
+public:
+  /** Get a string containing a descriptive name for this channel.
+   */
+  _MEMBER_GET(label, label, Glib::ustring, gchar*)
+
+  /** Get a set of Gst::TunerChannelFlags for this channel.
+   */
+  _MEMBER_GET(flags, flags, TunerChannelFlags, GstTunerChannelFlags)
+
+  /** Get the step size (in Hz) for the frequency setting.
+   */
+  _MEMBER_GET(freq_multiplicator, freq_multiplicator, float, gfloat)
+
+  /** Get the minimum valid frequency setting (in Hz).
+   */
+  _MEMBER_GET(min_frequency, min_frequency, gulong, gulong)
+
+  /** Get the maximum valid frequency setting (in Hz).
+   */
+  _MEMBER_GET(max_frequency, max_frequency, gulong, gulong)
+
+  /** Get the minimum reported signal strength value.
+   */
+  _MEMBER_GET(min_signal, min_signal, int, gint)
+
+  /** Get the maximum reported signal strength value.
+   */
+  _MEMBER_GET(max_signal, max_signal, int, gint)
+
+  /** Reports that the current frequency has changed.
+   * @param frequency The new frequency.
+   */
+  _WRAP_SIGNAL(void frequency_changed(gulong frequency), "frequency-changed")
+
+  /** Reports that the signal strength has changed.
+   * @param signal The new signal value.
+   */
+  _WRAP_SIGNAL(void signal_changed(int signal), "signal-changed")
+};
+
+} // namespace Gst

Added: gstreamermm/trunk/gstreamer/src/tunernorm.ccg
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/gstreamer/src/tunernorm.ccg	Wed Jan 28 02:22:24 2009
@@ -0,0 +1,23 @@
+/* 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 Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gst/interfaces/tuner.h>
+#include <gstreamermm/value.h>
+
+_PINCLUDE(glibmm/private/object_p.h)

Added: gstreamermm/trunk/gstreamer/src/tunernorm.hg
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/gstreamer/src/tunernorm.hg	Wed Jan 28 02:22:24 2009
@@ -0,0 +1,47 @@
+/* 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 Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/object.h>
+_DEFS(gstreamermm,gst)
+
+namespace Gst
+{
+
+class Fraction;
+
+/** Gst::TunerNorm - Encapsulates information about the data format(s) for a
+ * Gst::TunerChannel.
+ * @ingroup GstInterfaces
+ */
+class TunerNorm : public Glib::Object
+{
+  _CLASS_GOBJECT(TunerNorm, GstTunerNorm, GST_TUNER_NORM, Glib::Object, GObject)
+public:
+  /** Get a string containing a descriptive name for the norm.
+   */
+  _MEMBER_GET(label, label, Glib::ustring, gchar*)
+
+#m4 _CONVERSION(`GValue&', `Gst::Fraction', `Gst::Fraction($3)')
+  /** Get the framerate associated with this norm, if any. (May be unset).  If
+   * it is not set the value will be 0/1.
+   */
+  _MEMBER_GET(framerate, framerate, Gst::Fraction, GValue&)
+};
+
+} // namespace Gst

Modified: gstreamermm/trunk/gstreamer/src/value.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/value.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/value.ccg	Wed Jan 28 02:22:24 2009
@@ -59,13 +59,23 @@
 Fourcc::Fourcc(const Glib::ValueBase& value)
 : first(0), second(0), third(0), fourth(0)
 {
-  if(G_VALUE_TYPE(value.gobj()) == GST_TYPE_FOURCC)
+  if(GST_VALUE_HOLDS_FOURCC(value.gobj()))
   {
     int fourcc = gst_value_get_fourcc(value.gobj());
     set_ccs(fourcc);
   }
 }
 
+Fourcc::Fourcc(const GValue& value)
+: first(0), second(0), third(0), fourth(0)
+{
+  if(GST_VALUE_HOLDS_FOURCC(&value))
+  {
+    int fourcc = gst_value_get_fourcc(&value);
+    set_ccs(fourcc);
+  }
+}
+
 guint32 Fourcc::get_fourcc() const
 {
   return GST_MAKE_FOURCC(first, second, third, fourth);
@@ -95,13 +105,23 @@
 Fraction::Fraction(const Glib::ValueBase& value)
 : num(0), denom(1)
 {
-  if(G_VALUE_TYPE(value.gobj()) == GST_TYPE_FRACTION)
+  if(GST_VALUE_HOLDS_FRACTION(value.gobj()))
   {
     num = gst_value_get_fraction_numerator(value.gobj());
     denom = gst_value_get_fraction_denominator(value.gobj());
   }
 }
 
+Fraction::Fraction(const GValue& value)
+: num(0), denom(1)
+{
+  if(GST_VALUE_HOLDS_FRACTION(&value))
+  {
+    num = gst_value_get_fraction_numerator(&value);
+    denom = gst_value_get_fraction_denominator(&value);
+  }
+}
+
 Fraction& Fraction::operator=(const Fraction& src)
 {
   num = src.num;
@@ -126,13 +146,23 @@
 IntRange::IntRange(const Glib::ValueBase& value)
 : min(0), max(0)
 {
-  if(G_VALUE_TYPE(value.gobj()) == GST_TYPE_INT_RANGE)
+  if(GST_VALUE_HOLDS_INT_RANGE(value.gobj()))
   {
     min = gst_value_get_int_range_min(value.gobj());
     max = gst_value_get_int_range_max(value.gobj());
   }
 }
 
+IntRange::IntRange(const GValue& value)
+: min(0), max(0)
+{
+  if(GST_VALUE_HOLDS_INT_RANGE(&value))
+  {
+    min = gst_value_get_int_range_min(&value);
+    max = gst_value_get_int_range_max(&value);
+  }
+}
+
 IntRange& IntRange::operator=(const IntRange& src)
 {
   min = src.min;
@@ -157,13 +187,23 @@
 DoubleRange::DoubleRange(const Glib::ValueBase& value)
 : min(0), max(0)
 {
-  if(G_VALUE_TYPE(value.gobj()) == GST_TYPE_DOUBLE_RANGE)
+  if(GST_VALUE_HOLDS_DOUBLE_RANGE(value.gobj()))
   {
     min = gst_value_get_double_range_min(value.gobj());
     max = gst_value_get_double_range_max(value.gobj());
   }
 }
 
+DoubleRange::DoubleRange(const GValue& value)
+: min(0), max(0)
+{
+  if(GST_VALUE_HOLDS_DOUBLE_RANGE(&value))
+  {
+    min = gst_value_get_double_range_min(&value);
+    max = gst_value_get_double_range_max(&value);
+  }
+}
+
 DoubleRange& DoubleRange::operator=(const DoubleRange& src)
 {
   min = src.min;
@@ -195,7 +235,7 @@
 FractionRange::FractionRange(const Glib::ValueBase& value)
 : min(), max()
 {
-  if(G_VALUE_TYPE(value.gobj()) == GST_TYPE_FRACTION_RANGE)
+  if(GST_VALUE_HOLDS_FRACTION_RANGE(value.gobj()))
   {
     const GValue* min = gst_value_get_fraction_range_min(value.gobj());
     const GValue* max = gst_value_get_fraction_range_max(value.gobj());
@@ -208,4 +248,20 @@
   }
 }
 
+FractionRange::FractionRange(const GValue& value)
+: min(), max()
+{
+  if(GST_VALUE_HOLDS_FRACTION_RANGE(&value))
+  {
+    const GValue* min = gst_value_get_fraction_range_min(&value);
+    const GValue* max = gst_value_get_fraction_range_max(&value);
+
+    this->min.num = gst_value_get_fraction_numerator(min);
+    this->min.denom = gst_value_get_fraction_denominator(min);
+
+    this->max.num = gst_value_get_fraction_numerator(max);
+    this->max.denom = gst_value_get_fraction_denominator(max);
+  }
+}
+
 } //namespace Gst

Modified: gstreamermm/trunk/gstreamer/src/value.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/value.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/value.hg	Wed Jan 28 02:22:24 2009
@@ -25,6 +25,11 @@
 namespace Gst
 {
 
+/** @defgroup GstHelperClasses gstreamermm Helper Classes
+ *  Classes used to represent GStreamer internal GValue types such as
+ *  GST_TYPE_FRACTION, etc.
+ */
+
 /** Represents a 4 byte identifier (used in codecs).
  * Gst::Fourcc is used to store a four byte identifier in Gst::Structure of
  * Gst::Caps as a value representing a property (see GStreamer Application
@@ -47,19 +52,20 @@
  * char first_char = fourcc.first;
  * ...
  * @endcode
+ * @ingroup GstHelperClasses
  */
 class Fourcc
 {
 public:
-  /** Construct an undefined Gst::Fourcc
+  /** Construct an undefined Gst::Fourcc.
    */
   Fourcc();
 
-  /** Construct a Gst::Fourcc from another
+  /** Construct a Gst::Fourcc from another.
    */
   Fourcc(const Fourcc& src);
 
-  /** Construct a Gst::Fourcc from 4 characters
+  /** Construct a Gst::Fourcc from 4 characters.
    */
   Fourcc(char first, char second, char third, char fourth);
 
@@ -68,14 +74,18 @@
    */
   explicit Fourcc(const Glib::ustring& s);
 
-  /** Construct a Gst::Fourcc from a 32 bit unsigned integer
+  /** Construct a Gst::Fourcc from a 32 bit unsigned integer.
    */
   explicit Fourcc(guint32 fourcc);
 
-  /** Construct a Gst::Fourcc from a GST_TYPE_FOURCC
+  /** Construct a Gst::Fourcc from a GST_TYPE_FOURCC.
    */
   explicit Fourcc(const Glib::ValueBase& gst_fraction_value);
 
+  /** Construct a Gst::Fourcc from a GST_TYPE_FOURCC.
+   */
+  explicit Fourcc(const GValue& gst_fraction_value);
+
   Fourcc& operator=(const Fourcc& src);
 
 
@@ -117,26 +127,31 @@
  * int numerator = fract.num;
  * ...
  * @endcode
+ * @ingroup GstHelperClasses
  */
 class Fraction
 {
 public:
-  /** Constructs a zero Gst::Fraction (0/1)
+  /** Constructs a zero Gst::Fraction (0/1).
    */
   Fraction();
 
-  /** Constructs a Gst::Fraction from another
+  /** Constructs a Gst::Fraction from another.
    */
   Fraction(const Fraction& src);
 
-  /** Constructs a Gst::Fraction (num/denom)
+  /** Constructs a Gst::Fraction (num/denom).
    */
   Fraction(int num, int denom);
 
-  /** Constructs a Gst::Fraction from a GST_TYPE_FRACTION
+  /** Constructs a Gst::Fraction from a GST_TYPE_FRACTION.
    */
   explicit Fraction(const Glib::ValueBase& gst_fraction_value);
 
+  /** Constructs a Gst::Fraction from a GST_TYPE_FRACTION.
+   */
+  explicit Fraction(const GValue& gst_fraction_value);
+
   Fraction& operator=(const Fraction& src);
 
 
@@ -169,26 +184,31 @@
  * int max = range.max;
  * ...
  * @endcode
+ * @ingroup GstHelperClasses
  */
 class IntRange
 {
 public:
-  /** Constructs a zero Gst::IntRange (0 - 0)
+  /** Constructs a zero Gst::IntRange (0 - 0).
    */
   IntRange();
 
-  /** Constructs an Gst::IntRange (min - max)
+  /** Constructs an Gst::IntRange (min - max).
    */
   IntRange(int min, int max);
 
-  /** Constructs an Gst::IntRange from another
+  /** Constructs an Gst::IntRange from another.
    */
   IntRange(const IntRange& src);
 
-  /** Constructs an Gst::IntRange from a GST_TYPE_INT_RANGE
+  /** Constructs an Gst::IntRange from a GST_TYPE_INT_RANGE.
    */
   explicit IntRange(const Glib::ValueBase& gst_int_range_value);
 
+  /** Constructs an Gst::IntRange from a GST_TYPE_INT_RANGE.
+   */
+  explicit IntRange(const GValue& gst_int_range_value);
+
   IntRange& operator=(const IntRange& src);
 
 public:
@@ -218,26 +238,31 @@
  * double min = range.min;
  * ...
  * @endcode
+ * @ingroup GstHelperClasses
  */
 class DoubleRange
 {
 public:
-  /** Constructs a zero Gst::DoubleRange (0.0 - 0.0)
+  /** Constructs a zero Gst::DoubleRange (0.0 - 0.0).
    */
   DoubleRange();
 
-  /** Constructs a Gst::DoubleRange (min - max)
+  /** Constructs a Gst::DoubleRange (min - max).
    */
   DoubleRange(double min, double max);
 
-  /** Constructs a Gst::DoubleRange from another
+  /** Constructs a Gst::DoubleRange from another.
    */
   DoubleRange(const DoubleRange& src);
 
-  /** Constructs a Gst::DoubleRange from a GST_TYPE_DOUBLE_RANGE
+  /** Constructs a Gst::DoubleRange from a GST_TYPE_DOUBLE_RANGE.
    */
   explicit DoubleRange(const Glib::ValueBase& gst_double_range_value);
 
+  /** Constructs a Gst::DoubleRange from a GST_TYPE_DOUBLE_RANGE.
+   */
+  explicit DoubleRange(const GValue& gst_double_range_value);
+
   DoubleRange& operator=(const DoubleRange& src);
 
 public:
@@ -267,26 +292,31 @@
  * int min_numerator = range.min.num;
  * ...
  * @endcode
+ * @ingroup GstHelperClasses
  */
 class FractionRange
 {
 public:
-  /** Constructs a zero Gst::FractionRange (0/1 - 0/1)
+  /** Constructs a zero Gst::FractionRange (0/1 - 0/1).
    */
   FractionRange();
 
-  /** Constructs a Gst::FractionRange (min - max)
+  /** Constructs a Gst::FractionRange (min - max).
    */
   FractionRange(const Fraction& min, const Fraction& max);
 
-  /** Constructs a Gst::FractionRange from another
+  /** Constructs a Gst::FractionRange from another.
    */
   FractionRange(const FractionRange& src);
 
-  /** Constructs a Gst::FractionRange from a GST_TYPE_FRACTION_RANGE
+  /** Constructs a Gst::FractionRange from a GST_TYPE_FRACTION_RANGE.
    */
   explicit FractionRange(const Glib::ValueBase& gst_fraction_range_value);
 
+  /** Constructs a Gst::FractionRange from a GST_TYPE_FRACTION_RANGE.
+   */
+  explicit FractionRange(const GValue& gst_fraction_range_value);
+
   FractionRange& operator=(const FractionRange& src);
 
 public:

Modified: gstreamermm/trunk/tests/test-caps.cc
==============================================================================
--- gstreamermm/trunk/tests/test-caps.cc	(original)
+++ gstreamermm/trunk/tests/test-caps.cc	Wed Jan 28 02:22:24 2009
@@ -70,7 +70,7 @@
 
   if (caps->get_structure(0).get_field("string", string))
   {
-    std::cout << "Simple caps string after setting = " << string << "." <<
+    std::cout << "Simple caps string after setting = '" << string << "'." <<
       std::endl;
   }
   else

Modified: gstreamermm/trunk/tests/test-structure.cc
==============================================================================
--- gstreamermm/trunk/tests/test-structure.cc	(original)
+++ gstreamermm/trunk/tests/test-structure.cc	Wed Jan 28 02:22:24 2009
@@ -27,42 +27,47 @@
 
   Gst::Structure structure("my_structure");
 
-  structure.set_field(Glib::Quark("string"), "Hello; This is a ustring.");
+  structure.set_field(Glib::Quark("string"), "Hello; This is a ustring");
   structure.set_field("integer", 100);
   structure.set_field("fraction", Gst::Fraction(1,2));
-  structure.set_field("range", Gst::FractionRange(Gst::Fraction(1,2), Gst::Fraction(3,4)));
+  structure.set_field("range", Gst::FractionRange(Gst::Fraction(1,2),
+    Gst::Fraction(3,4)));
   Glib::Date date;
   date.set_time_current();
   structure.set_field("date", date);
-  structure.set_field("state", Glib::Value<Gst::State>::value_type(), Gst::STATE_PAUSED);
+  structure.set_field("state", Glib::Value<Gst::State>::value_type(),
+    Gst::STATE_PAUSED);
 
   Glib::ustring value1;
   structure.get_field("string", value1);
-  std::cout << "string value = '" << value1 << "'" << std::endl;
+  std::cout << "string value after getting = '" << value1 << "'." << std::endl;
 
   int value2;
   structure.get_field("integer", value2);
-  std::cout << "integer value = '" << value2 << "'" << std::endl;
+  std::cout << "integer value after getting = " << value2 << "." <<
+    std::endl;
 
   Gst::Fraction value3;
   structure.get_field("fraction", value3);
-  std::cout << "fraction value = '" << value3.num << "/" <<
-    value3.denom << "'" << std::endl;
+  std::cout << "fraction value after getting = " << value3.num << "/" <<
+    value3.denom << "." << std::endl;
 
   Gst::FractionRange value4;
   structure.get_field("range", value4);
-  std::cout << "fractional range value = '[(" << value4.min.num << "/" <<
-    value4.min.denom << "), (" << value4.max.num << "/" << value4.max.denom << ")]'" << std::endl;
+  std::cout << "fractional range value after getting = [(" <<
+    value4.min.num << "/" << value4.min.denom << "), (" <<
+    value4.max.num << "/" << value4.max.denom << ")]." << std::endl;
 
   Glib::Date value5;
   structure.get_field("date", value5);
-  std::cout << "date value = " <<  value5.get_month() << "/" <<
-    (int) value5.get_day() << "/" << value5.get_year() << std::endl;
+  std::cout << "date value after getting = " <<  value5.get_month() << "/" <<
+    (int) value5.get_day() << "/" << value5.get_year() << "." << std::endl;
 
   int state;
   structure.get_field("state", Glib::Value<Gst::State>::value_type(), state);
   if (state = Gst::STATE_PAUSED)
-    std::cout << "state value = Gst::STATE_PAUSED" << std::endl;
+    std::cout << "state value after getting = Gst::STATE_PAUSED." <<
+      std::endl;
 
   return 0;
 }

Modified: gstreamermm/trunk/tests/test-taglist.cc
==============================================================================
--- gstreamermm/trunk/tests/test-taglist.cc	(original)
+++ gstreamermm/trunk/tests/test-taglist.cc	Wed Jan 28 02:22:24 2009
@@ -53,7 +53,7 @@
   if (taglist.get(Gst::Tag::BITRATE, 0, rate))
     std::cout << "Tag bit-rate is " << rate << "." << std::endl;
   else
-    std::cout << "Could not get tag `" << Gst::Tag::BITRATE << "'." << std::endl;
+    std::cout << "Could not get tag " << Gst::Tag::BITRATE << "." << std::endl;
 
   Glib::Date date;
   if (taglist.get(Gst::Tag::DATE, date))

Modified: gstreamermm/trunk/tools/m4/convert_gst.m4
==============================================================================
--- gstreamermm/trunk/tools/m4/convert_gst.m4	(original)
+++ gstreamermm/trunk/tools/m4/convert_gst.m4	Wed Jan 28 02:22:24 2009
@@ -27,6 +27,7 @@
 _CONV_ENUM(Gst,StateChangeReturn)
 _CONV_ENUM(Gst,TagMergeMode)
 _CONV_ENUM(Gst,TaskState)
+_CONV_ENUM(Gst,TunerChannelFlags)
 _CONV_ENUM(Gst,URIType)
 
 ############### gstreamermm Class Conversions ######################
@@ -153,6 +154,18 @@
 _CONVERSION(`const GstTagList*',`const Gst::TagList',`Glib::wrap(const_cast<GstTagList*>($3), 0, true)')
 _CONVERSION(`Gst::TagList',`GstTagList*',`($3).gobj()')
 
+#TunerChannel
+_CONVERSION(`GstTunerChannel*',`Glib::RefPtr<Gst::TunerChannel>', `Glib::wrap($3)')
+_CONVERSION(`GstTunerChannel*',`Glib::RefPtr<const Gst::TunerChannel>', `Glib::wrap($3)')
+_CONVERSION(`const Glib::RefPtr<Gst::TunerChannel>&',`GstTunerChannel*', `Glib::unwrap($3)')
+_CONVERSION(`const Glib::RefPtr<const Gst::TunerChannel>&',`GstTunerChannel*', `const_cast<GstTunerChannel*>(Glib::unwrap($3))')
+
+#TunerNorm
+_CONVERSION(`GstTunerNorm*',`Glib::RefPtr<Gst::TunerNorm>', `Glib::wrap($3)')
+_CONVERSION(`GstTunerNorm*',`Glib::RefPtr<const Gst::TunerNorm>', `Glib::wrap($3)')
+_CONVERSION(`const Glib::RefPtr<Gst::TunerNorm>&',`GstTunerNorm*', `Glib::unwrap($3)')
+_CONVERSION(`const Glib::RefPtr<const Gst::TunerNorm>&',`GstTunerNorm*', `const_cast<GstTunerNorm*>(Glib::unwrap($3))')
+
 #URIHandler
 _CONVERSION(`const Glib::RefPtr<Gst::URIHandler>&',`GstURIHandler*',`Glib::unwrap($3)')
 



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