From f3970565f05e90af88604cc525e2774581f8dce9 Mon Sep 17 00:00:00 2001 From: Niels De Graef Date: Fri, 31 May 2019 23:04:11 +0200 Subject: [PATCH] meson: Bump minimal GLib version to 2.44 This means we can use some newer features and get rid of some boilerplate code using the G_DECLARE_* macros. As discussed on IRC, 2.44 is old enough by now to start depending on it. --- configure.ac | 2 +- gst/udp/gstmultiudpsink.c | 39 --------------------------------------- gst/udp/gstmultiudpsink.h | 20 -------------------- gst/udp/gstudpsrc.c | 4 ---- meson.build | 2 +- 5 files changed, 2 insertions(+), 65 deletions(-) diff --git a/configure.ac b/configure.ac index f30acc1..74a6601 100644 --- a/configure.ac +++ b/configure.ac @@ -215,7 +215,7 @@ dnl *** checks for dependency libraries *** dnl GLib -GLIB_REQ=2.40.0 +GLIB_REQ=2.44.0 AG_GST_GLIB_CHECK([$GLIB_REQ]) dnl Orc diff --git a/gst/udp/gstmultiudpsink.c b/gst/udp/gstmultiudpsink.c index 13f1cc2..942a251 100644 --- a/gst/udp/gstmultiudpsink.c +++ b/gst/udp/gstmultiudpsink.c @@ -557,45 +557,6 @@ gst_multiudpsink_finalize (GObject * object) G_OBJECT_CLASS (parent_class)->finalize (object); } -/* replacement until we can depend unconditionally on the real one in GLib */ -#ifndef HAVE_G_SOCKET_SEND_MESSAGES -#define g_socket_send_messages gst_socket_send_messages - -static gint -gst_socket_send_messages (GSocket * socket, GstOutputMessage * messages, - guint num_messages, gint flags, GCancellable * cancellable, GError ** error) -{ - gssize result; - gint i; - - for (i = 0; i < num_messages; ++i) { - GstOutputMessage *msg = &messages[i]; - GError *msg_error = NULL; - - result = g_socket_send_message (socket, msg->address, - msg->vectors, msg->num_vectors, - msg->control_messages, msg->num_control_messages, - flags, cancellable, &msg_error); - - if (result < 0) { - /* if we couldn't send all messages, just return how many we did - * manage to send, provided we managed to send at least one */ - if (msg_error->code == G_IO_ERROR_WOULD_BLOCK && i > 0) { - g_error_free (msg_error); - return i; - } else { - g_propagate_error (error, msg_error); - return -1; - } - } - - msg->bytes_sent = result; - } - - return i; -} -#endif /* HAVE_G_SOCKET_SEND_MESSAGES */ - static gsize fill_vectors (GOutputVector * vecs, GstMapInfo * maps, guint n, GstBuffer * buf) { diff --git a/gst/udp/gstmultiudpsink.h b/gst/udp/gstmultiudpsink.h index 8849f38..6310724 100644 --- a/gst/udp/gstmultiudpsink.h +++ b/gst/udp/gstmultiudpsink.h @@ -38,27 +38,7 @@ G_BEGIN_DECLS typedef struct _GstMultiUDPSink GstMultiUDPSink; typedef struct _GstMultiUDPSinkClass GstMultiUDPSinkClass; -#if GLIB_CHECK_VERSION (2, 43, 2) -#define HAVE_G_SOCKET_SEND_MESSAGES -#endif - -#ifndef HAVE_G_SOCKET_SEND_MESSAGES -/* same as GOutputMessage used for g_socket_send_messages() */ -typedef struct { - /*< private >*/ - GSocketAddress *address; - - GOutputVector *vectors; - guint num_vectors; - - guint bytes_sent; - - GSocketControlMessage **control_messages; - guint num_control_messages; -} GstOutputMessage; -#else typedef GOutputMessage GstOutputMessage; -#endif /* HAVE_G_SOCKET_SEND_MESSAGES*/ typedef struct { gint ref_count; /* for memory management */ diff --git a/gst/udp/gstudpsrc.c b/gst/udp/gstudpsrc.c index 681e77d..a887191 100644 --- a/gst/udp/gstudpsrc.c +++ b/gst/udp/gstudpsrc.c @@ -897,12 +897,8 @@ retry: * with udpsink generated a "port unreachable" ICMP response. We ignore * that and try again. * On Windows we get G_IO_ERROR_CONNECTION_CLOSED instead */ -#if GLIB_CHECK_VERSION(2,44,0) if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_HOST_UNREACHABLE) || g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CONNECTION_CLOSED)) { -#else - if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_HOST_UNREACHABLE)) { -#endif g_clear_error (&err); goto retry; } diff --git a/meson.build b/meson.build index 5022483..b967cb8 100644 --- a/meson.build +++ b/meson.build @@ -19,7 +19,7 @@ gst_version_is_dev = gst_version_minor % 2 == 1 and gst_version_micro < 90 # FIXME: automagic have_cxx = add_languages('cpp', required : false) -glib_req = '>= 2.40.0' +glib_req = '>= 2.44.0' orc_req = '>= 0.4.17' gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor) -- 2.7.4