[gstreamermm] TagSetter: Add Glib::ustring tag overrides.



commit d9c98aec5005d296c4ac7cc423b7f4488f8f1e71
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Wed Aug 19 13:49:33 2009 -0400

    	TagSetter: Add Glib::ustring tag overrides.
    
    	* gstreamer/src/tagsetter.ccg:
    	* gstreamer/src/tagsetter.hg: Added add_tag() methods that work with
    	Glib::ustring tags for custom tags not in the Gst::Tag enum.

 ChangeLog                   |    8 ++++++++
 gstreamer/src/tagsetter.ccg |   14 ++++++++++++++
 gstreamer/src/tagsetter.hg  |   41 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 63 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 641965f..2de78d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-08-19  José Alburquerque  <jaalburqu svn gnome org>
+
+	TagSetter: Add Glib::ustring tag overrides.
+
+	* gstreamer/src/tagsetter.ccg:
+	* gstreamer/src/tagsetter.hg: Added add_tag() methods that work with
+	Glib::ustring tags for custom tags not in the Gst::Tag enum. 
+
 2009-08-18  José Alburquerque  <jaalburqu svn gnome org>
 
 	Add Gst::MessageStep{Start,Done}.
diff --git a/gstreamer/src/tagsetter.ccg b/gstreamer/src/tagsetter.ccg
index eabf439..c68e4ec 100644
--- a/gstreamer/src/tagsetter.ccg
+++ b/gstreamer/src/tagsetter.ccg
@@ -27,10 +27,24 @@ void TagSetter::add_tag(Tag tag, const Glib::ValueBase& value,
     _tag_strings[tag], value.gobj(), (void*)0);
 }
 
+void TagSetter::add_tag(const Glib::ustring& tag, const Glib::ValueBase& value,
+  TagMergeMode mode)
+{
+  gst_tag_setter_add_tag_values(gobj(), (GstTagMergeMode) mode, tag.c_str(),
+    value.gobj(), (void*)0);
+}
+
 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);
 }
 
+void TagSetter::add_tag(const Glib::ustring& tag, const char* data,
+  TagMergeMode mode)
+{
+  gst_tag_setter_add_tags(gobj(), (GstTagMergeMode) mode, tag.c_str(),
+    data, (void*)0);
+}
+
 } //namespace Gst
diff --git a/gstreamer/src/tagsetter.hg b/gstreamer/src/tagsetter.hg
index 1bc7941..f3e96fe 100644
--- a/gstreamer/src/tagsetter.hg
+++ b/gstreamer/src/tagsetter.hg
@@ -61,6 +61,15 @@ public:
           gst_tag_setter_add_tag_value,
           gst_tag_setter_add_tag_valist_values)
 
+  /** Adds the given Glib::ValueBase on the setter using the given merge mode. 
+   *
+   * @param tag The tag to set.
+   * @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);
+
   /** Adds the given value on the setter using the given merge mode.
    *
    * @param tag The tag to set.
@@ -71,6 +80,17 @@ public:
   template <class DataType>
   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.
+   *
+   * @param tag The tag to set.
+   * @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>
+    void add_tag(const Glib::ustring& tag, const DataType& data,
+    TagMergeMode mode=TAG_MERGE_PREPEND);
+
   /** Adds the given value on the setter using the given merge mode. 
    *
    * @param tag The tag to set.
@@ -79,6 +99,15 @@ public:
    */
   void add_tag(Tag tag, const char* data, TagMergeMode mode=TAG_MERGE_PREPEND);
 
+  /** 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 mode The mode to use.
+   */
+  void add_tag(const Glib::ustring& 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)')
   _WRAP_METHOD(const Gst::TagList get_tag_list() const, gst_tag_setter_get_tag_list)
@@ -105,6 +134,18 @@ void TagSetter::add_tag(Tag tag, const DataType& data, TagMergeMode mode)
   this->add_tag(tag, (Glib::ValueBase)(value), mode);
 }
 
+template <class DataType>
+  void TagSetter::add_tag(const Glib::ustring& tag, const DataType& data,
+  TagMergeMode mode)
+{
+  typedef Glib::Value<DataType> ValueType;
+
+  ValueType value;
+  value.init(ValueType::value_type());
+  value.set(data);
+  this->add_tag(tag, (Glib::ValueBase)(value), mode);
+}
+
 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
 } // namespace Gst



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