[0.11] gstreamer: Use GLib's type for GError instead of our own

Tim Müller tpm at kemper.freedesktop.org
Sun Jan 22 07:16:30 PST 2012


Module: gstreamer
Branch: 0.11
Commit: 1654b7f1d7ca07702e2bfaf9a1e120e5aed0df60
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=1654b7f1d7ca07702e2bfaf9a1e120e5aed0df60

Author: Tim-Philipp Müller <tim.muller at collabora.co.uk>
Date:   Sun Jan 22 01:39:49 2012 +0000

Use GLib's type for GError instead of our own

We introduced our own when GLib didn't want to add a GType
for GError. But now that there is one, we can use GLib's
unconditionally and remove our version.

---

 docs/gst/gstreamer-sections.txt |    2 --
 docs/random/porting-to-0.11.txt |    5 +++++
 gst/gst.c                       |    2 --
 gst/gsterror.c                  |    8 --------
 gst/gsterror.h                  |    7 -------
 gst/gstmessage.c                |   12 ++++++------
 tests/check/gst/gststructure.c  |    2 +-
 win32/common/libgstreamer.def   |    1 -
 8 files changed, 12 insertions(+), 27 deletions(-)

diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt
index a19044d..31587d6 100644
--- a/docs/gst/gstreamer-sections.txt
+++ b/docs/gst/gstreamer-sections.txt
@@ -876,13 +876,11 @@ GST_STREAM_ERROR
 GST_ERROR_SYSTEM
 gst_error_get_message
 <SUBSECTION Standard>
-GST_TYPE_G_ERROR
 GST_TYPE_CORE_ERROR
 GST_TYPE_LIBRARY_ERROR
 GST_TYPE_RESOURCE_ERROR
 GST_TYPE_STREAM_ERROR
 <SUBSECTION Private>
-gst_g_error_get_type
 gst_core_error_get_type
 gst_library_error_get_type
 gst_resource_error_get_type
diff --git a/docs/random/porting-to-0.11.txt b/docs/random/porting-to-0.11.txt
index 43ccf6e..eb5b216 100644
--- a/docs/random/porting-to-0.11.txt
+++ b/docs/random/porting-to-0.11.txt
@@ -474,3 +474,8 @@ The 0.11 porting guide
     GST_VALUE_HOLDS_DATE(value) -> G_VALUE_HOLDS(value,G_TYPE_DATE)
     gst_value_set_date() -> g_value_set_boxed()
     gst_value_get_date() -> g_value_get_boxed()
+
+* GError/GstGError
+
+    GstGError -> GError
+    GST_TYPE_G_ERROR / gst_g_error_get_type() -> G_TYPE_ERROR
diff --git a/gst/gst.c b/gst/gst.c
index d1ccd69..84b9552 100644
--- a/gst/gst.c
+++ b/gst/gst.c
@@ -746,8 +746,6 @@ init_post (GOptionContext * context, GOptionGroup * group, gpointer data,
 
   _priv_gst_plugin_initialize ();
 
-  gst_g_error_get_type ();
-
   /* register core plugins */
   gst_plugin_register_static (GST_VERSION_MAJOR, GST_VERSION_MINOR,
       "staticelements", "core elements linked into the GStreamer library",
diff --git a/gst/gsterror.c b/gst/gsterror.c
index d415fcd..17ec81f 100644
--- a/gst/gsterror.c
+++ b/gst/gsterror.c
@@ -122,14 +122,6 @@ GQuark gst_ ## string ## _error_quark (void) {                          \
     quark = g_quark_from_static_string ("gst-" # string "-error-quark"); \
   return quark; }
 
-/* FIXME: Deprecate when we depend on GLib 2.26 */
-/* FIXME 0.11: remove gst_g_error_get_type() */
-GType
-gst_g_error_get_type (void)
-{
-  return g_error_get_type ();
-}
-
 #define FILE_A_BUG "  Please file a bug at " PACKAGE_BUGREPORT "."
 
 static const gchar *
diff --git a/gst/gsterror.h b/gst/gsterror.h
index d722ce0..eab6c00 100644
--- a/gst/gsterror.h
+++ b/gst/gsterror.h
@@ -197,8 +197,6 @@ typedef enum
   GST_STREAM_ERROR_NUM_ERRORS
 } GstStreamError;
 
-#define GST_TYPE_G_ERROR    (gst_g_error_get_type ())
-
 /**
  * GST_LIBRARY_ERROR:
  *
@@ -240,11 +238,6 @@ typedef enum
  */
 #define GST_ERROR_SYSTEM    ("system error: %s", g_strerror (errno))
 
-/* Hide this compatibility type from introspection */
-#ifndef __GI_SCANNER__
-GType gst_g_error_get_type (void);
-#endif
-
 gchar *gst_error_get_message (GQuark domain, gint code);
 GQuark gst_stream_error_quark (void);
 GQuark gst_core_error_quark (void);
diff --git a/gst/gstmessage.c b/gst/gstmessage.c
index 9bbbbd5..9c28a3a 100644
--- a/gst/gstmessage.c
+++ b/gst/gstmessage.c
@@ -386,7 +386,7 @@ gst_message_new_error (GstObject * src, GError * error, const gchar * debug)
   GstStructure *structure;
 
   structure = gst_structure_new_id (GST_QUARK (MESSAGE_ERROR),
-      GST_QUARK (GERROR), GST_TYPE_G_ERROR, error,
+      GST_QUARK (GERROR), G_TYPE_ERROR, error,
       GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL);
   message = gst_message_new_custom (GST_MESSAGE_ERROR, src, structure);
 
@@ -413,7 +413,7 @@ gst_message_new_warning (GstObject * src, GError * error, const gchar * debug)
   GstStructure *structure;
 
   structure = gst_structure_new_id (GST_QUARK (MESSAGE_WARNING),
-      GST_QUARK (GERROR), GST_TYPE_G_ERROR, error,
+      GST_QUARK (GERROR), G_TYPE_ERROR, error,
       GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL);
   message = gst_message_new_custom (GST_MESSAGE_WARNING, src, structure);
 
@@ -442,7 +442,7 @@ gst_message_new_info (GstObject * src, GError * error, const gchar * debug)
   GstStructure *structure;
 
   structure = gst_structure_new_id (GST_QUARK (MESSAGE_INFO),
-      GST_QUARK (GERROR), GST_TYPE_G_ERROR, error,
+      GST_QUARK (GERROR), G_TYPE_ERROR, error,
       GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL);
   message = gst_message_new_custom (GST_MESSAGE_INFO, src, structure);
 
@@ -1335,7 +1335,7 @@ gst_message_parse_error (GstMessage * message, GError ** gerror, gchar ** debug)
   structure = GST_MESSAGE_STRUCTURE (message);
   error_gvalue = gst_structure_id_get_value (structure, GST_QUARK (GERROR));
   g_return_if_fail (error_gvalue != NULL);
-  g_return_if_fail (G_VALUE_TYPE (error_gvalue) == GST_TYPE_G_ERROR);
+  g_return_if_fail (G_VALUE_TYPE (error_gvalue) == G_TYPE_ERROR);
 
   error_val = (GError *) g_value_get_boxed (error_gvalue);
   if (error_val)
@@ -1375,7 +1375,7 @@ gst_message_parse_warning (GstMessage * message, GError ** gerror,
   structure = GST_MESSAGE_STRUCTURE (message);
   error_gvalue = gst_structure_id_get_value (structure, GST_QUARK (GERROR));
   g_return_if_fail (error_gvalue != NULL);
-  g_return_if_fail (G_VALUE_TYPE (error_gvalue) == GST_TYPE_G_ERROR);
+  g_return_if_fail (G_VALUE_TYPE (error_gvalue) == G_TYPE_ERROR);
 
   error_val = (GError *) g_value_get_boxed (error_gvalue);
   if (error_val)
@@ -1416,7 +1416,7 @@ gst_message_parse_info (GstMessage * message, GError ** gerror, gchar ** debug)
   structure = GST_MESSAGE_STRUCTURE (message);
   error_gvalue = gst_structure_id_get_value (structure, GST_QUARK (GERROR));
   g_return_if_fail (error_gvalue != NULL);
-  g_return_if_fail (G_VALUE_TYPE (error_gvalue) == GST_TYPE_G_ERROR);
+  g_return_if_fail (G_VALUE_TYPE (error_gvalue) == G_TYPE_ERROR);
 
   error_val = (GError *) g_value_get_boxed (error_gvalue);
   if (error_val)
diff --git a/tests/check/gst/gststructure.c b/tests/check/gst/gststructure.c
index cea4511..6a258f8 100644
--- a/tests/check/gst/gststructure.c
+++ b/tests/check/gst/gststructure.c
@@ -317,7 +317,7 @@ GST_START_TEST (test_structure_new)
 
   domain = g_quark_from_static_string ("test");
   e = g_error_new (domain, 0, "a test error");
-  s = gst_structure_new ("name", "key", GST_TYPE_G_ERROR, e, NULL);
+  s = gst_structure_new ("name", "key", G_TYPE_ERROR, e, NULL);
   g_error_free (e);
   gst_structure_free (s);
 
diff --git a/win32/common/libgstreamer.def b/win32/common/libgstreamer.def
index 61ac17d..157b1a7 100644
--- a/win32/common/libgstreamer.def
+++ b/win32/common/libgstreamer.def
@@ -451,7 +451,6 @@ EXPORTS
 	gst_formats_contains
 	gst_fraction_get_type
 	gst_fraction_range_get_type
-	gst_g_error_get_type
 	gst_ghost_pad_activate_mode_default
 	gst_ghost_pad_construct
 	gst_ghost_pad_get_target



More information about the gstreamer-commits mailing list