gnomemm r1776 - in gstreamermm/trunk: . gstreamer/gstreamermm gstreamer/src tests
- From: jaalburqu svn gnome org
- To: svn-commits-list gnome org
- Subject: gnomemm r1776 - in gstreamermm/trunk: . gstreamer/gstreamermm gstreamer/src tests
- Date: Thu, 6 Nov 2008 22:49:41 +0000 (UTC)
Author: jaalburqu
Date: Thu Nov 6 22:49:41 2008
New Revision: 1776
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1776&view=rev
Log:
2008-11-06 Josà Alburquerque <jaalburqu svn gnome org>
* gstreamer/gstreamermm/Makefile.am:
* gstreamer/gstreamermm/structurevalue.cc:
* gstreamer/gstreamermm/structurevalue.h:
* gstreamer/src/caps.hg:
* gstreamer/src/tagsetter.hg: Remove unneeded Gst::StructureValue
classes (used before for setting and getting generic types in methods
such as Gst::Caps::set_simple(), Gst::TagList::add() and
Gst::TagList::add_tag()).
* gstreamer/src/taglist.ccg:
* gstreamer/src/taglist.hg:
* gstreamer/gstreamermm/taglist.cc:
* gstreamer/gstreamermm/taglist.h: Renamed get_tag_size() to size().
Added a non-index get() method for Glib::ValueBase. Replaced the
overridden get() methods with index and non-index generic data type
get() methods.
* tests/test-taglist.cc: Added sections for adding and getting a
Glib::Date. Used the index get() method for retrieving the bit rate
to ensure that the index get() generic data type method works.
Removed:
gstreamermm/trunk/gstreamer/gstreamermm/structurevalue.cc
gstreamermm/trunk/gstreamer/gstreamermm/structurevalue.h
Modified:
gstreamermm/trunk/ChangeLog
gstreamermm/trunk/gstreamer/gstreamermm/Makefile.am
gstreamermm/trunk/gstreamer/gstreamermm/taglist.cc
gstreamermm/trunk/gstreamer/gstreamermm/taglist.h
gstreamermm/trunk/gstreamer/src/caps.hg
gstreamermm/trunk/gstreamer/src/taglist.ccg
gstreamermm/trunk/gstreamer/src/taglist.hg
gstreamermm/trunk/gstreamer/src/tagsetter.hg
gstreamermm/trunk/tests/test-taglist.cc
Modified: gstreamermm/trunk/gstreamer/gstreamermm/Makefile.am
==============================================================================
--- gstreamermm/trunk/gstreamer/gstreamermm/Makefile.am (original)
+++ gstreamermm/trunk/gstreamer/gstreamermm/Makefile.am Thu Nov 6 22:49:41 2008
@@ -13,12 +13,12 @@
sublib_files_extra_posix_cc =
sublib_files_extra_win32_cc =
-sublib_files_extra_general_cc = init.cc miniobject.cc object.cc version.cc wrap.cc gst_wrap_init.cc taglist.cc structurevalue.cc
+sublib_files_extra_general_cc = init.cc miniobject.cc object.cc version.cc wrap.cc gst_wrap_init.cc taglist.cc
sublib_files_extra_general_deprecated_cc =
sublib_files_extra_posix_h =
sublib_files_extra_win32_h =
-sublib_files_extra_general_h = init.h miniobject.h object.h version.h wrap.h gst_wrap_init.h taglist.h structurevalue.h
+sublib_files_extra_general_h = init.h miniobject.h object.h version.h wrap.h gst_wrap_init.h taglist.h
sublib_files_extra_general_deprecated_h =
include $(top_srcdir)/build_shared/Makefile_build.am_fragment
Modified: gstreamermm/trunk/gstreamer/gstreamermm/taglist.cc
==============================================================================
--- gstreamermm/trunk/gstreamer/gstreamermm/taglist.cc (original)
+++ gstreamermm/trunk/gstreamer/gstreamermm/taglist.cc Thu Nov 6 22:49:41 2008
@@ -55,6 +55,11 @@
delete slot_copy;
}
+bool TagList::get(const Glib::ustring& tag, Glib::ValueBase& dest)
+{
+ return gst_tag_list_copy_value(dest.gobj(), gobj(), tag.c_str());
+}
+
bool TagList::get(const Glib::ustring& tag, guint index, Glib::ValueBase& value)
{
const GValue* gst_value = gst_tag_list_get_value_index(gobj(), tag.c_str(), index);
@@ -66,152 +71,6 @@
return false;
}
-bool TagList::get(const Glib::ustring& tag, char& value)
-{
- return gst_tag_list_get_char(gobj(), tag.c_str(), &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, char& value)
-{
- return gst_tag_list_get_char_index(gobj(), tag.c_str(), index, &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guchar& value)
-{
- return gst_tag_list_get_uchar(gobj(), tag.c_str(), &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, guchar& value)
-{
- return gst_tag_list_get_uchar_index(gobj(), tag.c_str(), index, &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, bool& value)
-{
- gboolean gst_value = false;
- bool result = gst_tag_list_get_boolean(gobj(), tag.c_str(), &gst_value);
- value = gst_value;
- return result;
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, bool& value)
-{
- gboolean gst_value = false;
- bool result = gst_tag_list_get_boolean_index(gobj(), tag.c_str(), index, &gst_value);
- value = gst_value;
- return result;
-}
-
-bool TagList::get(const Glib::ustring& tag, int& value)
-{
- return gst_tag_list_get_int(gobj(), tag.c_str(), &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, int& value)
-{
- return gst_tag_list_get_int_index(gobj(), tag.c_str(), index, &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guint& value)
-{
- return gst_tag_list_get_uint(gobj(), tag.c_str(), &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, guint& value)
-{
- return gst_tag_list_get_uint_index(gobj(), tag.c_str(), index, &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, long& value)
-{
- return gst_tag_list_get_long(gobj(), tag.c_str(), &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, long& value)
-{
- return gst_tag_list_get_long_index(gobj(), tag.c_str(), index, &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, gulong& value)
-{
- return gst_tag_list_get_ulong(gobj(), tag.c_str(), &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, gulong& value)
-{
- return gst_tag_list_get_ulong_index(gobj(), tag.c_str(), index, &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, float& value)
-{
- return gst_tag_list_get_float(gobj(), tag.c_str(), &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, float& value)
-{
- return gst_tag_list_get_float_index(gobj(), tag.c_str(), index, &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, double& value)
-{
- return gst_tag_list_get_double(gobj(), tag.c_str(), &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, double& value)
-{
- return gst_tag_list_get_double_index(gobj(), tag.c_str(), index, &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, Glib::ustring& value)
-{
- gchar *gst_value = 0;
- bool result = gst_tag_list_get_string(gobj(), tag.c_str(), &gst_value);
-
- if (result)
- {
- value = gst_value;
- g_free(gst_value);
- }
-
- return result;
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, Glib::ustring& value)
-{
- gchar *gst_value = 0;
- bool result = gst_tag_list_get_string_index(gobj(), tag.c_str(), index, &gst_value);
-
- if (result)
- {
- value = gst_value;
- g_free(gst_value);
- }
-
- return result;
-}
-
-bool TagList::get(const Glib::ustring& tag, Glib::Date& value)
-{
- GDate* gst_value = 0;
- bool result = gst_tag_list_get_date(gobj(), tag.c_str(), &gst_value);
-
- if (result)
- value.set_julian(Glib::Date(*gst_value).get_julian());
-
- return result;
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, Glib::Date& value)
-{
- GDate* gst_value = 0;
- bool result = gst_tag_list_get_date_index(gobj(), tag.c_str(), index, &gst_value);
-
- if (result)
- value.set_julian(g_date_julian(gst_value));
-
- return result;
-}
-
} //namespace Gst
namespace
@@ -347,7 +206,7 @@
return Glib::wrap(gst_tag_list_merge(gobj(), ((other).gobj()), ((GstTagMergeMode)(mode))), 0, true);
}
-guint TagList::get_tag_size(const Glib::ustring& tag) const
+guint TagList::size(const Glib::ustring& tag) const
{
return gst_tag_list_get_tag_size(const_cast<GstTagList*>(gobj()), tag.c_str());
}
Modified: gstreamermm/trunk/gstreamer/gstreamermm/taglist.h
==============================================================================
--- gstreamermm/trunk/gstreamer/gstreamermm/taglist.h (original)
+++ gstreamermm/trunk/gstreamer/gstreamermm/taglist.h Thu Nov 6 22:49:41 2008
@@ -29,7 +29,6 @@
#include <gst/gsttaglist.h>
#include <gstreamermm/structure.h>
-#include <gstreamermm/structurevalue.h>
namespace Gst
{
@@ -442,7 +441,7 @@
* @param tag The tag to query.
* @return The number of tags stored.
*/
- guint get_tag_size(const Glib::ustring& tag) const;
+ guint size(const Glib::ustring& tag) const;
/** Sets a GValue for the given @a tag using the specified mode.
*
@@ -464,8 +463,8 @@
/** Sets the value for the given tag using the specified mode.
*
* @param tag The tag name.
- * @param data A value which the tag should be set to (this can be any C++
- * class).
+ * @param data A value which the tag should be set to (this can be any
+ * supported C++ type).
* @param mode The merge mode to use.
*/
template <class DataType>
@@ -490,245 +489,46 @@
void foreach(const SlotForeach& slot);
- /** Gets the value that is at the given index for the given tag.
-
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @@param The Glib::ValueBase to store the value in.
- * @return true if tag was available and had right number of entries, false
- * otherwise.
- */
- bool get(const Glib::ustring& tag, guint index, Glib::ValueBase& value);
-
-
- /** Copies the contents for the given tag into the value, merging multiple
- * values into one if multiple values are associated with the tag.
- * @param tag The tag to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, char& value);
-
-
- /** Gets the value that is at the given index for the given tag.
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint index, char& value);
-
-
- /** Copies the contents for the given tag into the value, merging multiple
- * values into one if multiple values are associated with the tag.
- * @param tag The tag to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guchar& value);
-
-
- /** Gets the value that is at the given index for the given tag.
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint index, guchar& value);
-
-
- /** Copies the contents for the given tag into the value, merging multiple
- * values into one if multiple values are associated with the tag.
- * @param tag The tag to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, bool& value);
-
-
- /** Gets the value that is at the given index for the given tag.
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint index, bool& value);
-
-
- /** Copies the contents for the given tag into the value, merging multiple
- * values into one if multiple values are associated with the tag.
- * @param tag The tag to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, int& value);
-
-
- /** Gets the value that is at the given index for the given tag.
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint index, int& value);
-
-
- /** Copies the contents for the given tag into the value, merging multiple
- * values into one if multiple values are associated with the tag.
- * @param tag The tag to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint& value);
-
-
- /** Gets the value that is at the given index for the given tag.
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint index, guint& value);
-
-
- /** Copies the contents for the given tag into the value, merging multiple
- * values into one if multiple values are associated with the tag.
- * @param tag The tag to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, long& value);
-
-
- /** Gets the value that is at the given index for the given tag.
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint index, long& value);
-
-
- /** Copies the contents for the given tag into the value, merging multiple
- * values into one if multiple values are associated with the tag.
- * @param tag The tag to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, gulong& value);
-
-
- /** Gets the value that is at the given index for the given tag.
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint index, gulong& value);
-
-
- /** Copies the contents for the given tag into the value, merging multiple
- * values into one if multiple values are associated with the tag.
- * @param tag The tag to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, float& value);
-
-
- /** Gets the value that is at the given index for the given tag.
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint index, float& value);
-
-
/** Copies the contents for the given tag into the value, merging multiple
* values into one if multiple values are associated with the tag.
+ *
+ * @param dest An uninitialized Glib::ValueBase to copy into.
* @param tag The tag to read out.
- * @param value Location for the result.
* @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
+ * list.
*/
- bool get(const Glib::ustring& tag, double& value);
+ bool get(const Glib::ustring& tag, Glib::ValueBase& dest);
/** Gets the value that is at the given index for the given tag.
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint index, double& value);
-
- /** Copies the contents for the given tag into the value, possibly merging
- * multiple values into one if multiple values are associated with the tag.
- *
- * Use the index version of this method if you want to retrieve the first
- * string associated with this tag unmodified.
- *
- * The resulting string in value will be in UTF-8 encoding.
- *
- * @param tag The tag to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, Glib::ustring& value);
-
-
- /** Gets the value that is at the given index for the given tag in the given
- * list.
- *
- * The resulting string in value will be in UTF-8 encoding.
- *
* @param tag The tag to read out.
* @param index Number of entry to read out.
- * @param value location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
+ * @@param The Glib::ValueBase to store the value in.
+ * @return true if tag was available and had right number of entries, false
+ * otherwise.
*/
- bool get(const Glib::ustring& tag, guint index, Glib::ustring& value);
+ bool get(const Glib::ustring& tag, guint index, Glib::ValueBase& dest);
/** Copies the contents for the given tag into the value, merging multiple
* values into one if multiple values are associated with the tag.
* @param tag The tag to read out.
- * @param value Location for the result.
+ * @param value Location for the result (this can be any supported C++ type).
* @return true, if a value was copied, false if the tag didn't exist in the
* given list.
*/
- bool get(const Glib::ustring& tag, Glib::Date& value);
+ template<class DataType> bool get(const Glib::ustring& tag, DataType& value);
/** Gets the value that is at the given index for the given tag.
* @param tag The tag to read out.
* @param index Number of entry to read out.
- * @param value Location for the result.
+ * @param value Location for the result (this can be any supported C++ type).
* @return true, if a value was copied, false if the tag didn't exist in the
* given list.
*/
- bool get(const Glib::ustring& tag, guint index, Glib::Date& value);
+ template<class DataType> bool get(const Glib::ustring& tag, guint index, DataType& value);
//Variable argument functions are ignored.
@@ -738,13 +538,12 @@
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-/******************************* Gst::Caps *******************************/
+/***************************** Gst::TagList *****************************/
template <class DataType>
void TagList::add(const Glib::ustring& tag, const DataType& data, TagMergeMode mode)
{
- typedef typename Gst::StructureValue<DataType> type_cppdata;
- typedef typename type_cppdata::ValueType ValueType;
+ typedef Glib::Value<DataType> ValueType;
ValueType value;
value.init(ValueType::value_type());
@@ -752,6 +551,30 @@
this->add(tag, (Glib::ValueBase) value, mode);
}
+template<class DataType>
+bool TagList::get(const Glib::ustring& tag, DataType& data)
+{
+ Glib::Value<DataType> value;
+ bool result = this->get(tag, (Glib::ValueBase&) value);
+
+ if (result)
+ data = value.get();
+
+ return result;
+}
+
+template<class DataType>
+bool TagList::get(const Glib::ustring& tag, guint index, DataType& data)
+{
+ Glib::Value<DataType> value;
+ bool result = this->get(tag, index, (Glib::ValueBase&) value);
+
+ if (result)
+ data = value.get();
+
+ return result;
+}
+
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
Modified: gstreamermm/trunk/gstreamer/src/caps.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/caps.hg (original)
+++ gstreamermm/trunk/gstreamer/src/caps.hg Thu Nov 6 22:49:41 2008
@@ -21,7 +21,6 @@
#include <gst/gstcaps.h>
#include <gstreamermm/structure.h>
-#include <gstreamermm/structurevalue.h>
#include <libxml++/nodes/node.h>
_DEFS(gstreamermm,gst)
@@ -139,8 +138,8 @@
* functional compatibility.
*
* @param name Field to set.
- * @param data A value which the field should be set to (this can be any C++
- * class).
+ * @param data A value which the field should be set to (this can be any
+ * supported C++ type).
*/
template <class DataType>
void set_simple(const Glib::ustring& name, const DataType& data);
@@ -187,8 +186,7 @@
template <class DataType>
void Caps::set_simple(const Glib::ustring& name, const DataType& data)
{
- typedef typename Gst::StructureValue<DataType> type_cppdata;
- typedef typename type_cppdata::ValueType ValueType;
+ typedef Glib::Value<DataType> ValueType;
ValueType value;
value.init(ValueType::value_type());
Modified: gstreamermm/trunk/gstreamer/src/taglist.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/taglist.ccg (original)
+++ gstreamermm/trunk/gstreamer/src/taglist.ccg Thu Nov 6 22:49:41 2008
@@ -49,6 +49,11 @@
delete slot_copy;
}
+bool TagList::get(const Glib::ustring& tag, Glib::ValueBase& dest)
+{
+ return gst_tag_list_copy_value(dest.gobj(), gobj(), tag.c_str());
+}
+
bool TagList::get(const Glib::ustring& tag, guint index, Glib::ValueBase& value)
{
const GValue* gst_value = gst_tag_list_get_value_index(gobj(), tag.c_str(), index);
@@ -60,150 +65,4 @@
return false;
}
-bool TagList::get(const Glib::ustring& tag, char& value)
-{
- return gst_tag_list_get_char(gobj(), tag.c_str(), &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, char& value)
-{
- return gst_tag_list_get_char_index(gobj(), tag.c_str(), index, &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guchar& value)
-{
- return gst_tag_list_get_uchar(gobj(), tag.c_str(), &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, guchar& value)
-{
- return gst_tag_list_get_uchar_index(gobj(), tag.c_str(), index, &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, bool& value)
-{
- gboolean gst_value = false;
- bool result = gst_tag_list_get_boolean(gobj(), tag.c_str(), &gst_value);
- value = gst_value;
- return result;
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, bool& value)
-{
- gboolean gst_value = false;
- bool result = gst_tag_list_get_boolean_index(gobj(), tag.c_str(), index, &gst_value);
- value = gst_value;
- return result;
-}
-
-bool TagList::get(const Glib::ustring& tag, int& value)
-{
- return gst_tag_list_get_int(gobj(), tag.c_str(), &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, int& value)
-{
- return gst_tag_list_get_int_index(gobj(), tag.c_str(), index, &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guint& value)
-{
- return gst_tag_list_get_uint(gobj(), tag.c_str(), &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, guint& value)
-{
- return gst_tag_list_get_uint_index(gobj(), tag.c_str(), index, &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, long& value)
-{
- return gst_tag_list_get_long(gobj(), tag.c_str(), &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, long& value)
-{
- return gst_tag_list_get_long_index(gobj(), tag.c_str(), index, &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, gulong& value)
-{
- return gst_tag_list_get_ulong(gobj(), tag.c_str(), &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, gulong& value)
-{
- return gst_tag_list_get_ulong_index(gobj(), tag.c_str(), index, &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, float& value)
-{
- return gst_tag_list_get_float(gobj(), tag.c_str(), &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, float& value)
-{
- return gst_tag_list_get_float_index(gobj(), tag.c_str(), index, &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, double& value)
-{
- return gst_tag_list_get_double(gobj(), tag.c_str(), &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, double& value)
-{
- return gst_tag_list_get_double_index(gobj(), tag.c_str(), index, &value);
-}
-
-bool TagList::get(const Glib::ustring& tag, Glib::ustring& value)
-{
- gchar *gst_value = 0;
- bool result = gst_tag_list_get_string(gobj(), tag.c_str(), &gst_value);
-
- if (result)
- {
- value = gst_value;
- g_free(gst_value);
- }
-
- return result;
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, Glib::ustring& value)
-{
- gchar *gst_value = 0;
- bool result = gst_tag_list_get_string_index(gobj(), tag.c_str(), index, &gst_value);
-
- if (result)
- {
- value = gst_value;
- g_free(gst_value);
- }
-
- return result;
-}
-
-bool TagList::get(const Glib::ustring& tag, Glib::Date& value)
-{
- GDate* gst_value = 0;
- bool result = gst_tag_list_get_date(gobj(), tag.c_str(), &gst_value);
-
- if (result)
- value.set_julian(Glib::Date(*gst_value).get_julian());
-
- return result;
-}
-
-bool TagList::get(const Glib::ustring& tag, guint index, Glib::Date& value)
-{
- GDate* gst_value = 0;
- bool result = gst_tag_list_get_date_index(gobj(), tag.c_str(), index, &gst_value);
-
- if (result)
- value.set_julian(g_date_julian(gst_value));
-
- return result;
-}
-
} //namespace Gst
Modified: gstreamermm/trunk/gstreamer/src/taglist.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/taglist.hg (original)
+++ gstreamermm/trunk/gstreamer/src/taglist.hg Thu Nov 6 22:49:41 2008
@@ -21,7 +21,6 @@
#include <gst/gsttaglist.h>
#include <gstreamermm/structure.h>
-#include <gstreamermm/structurevalue.h>
_DEFS(gstreamermm,gst)
@@ -282,7 +281,7 @@
_WRAP_METHOD(bool is_empty() const, gst_tag_list_is_empty)
_WRAP_METHOD(void insert(const TagList& other, TagMergeMode mode=TAG_MERGE_PREPEND), gst_tag_list_insert)
_WRAP_METHOD(TagList merge(const TagList& other, TagMergeMode mode=TAG_MERGE_PREPEND), gst_tag_list_merge)
- _WRAP_METHOD(guint get_tag_size(const Glib::ustring& tag) const, gst_tag_list_get_tag_size)
+ _WRAP_METHOD(guint size(const Glib::ustring& tag) const, gst_tag_list_get_tag_size)
/** Sets a GValue for the given @a tag using the specified mode.
*
@@ -304,8 +303,8 @@
/** Sets the value for the given tag using the specified mode.
*
* @param tag The tag name.
- * @param data A value which the tag should be set to (this can be any C++
- * class).
+ * @param data A value which the tag should be set to (this can be any
+ * supported C++ type).
* @param mode The merge mode to use.
*/
template <class DataType>
@@ -327,246 +326,67 @@
void foreach(const SlotForeach& slot);
_IGNORE(gst_tag_list_foreach)
- /** Gets the value that is at the given index for the given tag.
-
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @@param The Glib::ValueBase to store the value in.
- * @return true if tag was available and had right number of entries, false
- * otherwise.
- */
- bool get(const Glib::ustring& tag, guint index, Glib::ValueBase& value);
- _IGNORE(gst_tag_list_get_value_index)
-
- /** Copies the contents for the given tag into the value, merging multiple
- * values into one if multiple values are associated with the tag.
- * @param tag The tag to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, char& value);
- _IGNORE(gst_tag_list_get_char)
-
- /** Gets the value that is at the given index for the given tag.
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint index, char& value);
- _IGNORE(gst_tag_list_get_char_index)
-
- /** Copies the contents for the given tag into the value, merging multiple
- * values into one if multiple values are associated with the tag.
- * @param tag The tag to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guchar& value);
- _IGNORE(gst_tag_list_get_uchar)
-
- /** Gets the value that is at the given index for the given tag.
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint index, guchar& value);
- _IGNORE(gst_tag_list_get_uchar_index)
-
- /** Copies the contents for the given tag into the value, merging multiple
- * values into one if multiple values are associated with the tag.
- * @param tag The tag to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, bool& value);
- _IGNORE(gst_tag_list_get_boolean)
-
- /** Gets the value that is at the given index for the given tag.
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint index, bool& value);
- _IGNORE(gst_tag_list_get_boolean_index)
-
- /** Copies the contents for the given tag into the value, merging multiple
- * values into one if multiple values are associated with the tag.
- * @param tag The tag to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, int& value);
- _IGNORE(gst_tag_list_get_int)
-
- /** Gets the value that is at the given index for the given tag.
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint index, int& value);
- _IGNORE(gst_tag_list_get_int_index)
-
- /** Copies the contents for the given tag into the value, merging multiple
- * values into one if multiple values are associated with the tag.
- * @param tag The tag to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint& value);
- _IGNORE(gst_tag_list_get_uint)
-
- /** Gets the value that is at the given index for the given tag.
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint index, guint& value);
- _IGNORE(gst_tag_list_get_uint_index)
-
- /** Copies the contents for the given tag into the value, merging multiple
- * values into one if multiple values are associated with the tag.
- * @param tag The tag to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, long& value);
- _IGNORE(gst_tag_list_get_long, gst_tag_list_get_int64)
-
- /** Gets the value that is at the given index for the given tag.
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint index, long& value);
- _IGNORE(gst_tag_list_get_long_index, gst_tag_list_get_int64_index)
-
- /** Copies the contents for the given tag into the value, merging multiple
- * values into one if multiple values are associated with the tag.
- * @param tag The tag to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, gulong& value);
- _IGNORE(gst_tag_list_get_ulong, gst_tag_list_get_uint64)
-
- /** Gets the value that is at the given index for the given tag.
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint index, gulong& value);
- _IGNORE(gst_tag_list_get_ulong_index, gst_tag_list_get_uint64_index)
-
- /** Copies the contents for the given tag into the value, merging multiple
- * values into one if multiple values are associated with the tag.
- * @param tag The tag to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, float& value);
- _IGNORE(gst_tag_list_get_float)
-
- /** Gets the value that is at the given index for the given tag.
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint index, float& value);
- _IGNORE(gst_tag_list_get_float_index)
-
/** Copies the contents for the given tag into the value, merging multiple
* values into one if multiple values are associated with the tag.
+ *
+ * @param dest An uninitialized Glib::ValueBase to copy into.
* @param tag The tag to read out.
- * @param value Location for the result.
* @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
+ * list.
*/
- bool get(const Glib::ustring& tag, double& value);
- _IGNORE(gst_tag_list_get_double)
+ bool get(const Glib::ustring& tag, Glib::ValueBase& dest);
+ _IGNORE(gst_tag_list_copy_value)
/** Gets the value that is at the given index for the given tag.
- * @param tag The tag to read out.
- * @param index Number of entry to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, guint index, double& value);
- _IGNORE(gst_tag_list_get_double_index)
- /** Copies the contents for the given tag into the value, possibly merging
- * multiple values into one if multiple values are associated with the tag.
- *
- * Use the index version of this method if you want to retrieve the first
- * string associated with this tag unmodified.
- *
- * The resulting string in value will be in UTF-8 encoding.
- *
- * @param tag The tag to read out.
- * @param value Location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
- */
- bool get(const Glib::ustring& tag, Glib::ustring& value);
- _IGNORE(gst_tag_list_get_string)
-
- /** Gets the value that is at the given index for the given tag in the given
- * list.
- *
- * The resulting string in value will be in UTF-8 encoding.
- *
* @param tag The tag to read out.
* @param index Number of entry to read out.
- * @param value location for the result.
- * @return true, if a value was copied, false if the tag didn't exist in the
- * given list.
+ * @@param The Glib::ValueBase to store the value in.
+ * @return true if tag was available and had right number of entries, false
+ * otherwise.
*/
- bool get(const Glib::ustring& tag, guint index, Glib::ustring& value);
- _IGNORE(gst_tag_list_get_string_index)
+ bool get(const Glib::ustring& tag, guint index, Glib::ValueBase& dest);
+ _IGNORE(gst_tag_list_get_value_index)
/** Copies the contents for the given tag into the value, merging multiple
* values into one if multiple values are associated with the tag.
* @param tag The tag to read out.
- * @param value Location for the result.
+ * @param value Location for the result (this can be any supported C++ type).
* @return true, if a value was copied, false if the tag didn't exist in the
* given list.
*/
- bool get(const Glib::ustring& tag, Glib::Date& value);
- _IGNORE(gst_tag_list_get_date)
+ template<class DataType> bool get(const Glib::ustring& tag, DataType& value);
+ _IGNORE(gst_tag_list_get_char,
+ gst_tag_list_get_uchar,
+ gst_tag_list_get_boolean,
+ gst_tag_list_get_int,
+ gst_tag_list_get_uint,
+ gst_tag_list_get_long, gst_tag_list_get_int64,
+ gst_tag_list_get_ulong, gst_tag_list_get_uint64,
+ gst_tag_list_get_float,
+ gst_tag_list_get_double,
+ gst_tag_list_get_string,
+ gst_tag_list_get_date)
/** Gets the value that is at the given index for the given tag.
* @param tag The tag to read out.
* @param index Number of entry to read out.
- * @param value Location for the result.
+ * @param value Location for the result (this can be any supported C++ type).
* @return true, if a value was copied, false if the tag didn't exist in the
* given list.
*/
- bool get(const Glib::ustring& tag, guint index, Glib::Date& value);
- _IGNORE(gst_tag_list_get_date_index)
+ template<class DataType> bool get(const Glib::ustring& tag, guint index, DataType& value);
+ _IGNORE(gst_tag_list_get_char_index,
+ gst_tag_list_get_uchar_index,
+ gst_tag_list_get_boolean_index,
+ gst_tag_list_get_int_index,
+ gst_tag_list_get_uint_index,
+ gst_tag_list_get_long_index, gst_tag_list_get_int64_index,
+ gst_tag_list_get_ulong_index, gst_tag_list_get_uint64_index,
+ gst_tag_list_get_float_index,
+ gst_tag_list_get_double_index,
+ gst_tag_list_get_string_index,
+ gst_tag_list_get_date_index)
//Variable argument functions are ignored.
_IGNORE(gst_tag_list_add, gst_tag_list_add_values)
@@ -574,13 +394,12 @@
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-/******************************* Gst::Caps *******************************/
+/***************************** Gst::TagList *****************************/
template <class DataType>
void TagList::add(const Glib::ustring& tag, const DataType& data, TagMergeMode mode)
{
- typedef typename Gst::StructureValue<DataType> type_cppdata;
- typedef typename type_cppdata::ValueType ValueType;
+ typedef Glib::Value<DataType> ValueType;
ValueType value;
value.init(ValueType::value_type());
@@ -588,6 +407,30 @@
this->add(tag, (Glib::ValueBase) value, mode);
}
+template<class DataType>
+bool TagList::get(const Glib::ustring& tag, DataType& data)
+{
+ Glib::Value<DataType> value;
+ bool result = this->get(tag, (Glib::ValueBase&) value);
+
+ if (result)
+ data = value.get();
+
+ return result;
+}
+
+template<class DataType>
+bool TagList::get(const Glib::ustring& tag, guint index, DataType& data)
+{
+ Glib::Value<DataType> value;
+ bool result = this->get(tag, index, (Glib::ValueBase&) value);
+
+ if (result)
+ data = value.get();
+
+ return result;
+}
+
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
Modified: gstreamermm/trunk/gstreamer/src/tagsetter.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/tagsetter.hg (original)
+++ gstreamermm/trunk/gstreamer/src/tagsetter.hg Thu Nov 6 22:49:41 2008
@@ -23,7 +23,6 @@
#include <glibmm/interface.h>
#include <gstreamermm/enums.h>
#include <gstreamermm/taglist.h>
-#include <gstreamermm/structurevalue.h>
_DEFS(gstreamermm,gst)
@@ -63,7 +62,8 @@
/** Adds the given value on the setter using the given merge mode.
*
* @param tag The tag to set.
- * @param data The value to set the tag to.
+ * @param data The value to set the tag to (this may be any supported C++
+ * type).
* @param mode The mode to use.
*/
template <class DataType>
@@ -84,8 +84,7 @@
template <class DataType>
void TagSetter::add_tag(const Glib::ustring& tag, const DataType& data, TagMergeMode mode)
{
- typedef typename Gst::StructureValue<DataType> type_cppdata;
- typedef typename type_cppdata::ValueType ValueType;
+ typedef Glib::Value<DataType> ValueType;
ValueType value;
value.init(ValueType::value_type());
Modified: gstreamermm/trunk/tests/test-taglist.cc
==============================================================================
--- gstreamermm/trunk/tests/test-taglist.cc (original)
+++ gstreamermm/trunk/tests/test-taglist.cc Thu Nov 6 22:49:41 2008
@@ -37,6 +37,7 @@
taglist.add(Gst::Tag::TITLE, "My Song");
taglist.add(Gst::Tag::ARTIST, "Artist");
taglist.add(Gst::Tag::BITRATE, (guint) 192);
+ taglist.add(Gst::Tag::DATE, Glib::Date(5, Glib::Date::NOVEMBER, 2008));
Glib::ustring title;
if (taglist.get(Gst::Tag::TITLE, title))
@@ -51,10 +52,17 @@
std::cout << "Could not get tag `" << Gst::Tag::ARTIST << "'." << std::endl;
guint rate;
- if (taglist.get(Gst::Tag::BITRATE, rate))
+ 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;
+ Glib::Date date;
+ if (taglist.get(Gst::Tag::DATE, date))
+ std::cout << "Tag date is " << date.get_year() << "-" <<
+ date.get_month() << "-" << (int) date.get_day() << "." << std::endl;
+ else
+ std::cout << "Could not get tag `" << Gst::Tag::DATE << "'." << std::endl;
+
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]