[gstreamermm] Gst::Message: update Message API



commit f4cb214c979e409f2d1375a36ccf787cb43c9c6b
Author: Marcin Kolny <marcin kolny gmail com>
Date:   Mon Oct 3 20:37:23 2016 +0200

    Gst::Message: update Message API
    
        * examples/media_player_gtkmm/player_window.cc: fix warning.
        * gstreamer/src/message.{ccg|hg}: parse() method name for MessageError,
          add some methods to MessageProgress.

 examples/media_player_gtkmm/player_window.cc |    3 +-
 gstreamer/src/message.ccg                    |   46 ++++++++++++++++++++++++-
 gstreamer/src/message.hg                     |   22 +++++++++++-
 3 files changed, 65 insertions(+), 6 deletions(-)
---
diff --git a/examples/media_player_gtkmm/player_window.cc b/examples/media_player_gtkmm/player_window.cc
index 53c3906..04001bb 100644
--- a/examples/media_player_gtkmm/player_window.cc
+++ b/examples/media_player_gtkmm/player_window.cc
@@ -217,8 +217,7 @@ void PlayerWindow::on_video_changed()
   }
 }
 
-Gst::PadProbeReturn PlayerWindow::on_video_pad_got_buffer(const Glib::RefPtr<Gst::Pad>& pad,
-        const Gst::PadProbeInfo& data)
+Gst::PadProbeReturn PlayerWindow::on_video_pad_got_buffer(const Glib::RefPtr<Gst::Pad>& pad, const 
Gst::PadProbeInfo& /* data */)
 {
   int width_value;
   int height_value;
diff --git a/gstreamer/src/message.ccg b/gstreamer/src/message.ccg
index 0b15d39..97087d7 100644
--- a/gstreamer/src/message.ccg
+++ b/gstreamer/src/message.ccg
@@ -140,7 +140,7 @@ void MessageInfo::parse(Glib::Error& error, std::string& debug) const
   error = Glib::Error(c_error);
 }
 
-Glib::Error MessageInfo::parse() const
+Glib::Error MessageInfo::parse_error() const
 {
   GError* c_error = nullptr;
   gst_message_parse_info(const_cast<GstMessage*>(gobj()), &c_error, nullptr);
@@ -683,7 +683,7 @@ void MessageToc::parse(Glib::RefPtr<Gst::Toc>& toc, bool& updated) const
   updated = updated;
 }
 
-void MessageProgress::parse(Gst::ProgressType& type, Glib::ustring code, Glib::ustring& text) const
+void MessageProgress::parse(Gst::ProgressType& type, Glib::ustring& code, Glib::ustring& text) const
 {
   GstProgressType c_type;
   gchar* c_code, * c_text;
@@ -697,4 +697,46 @@ void MessageProgress::parse(Gst::ProgressType& type, Glib::ustring code, Glib::u
   type = static_cast<Gst::ProgressType>(c_type);
 }
 
+Gst::ProgressType MessageProgress::parse_type() const
+{
+  GstProgressType c_type;
+
+  gst_message_parse_progress(const_cast<GstMessage*>(gobj()),
+    &c_type, nullptr, nullptr);
+
+  return static_cast<Gst::ProgressType>(c_type);
+}
+
+Glib::ustring MessageProgress::parse_code() const
+{
+  gchar* c_code;
+  Glib::ustring code;
+  
+  gst_message_parse_progress(const_cast<GstMessage*>(gobj()),
+    nullptr, &c_code, nullptr);
+
+  code = c_code;
+
+  if(c_code)
+    g_free(c_code);
+
+  return code;
+}
+
+Glib::ustring MessageProgress::parse_text() const
+{
+  gchar* c_text;
+  Glib::ustring text;
+  
+  gst_message_parse_progress(const_cast<GstMessage*>(gobj()),
+    nullptr, nullptr, &c_text);
+
+  text = c_text;
+
+  if(c_text)
+    g_free(c_text);
+
+  return text;
+}
+
 } //namespace Gst
diff --git a/gstreamer/src/message.hg b/gstreamer/src/message.hg
index 08a597a..1de3c95 100644
--- a/gstreamer/src/message.hg
+++ b/gstreamer/src/message.hg
@@ -231,7 +231,7 @@ public:
    *
    * @return The Glib::Error.
    */
-  Glib::Error parse() const;
+  Glib::Error parse_error() const;
 
   /** Extracts and returns the debug message from the Gst::MessageInfo.
    *
@@ -1187,8 +1187,26 @@ public:
    * @param code A code.
    * @param text A text.
    */
-  void parse(Gst::ProgressType& type, Glib::ustring code, Glib::ustring& text) const;
+  void parse(Gst::ProgressType& type, Glib::ustring& code, Glib::ustring& text) const;
   _IGNORE(gst_message_parse_progress)
+
+  /** Extracts and returns the ProgressType from the Gst::MessageProgress.
+   *
+   * @return The ProgressType.
+   */
+  Gst::ProgressType parse_type() const;
+
+  /** Extracts and returns the code from the Gst::MessageProgress.
+   *
+   * @return The code.
+   */
+  Glib::ustring parse_code() const;
+
+  /** Extracts and returns the text from the Gst::MessageProgress.
+   *
+   * @return The text.
+   */
+  Glib::ustring parse_text() const;
 };
 
 } //namespace Gst


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