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



Author: murrayc
Date: Sun May 18 08:55:19 2008
New Revision: 1502
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1502&view=rev

Log:
2008-05-18  Murray Cumming  <murrayc murrayc com>

* gstreamer/src/taglist.ccg:
* gstreamer/src/taglist.hg: As with Structure, use _CLASS_BOXEDTYPE() 
instead of the custom _CLASS_BOXEDTYPE_NCOPY_EXTRA() macro, so we can 
just use this by copying it instead of having strange ownership rules.
Uncommented and corrected the foreach() implementation.
* gstreamer/src/tagsetter.hg: Wrapped merge_tags().
* gstreamer/src/element.hg:
* gstreamer/src/event.ccg:
* gstreamer/src/event.hg:
* gstreamer/src/message.ccg:
* gstreamer/src/message.hg: Adapt to this change.
* tools/m4/: Removed the unused .m4 files.

Removed:
   gstreamermm/trunk/tools/m4/class_boxedtype_ncopy_extra.m4
Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/gstreamer/src/element.hg
   gstreamermm/trunk/gstreamer/src/event.ccg
   gstreamermm/trunk/gstreamer/src/event.hg
   gstreamermm/trunk/gstreamer/src/message.ccg
   gstreamermm/trunk/gstreamer/src/message.hg
   gstreamermm/trunk/gstreamer/src/taglist.ccg
   gstreamermm/trunk/gstreamer/src/taglist.hg
   gstreamermm/trunk/gstreamer/src/tagsetter.hg
   gstreamermm/trunk/tools/m4/Makefile_list_of_sources.am_fragment
   gstreamermm/trunk/tools/m4/convert.m4
   gstreamermm/trunk/tools/m4/convert_gst.m4

Modified: gstreamermm/trunk/gstreamer/src/element.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/element.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/element.hg	Sun May 18 08:55:19 2008
@@ -190,8 +190,8 @@
   _WRAP_METHOD(void lost_state(), gst_element_lost_state)
   _WRAP_METHOD(bool sync_state_with_parent(), gst_element_sync_state_with_parent)
   _WRAP_METHOD(StateChangeReturn change_state(StateChange transition), gst_element_change_state)
-  _WRAP_METHOD(void found_tags(TagList& list), gst_element_found_tags) //TODO: Use return value instead?
-  _WRAP_METHOD(void found_tags_for_pad(const Glib::RefPtr<Pad>& pad, TagList& list), gst_element_found_tags_for_pad)
+  _WRAP_METHOD(void found_tags(const TagList& list), gst_element_found_tags) //TODO: Use return value instead?
+  _WRAP_METHOD(void found_tags_for_pad(const Glib::RefPtr<Pad>& pad, const TagList& list), gst_element_found_tags_for_pad)
 
   //TODO: Change the parameter order?
   _WRAP_METHOD(void post_message(MessageType message_type, const Glib::QueryQuark& domain, int code, const Glib::ustring& message, const Glib::ustring& debug, const Glib::ustring& filename, const Glib::ustring& function_name, int line_number), gst_element_message_full)

Modified: gstreamermm/trunk/gstreamer/src/event.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/event.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/event.ccg	Sun May 18 08:55:19 2008
@@ -200,9 +200,11 @@
 {
 }
 
-Glib::RefPtr<Event> EventTag::create(TagList& taglist)
+Glib::RefPtr<Event> EventTag::create(const TagList& taglist)
 {
-  GstEvent* event = gst_event_new_tag(taglist.gobj());
+  //We create a copy because gst_event_new_tag() takes ownership:
+  GstTagList* c_taglist = gst_tag_list_copy(taglist.gobj());
+  GstEvent* event = gst_event_new_tag(c_taglist);
   return Gst::Event::wrap(event, false);
 }
 
@@ -211,6 +213,8 @@
   GstTagList* gst_taglist = gst_tag_list_new();
   gst_event_parse_tag(gobj(), &gst_taglist);
   TagList parsed_taglist(gst_taglist);
+
+  //TODO: What generates the swap() method?
   taglist.swap(parsed_taglist);
 }
 

Modified: gstreamermm/trunk/gstreamer/src/event.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/event.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/event.hg	Sun May 18 08:55:19 2008
@@ -504,8 +504,9 @@
    * @param taglist metadata list
    * @return a new Gst::Event
    */
-  static Glib::RefPtr<Event> create(TagList& taglist);
+  static Glib::RefPtr<Event> create(const TagList& taglist);
 
+  //TODO: Use return value:
   /** Parses a tag event and stores the results in the given taglist location.
    * @param taglist pointer to metadata list 
    */

Modified: gstreamermm/trunk/gstreamer/src/message.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/message.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/message.ccg	Sun May 18 08:55:19 2008
@@ -280,9 +280,11 @@
 {
 }
 
-Glib::RefPtr<Message> MessageTag::create(const Glib::RefPtr<Object>& src, TagList& taglist)
+Glib::RefPtr<Message> MessageTag::create(const Glib::RefPtr<Object>& src, const TagList& taglist)
 {
-  GstMessage* message = gst_message_new_tag(src->gobj(), taglist.gobj());
+  //We create a copy because gst_message_new_tag() takes ownership:
+  GstTagList* c_taglist = gst_tag_list_copy(taglist.gobj());
+  GstMessage* message = gst_message_new_tag(src->gobj(), c_taglist);
   return Gst::Message::wrap(message, false);
 }
 

Modified: gstreamermm/trunk/gstreamer/src/message.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/message.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/message.hg	Sun May 18 08:55:19 2008
@@ -205,7 +205,7 @@
 public:
   explicit MessageTag(GstMessage* castitem);
 
-  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, TagList& taglist);
+  static Glib::RefPtr<Message> create(const Glib::RefPtr<Object>& src, const TagList& taglist);
 
   //TODO: Use something as return type?
   void parse(TagList& taglist);

Modified: gstreamermm/trunk/gstreamer/src/taglist.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/taglist.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/taglist.ccg	Sun May 18 08:55:19 2008
@@ -21,27 +21,25 @@
 
 #include <gst/gstenumtypes.h>
 
-/*
+
 static gboolean
-TagList_Foreach_gstreamermm_callback(const GstTagList* list, const gchar *tag, void* data)
+TagList_foreach_gstreamermm_callback(const GstTagList* list, const gchar *tag, void* data)
 {
   Gst::TagList::SlotForeach* slot = static_cast<Gst::TagList::SlotForeach*>(data);
-  bool result = (*slot)(Glib::wrap(list), Glib::ustring(value));
-  delete slot;
-  return result;
+
+  const Glib::ustring tag_str = Glib::convert_const_gchar_ptr_to_ustring(tag);
+  return (*slot)(tag_str);
 }
-*/
 
 namespace Gst
 {
 
-/*
 void
 TagList::foreach(const SlotForeach& slot)
 {
   SlotForeach* slot_copy = new SlotForeach(slot);
-  gst_taglist_foreach(gobj(), &TagList_Foreach_gstreamermm_callback, slot_copy);
+  gst_taglist_foreach(gobj(), &TagList_foreach_gstreamermm_callback, slot_copy);
+  delete slot_copy;
 }
-*/
 
 } //namespace Gst

Modified: gstreamermm/trunk/gstreamer/src/taglist.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/taglist.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/taglist.hg	Sun May 18 08:55:19 2008
@@ -29,17 +29,16 @@
 _WRAP_ENUM(TagMergeMode, GstTagMergeMode)
 _WRAP_ENUM(TagFlag, GstTagFlag)
 
-/** Gst::TagList â List of tags and values used to describe media metadata.
+//TODO: Suggest how you might get a TagList.
+/** A List of tags and values used to describe media metadata.
  */
 class TagList
 {
-  _CLASS_BOXEDTYPE_NCOPY_EXTRA(TagList, GstTagList, gst_tag_list_new, gst_tag_list_copy, gst_tag_list_free)
+  _CLASS_BOXEDTYPE(TagList, GstTagList, gst_tag_list_new, gst_tag_list_copy, gst_tag_list_free)
 
 public:
-  /** For example,
-   * void on_foreach(const Gst::TagList& taglist, const Glib::Ustring& tag);
-   */
-  typedef sigc::slot<void, const TagList&, const Glib::ustring&> SlotForeach;
+
+  //TODO: Add operator bool() to handle when C functions return NULL TagList*?
 
   _WRAP_METHOD(static bool exists(const Glib::ustring& tag), gst_tag_exists)
   _WRAP_METHOD(static GType get_type(const Glib::ustring& tag), gst_tag_get_type)
@@ -47,10 +46,17 @@
   _WRAP_METHOD(static Glib::ustring get_description(const Glib::ustring& tag), gst_tag_get_description)
   _WRAP_METHOD(static TagFlag get_flag(const Glib::ustring& tag), gst_tag_get_flag)
   _WRAP_METHOD(static bool is_fixed(const Glib::ustring& tag), gst_tag_is_fixed)
-  _WRAP_METHOD(bool empty(), gst_tag_list_is_empty)
+  _WRAP_METHOD(bool empty() const, gst_tag_list_is_empty)
+
+  //TODO: Add a suitable default value for mode?
   _WRAP_METHOD(void insert(const TagList& other, TagMergeMode mode), gst_tag_list_insert)
   _WRAP_METHOD(TagList merge(const TagList& other, TagMergeMode mode), gst_tag_list_merge)
 
+  /** For example,
+   * void on_foreach(const Glib::ustring& tag);
+   */
+  typedef sigc::slot<void, Glib::ustring&> SlotForeach;
+
   /** Calls the given slot for each tag inside the tag list. Note that if there
    * is no tag, the slot won't be called at all.
    *

Modified: gstreamermm/trunk/gstreamer/src/tagsetter.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/tagsetter.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/tagsetter.hg	Sun May 18 08:55:19 2008
@@ -22,14 +22,13 @@
 #include <gst/gsttagsetter.h>
 #include <glibmm/interface.h>
 #include <gstreamermm/enums.h>
+#include <gstreamermm/taglist.h>
 
 _DEFS(gstreamermm,gst)
 
 namespace Gst
 {
 
-class TagList;
-
 /** Gst::TagSetter â Gst::Element interface that allows setting and retrieval
  * of media metadata.
  *
@@ -55,7 +54,8 @@
   _CLASS_INTERFACE(TagSetter, GstTagSetter, GST_TAG_SETTER, GstTagSetterIFace)
 
 public:
-  //TODO: _WRAP_METHOD(void merge_tags(const Glib::RefPtr<const TagList>& list, TagMergeMode), gst_tag_setter_merge_tags)
+  //TODO: Add suitable default value for mode?
+  _WRAP_METHOD(void merge_tags(const TagList& list, TagMergeMode mode), gst_tag_setter_merge_tags)
   //TODO: Wrap rest of GstTagStetter methods
 };
 

Modified: gstreamermm/trunk/tools/m4/Makefile_list_of_sources.am_fragment
==============================================================================
--- gstreamermm/trunk/tools/m4/Makefile_list_of_sources.am_fragment	(original)
+++ gstreamermm/trunk/tools/m4/Makefile_list_of_sources.am_fragment	Sun May 18 08:55:19 2008
@@ -1,2 +1,2 @@
-files_tools_m4 = convert_gst.m4
+files_tools_m4 = convert.m4 convert_gst.m4 class_gstminiobject.m4
 

Modified: gstreamermm/trunk/tools/m4/convert.m4
==============================================================================
--- gstreamermm/trunk/tools/m4/convert.m4	(original)
+++ gstreamermm/trunk/tools/m4/convert.m4	Sun May 18 08:55:19 2008
@@ -2,4 +2,3 @@
 include(convert_glib.m4)
 include(convert_gst.m4)
 include(class_gstminiobject.m4)
-include(class_boxedtype_ncopy_extra.m4)

Modified: gstreamermm/trunk/tools/m4/convert_gst.m4
==============================================================================
--- gstreamermm/trunk/tools/m4/convert_gst.m4	(original)
+++ gstreamermm/trunk/tools/m4/convert_gst.m4	Sun May 18 08:55:19 2008
@@ -119,6 +119,7 @@
 _CONVERSION(`const TagList&',`const GstTagList*',`(($3).gobj())')
 _CONVERSION(`GstTagList*',`TagList',`Glib::wrap($3)')
 _CONVERSION(`TagList&',`GstTagList*',`(($3).gobj())')
+_CONVERSION(`const TagList&',`GstTagList*',`const_cast<GstTagList*>(($3).gobj())')
 
 #URIHandler
 _CONVERSION(`const Glib::RefPtr<URIHandler>&',`GstURIHandler*',`Glib::unwrap($3)')



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