Bump GLib requirement to >= 2.62

Can't require 2.64 yet because of
https://gitlab.freedesktop.org/gstreamer/cerbero/-/issues/323

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2568>
This commit is contained in:
Tim-Philipp Müller 2022-04-06 12:56:30 +01:00 committed by GStreamer Marge Bot
parent 92a4088621
commit 9d9e59622f
25 changed files with 11 additions and 352 deletions

View file

@ -28,7 +28,7 @@ osxversion = curversion + 1
prefix = get_option('prefix')
glib_req = '>= 2.56.0'
glib_req = '>= 2.62.0'
if gst_version_is_stable
gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)

View file

@ -582,107 +582,6 @@ gst_validate_get_test_file_scenario (GList ** structs,
return TRUE;
}
#if !GLIB_CHECK_VERSION(2,58,0)
/* Copied from https://gitlab.gnome.org/GNOME/glib/-/blob/main/glib/gfileutils.c#L2736 */
static gchar *
g_canonicalize_filename (const gchar * filename, const gchar * relative_to)
{
gchar *canon, *start, *p, *q;
guint i;
g_return_val_if_fail (relative_to == NULL
|| g_path_is_absolute (relative_to), NULL);
if (!g_path_is_absolute (filename)) {
gchar *cwd_allocated = NULL;
const gchar *cwd;
if (relative_to != NULL)
cwd = relative_to;
else
cwd = cwd_allocated = g_get_current_dir ();
canon = g_build_filename (cwd, filename, NULL);
g_free (cwd_allocated);
} else {
canon = g_strdup (filename);
}
start = (char *) g_path_skip_root (canon);
if (start == NULL) {
/* This shouldn't really happen, as g_get_current_dir() should
return an absolute pathname, but bug 573843 shows this is
not always happening */
g_free (canon);
return g_build_filename (G_DIR_SEPARATOR_S, filename, NULL);
}
/* POSIX allows double slashes at the start to
* mean something special (as does windows too).
* So, "//" != "/", but more than two slashes
* is treated as "/".
*/
i = 0;
for (p = start - 1; (p >= canon) && G_IS_DIR_SEPARATOR (*p); p--)
i++;
if (i > 2) {
i -= 1;
start -= i;
memmove (start, start + i, strlen (start + i) + 1);
}
/* Make sure we're using the canonical dir separator */
p++;
while (p < start && G_IS_DIR_SEPARATOR (*p))
*p++ = G_DIR_SEPARATOR;
p = start;
while (*p != 0) {
if (p[0] == '.' && (p[1] == 0 || G_IS_DIR_SEPARATOR (p[1]))) {
memmove (p, p + 1, strlen (p + 1) + 1);
} else if (p[0] == '.' && p[1] == '.' && (p[2] == 0
|| G_IS_DIR_SEPARATOR (p[2]))) {
q = p + 2;
/* Skip previous separator */
p = p - 2;
if (p < start)
p = start;
while (p > start && !G_IS_DIR_SEPARATOR (*p))
p--;
if (G_IS_DIR_SEPARATOR (*p))
*p++ = G_DIR_SEPARATOR;
memmove (p, q, strlen (q) + 1);
} else {
/* Skip until next separator */
while (*p != 0 && !G_IS_DIR_SEPARATOR (*p))
p++;
if (*p != 0) {
/* Canonicalize one separator */
*p++ = G_DIR_SEPARATOR;
}
}
/* Remove additional separators */
q = p;
while (*q && G_IS_DIR_SEPARATOR (*q))
q++;
if (p != q)
memmove (p, q, strlen (q) + 1);
}
/* Remove trailing slashes */
if (p > start && G_IS_DIR_SEPARATOR (*(p - 1)))
*(p - 1) = 0;
return canon;
}
#endif
/* Only the first monitor pipeline will be used */
GstStructure *
gst_validate_setup_test_file (const gchar * testfile, gboolean use_fakesinks)

View file

@ -27,7 +27,7 @@ curversion = gst_version_minor * 100 + gst_version_micro
libversion = '@0@.@1@.0'.format(soversion, curversion)
osxversion = curversion + 1
glib_req = '>= 2.56.0'
glib_req = '>= 2.62.0'
if gst_version_is_stable
gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)

View file

@ -15,7 +15,7 @@ else
gst_version_nano = 0
endif
glib_req = '>= 2.56.0'
glib_req = '>= 2.62.0'
gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
tizil_req = '>= 0.19.0'
api_version = '1.0'

View file

@ -25,37 +25,6 @@
namespace gcs = google::cloud::storage;
namespace {
#if !GLIB_CHECK_VERSION(2, 62, 0)
static inline gchar* g_date_time_format_iso8601(GDateTime* datetime) {
GString* outstr = NULL;
gchar* main_date = NULL;
gint64 offset;
// Main date and time.
main_date = g_date_time_format(datetime, "%Y-%m-%dT%H:%M:%S");
outstr = g_string_new(main_date);
g_free(main_date);
// Timezone. Format it as `%:::z` unless the offset is zero, in which case
// we can simply use `Z`.
offset = g_date_time_get_utc_offset(datetime);
if (offset == 0) {
g_string_append_c(outstr, 'Z');
} else {
gchar* time_zone = g_date_time_format(datetime, "%:::z");
g_string_append(outstr, time_zone);
g_free(time_zone);
}
return g_string_free(outstr, FALSE);
}
#endif
} // namespace
std::unique_ptr<google::cloud::storage::Client> gst_gs_create_client(
const gchar* service_account_email,
const gchar* service_account_credentials,

View file

@ -502,13 +502,7 @@ mpegts_base_steal_program (MpegTSBase * base, gint program_number)
for (i = 0; i < base->programs->len; i++) {
MpegTSBaseProgram *program = g_ptr_array_index (base->programs, i);
if (program->program_number == program_number) {
#if GLIB_CHECK_VERSION(2, 58, 0)
return g_ptr_array_steal_index (base->programs, i);
#else
program->recycle = TRUE;
g_ptr_array_remove_index (base->programs, i);
return program;
#endif
}
}

View file

@ -3338,21 +3338,6 @@ compare_index_table_segment (MXFIndexTableSegment * sa,
return 1;
}
#if !GLIB_CHECK_VERSION(2, 62, 0)
static gboolean
has_table_segment (GArray * segments, MXFIndexTableSegment * target)
{
guint i;
for (i = 0; i < segments->len; i++) {
MXFIndexTableSegment *cand =
&g_array_index (segments, MXFIndexTableSegment, i);
if (compare_index_table_segment (cand, target) == 0)
return TRUE;
}
return FALSE;
}
#endif
static GstFlowReturn
gst_mxf_demux_handle_index_table_segment (GstMXFDemux * demux, GstMXFKLV * klv)
{
@ -3392,12 +3377,8 @@ gst_mxf_demux_handle_index_table_segment (GstMXFDemux * demux, GstMXFKLV * klv)
}
for (tmp = demux->index_tables; tmp; tmp = tmp->next) {
GstMXFDemuxIndexTable *table = (GstMXFDemuxIndexTable *) tmp->data;
#if !GLIB_CHECK_VERSION (2, 62, 0)
if (has_table_segment (table->segments, segment)) {
#else
if (g_array_binary_search (table->segments, segment,
(GCompareFunc) compare_index_table_segment, NULL)) {
#endif
GST_DEBUG_OBJECT (demux, "Already handled");
g_free (segment);
return GST_FLOW_OK;

View file

@ -17,7 +17,7 @@ endif
gst_version_is_stable = gst_version_minor.is_even()
gst_version_is_dev = gst_version_minor.is_odd() and gst_version_micro < 90
glib_req = '>= 2.56.0'
glib_req = '>= 2.62.0'
orc_req = '>= 0.4.17'
if gst_version_is_stable

View file

@ -80,22 +80,6 @@ using namespace Microsoft::WRL;
* D3D11_VIDEO_PROCESSOR_STREAM::ppFutureSurfaces
*/
/* g_queue_clear_full is available since 2.60 */
#if !GLIB_CHECK_VERSION(2,60,0)
#define g_queue_clear_full gst_d3d11_deinterlace_g_queue_clear_full
static void
gst_d3d11_deinterlace_g_queue_clear_full (GQueue * queue,
GDestroyNotify free_func)
{
g_return_if_fail (queue != NULL);
if (free_func != NULL)
g_queue_foreach (queue, (GFunc) free_func, NULL);
g_queue_clear (queue);
}
#endif
typedef enum
{
GST_D3D11_DEINTERLACE_METHOD_BLEND =

View file

@ -24,34 +24,4 @@
G_BEGIN_DECLS
#if !GLIB_CHECK_VERSION(2, 60, 0)
#define g_queue_clear_full queue_clear_full
static inline void
queue_clear_full (GQueue * queue, GDestroyNotify free_func)
{
gpointer data;
while ((data = g_queue_pop_head (queue)) != NULL)
free_func (data);
}
#endif
#if !GLIB_CHECK_VERSION(2, 62, 0)
#define g_array_copy array_copy
static inline GArray *
array_copy (GArray *array)
{
GArray *new_array;
guint elt_size = g_array_get_element_size (array);
new_array = g_array_sized_new (FALSE, FALSE, elt_size, array->len);
g_array_set_size (new_array, array->len);
if (array->len > 0)
memcpy (new_array->data, array->data, array->len * elt_size);
return new_array;
}
#endif
G_END_DECLS

View file

@ -1304,7 +1304,6 @@ error:
}
/* NOTE: This changes the values of vectors if multiple iterations are needed! */
#if GLIB_CHECK_VERSION(2, 59, 1)
static GstRTSPResult
writev_bytes (GOutputStream * stream, GOutputVector * vectors, gint n_vectors,
gsize * bytes_written, gboolean block, GCancellable * cancellable)
@ -1373,31 +1372,6 @@ error:
return ret;
}
}
#else
static GstRTSPResult
writev_bytes (GOutputStream * stream, GOutputVector * vectors, gint n_vectors,
gsize * bytes_written, gboolean block, GCancellable * cancellable)
{
gsize _bytes_written = 0;
guint written;
gint i;
GstRTSPResult res = GST_RTSP_OK;
for (i = 0; i < n_vectors; i++) {
written = 0;
res =
write_bytes (stream, vectors[i].buffer, &written, vectors[i].size,
block, cancellable);
_bytes_written += written;
if (G_UNLIKELY (res != GST_RTSP_OK))
break;
}
*bytes_written = _bytes_written;
return res;
}
#endif
static gint
fill_raw_bytes (GstRTSPConnection * conn, guint8 * buffer, guint size,

View file

@ -2281,18 +2281,6 @@ gst_video_decoder_get_buffer_info_at_offset (GstVideoDecoder *
GST_TIME_ARGS (*pts), GST_TIME_ARGS (*dts), *flags, got_offset, offset);
}
#if !GLIB_CHECK_VERSION(2, 60, 0)
#define g_queue_clear_full queue_clear_full
static void
queue_clear_full (GQueue * queue, GDestroyNotify free_func)
{
gpointer data;
while ((data = g_queue_pop_head (queue)) != NULL)
free_func (data);
}
#endif
static void
gst_video_decoder_clear_queues (GstVideoDecoder * dec)
{

View file

@ -444,18 +444,6 @@ _flush_events (GstPad * pad, GList * events)
return NULL;
}
#if !GLIB_CHECK_VERSION(2, 60, 0)
#define g_queue_clear_full queue_clear_full
static void
queue_clear_full (GQueue * queue, GDestroyNotify free_func)
{
gpointer data;
while ((data = g_queue_pop_head (queue)) != NULL)
free_func (data);
}
#endif
static gboolean
gst_video_encoder_reset (GstVideoEncoder * encoder, gboolean hard)
{

View file

@ -27,7 +27,7 @@ else
have_objc = false
endif
glib_req = '>= 2.56.0'
glib_req = '>= 2.62.0'
orc_req = '>= 0.4.24'
if gst_version_is_stable

View file

@ -469,11 +469,6 @@ live_switch_push (gint pts, gint rate, GstCaps * caps)
gst_caps_unref (desired);
}
#if !GLIB_CHECK_VERSION(2,58,0)
#define G_APPROX_VALUE(a, b, epsilon) \
(((a) > (b) ? (a) - (b) : (b) - (a)) < (epsilon))
#endif
GST_START_TEST (test_live_switch)
{
GstElement *audioresample;

View file

@ -383,34 +383,6 @@ GstStreamType gst_stream_type_from_hls_type (GstHLSRenditionStreamType
GstStreamType gst_hls_get_stream_type_from_structure (GstStructure *structure);
GstStreamType gst_hls_get_stream_type_from_caps (GstCaps *caps);
#if !GLIB_CHECK_VERSION(2, 62, 0)
static inline gchar* g_date_time_format_iso8601(GDateTime* datetime) {
GString* outstr = NULL;
gchar* main_date = NULL;
gint64 offset;
// Main date and time.
main_date = g_date_time_format(datetime, "%Y-%m-%dT%H:%M:%S");
outstr = g_string_new(main_date);
g_free(main_date);
// Timezone. Format it as `%:::z` unless the offset is zero, in which case
// we can simply use `Z`.
offset = g_date_time_get_utc_offset(datetime);
if (offset == 0) {
g_string_append_c(outstr, 'Z');
} else {
gchar* time_zone = g_date_time_format(datetime, "%:::z");
g_string_append(outstr, time_zone);
g_free(time_zone);
}
return g_string_free(outstr, FALSE);
}
#endif
G_END_DECLS
#endif /* __M3U8_H__ */

View file

@ -279,18 +279,6 @@ enum
#define GST_BUFFER_IS_RETRANSMISSION(buffer) \
GST_BUFFER_FLAG_IS_SET (buffer, GST_RTP_BUFFER_FLAG_RETRANSMISSION)
#if !GLIB_CHECK_VERSION(2, 60, 0)
#define g_queue_clear_full queue_clear_full
static void
queue_clear_full (GQueue * queue, GDestroyNotify free_func)
{
gpointer data;
while ((data = g_queue_pop_head (queue)) != NULL)
free_func (data);
}
#endif
struct _GstRtpJitterBufferPrivate
{
GstPad *sinkpad, *srcpad;

View file

@ -70,18 +70,6 @@
#include "gstrtpst2022-1-fecenc.h"
#if !GLIB_CHECK_VERSION(2, 60, 0)
#define g_queue_clear_full queue_clear_full
static void
queue_clear_full (GQueue * queue, GDestroyNotify free_func)
{
gpointer data;
while ((data = g_queue_pop_head (queue)) != NULL)
free_func (data);
}
#endif
GST_DEBUG_CATEGORY_STATIC (gst_rtpst_2022_1_fecenc_debug);
#define GST_CAT_DEFAULT gst_rtpst_2022_1_fecenc_debug

View file

@ -32,12 +32,6 @@ udp_element_init (GstPlugin * plugin)
{
static gsize res = FALSE;
if (g_once_init_enter (&res)) {
/* not using GLIB_CHECK_VERSION on purpose, run-time version matters */
if (glib_check_version (2, 36, 0) != NULL) {
GST_WARNING ("Your GLib version is < 2.36, UDP multicasting support may "
"be broken, see https://bugzilla.gnome.org/show_bug.cgi?id=688378");
}
/* register info of the netaddress metadata so that we can use it from
* multiple threads right away. Note that the plugin loading is always
* serialized */

View file

@ -19,7 +19,7 @@ gst_version_is_dev = gst_version_minor.is_odd() and gst_version_micro < 90
have_cxx = add_languages('cpp', native: false, required: false)
glib_req = '>= 2.56.0'
glib_req = '>= 2.62.0'
orc_req = '>= 0.4.17'
if gst_version_is_stable

View file

@ -19,7 +19,7 @@ gst_version_is_dev = gst_version_minor.is_odd() and gst_version_micro < 90
have_cxx = add_languages('cpp', native: false, required: false)
glib_req = '>= 2.56.0'
glib_req = '>= 2.62.0'
if gst_version_is_stable
gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)

View file

@ -16,7 +16,7 @@ endif
gst_version_is_stable = gst_version_minor.is_even()
gst_version_is_dev = gst_version_minor.is_odd() and gst_version_micro < 90
glib_req = '>= 2.56.0'
glib_req = '>= 2.62.0'
if gst_version_is_stable
gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)

View file

@ -373,18 +373,6 @@ gst_device_monitor_dispose (GObject * object)
G_OBJECT_CLASS (gst_device_monitor_parent_class)->dispose (object);
}
#if !GLIB_CHECK_VERSION(2, 60, 0)
#define g_queue_clear_full queue_clear_full
static void
queue_clear_full (GQueue * queue, GDestroyNotify free_func)
{
gpointer data;
while ((data = g_queue_pop_head (queue)) != NULL)
free_func (data);
}
#endif
/**
* gst_device_monitor_get_devices:
* @monitor: A #GstDeviceProvider

View file

@ -521,8 +521,10 @@ configinc = include_directories('.')
libsinc = include_directories('libs')
privinc = include_directories('gst')
glib_req = '>= 2.62.0'
# Find dependencies
glib_dep = dependency('glib-2.0', version : '>=2.56.0',
glib_dep = dependency('glib-2.0', version: glib_req,
fallback: ['glib', 'libglib_dep'])
gobject_dep = dependency('gobject-2.0')
gmodule_dep = dependency('gmodule-no-export-2.0')

View file

@ -477,12 +477,7 @@ static const struct URITest url_presenting_tests[] = {
{.uri = {"scheme", "user:pass", "host", 1234, "/path/to/dir",
{{"query", NULL}, {"key", "value"}}, "fragment"},
.str =
#if GLIB_CHECK_VERSION(2, 59, 0)
"scheme://user:pass@host:1234/path/to/dir?key=value&query#fragment"},
#else
"scheme://user:pass@host:1234/path/to/dir?query&key=value#fragment"},
#endif
/* IPv6 literal should render in square brackets */
{.uri = {"scheme", "user:pass", "12:34:56:78:9a:bc:de:f0", 1234,
"/path/to/dir", {{"query", "value"}}, "fragment"},
@ -1044,24 +1039,14 @@ GST_START_TEST (test_url_get_set)
fail_unless (gst_uri_set_query_value (url, "key", "value"));
tmp_str = gst_uri_to_string (url);
#if GLIB_CHECK_VERSION(2, 59, 0)
fail_unless_equals_string (tmp_str,
"//example.com/path/to/file/there/segment?key=value&query#fragment");
#else
fail_unless_equals_string (tmp_str,
"//example.com/path/to/file/there/segment?query&key=value#fragment");
#endif
g_free (tmp_str);
fail_unless (gst_uri_set_query_value (url, "key", NULL));
tmp_str = gst_uri_to_string (url);
#if GLIB_CHECK_VERSION(2, 59, 0)
fail_unless_equals_string (tmp_str,
"//example.com/path/to/file/there/segment?key&query#fragment");
#else
fail_unless_equals_string (tmp_str,
"//example.com/path/to/file/there/segment?query&key#fragment");
#endif
g_free (tmp_str);
fail_unless (!gst_uri_set_query_value (NULL, "key", "value"));