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



Author: jaalburqu
Date: Tue Mar  3 23:59:37 2009
New Revision: 2079
URL: http://svn.gnome.org/viewvc/gnomemm?rev=2079&view=rev

Log:
2009-03-03  Josà Alburquerque  <jaalburqu svn gnome org>

	* gstreamer/src/format.ccg:
	* gstreamer/src/format.hg: Use const GstFormatDefinition* in cast
	constructor of Gst::FormatDefinition.
	* gstreamer/src/query.ccg:
	* gstreamer/src/query.hg: Use const GstQueryDefinition* in cast
	constructor of Gst::FormatQueryDefinition.

	* gstreamer/src/index.ccg:
	* gstreamer/src/index.hg: Cleaned up code (placing signal callbacks
	out of Gst namespace, Removing unused Gst::IndexGroup, and placing
	slot typdefs at top of Gst::Index member definitions).  Corrected
	Gst::IndexAssociation class definition and Index::add_association()
	method.  Hand-wrote Index::get_assoc_entry() so that default
	parameters are used.
	* tools/m4/convert_gst.m4: Removed unused conversion.

Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/gstreamer/src/format.ccg
   gstreamermm/trunk/gstreamer/src/format.hg
   gstreamermm/trunk/gstreamer/src/index.ccg
   gstreamermm/trunk/gstreamer/src/index.hg
   gstreamermm/trunk/gstreamer/src/query.ccg
   gstreamermm/trunk/gstreamer/src/query.hg
   gstreamermm/trunk/tools/m4/convert_gst.m4

Modified: gstreamermm/trunk/gstreamer/src/format.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/format.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/format.ccg	Tue Mar  3 23:59:37 2009
@@ -28,7 +28,7 @@
   quark((GQuark)(0))
 {}
 
-FormatDefinition::FormatDefinition(GstFormatDefinition* castitem)
+FormatDefinition::FormatDefinition(const GstFormatDefinition* castitem)
 : value(Gst::FORMAT_UNDEFINED),
   quark((castitem) ? castitem->quark : 0)
 {

Modified: gstreamermm/trunk/gstreamer/src/format.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/format.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/format.hg	Tue Mar  3 23:59:37 2009
@@ -45,7 +45,7 @@
    * The @a castitem is left unaffected; its contents are simply copied.
    * @param castitem The GstFormatDefinition to copy contents from.
    */
-  FormatDefinition(GstFormatDefinition* castitem);
+  FormatDefinition(const GstFormatDefinition* castitem);
 
   /// The unique id of this format.
   Gst::Format         value;

Modified: gstreamermm/trunk/gstreamer/src/index.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/index.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/index.ccg	Tue Mar  3 23:59:37 2009
@@ -20,12 +20,10 @@
 #include <gst/gstenumtypes.h>
 _PINCLUDE(gstreamermm/private/object_p.h)
 
-namespace Gst
-{
-
 static gboolean Index_Filter_gstreamermm_callback(GstIndex* index, GstIndexEntry* entry, void* data)
 {
-  Index::SlotFilter * the_slot = static_cast<Index::SlotFilter*>(data);
+  Gst::Index::SlotFilter * the_slot =
+    static_cast<Gst::Index::SlotFilter*>(data);
 
   #ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
@@ -45,14 +43,15 @@
 
 static void Index_Filter_gstreamermm_callback_destroy(void* data)
 {
-  Index::SlotFilter* the_slot = static_cast<Index::SlotFilter*>(data);
+  Gst::Index::SlotFilter* the_slot = static_cast<Gst::Index::SlotFilter*>(data);
   if(the_slot)
     delete the_slot;
 }
 
 static gboolean Index_Resolver_gstreamermm_callback(GstIndex *index, GstObject *writer, gchar **writer_string, void* data)
 {
-  Index::SlotResolver * the_slot = static_cast<Index::SlotResolver*>(data);
+  Gst::Index::SlotResolver * the_slot =
+    static_cast<Gst::Index::SlotResolver*>(data);
 
   #ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
@@ -81,9 +80,22 @@
 
 static void Index_Resolver_gstreamermm_callback_destroy(void* data)
 {
-  delete static_cast<Index::SlotResolver*>(data);
+  delete static_cast<Gst::Index::SlotResolver*>(data);
 }
 
+namespace Gst
+{
+
+IndexAssociation::IndexAssociation()
+: format(Gst::FORMAT_UNDEFINED),
+  value(0)
+{}
+
+IndexAssociation::IndexAssociation(const GstIndexAssociation* castitem)
+: format((castitem) ? (Gst::Format)(castitem->format) : Gst::FORMAT_UNDEFINED),
+  value((castitem) ? castitem->value : 0)
+{}
+
 bool Index::is_readable() const
 {
   return GST_INDEX_IS_READABLE(gobj());
@@ -94,6 +106,17 @@
   return GST_INDEX_IS_WRITABLE(gobj());
 }
 
+Gst::IndexEntry Index::get_assoc_entry(int id, gint64 value,
+  IndexLookupMethod method, AssocFlags flags, Format format) const
+{
+  GstIndexEntry* gst_entry =
+    gst_index_get_assoc_entry(const_cast<GstIndex*>(gobj()), id,
+    (GstIndexLookupMethod) method, (GstAssocFlags) flags, (GstFormat) format,
+    value);
+
+  return Glib::wrap(gst_entry);
+}
+
 void Index::set_filter(const SlotFilter& slot)
 {
   SlotFilter* slot_copy = new SlotFilter(slot); //Deleted in Index_Filter_gstreamermm_callback_destroy

Modified: gstreamermm/trunk/gstreamer/src/index.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/index.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/index.hg	Tue Mar  3 23:59:37 2009
@@ -42,18 +42,27 @@
   _WRAP_METHOD(bool assoc_map(Format format, gint64& value) const, gst_index_entry_assoc_map)
 };
 
-/** A group of related entries in an index.
- */
-class IndexGroup
-{
-  _CLASS_GENERIC(IndexGroup, GstIndexGroup)
-};
-
 /** An association in an entry.
  */
 class IndexAssociation
 {
   _CLASS_GENERIC(IndexAssociation, GstIndexAssociation)
+
+public:
+  /// Default constructor
+  IndexAssociation();
+
+  /** Constructs a Gst::IndexAssociation from a C GstIndexAssociation type.
+   * The @a castitem is left unaffected; its contents are simply copied.
+   * @param castitem The GstIndexAssociation to copy contents from.
+   */
+   IndexAssociation(const GstIndexAssociation* castitem);
+
+  /// The format of the association.
+  Gst::Format format;
+
+  /// The value of the association
+  gint64 value;
 };
 
 
@@ -67,6 +76,22 @@
   _CTOR_DEFAULT
 
 public:
+  /** For example,
+   * bool on_filter(const Glib::RefPtr<Gst::Index>& index, Gst::IndexEntry
+   * entry);.
+   * The filter function should return true if the entry is to be added to the
+   * index, false otherwise.
+   */ 
+  typedef sigc::slot<bool, const Glib::RefPtr<Gst::Index>&, Gst::IndexEntry> SlotFilter;
+
+  /** For example,
+   * bool on_resolve(const Glib::RefPtr<Gst::Object>& writer, Glib::ustring&
+   * writer_string);.
+   * The resolve function should return true if an id could be assigned to
+   * writer.
+   */ 
+  typedef sigc::slot<bool, const Glib::RefPtr<Gst::Index>&, const Glib::RefPtr<Gst::Object>&, Glib::ustring&> SlotResolver;
+
   /** Check if the index can be read from.
    * @return true if index is readable, false otherwise.
    */
@@ -85,19 +110,26 @@
   _WRAP_METHOD(IndexCertainty get_certainty() const, gst_index_get_certainty)
   _WRAP_METHOD(bool get_writer_id(const Glib::RefPtr<Gst::Object>& writer, int& id) const, gst_index_get_writer_id)
   _WRAP_METHOD(Gst::IndexEntry add_format(int id, Format format), gst_index_add_format)
-  _WRAP_METHOD(Gst::IndexEntry add_association(int id, AssocFlags flags, int n, const Gst::IndexAssociation& list), gst_index_add_associationv)
-  _WRAP_METHOD(Gst::IndexEntry add_id(int id, const Glib::ustring& description), gst_index_add_id)
 
-  //TODO: Reorder parameters to allow default values?
-  _WRAP_METHOD(Gst::IndexEntry get_assoc_entry(int id, IndexLookupMethod method, AssocFlags flags, Format format, gint64 value) const, gst_index_get_assoc_entry)
+#m4 _CONVERSION(`const Glib::ArrayHandle<const Gst::IndexAssociation>&', `const GstIndexAssociation*', `(const GstIndexAssociation*)(($3).data())')
+  _WRAP_METHOD(Gst::IndexEntry add_association(int id, AssocFlags flags, int n, const Glib::ArrayHandle<const Gst::IndexAssociation>& list), gst_index_add_associationv)
 
-  /** For example,
-   * bool on_filter(const Glib::RefPtr<Gst::Index>& index, Gst::IndexEntry
-   * entry);.
-   * The filter function should return true if the entry is to be added to the
-   * index, false otherwise.
-   */ 
-  typedef sigc::slot<bool, const Glib::RefPtr<Gst::Index>&, Gst::IndexEntry> SlotFilter;
+  _WRAP_METHOD(Gst::IndexEntry add_id(int id, const Glib::ustring& description), gst_index_add_id)
+
+  /** Finds the given format/value in the index.
+   *
+   * @param id The id of the index writer.
+   * @param value The value to find.
+   * @param method The lookup method to use.
+   * @param flags Flags for the entry.
+   * @param format The format of the value.
+   * @return The entry associated with the value or 0 if the value was not
+   * found. 
+   */
+  Gst::IndexEntry get_assoc_entry(int id, gint64 value,
+    IndexLookupMethod method = Gst::INDEX_LOOKUP_EXACT,
+    AssocFlags flags = Gst::ASSOCIATION_FLAG_NONE,
+    Format format = Gst::FORMAT_DEFAULT) const;
 
   /** Lets the app register a custom filter slot so that it can select what
    * entries should be stored in the index.
@@ -106,14 +138,6 @@
    */
   void set_filter(const SlotFilter& slot);
 
-  /** For example,
-   * bool on_resolve(const Glib::RefPtr<Gst::Object>& writer, Glib::ustring&
-   * writer_string);.
-   * The resolve function should return true if an id could be assigned to
-   * writer.
-   */ 
-  typedef sigc::slot<bool, const Glib::RefPtr<Gst::Index>&, const Glib::RefPtr<Gst::Object>&, Glib::ustring&> SlotResolver;
-
   /** Lets the app register a custom slot to map index ids to writer
    * descriptions.
    * @param slot The resolver slot to register.

Modified: gstreamermm/trunk/gstreamer/src/query.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/query.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/query.ccg	Tue Mar  3 23:59:37 2009
@@ -30,7 +30,7 @@
   quark((GQuark)(0))
 {}
 
-QueryTypeDefinition::QueryTypeDefinition(GstQueryTypeDefinition* castitem)
+QueryTypeDefinition::QueryTypeDefinition(const GstQueryTypeDefinition* castitem)
 : value(Gst::QUERY_NONE),
   quark((castitem) ? castitem->quark : 0)
 {

Modified: gstreamermm/trunk/gstreamer/src/query.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/query.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/query.hg	Tue Mar  3 23:59:37 2009
@@ -50,7 +50,7 @@
    * type.  The @a castitem is left unaffected; its contents are simply copied.
    * @param castitem The GstQueryTypeDefinition to copy contents from.
    */
-  QueryTypeDefinition(GstQueryTypeDefinition* castitem);
+  QueryTypeDefinition(const GstQueryTypeDefinition* castitem);
 
   /// The unique id of the Query type.
   QueryType             value;

Modified: gstreamermm/trunk/tools/m4/convert_gst.m4
==============================================================================
--- gstreamermm/trunk/tools/m4/convert_gst.m4	(original)
+++ gstreamermm/trunk/tools/m4/convert_gst.m4	Tue Mar  3 23:59:37 2009
@@ -91,9 +91,6 @@
 _CONVERSION(`const Glib::RefPtr<Gst::Index>&',`GstIndex*',`Glib::unwrap($3)')
 _CONVERSION(`Glib::RefPtr<Gst::Index>',`GstIndex*',`Glib::unwrap($3)')
 
-#IndexAssociation
-_CONVERSION(`const Gst::IndexAssociation&',`const GstIndexAssociation*',`((GstIndexAssociation*)(&($3)))')
-
 #IndexEntry
 _CONVERSION(`GstIndexEntry*',`Gst::IndexEntry',`Glib::wrap($3, true)')
 _CONVERSION(`const Gst::IndexEntry&',`GstIndexEntry*',`const_cast<GstIndexEntry*>(($3).gobj())')



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