[gstreamermm] TagList: Export a lookup function for tags and not the internal array.
- From: José Alburquerque <jaalburqu src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gstreamermm] TagList: Export a lookup function for tags and not the internal array.
- Date: Wed, 23 Dec 2009 01:07:36 +0000 (UTC)
commit 88700f36413536c6cdc7e87c078f7ec170ebf02e
Author: José Alburquerque <jaalburqu svn gnome org>
Date: Tue Dec 22 19:55:00 2009 -0500
TagList: Export a lookup function for tags and not the internal array.
* gstreamer/src/taglist.ccg (_tag_strings): Make array of const char*
static within the file so it cannot be accessed outside.
* gstreamer/src/taglist.hg (gstreamermm_get_stock_tag): Defined this
method to get internal tags instead of having to access the internal
array.
* gstreamer/src/tagsetter.ccg (add_tag): Modified methods to use look
up function above instead of accessing the internal _tag_strings
array.
ChangeLog | 13 +++++++++++++
gstreamer/src/taglist.ccg | 11 +++++++----
gstreamer/src/taglist.hg | 6 ++----
gstreamer/src/tagsetter.ccg | 6 +++---
4 files changed, 25 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ab98d53..6495bc4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2009-12-22 José Alburquerque <jaalburqu svn gnome org>
+ TagList: Export a lookup function for tags and not the internal array.
+
+ * gstreamer/src/taglist.ccg (_tag_strings): Make array of const char*
+ static within the file so it cannot be accessed outside.
+ * gstreamer/src/taglist.hg (gstreamermm_get_stock_tag): Defined this
+ method to get internal tags instead of having to access the internal
+ array.
+ * gstreamer/src/tagsetter.ccg (add_tag): Modified methods to use look
+ up function above instead of accessing the internal _tag_strings
+ array.
+
+2009-12-22 José Alburquerque <jaalburqu svn gnome org>
+
RingBufferSpec: Use _MEMBER_[GET|SET] macros for accessing members.
* gstreamer/src/ringbuffer.ccg:
diff --git a/gstreamer/src/taglist.ccg b/gstreamer/src/taglist.ccg
index 99dab50..28a4ea3 100644
--- a/gstreamer/src/taglist.ccg
+++ b/gstreamer/src/taglist.ccg
@@ -50,10 +50,8 @@ static void TagList_foreach_gstreamermm_callback(const GstTagList*, const char *
namespace Gst
{
-// Make sure the order here is the same order as in Gst:Tag.
-// TODO: It would probably be better to export a lookup function instead of
-// the array itself.
-const char* const _tag_strings[] =
+// Make sure the order here is the same order as in Gst::Tag.
+static const char* const _tag_strings[] =
{
GST_TAG_TITLE,
GST_TAG_TITLE_SORTNAME,
@@ -109,6 +107,11 @@ const char* const _tag_strings[] =
GST_TAG_GEO_LOCATION_ELEVATION
};
+const char* gstreamermm_get_stock_tag(Tag tag)
+{
+ return _tag_strings[tag];
+}
+
TagList::operator bool() const
{
return gobject_ != 0;
diff --git a/gstreamer/src/taglist.hg b/gstreamer/src/taglist.hg
index 1e60147..cffe2b7 100644
--- a/gstreamer/src/taglist.hg
+++ b/gstreamer/src/taglist.hg
@@ -301,9 +301,7 @@ TAG_GEO_LOCATION_ELEVATION
std::ostream& operator<<(std::ostream& stream, Tag tag);
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-// I think that the reason this is external is that tagsetter.ccg also uses
-// it.
-extern const char* const _tag_strings[];
+const char* gstreamermm_get_stock_tag(Tag tag);
#endif
/** A List of tags and values used to describe media metadata.
@@ -410,7 +408,7 @@ public:
#m4begin
dnl See .ccg implementation for how this conversion works.
- _CONVERSION(`Tag', `const gchar*', `_tag_strings[$3]')
+ _CONVERSION(`Tag', `const gchar*', `gstreamermm_get_stock_tag($3)')
#m4end
_WRAP_METHOD(void remove_tag(Tag tag), gst_tag_list_remove_tag)
diff --git a/gstreamer/src/tagsetter.ccg b/gstreamer/src/tagsetter.ccg
index c68e4ec..1e8350e 100644
--- a/gstreamer/src/tagsetter.ccg
+++ b/gstreamer/src/tagsetter.ccg
@@ -24,7 +24,7 @@ void TagSetter::add_tag(Tag tag, const Glib::ValueBase& value,
TagMergeMode mode)
{
gst_tag_setter_add_tag_values(gobj(), (GstTagMergeMode) mode,
- _tag_strings[tag], value.gobj(), (void*)0);
+ gstreamermm_get_stock_tag(tag), value.gobj(), (void*)0);
}
void TagSetter::add_tag(const Glib::ustring& tag, const Glib::ValueBase& value,
@@ -36,8 +36,8 @@ void TagSetter::add_tag(const Glib::ustring& tag, const Glib::ValueBase& value,
void TagSetter::add_tag(Tag tag, const char* data, TagMergeMode mode)
{
- gst_tag_setter_add_tags(gobj(), (GstTagMergeMode) mode, _tag_strings[tag],
- data, (void*)0);
+ gst_tag_setter_add_tags(gobj(), (GstTagMergeMode) mode,
+ gstreamermm_get_stock_tag(tag), data, (void*)0);
}
void TagSetter::add_tag(const Glib::ustring& tag, const char* data,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]