[gstreamermm] Gst::Structure: minor improvements



commit 1751032e7d096e6087ce1ec172e8c13101310986
Author: Marcin Kolny <marcin kolny gmail com>
Date:   Fri Feb 27 01:16:37 2015 +0100

    Gst::Structure: minor improvements
    
        * gstreamer/src/structure.{ccg|hg}: wrap gst_structure_get_int64,
          remove gst_structure_get_clock_time and replace it by
          gst_structure_get_uint64, which can be used to acquire ClockTime
          too.
        * gstreamer/src/caps.hg: restore gst_caps_new_any() method.

 gstreamer/src/caps.hg       |    2 +-
 gstreamer/src/structure.ccg |   19 ++++++++++---------
 gstreamer/src/structure.hg  |   42 ++++++++++++++++++++++++++++--------------
 3 files changed, 39 insertions(+), 24 deletions(-)
---
diff --git a/gstreamer/src/caps.hg b/gstreamer/src/caps.hg
index d28d2e6..7d21c0b 100644
--- a/gstreamer/src/caps.hg
+++ b/gstreamer/src/caps.hg
@@ -214,7 +214,7 @@ public:
   _WRAP_METHOD(bool is_subset_structure(const Gst::Structure& structure, const Gst::CapsFeatures& features) 
const, gst_caps_is_subset_structure_full)
 
 
-  _WRAP_METHOD(static Glib::RefPtr<Gst::Caps> create_any(), gst_caps_create_any)
+  _WRAP_METHOD(static Glib::RefPtr<Gst::Caps> create_any(), gst_caps_new_any)
 
   //This is const (returns a non const) because it always creates a new instance:
   _WRAP_METHOD(Glib::RefPtr<Gst::Caps> get_intersect(const Glib::RefPtr<const Gst::Caps>& other_caps) const, 
gst_caps_intersect)
diff --git a/gstreamer/src/structure.ccg b/gstreamer/src/structure.ccg
index 58b35ff..afdbec3 100644
--- a/gstreamer/src/structure.ccg
+++ b/gstreamer/src/structure.ccg
@@ -206,6 +206,16 @@ bool Structure::get_field(const Glib::ustring& name, guint& value) const
   return gst_structure_get_uint(gobj(), name.c_str(), &value);
 }
 
+bool Structure::get_field(const Glib::ustring& name, guint64& value) const
+{
+  return gst_structure_get_uint64(gobj(), name.c_str(), &value);
+}
+
+bool Structure::get_field(const Glib::ustring& name, gint64& value) const
+{
+  return gst_structure_get_int64(gobj(), name.c_str(), &value);
+}
+
 bool Structure::get_field(const Glib::ustring& name, double& value) const
 {
   return gst_structure_get_double(gobj(), name.c_str(), &value);
@@ -255,15 +265,6 @@ bool Structure::get_field(const Glib::ustring& name, Glib::DateTime& datetime) c
   return has;
 }
 
-bool Structure::get_field(const Glib::ustring& name, ClockTime& value) const
-{
-  GstClockTime cvalue = 0;
-  const bool result = gst_structure_get_clock_time(gobj(), name.c_str(), &cvalue);
-  value = cvalue;
-  return result;
-}
-
-
 bool Structure::get_field(const Glib::ustring& name, GType enum_type, int& value) const
 {
   return gst_structure_get_enum(gobj(), name.c_str(), enum_type, &value);
diff --git a/gstreamer/src/structure.hg b/gstreamer/src/structure.hg
index 8bab6b7..f6dab69 100644
--- a/gstreamer/src/structure.hg
+++ b/gstreamer/src/structure.hg
@@ -284,7 +284,7 @@ public:
 
   /** For example,
    * bool on_foreach(const Glib::ustring& id, const Glib::ValueBase& value);.
-   * The foreach function should return true if the foreach operation should
+   * The on_foreach function should return true if the foreach operation should
    * continue, or false if the operation should stop with false.
    */
   typedef sigc::slot<bool, const Glib::ustring&, const Glib::ValueBase&> SlotForeach;
@@ -346,6 +346,33 @@ public:
   bool get_field(const Glib::ustring& fieldname, guint& value) const;
   _IGNORE(gst_structure_get_uint)
 
+  /** Gets the value of field @a fieldname into ClockTime or guint64 @a value.
+   * The caller is responsible for making sure the field exists and has the
+   * correct type.
+   *
+   * @param fieldname The name of a field.
+   * @param value An output parameter that will be set with the value.
+   * @return true if @a value could be set correctly. If there was no field
+   * with @a fieldname or the existing field did not contain an guint, this
+   * function returns false.
+   */
+  bool get_field(const Glib::ustring& fieldname, guint64& value) const;
+  _IGNORE(gst_structure_get_uint64)
+  _IGNORE(gst_structure_get_clock_time)
+
+  /** Gets the value of field @a fieldname into gint64 @a value.
+   * The caller is responsible for making sure the field exists and has the
+   * correct type.
+   *
+   * @param fieldname The name of a field.
+   * @param value An output parameter that will be set with the value.
+   * @return true if @a value could be set correctly. If there was no field
+   * with @a fieldname or the existing field did not contain an guint, this
+   * function returns false.
+   */
+  bool get_field(const Glib::ustring& fieldname, gint64& value) const;
+  _IGNORE(gst_structure_get_int64)
+
   /** Gets the value of field @a fieldname into double @a value.
    * The caller is responsible for making sure the field exists and has the
    * correct type.
@@ -410,19 +437,6 @@ public:
   bool get_field(const Glib::ustring& fieldname, Glib::DateTime& value) const;
   _IGNORE(gst_structure_get_date_time)
 
-  /** Gets the value of field @a fieldname into Gst::ClockTime @a value.
-   * The caller is responsible for making sure the field exists and has the
-   * correct type.
-   *
-   * @param fieldname The name of a field.
-   * @param value An output parameter that will be set with the value.
-   * @return true if @a value could be set correctly. If there was no field
-   * with @a fieldname or the existing field did not contain a Gst::ClockTime,
-   * this function returns false.
-   */
-  bool get_field(const Glib::ustring& fieldname, ClockTime& value) const;
-  _IGNORE(gst_structure_get_clock_time)
-
   /** Gets the value of field @a fieldname with GType enum type @a enumtype
    * into integer @a value.  Caller is responsible for making sure the
    * field exists and has the correct type.  A call to this method would look


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