[gstreamermm] Modified Gst::TagList and Gst::TagSetter to use an enum for the tags.
- From: José Alburquerque <jaalburqu src gnome org>
- To: svn-commits-list gnome org
- Subject: [gstreamermm] Modified Gst::TagList and Gst::TagSetter to use an enum for the tags.
- Date: Wed, 20 May 2009 20:55:05 -0400 (EDT)
commit 3c70106f752bcdfec1cd158914199b321120bb70
Author: José Alburquerque <jaalburqu svn gnome org>
Date: Wed May 20 20:54:12 2009 -0400
Modified Gst::TagList and Gst::TagSetter to use an enum for the tags.
---
ChangeLog | 18 +++++
gstreamer/src/taglist.ccg | 83 ++++++++++++++++++--
gstreamer/src/taglist.hg | 178 ++++++++++++++++++++++++++++---------------
gstreamer/src/tagsetter.ccg | 11 ++-
gstreamer/src/tagsetter.hg | 8 +-
tests/test-taglist.cc | 24 +++---
tests/test-tagsetter.cc | 12 ++--
7 files changed, 238 insertions(+), 96 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d7eb1a2..ca907b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
2009-05-20 José Alburquerque <jaalburqu svn gnome org>
+ * gstreamer/src/taglist.ccg:
+ * gstreamer/src/taglist.hg:
+ * gstreamer/src/tagsetter.ccg:
+ * gstreamer/src/tagsetter.hg: Modified Gst::TagList and Gst::TagSetter
+ to use an enum for the tags instead of a Glib::ustring as Daniel
+ suggested in the following e-mail:
+
+ http://mail.gnome.org/archives/gtkmm-list/2009-May/msg00164.html
+
+ I hope it is something along the lines of what he meant. Of course,
+ others can correct things if needed.
+
+ * tests/test-taglist.cc:
+ * tests/test-tagsetter.cc: Modified tests according to the changes
+ above.
+
+2009-05-20 José Alburquerque <jaalburqu svn gnome org>
+
* examples/optiongroup/main.cc: Included the fix of coding style from
'function ()' to 'function()' which had not been done in the previous
general coding style fix.
diff --git a/gstreamer/src/taglist.ccg b/gstreamer/src/taglist.ccg
index 42e5d0f..87b9be8 100644
--- a/gstreamer/src/taglist.ccg
+++ b/gstreamer/src/taglist.ccg
@@ -41,15 +41,81 @@ static void TagList_foreach_gstreamermm_callback(const GstTagList* list, const g
namespace Gst
{
-void TagList::add(const Glib::ustring& tag, const Glib::ValueBase& value, TagMergeMode mode)
+// The size should be the last enum in Gst::Tag + 1. Make sure the order here
+// is the same order as in Gst:Tag.
+const char* tagStrings[TAG_GEO_LOCATION_ELEVATION + 1] =
+{
+ GST_TAG_TITLE,
+ GST_TAG_TITLE_SORTNAME,
+ GST_TAG_ARTIST,
+ GST_TAG_ARTIST_SORTNAME,
+ GST_TAG_ALBUM,
+ GST_TAG_ALBUM_SORTNAME,
+ GST_TAG_DATE,
+ GST_TAG_GENRE,
+ GST_TAG_COMMENT,
+ GST_TAG_EXTENDED_COMMENT,
+ GST_TAG_TRACK_NUMBER,
+ GST_TAG_TRACK_COUNT,
+ GST_TAG_ALBUM_VOLUME_NUMBER,
+ GST_TAG_ALBUM_VOLUME_COUNT,
+ GST_TAG_LOCATION,
+ GST_TAG_DESCRIPTION,
+ GST_TAG_VERSION,
+ GST_TAG_ISRC,
+ GST_TAG_ORGANIZATION,
+ GST_TAG_COPYRIGHT,
+ GST_TAG_COPYRIGHT_URI,
+ GST_TAG_COMPOSER,
+ GST_TAG_CONTACT,
+ GST_TAG_LICENSE,
+ GST_TAG_LICENSE_URI,
+ GST_TAG_PERFORMER,
+ GST_TAG_DURATION,
+ GST_TAG_CODEC,
+ GST_TAG_VIDEO_CODEC,
+ GST_TAG_AUDIO_CODEC,
+ GST_TAG_BITRATE,
+ GST_TAG_NOMINAL_BITRATE,
+ GST_TAG_MINIMUM_BITRATE,
+ GST_TAG_MAXIMUM_BITRATE,
+ GST_TAG_SERIAL,
+ GST_TAG_ENCODER,
+ GST_TAG_ENCODER_VERSION,
+ GST_TAG_TRACK_GAIN,
+ GST_TAG_TRACK_PEAK,
+ GST_TAG_ALBUM_GAIN,
+ GST_TAG_ALBUM_PEAK,
+ GST_TAG_REFERENCE_LEVEL,
+ GST_TAG_LANGUAGE_CODE,
+ GST_TAG_IMAGE,
+ GST_TAG_PREVIEW_IMAGE,
+ GST_TAG_ATTACHMENT,
+ GST_TAG_BEATS_PER_MINUTE,
+ GST_TAG_KEYWORDS,
+ GST_TAG_GEO_LOCATION_NAME,
+ GST_TAG_GEO_LOCATION_LATITUDE,
+ GST_TAG_GEO_LOCATION_LONGITUDE,
+ GST_TAG_GEO_LOCATION_ELEVATION
+};
+
+std::ostream& operator<<(std::ostream& stream, Tag tag)
+{
+ stream << tagStrings[tag];
+ return stream;
+}
+
+void TagList::add(Tag tag, const Glib::ValueBase& value, TagMergeMode mode)
{
//TODO: The gst_tag_list_add_values() documentation says nothing about ending the ... with NULL.
- gst_tag_list_add_values(gobj(), (GstTagMergeMode) mode, tag.c_str(), value.gobj(), (void*)0);
+ gst_tag_list_add_values(gobj(), (GstTagMergeMode) mode, tagStrings[tag],
+ value.gobj(), (void*)0);
}
-void TagList::add(const Glib::ustring& tag, const char* data, TagMergeMode mode)
+void TagList::add(Tag tag, const char* data, TagMergeMode mode)
{
- gst_tag_list_add(gobj(), (GstTagMergeMode) mode, tag.c_str(), data, (void*)0);
+ gst_tag_list_add(gobj(), (GstTagMergeMode) mode, tagStrings[tag], data,
+ (void*)0);
}
void TagList::foreach(const SlotForeach& slot)
@@ -59,18 +125,17 @@ void TagList::foreach(const SlotForeach& slot)
delete slot_copy;
}
-bool TagList::get(const Glib::ustring& tag, Glib::ValueBase& dest) const
+bool TagList::get(Tag tag, Glib::ValueBase& dest) const
{
return gst_tag_list_copy_value(dest.gobj(), const_cast<GstTagList*>(gobj()),
- tag.c_str());
+ tagStrings[tag]);
}
-bool TagList::get(const Glib::ustring& tag, guint index,
- Glib::ValueBase& value) const
+bool TagList::get(Tag tag, guint index, Glib::ValueBase& value) const
{
const GValue* gst_value =
gst_tag_list_get_value_index(const_cast<GstTagList*>(gobj()),
- tag.c_str(), index);
+ tagStrings[tag], index);
if(gst_value)
{
value.init(gst_value);
diff --git a/gstreamer/src/taglist.hg b/gstreamer/src/taglist.hg
index 721e72a..27bb289 100644
--- a/gstreamer/src/taglist.hg
+++ b/gstreamer/src/taglist.hg
@@ -28,26 +28,28 @@ namespace Gst
_WRAP_ENUM(TagMergeMode, GstTagMergeMode)
_WRAP_ENUM(TagFlag, GstTagFlag)
-namespace Tag
+// When adding tags, make sure that they are added to this enum and then in the
+// ccg file in the correct order. Also make sure that the size of the array of
+// strings is updated in the declaration below and in the ccg file.
+enum Tag
{
-
/** Commonly used title (string).
* The title as it should be displayed, e.g. 'The Doll House'.
*/
-const Glib::ustring TITLE = GST_TAG_TITLE;
+TAG_TITLE,
/** Commonly used title, as used for sorting (string).
* The title as it should be sorted, e.g. 'Doll House, The'.
*
* Since 0.10.15.
*/
-const Glib::ustring TITLE_SORTNAME = GST_TAG_TITLE_SORTNAME;
+TAG_TITLE_SORTNAME,
/** Person(s) responsible for the recording (string).
* The artist name as it should be displayed, e.g. 'Jimi Hendrix' or 'The
* Guitar Heroes'.
*/
-const Glib::ustring ARTIST = GST_TAG_ARTIST;
+TAG_ARTIST,
/** Person(s) responsible for the recording, as used for sorting (string).
* The artist name as it should be sorted, e.g. 'Hendrix, Jimi' or 'Guitar
@@ -55,31 +57,31 @@ const Glib::ustring ARTIST = GST_TAG_ARTIST;
*
* Since 0.10.15.
*/
-const Glib::ustring ARTIST_SORTNAME = GST_TAG_ARTIST_SORTNAME;
+TAG_ARTIST_SORTNAME,
/** Album containing this data (string).
* The album name as it should be displayed, e.g. 'The Jazz Guitar'.
*/
-const Glib::ustring ALBUM = GST_TAG_ALBUM;
+TAG_ALBUM,
/** Album containing this data, as used for sorting (string).
* The album name as it should be sorted, e.g. 'Jazz Guitar, The'.
*
* Since 0.10.15.
*/
-const Glib::ustring ALBUM_SORTNAME = GST_TAG_ALBUM_SORTNAME;
+TAG_ALBUM_SORTNAME,
/** Date the data was created (GDate structure).
*/
-const Glib::ustring DATE = GST_TAG_DATE;
+TAG_DATE,
/** Genre this data belongs to (string).
*/
-const Glib::ustring GENRE = GST_TAG_GENRE;
+TAG_GENRE,
/** Free text commenting the data (string).
*/
-const Glib::ustring COMMENT = GST_TAG_COMMENT;
+TAG_COMMENT,
/** Key/value text commenting the data (string).
* Must be in the form of 'key=comment' or 'key[lc]=comment' where 'lc' is an
@@ -90,163 +92,214 @@ const Glib::ustring COMMENT = GST_TAG_COMMENT;
*
* Since 0.10.10.
*/
-const Glib::ustring EXTENDED_COMMENT = GST_TAG_EXTENDED_COMMENT;
+TAG_EXTENDED_COMMENT,
/** Track number inside a collection (unsigned integer).
*/
-const Glib::ustring TRACK_NUMBER = GST_TAG_TRACK_NUMBER;
+TAG_TRACK_NUMBER,
/** Count of tracks inside collection this track belongs to (unsigned integer).
*/
-const Glib::ustring TRACK_COUNT = GST_TAG_TRACK_COUNT;
+TAG_TRACK_COUNT,
/** Disc number inside a collection (unsigned integer).
*/
-const Glib::ustring ALBUM_VOLUME_NUMBER = GST_TAG_ALBUM_VOLUME_NUMBER;
+TAG_ALBUM_VOLUME_NUMBER,
/** Count of discs inside collection this disc belongs to (unsigned integer).
*/
-const Glib::ustring ALBUM_VOLUME_COUNT = GST_TAG_ALBUM_VOLUME_COUNT;
+TAG_ALBUM_VOLUME_COUNT,
/** Original location of file as a URI (string).
*/
-const Glib::ustring LOCATION = GST_TAG_LOCATION;
+TAG_LOCATION,
/** Short text describing the content of the data (string).
*/
-const Glib::ustring DESCRIPTION = GST_TAG_DESCRIPTION;
+TAG_DESCRIPTION,
/** Version of this data (string).
*/
-const Glib::ustring VERSION = GST_TAG_VERSION;
+TAG_VERSION,
/** International Standard Recording Code - see http://www.ifpi.org/isrc/
* (string).
*/
-const Glib::ustring ISRC = GST_TAG_ISRC;
+TAG_ISRC,
/** Organization (string).
*/
-const Glib::ustring ORGANIZATION = GST_TAG_ORGANIZATION;
+TAG_ORGANIZATION,
/** Copyright notice of the data (string).
*/
-const Glib::ustring COPYRIGHT = GST_TAG_COPYRIGHT;
+TAG_COPYRIGHT,
/** URI to location where copyright details can be found (string).
* Since 0.10.14.
*/
-const Glib::ustring COPYRIGHT_URI = GST_TAG_COPYRIGHT_URI;
+TAG_COPYRIGHT_URI,
/** Person(s) who composed the recording (string).
* Since 0.10.15.
*/
-const Glib::ustring COMPOSER = GST_TAG_COMPOSER;
+TAG_COMPOSER,
/** Contact information (string).
*/
-const Glib::ustring CONTACT = GST_TAG_CONTACT;
+TAG_CONTACT,
/** License of data (string).
*/
-const Glib::ustring LICENSE = GST_TAG_LICENSE;
+TAG_LICENSE,
/** URI to location where license details can be found (string).
* Since 0.10.14.
*/
-const Glib::ustring LICENSE_URI = GST_TAG_LICENSE_URI;
+TAG_LICENSE_URI,
/** Person(s) performing (string).
*/
-const Glib::ustring PERFORMER = GST_TAG_PERFORMER;
+TAG_PERFORMER,
/** Length in GStreamer time units (nanoseconds) (unsigned 64-bit integer).
*/
-const Glib::ustring DURATION = GST_TAG_DURATION;
+TAG_DURATION,
/** Codec the data is stored in (string).
*/
-const Glib::ustring CODEC = GST_TAG_CODEC;
+TAG_CODEC,
/** Codec the video data is stored in (string).
*/
-const Glib::ustring VIDEO_CODEC = GST_TAG_VIDEO_CODEC;
+TAG_VIDEO_CODEC,
/** Codec the audio data is stored in (string).
*/
-const Glib::ustring AUDIO_CODEC = GST_TAG_AUDIO_CODEC;
+TAG_AUDIO_CODEC,
/** Exact or average bitrate in bits/s (unsigned integer).
*/
-const Glib::ustring BITRATE = GST_TAG_BITRATE;
+TAG_BITRATE,
/** Nominal bitrate in bits/s (unsigned integer).
*/
-const Glib::ustring NOMINAL_BITRATE = GST_TAG_NOMINAL_BITRATE;
+TAG_NOMINAL_BITRATE,
/** Minimum bitrate in bits/s (unsigned integer).
*/
-const Glib::ustring MINIMUM_BITRATE = GST_TAG_MINIMUM_BITRATE;
+TAG_MINIMUM_BITRATE,
/** Maximum bitrate in bits/s (unsigned integer).
*/
-const Glib::ustring MAXIMUM_BITRATE = GST_TAG_MAXIMUM_BITRATE;
+TAG_MAXIMUM_BITRATE,
/** Serial number of track (unsigned integer).
*/
-const Glib::ustring SERIAL = GST_TAG_SERIAL;
+TAG_SERIAL,
/** Encoder used to encode this stream (string).
*/
-const Glib::ustring ENCODER = GST_TAG_ENCODER;
+TAG_ENCODER,
/** Version of the encoder used to encode this stream (unsigned integer).
*/
-const Glib::ustring ENCODER_VERSION = GST_TAG_ENCODER_VERSION;
+TAG_ENCODER_VERSION,
/** Track gain in db (double).
*/
-const Glib::ustring TRACK_GAIN = GST_TAG_TRACK_GAIN;
+TAG_TRACK_GAIN,
/** Peak of the track (double).
*/
-const Glib::ustring TRACK_PEAK = GST_TAG_TRACK_PEAK;
+TAG_TRACK_PEAK,
/** Album gain in db (double).
*/
-const Glib::ustring ALBUM_GAIN = GST_TAG_ALBUM_GAIN;
+TAG_ALBUM_GAIN,
/** Peak of the album (double).
*/
-const Glib::ustring ALBUM_PEAK = GST_TAG_ALBUM_PEAK;
+TAG_ALBUM_PEAK,
/** Reference level of track and album gain values (double).
* Since 0.10.12.
*/
-const Glib::ustring REFERENCE_LEVEL = GST_TAG_REFERENCE_LEVEL;
+TAG_REFERENCE_LEVEL,
/** Language code (ISO-639-1) (string) of the content.
*/
-const Glib::ustring LANGUAGE_CODE = GST_TAG_LANGUAGE_CODE;
+TAG_LANGUAGE_CODE,
/** Image (buffer) (buffer caps should specify the content type and preferably
* also set "image-type" field as GstTagImageType).
* Since 0.10.6
*/
-const Glib::ustring IMAGE = GST_TAG_IMAGE;
+TAG_IMAGE,
/** Image that is meant for preview purposes, e.g. small icon-sized version
* (buffer) (buffer caps should specify the content type).
* Since 0.10.7.
*/
-const Glib::ustring PREVIEW_IMAGE = GST_TAG_PREVIEW_IMAGE;
+TAG_PREVIEW_IMAGE,
+
+/** Generic file attachment (buffer) (buffer caps should specify the content
+ * type and if possible set "filename" to the file name of the attachment).
+ *
+ * Since 0.10.21.
+ */
+TAG_ATTACHMENT,
/** Number of beats per minute in audio (double).
* Since 0.10.12.
*/
-const Glib::ustring BEATS_PER_MINUTE = GST_TAG_BEATS_PER_MINUTE;
+TAG_BEATS_PER_MINUTE,
-}
+/** Comma separated keywords describing the content (string).
+ *
+ * Since 0.10.21
+ */
+TAG_KEYWORDS,
+
+/** Human readable descriptive location of where the media has been recorded or
+ * produced. (string).
+ *
+ * Since 0.10.21.
+ */
+TAG_GEO_LOCATION_NAME,
+
+/** Geo latitude location of where the media has been recorded or produced in
+ * degrees according to WGS84 (zero at the equator, negative values for
+ * southern latitudes) (double).
+ *
+ * Since 0.10.21.
+ */
+TAG_GEO_LOCATION_LATITUDE,
+
+/** Geo longitude location of where the media has been recorded or produced in
+ * degrees according to WGS84 (zero at the prime meridian in Greenwich/UK,
+ * negative values for western longitudes). (double).
+ *
+ * Since 0.10.21.
+ */
+TAG_GEO_LOCATION_LONGITUDE,
+
+/** Geo elevation of where the media has been recorded or produced in meters
+ * according to WGS84 (zero is average sea level) (double).
+ *
+ * Since 0.10.21.
+ */
+TAG_GEO_LOCATION_ELEVATION
+};
+
+/** Output stream operator for the Gst::Tag enum (this will output a string).
+ */
+std::ostream& operator<<(std::ostream& stream, Tag tag);
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+// The size should be the last enum of Gst::Tag (above) + 1.
+extern const char* tagStrings[TAG_GEO_LOCATION_ELEVATION + 1];
+#endif
/** A List of tags and values used to describe media metadata.
* Taglists form part of media streams and describe the content of a stream in
@@ -287,7 +340,7 @@ public:
* @param mode The mode to use.
* @param value The Glib::Value<> to use.
*/
- void add(const Glib::ustring& tag, const Glib::ValueBase& value, TagMergeMode mode=TAG_MERGE_PREPEND);
+ void add(Tag tag, const Glib::ValueBase& value, TagMergeMode mode=TAG_MERGE_PREPEND);
/** Sets the value for the given tag to string @a data using the specified
* mode.
@@ -296,7 +349,7 @@ public:
* @param data A string to which the tag should be set to.
* @param mode The merge mode to use.
*/
- void add(const Glib::ustring& tag, const char* data, TagMergeMode mode=TAG_MERGE_PREPEND);
+ void add(Tag tag, const char* data, TagMergeMode mode=TAG_MERGE_PREPEND);
/** Sets the value for the given tag using the specified mode.
*
@@ -306,10 +359,14 @@ public:
* @param mode The merge mode to use.
*/
template <class DataType>
- void add(const Glib::ustring& tag, const DataType& data, TagMergeMode mode=TAG_MERGE_PREPEND);
+ void add(Tag tag, const DataType& data, TagMergeMode mode=TAG_MERGE_PREPEND);
_IGNORE(gst_tag_list_add_valist, gst_tag_list_add_valist_values)
- _WRAP_METHOD(void remove_tag(const Glib::ustring& tag), gst_tag_list_remove_tag)
+#m4begin
+dnl See .ccg implementation for how this conversion works.
+ _CONVERSION(`Tag', `const gchar*', `tagStrings[$3]')
+#m4end
+ _WRAP_METHOD(void remove_tag(Tag tag), gst_tag_list_remove_tag)
/** For example,
* void on_foreach(const Glib::ustring& tag);.
@@ -332,7 +389,7 @@ public:
* @return true, if a value was copied, false if the tag didn't exist in the
* list.
*/
- bool get(const Glib::ustring& tag, Glib::ValueBase& dest) const;
+ bool get(Tag tag, Glib::ValueBase& dest) const;
_IGNORE(gst_tag_list_copy_value)
/** Gets the value that is at the given index for the given tag.
@@ -343,7 +400,7 @@ public:
* @return true if tag was available and had right number of entries, false
* otherwise.
*/
- bool get(const Glib::ustring& tag, guint index, Glib::ValueBase& dest) const;
+ bool get(Tag tag, guint index, Glib::ValueBase& dest) const;
_IGNORE(gst_tag_list_get_value_index)
/** Copies the contents for the given tag into the value, merging multiple
@@ -354,7 +411,7 @@ public:
* given list.
*/
template<class DataType>
- bool get(const Glib::ustring& tag, DataType& value) const;
+ bool get(Tag tag, DataType& value) const;
_IGNORE(gst_tag_list_get_char,
gst_tag_list_get_uchar,
gst_tag_list_get_boolean,
@@ -377,7 +434,7 @@ public:
* given list.
*/
template<class DataType>
- bool get(const Glib::ustring& tag, guint index, DataType& value) const;
+ bool get(Tag tag, guint index, DataType& value) const;
_IGNORE(gst_tag_list_get_char_index,
gst_tag_list_get_uchar_index,
gst_tag_list_get_boolean_index,
@@ -399,8 +456,7 @@ public:
/***************************** Gst::TagList *****************************/
template <class DataType>
-void TagList::add(const Glib::ustring& tag, const DataType& data,
- TagMergeMode mode)
+void TagList::add(Tag tag, const DataType& data, TagMergeMode mode)
{
typedef Glib::Value<DataType> ValueType;
@@ -411,7 +467,7 @@ void TagList::add(const Glib::ustring& tag, const DataType& data,
}
template<class DataType>
-bool TagList::get(const Glib::ustring& tag, DataType& data) const
+bool TagList::get(Tag tag, DataType& data) const
{
Glib::Value<DataType> value;
bool result = this->get(tag, (Glib::ValueBase&) value);
@@ -423,7 +479,7 @@ bool TagList::get(const Glib::ustring& tag, DataType& data) const
}
template<class DataType>
-bool TagList::get(const Glib::ustring& tag, guint index, DataType& data) const
+bool TagList::get(Tag tag, guint index, DataType& data) const
{
Glib::Value<DataType> value;
bool result = this->get(tag, index, (Glib::ValueBase&) value);
diff --git a/gstreamer/src/tagsetter.ccg b/gstreamer/src/tagsetter.ccg
index a768164..6ed8ce2 100644
--- a/gstreamer/src/tagsetter.ccg
+++ b/gstreamer/src/tagsetter.ccg
@@ -20,14 +20,17 @@
namespace Gst
{
-void TagSetter::add_tag(const Glib::ustring& tag, const Glib::ValueBase& value, TagMergeMode mode)
+void TagSetter::add_tag(Tag tag, const Glib::ValueBase& value,
+ TagMergeMode mode)
{
- gst_tag_setter_add_tag_values(gobj(), (GstTagMergeMode) mode, tag.c_str(), value.gobj(), (void*)0);
+ gst_tag_setter_add_tag_values(gobj(), (GstTagMergeMode) mode,
+ tagStrings[tag], value.gobj(), (void*)0);
}
-void TagSetter::add_tag(const Glib::ustring& tag, const char* data, TagMergeMode mode)
+void TagSetter::add_tag(Tag tag, const char* data, TagMergeMode mode)
{
- gst_tag_setter_add_tags(gobj(), (GstTagMergeMode) mode, tag.c_str(), data, (void*)0);
+ gst_tag_setter_add_tags(gobj(), (GstTagMergeMode) mode, tagStrings[tag],
+ data, (void*)0);
}
} //namespace Gst
diff --git a/gstreamer/src/tagsetter.hg b/gstreamer/src/tagsetter.hg
index fe18a9d..3b48c1a 100644
--- a/gstreamer/src/tagsetter.hg
+++ b/gstreamer/src/tagsetter.hg
@@ -56,7 +56,7 @@ public:
* @param value The value to set the tag to.
* @param mode The mode to use.
*/
- void add_tag(const Glib::ustring& tag, const Glib::ValueBase& value, TagMergeMode mode=TAG_MERGE_PREPEND);
+ void add_tag(Tag tag, const Glib::ValueBase& value, TagMergeMode mode=TAG_MERGE_PREPEND);
_IGNORE(gst_tag_setter_add_tag_valist, gst_tag_setter_add_tag_valist_values)
/** Adds the given value on the setter using the given merge mode.
@@ -67,7 +67,7 @@ public:
* @param mode The mode to use.
*/
template <class DataType>
- void add_tag(const Glib::ustring& tag, const DataType& data, TagMergeMode mode=TAG_MERGE_PREPEND);
+ void add_tag(Tag tag, const DataType& data, TagMergeMode mode=TAG_MERGE_PREPEND);
/** Adds the given value on the setter using the given merge mode.
*
@@ -75,7 +75,7 @@ public:
* @param data The value to set the tag to.
* @param mode The mode to use.
*/
- void add_tag(const Glib::ustring& tag, const char* data, TagMergeMode mode=TAG_MERGE_PREPEND);
+ void add_tag(Tag tag, const char* data, TagMergeMode mode=TAG_MERGE_PREPEND);
// A copy is taken so that the original is not freed by the wrapper.
#m4 _CONVERSION(`const GstTagList*',`const Gst::TagList',`Glib::wrap(const_cast<GstTagList*>($3), 0, true)')
@@ -93,7 +93,7 @@ public:
/************************** Gst::TagSetter ***************************/
template <class DataType>
-void TagSetter::add_tag(const Glib::ustring& tag, const DataType& data, TagMergeMode mode)
+void TagSetter::add_tag(Tag tag, const DataType& data, TagMergeMode mode)
{
typedef Glib::Value<DataType> ValueType;
diff --git a/tests/test-taglist.cc b/tests/test-taglist.cc
index 35cd6ee..0d8ad5d 100644
--- a/tests/test-taglist.cc
+++ b/tests/test-taglist.cc
@@ -32,35 +32,35 @@ int main (int argc, char* argv[])
exit(1);
}
- 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));
+ 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))
+ if(taglist.get(Gst::TAG_TITLE, title))
std::cout << "Tag title is '" << title << "'." << std::endl;
else
- std::cout << "Could not get tag `" << Gst::Tag::TITLE << "'." << std::endl;
+ std::cout << "Could not get tag `" << Gst::TAG_TITLE << "'." << std::endl;
Glib::ustring artist;
- if(taglist.get(Gst::Tag::ARTIST, artist))
+ if(taglist.get(Gst::TAG_ARTIST, artist))
std::cout << "Tag artist is '" << artist << "'." << std::endl;
else
- std::cout << "Could not get tag `" << Gst::Tag::ARTIST << "'." << std::endl;
+ std::cout << "Could not get tag `" << Gst::TAG_ARTIST << "'." << std::endl;
guint rate;
- if(taglist.get(Gst::Tag::BITRATE, 0, 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;
+ std::cout << "Could not get tag " << Gst::TAG_BITRATE << "." << std::endl;
Glib::Date date;
- if(taglist.get(Gst::Tag::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;
+ std::cout << "Could not get tag `" << Gst::TAG_DATE << "'." << std::endl;
return 0;
}
diff --git a/tests/test-tagsetter.cc b/tests/test-tagsetter.cc
index e65ee86..266c736 100644
--- a/tests/test-tagsetter.cc
+++ b/tests/test-tagsetter.cc
@@ -42,23 +42,23 @@ int main (int argc, char* argv[])
exit(1);
}
- setter->add_tag(Gst::Tag::BITRATE, 192);
- setter->add_tag(Gst::Tag::TITLE, "A Song");
+ setter->add_tag(Gst::TAG_BITRATE, 192);
+ setter->add_tag(Gst::TAG_TITLE, "A Song");
int bitrate = 0;
- if(setter->get_tag_list().get(Gst::Tag::BITRATE, bitrate))
+ if(setter->get_tag_list().get(Gst::TAG_BITRATE, bitrate))
std::cout << "bitrate = " << bitrate << "." << std::endl;
else
- std::cout << "Could not get tag `" << Gst::Tag::BITRATE <<
+ std::cout << "Could not get tag `" << Gst::TAG_BITRATE <<
"' from tagsetter." << std::endl;
std::string title;
- if(setter->get_tag_list().get(Gst::Tag::TITLE, title))
+ if(setter->get_tag_list().get(Gst::TAG_TITLE, title))
std::cout << "title = `" << title << "'." << std::endl;
else
- std::cout << "Could not get tag `" << Gst::Tag::TITLE <<
+ std::cout << "Could not get tag `" << Gst::TAG_TITLE <<
"' from tagsetter." << std::endl;
return 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]