mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
Use recent GLib API unconditionally now that we depend on the latest GLib
This commit is contained in:
parent
612abd89dd
commit
13d91d1f6c
32 changed files with 26 additions and 290 deletions
|
@ -27,40 +27,6 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2,25,0)
|
||||
|
||||
#if defined (_MSC_VER) && !defined(_WIN64)
|
||||
typedef struct _stat32 GStatBuf;
|
||||
#else
|
||||
typedef struct stat GStatBuf;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if GLIB_CHECK_VERSION(2,26,0)
|
||||
#define GLIB_HAS_GDATETIME
|
||||
#endif
|
||||
|
||||
/* See bug #651514 */
|
||||
#if GLIB_CHECK_VERSION(2,29,5)
|
||||
#define G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE(a,b,c) \
|
||||
g_atomic_pointer_compare_and_exchange ((a),(b),(c))
|
||||
#define G_ATOMIC_INT_COMPARE_AND_EXCHANGE(a,b,c) \
|
||||
g_atomic_int_compare_and_exchange ((a),(b),(c))
|
||||
#else
|
||||
#define G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE(a,b,c) \
|
||||
g_atomic_pointer_compare_and_exchange ((volatile gpointer *)(a),(b),(c))
|
||||
#define G_ATOMIC_INT_COMPARE_AND_EXCHANGE(a,b,c) \
|
||||
g_atomic_int_compare_and_exchange ((volatile int *)(a),(b),(c))
|
||||
#endif
|
||||
|
||||
/* See bug #651514 */
|
||||
#if GLIB_CHECK_VERSION(2,29,5)
|
||||
#define G_ATOMIC_INT_ADD(a,b) g_atomic_int_add ((a),(b))
|
||||
#else
|
||||
#define G_ATOMIC_INT_ADD(a,b) g_atomic_int_exchange_and_add ((a),(b))
|
||||
#endif
|
||||
|
||||
/* copies */
|
||||
|
||||
/* adaptations */
|
||||
|
|
36
gst/gst.c
36
gst/gst.c
|
@ -360,32 +360,6 @@ gst_init_get_option_group (void)
|
|||
{NULL}
|
||||
};
|
||||
|
||||
/* Since GLib 2.31.0 threading is always enabled and g_thread_init()
|
||||
* is not needed any longer and deprecated */
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
/* Since GLib 2.23.2 calling g_thread_init() 'late' is allowed and is
|
||||
* automatically done as part of g_type_init() */
|
||||
if (glib_check_version (2, 23, 3)) {
|
||||
/* The GLib threading system must be initialised before calling any other
|
||||
* GLib function according to the documentation; if the application hasn't
|
||||
* called gst_init() yet or initialised the threading system otherwise, we
|
||||
* better issue a warning here (since chances are high that the application
|
||||
* has already called other GLib functions such as g_option_context_new() */
|
||||
if (!g_thread_get_initialized ()) {
|
||||
g_warning ("The GStreamer function gst_init_get_option_group() was\n"
|
||||
"\tcalled, but the GLib threading system has not been initialised\n"
|
||||
"\tyet, something that must happen before any other GLib function\n"
|
||||
"\tis called. The application needs to be fixed so that it calls\n"
|
||||
"\t if (!g_thread_get_initialized ()) g_thread_init(NULL);\n"
|
||||
"\tas very first thing in its main() function. Please file a bug\n"
|
||||
"\tagainst this application.");
|
||||
g_thread_init (NULL);
|
||||
}
|
||||
} else {
|
||||
/* GLib >= 2.23.2 */
|
||||
}
|
||||
#endif
|
||||
|
||||
group = g_option_group_new ("gst", _("GStreamer Options"),
|
||||
_("Show GStreamer Options"), NULL, NULL);
|
||||
g_option_group_set_parse_hooks (group, (GOptionParseFunc) init_pre,
|
||||
|
@ -428,11 +402,6 @@ gst_init_check (int *argc, char **argv[], GError ** err)
|
|||
#endif
|
||||
gboolean res;
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
if (!g_thread_get_initialized ())
|
||||
g_thread_init (NULL);
|
||||
#endif
|
||||
|
||||
if (gst_initialized) {
|
||||
GST_DEBUG ("already initialized gst");
|
||||
return TRUE;
|
||||
|
@ -580,11 +549,6 @@ init_pre (GOptionContext * context, GOptionGroup * group, gpointer data,
|
|||
|
||||
g_type_init ();
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
/* we need threading to be enabled right here */
|
||||
g_assert (g_thread_get_initialized ());
|
||||
#endif
|
||||
|
||||
#ifndef GST_DISABLE_GST_DEBUG
|
||||
_priv_gst_debug_init ();
|
||||
#endif
|
||||
|
|
|
@ -113,7 +113,7 @@ add_to_free_list (GstAtomicQueue * queue, GstAQueueMem * mem)
|
|||
{
|
||||
do {
|
||||
mem->free = g_atomic_pointer_get (&queue->free_list);
|
||||
} while (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&queue->free_list,
|
||||
} while (!g_atomic_pointer_compare_and_exchange (&queue->free_list,
|
||||
mem->free, mem));
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ clear_free_list (GstAtomicQueue * queue)
|
|||
free_list = g_atomic_pointer_get (&queue->free_list);
|
||||
if (free_list == NULL)
|
||||
return;
|
||||
} while (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&queue->free_list, free_list,
|
||||
} while (!g_atomic_pointer_compare_and_exchange (&queue->free_list, free_list,
|
||||
NULL));
|
||||
|
||||
while (free_list) {
|
||||
|
@ -248,7 +248,7 @@ gst_atomic_queue_peek (GstAtomicQueue * queue)
|
|||
|
||||
/* now we try to move the next array as the head memory. If we fail to do that,
|
||||
* some other reader managed to do it first and we retry */
|
||||
if (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&queue->head_mem, head_mem,
|
||||
if (!g_atomic_pointer_compare_and_exchange (&queue->head_mem, head_mem,
|
||||
next))
|
||||
continue;
|
||||
|
||||
|
@ -305,7 +305,7 @@ gst_atomic_queue_pop (GstAtomicQueue * queue)
|
|||
|
||||
/* now we try to move the next array as the head memory. If we fail to do that,
|
||||
* some other reader managed to do it first and we retry */
|
||||
if (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&queue->head_mem, head_mem,
|
||||
if (!g_atomic_pointer_compare_and_exchange (&queue->head_mem, head_mem,
|
||||
next))
|
||||
continue;
|
||||
|
||||
|
@ -363,7 +363,7 @@ gst_atomic_queue_push (GstAtomicQueue * queue, gpointer data)
|
|||
mem = new_queue_mem ((size << 1) + 1, tail);
|
||||
|
||||
/* try to make our new array visible to other writers */
|
||||
if (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&queue->tail_mem, tail_mem,
|
||||
if (!g_atomic_pointer_compare_and_exchange (&queue->tail_mem, tail_mem,
|
||||
mem)) {
|
||||
/* we tried to swap the new writer array but something changed. This is
|
||||
* because some other writer beat us to it, we free our memory and try
|
||||
|
|
|
@ -964,7 +964,7 @@ gst_buffer_pool_release_buffer (GstBufferPool * pool, GstBuffer * buffer)
|
|||
|
||||
/* check that the buffer is ours, all buffers returned to the pool have the
|
||||
* pool member set to NULL and the pool refcount decreased */
|
||||
if (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&buffer->pool, pool, NULL))
|
||||
if (!g_atomic_pointer_compare_and_exchange (&buffer->pool, pool, NULL))
|
||||
return;
|
||||
|
||||
pclass = GST_BUFFER_POOL_GET_CLASS (pool);
|
||||
|
|
|
@ -799,9 +799,7 @@ gst_bus_create_watch (GstBus * bus)
|
|||
source = (GstBusSource *) g_source_new (&gst_bus_source_funcs,
|
||||
sizeof (GstBusSource));
|
||||
|
||||
#if GLIB_CHECK_VERSION(2,26,0)
|
||||
g_source_set_name ((GSource *) source, "GStreamer message bus watch");
|
||||
#endif
|
||||
|
||||
source->bus = gst_object_ref (bus);
|
||||
g_source_add_poll ((GSource *) source, &bus->priv->pollfd);
|
||||
|
|
|
@ -257,11 +257,14 @@
|
|||
#define GST_DATE_TIME_USEC_PER_SECOND (G_GINT64_CONSTANT (1000000))
|
||||
#define GST_DATE_TIME_USEC_PER_MILLISECOND (G_GINT64_CONSTANT (1000))
|
||||
|
||||
/* FIXME: this bug was resolved NOTGNOME */
|
||||
/* Jan 5th 2011 (Edward) : GLib's GDateTime is broken in regards to gmt offset
|
||||
* on macosx. Re-enable it once the following bug is fixed:
|
||||
* https://bugzilla.gnome.org/show_bug.cgi?id=638666 */
|
||||
#ifdef HAVE_OSX
|
||||
#undef GLIB_HAS_GDATETIME
|
||||
#else
|
||||
#define GLIB_HAS_GDATETIME
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -381,7 +381,7 @@ gst_element_factory_create (GstElementFactory * factory, const gchar * name)
|
|||
* an element at the same moment
|
||||
*/
|
||||
oclass = GST_ELEMENT_GET_CLASS (element);
|
||||
if (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&oclass->elementfactory, NULL,
|
||||
if (!g_atomic_pointer_compare_and_exchange (&oclass->elementfactory, NULL,
|
||||
factory))
|
||||
gst_object_unref (factory);
|
||||
|
||||
|
|
|
@ -123,19 +123,11 @@ GQuark gst_ ## string ## _error_quark (void) { \
|
|||
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)
|
||||
{
|
||||
#if GLIB_CHECK_VERSION(2,25,2)
|
||||
return g_error_get_type ();
|
||||
#else
|
||||
static GType type = 0;
|
||||
|
||||
if (G_UNLIKELY (type == 0))
|
||||
type = g_boxed_type_register_static ("GstGError",
|
||||
(GBoxedCopyFunc) g_error_copy, (GBoxedFreeFunc) g_error_free);
|
||||
return type;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define FILE_A_BUG " Please file a bug at " PACKAGE_BUGREPORT "."
|
||||
|
|
|
@ -160,8 +160,8 @@ static gboolean gst_poll_add_fd_unlocked (GstPoll * set, GstPollFD * fd);
|
|||
#define IS_FLUSHING(s) (g_atomic_int_get(&(s)->flushing))
|
||||
#define SET_FLUSHING(s,val) (g_atomic_int_set(&(s)->flushing, (val)))
|
||||
|
||||
#define INC_WAITING(s) (G_ATOMIC_INT_ADD(&(s)->waiting, 1))
|
||||
#define DEC_WAITING(s) (G_ATOMIC_INT_ADD(&(s)->waiting, -1))
|
||||
#define INC_WAITING(s) (g_atomic_int_add(&(s)->waiting, 1))
|
||||
#define DEC_WAITING(s) (g_atomic_int_add(&(s)->waiting, -1))
|
||||
#define GET_WAITING(s) (g_atomic_int_get(&(s)->waiting))
|
||||
|
||||
#define TEST_REBUILD(s) (g_atomic_int_compare_and_exchange(&(s)->rebuild, 1, 0))
|
||||
|
@ -182,7 +182,7 @@ raise_wakeup (GstPoll * set)
|
|||
{
|
||||
gboolean result = TRUE;
|
||||
|
||||
if (G_ATOMIC_INT_ADD (&set->control_pending, 1) == 0) {
|
||||
if (g_atomic_int_add (&set->control_pending, 1) == 0) {
|
||||
/* raise when nothing pending */
|
||||
GST_LOG ("%p: raise", set);
|
||||
result = WAKE_EVENT (set);
|
||||
|
@ -222,7 +222,7 @@ release_all_wakeup (GstPoll * set)
|
|||
break;
|
||||
else
|
||||
/* retry again until we read it successfully */
|
||||
G_ATOMIC_INT_ADD (&set->control_pending, 1);
|
||||
g_atomic_int_add (&set->control_pending, 1);
|
||||
}
|
||||
}
|
||||
return old;
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
#define GET_ENTRY_STATUS(e) ((GstClockReturn) g_atomic_int_get(&GST_CLOCK_ENTRY_STATUS(e)))
|
||||
#define SET_ENTRY_STATUS(e,val) (g_atomic_int_set(&GST_CLOCK_ENTRY_STATUS(e),(val)))
|
||||
#define CAS_ENTRY_STATUS(e,old,val) (G_ATOMIC_INT_COMPARE_AND_EXCHANGE(\
|
||||
#define CAS_ENTRY_STATUS(e,old,val) (g_atomic_int_compare_and_exchange(\
|
||||
(&GST_CLOCK_ENTRY_STATUS(e)), (old), (val)))
|
||||
|
||||
/* Define this to get some extra debug about jitter from each clock_wait */
|
||||
|
@ -732,13 +732,8 @@ gst_system_clock_start_async (GstSystemClock * clock)
|
|||
if (G_LIKELY (clock->thread != NULL))
|
||||
return TRUE; /* Thread already running. Nothing to do */
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
clock->thread = g_thread_create ((GThreadFunc) gst_system_clock_async_thread,
|
||||
clock, TRUE, &error);
|
||||
#else
|
||||
clock->thread = g_thread_try_new ("GstSystemClock",
|
||||
(GThreadFunc) gst_system_clock_async_thread, clock, &error);
|
||||
#endif
|
||||
|
||||
if (G_UNLIKELY (error))
|
||||
goto no_thread;
|
||||
|
|
|
@ -73,19 +73,11 @@ typedef struct
|
|||
}
|
||||
GstTagInfo;
|
||||
|
||||
#if GLIB_CHECK_VERSION (2, 31, 0)
|
||||
#define g_value_get_char g_value_get_schar
|
||||
#endif
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
static GMutex *__tag_mutex;
|
||||
#define TAG_LOCK g_mutex_lock (__tag_mutex)
|
||||
#define TAG_UNLOCK g_mutex_unlock (__tag_mutex)
|
||||
#else
|
||||
static GMutex __tag_mutex;
|
||||
#define TAG_LOCK g_mutex_lock (&__tag_mutex)
|
||||
#define TAG_UNLOCK g_mutex_unlock (&__tag_mutex)
|
||||
#endif
|
||||
|
||||
/* tags hash table: maps tag name string => GstTagInfo */
|
||||
static GHashTable *__tags;
|
||||
|
@ -111,11 +103,8 @@ gst_tag_list_get_type (void)
|
|||
void
|
||||
_priv_gst_tag_initialize (void)
|
||||
{
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
__tag_mutex = g_mutex_new ();
|
||||
#else
|
||||
g_mutex_init (&__tag_mutex);
|
||||
#endif
|
||||
|
||||
__tags = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
gst_tag_register (GST_TAG_TITLE, GST_TAG_FLAG_META,
|
||||
G_TYPE_STRING,
|
||||
|
|
|
@ -83,20 +83,11 @@ typedef struct
|
|||
{
|
||||
GstTagMergeMode mode;
|
||||
GstTagList *list;
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
GStaticMutex lock;
|
||||
#else
|
||||
GMutex lock;
|
||||
#endif
|
||||
} GstTagData;
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
#define GST_TAG_DATA_LOCK(data) g_static_mutex_lock(&data->lock)
|
||||
#define GST_TAG_DATA_UNLOCK(data) g_static_mutex_unlock(&data->lock)
|
||||
#else
|
||||
#define GST_TAG_DATA_LOCK(data) g_mutex_lock(&data->lock)
|
||||
#define GST_TAG_DATA_UNLOCK(data) g_mutex_unlock(&data->lock)
|
||||
#endif
|
||||
|
||||
GType
|
||||
gst_tag_setter_get_type (void)
|
||||
|
@ -137,11 +128,7 @@ gst_tag_data_free (gpointer p)
|
|||
if (data->list)
|
||||
gst_tag_list_free (data->list);
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
g_static_mutex_free (&data->lock);
|
||||
#else
|
||||
g_mutex_clear (&data->lock);
|
||||
#endif
|
||||
|
||||
g_slice_free (GstTagData, data);
|
||||
}
|
||||
|
@ -154,34 +141,21 @@ gst_tag_setter_get_data (GstTagSetter * setter)
|
|||
data = g_object_get_qdata (G_OBJECT (setter), gst_tag_key);
|
||||
if (!data) {
|
||||
/* make sure no other thread is creating a GstTagData at the same time */
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
static GStaticMutex create_mutex = G_STATIC_MUTEX_INIT;
|
||||
|
||||
g_static_mutex_lock (&create_mutex);
|
||||
#else
|
||||
static GMutex create_mutex; /* no initialisation required */
|
||||
|
||||
g_mutex_lock (&create_mutex);
|
||||
#endif
|
||||
|
||||
data = g_object_get_qdata (G_OBJECT (setter), gst_tag_key);
|
||||
if (!data) {
|
||||
data = g_slice_new (GstTagData);
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
g_static_mutex_init (&data->lock);
|
||||
#else
|
||||
g_mutex_init (&data->lock);
|
||||
#endif
|
||||
data->list = NULL;
|
||||
data->mode = GST_TAG_MERGE_KEEP;
|
||||
g_object_set_qdata_full (G_OBJECT (setter), gst_tag_key, data,
|
||||
gst_tag_data_free);
|
||||
}
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
g_static_mutex_unlock (&create_mutex);
|
||||
#else
|
||||
|
||||
g_mutex_unlock (&create_mutex);
|
||||
#endif
|
||||
}
|
||||
|
||||
return data;
|
||||
|
|
|
@ -277,11 +277,7 @@ gst_task_func (GstTask * task)
|
|||
task->thread = tself;
|
||||
/* only update the priority when it was changed */
|
||||
if (priv->prio_set) {
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
g_thread_set_priority (tself, priv->priority);
|
||||
#else
|
||||
GST_INFO_OBJECT (task, "Thread priorities no longer have any effect");
|
||||
#endif
|
||||
}
|
||||
GST_OBJECT_UNLOCK (task);
|
||||
|
||||
|
@ -330,12 +326,6 @@ exit:
|
|||
GST_OBJECT_UNLOCK (task);
|
||||
priv->thr_callbacks.leave_thread (task, tself, priv->thr_user_data);
|
||||
GST_OBJECT_LOCK (task);
|
||||
} else {
|
||||
/* restore normal priority when releasing back into the pool, we will not
|
||||
* touch the priority when a custom callback has been installed. */
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
g_thread_set_priority (tself, G_THREAD_PRIORITY_NORMAL);
|
||||
#endif
|
||||
}
|
||||
/* now we allow messing with the lock again by setting the running flag to
|
||||
* FALSE. Together with the SIGNAL this is the sign for the _join() to
|
||||
|
@ -460,6 +450,7 @@ is_running:
|
|||
*
|
||||
* Since: 0.10.24
|
||||
*/
|
||||
/* FIXME 0.11: remove gst_task_set_priority() */
|
||||
void
|
||||
gst_task_set_priority (GstTask * task, GThreadPriority priority)
|
||||
{
|
||||
|
@ -477,11 +468,7 @@ gst_task_set_priority (GstTask * task, GThreadPriority priority)
|
|||
if (thread != NULL) {
|
||||
/* if this task already has a thread, we can configure the priority right
|
||||
* away, else we do that when we assign a thread to the task. */
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
g_thread_set_priority (thread, priority);
|
||||
#else
|
||||
GST_INFO_OBJECT (task, "Thread priorities no longer have any effect");
|
||||
#endif
|
||||
}
|
||||
GST_OBJECT_UNLOCK (task);
|
||||
}
|
||||
|
|
|
@ -704,7 +704,7 @@ guint32
|
|||
gst_util_seqnum_next (void)
|
||||
{
|
||||
static gint counter = 0;
|
||||
return G_ATOMIC_INT_ADD (&counter, 1);
|
||||
return g_atomic_int_add (&counter, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -289,11 +289,7 @@ struct _GstBaseParsePrivate
|
|||
GstIndex *index;
|
||||
gint index_id;
|
||||
gboolean own_index;
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
GStaticMutex index_lock;
|
||||
#else
|
||||
GMutex index_lock;
|
||||
#endif
|
||||
|
||||
/* seek table entries only maintained if upstream is BYTE seekable */
|
||||
gboolean upstream_seekable;
|
||||
|
@ -342,17 +338,10 @@ typedef struct _GstBaseParseSeek
|
|||
GstClockTime start_ts;
|
||||
} GstBaseParseSeek;
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
#define GST_BASE_PARSE_INDEX_LOCK(parse) \
|
||||
g_static_mutex_lock (&parse->priv->index_lock);
|
||||
#define GST_BASE_PARSE_INDEX_UNLOCK(parse) \
|
||||
g_static_mutex_unlock (&parse->priv->index_lock);
|
||||
#else
|
||||
#define GST_BASE_PARSE_INDEX_LOCK(parse) \
|
||||
g_mutex_lock (&parse->priv->index_lock);
|
||||
#define GST_BASE_PARSE_INDEX_UNLOCK(parse) \
|
||||
g_mutex_unlock (&parse->priv->index_lock);
|
||||
#endif
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
|
@ -500,11 +489,7 @@ gst_base_parse_finalize (GObject * object)
|
|||
gst_object_unref (parse->priv->index);
|
||||
parse->priv->index = NULL;
|
||||
}
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
g_static_mutex_free (&parse->priv->index_lock);
|
||||
#else
|
||||
g_mutex_clear (&parse->priv->index_lock);
|
||||
#endif
|
||||
|
||||
gst_base_parse_clear_queues (parse);
|
||||
|
||||
|
@ -586,11 +571,7 @@ gst_base_parse_init (GstBaseParse * parse, GstBaseParseClass * bclass)
|
|||
|
||||
parse->priv->pad_mode = GST_PAD_MODE_NONE;
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
g_static_mutex_init (&parse->priv->index_lock);
|
||||
#else
|
||||
g_mutex_init (&parse->priv->index_lock);
|
||||
#endif
|
||||
|
||||
/* init state */
|
||||
gst_base_parse_reset (parse);
|
||||
|
|
|
@ -41,11 +41,6 @@ main (int argc, char *argv[])
|
|||
if (argc != 2 || strcmp (argv[1], "-l"))
|
||||
return 1;
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
if (!g_thread_supported ())
|
||||
g_thread_init (NULL);
|
||||
#endif
|
||||
|
||||
my_argc = 2;
|
||||
my_argv = g_malloc (my_argc * sizeof (char *));
|
||||
my_argv[0] = argv[0];
|
||||
|
|
|
@ -465,13 +465,8 @@ gst_net_client_clock_start (GstNetClientClock * self)
|
|||
self->priv->socket = socket;
|
||||
self->priv->servaddr = G_SOCKET_ADDRESS (servaddr);
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
self->priv->thread = g_thread_create (gst_net_client_clock_thread, self, TRUE,
|
||||
&error);
|
||||
#else
|
||||
self->priv->thread = g_thread_try_new ("GstNetClientClock",
|
||||
gst_net_client_clock_thread, self, &error);
|
||||
#endif
|
||||
|
||||
if (error != NULL)
|
||||
goto no_thread;
|
||||
|
|
|
@ -319,13 +319,8 @@ gst_net_time_provider_start (GstNetTimeProvider * self)
|
|||
self->priv->socket = socket;
|
||||
self->priv->cancel = g_cancellable_new ();
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
self->priv->thread =
|
||||
g_thread_create (gst_net_time_provider_thread, self, TRUE, &err);
|
||||
#else
|
||||
self->priv->thread = g_thread_try_new ("GstNetTimeProvider",
|
||||
gst_net_time_provider_thread, self, &err);
|
||||
#endif
|
||||
|
||||
if (err != NULL)
|
||||
goto no_thread;
|
||||
|
|
|
@ -271,9 +271,6 @@ gst_fake_sink_init (GstFakeSink * fakesink)
|
|||
fakesink->state_error = DEFAULT_STATE_ERROR;
|
||||
fakesink->signal_handoffs = DEFAULT_SIGNAL_HANDOFFS;
|
||||
fakesink->num_buffers = DEFAULT_NUM_BUFFERS;
|
||||
#if !GLIB_CHECK_VERSION(2,26,0)
|
||||
g_static_rec_mutex_init (&fakesink->notify_lock);
|
||||
#endif
|
||||
|
||||
gst_base_sink_set_sync (GST_BASE_SINK (fakesink), DEFAULT_SYNC);
|
||||
}
|
||||
|
@ -281,12 +278,6 @@ gst_fake_sink_init (GstFakeSink * fakesink)
|
|||
static void
|
||||
gst_fake_sink_finalize (GObject * obj)
|
||||
{
|
||||
#if !GLIB_CHECK_VERSION(2,26,0)
|
||||
GstFakeSink *sink = GST_FAKE_SINK (obj);
|
||||
|
||||
g_static_rec_mutex_free (&sink->notify_lock);
|
||||
#endif
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
||||
}
|
||||
|
||||
|
@ -370,19 +361,7 @@ gst_fake_sink_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
static void
|
||||
gst_fake_sink_notify_last_message (GstFakeSink * sink)
|
||||
{
|
||||
/* FIXME: this hacks around a bug in GLib/GObject: doing concurrent
|
||||
* g_object_notify() on the same object might lead to crashes, see
|
||||
* http://bugzilla.gnome.org/show_bug.cgi?id=166020#c60 and follow-ups.
|
||||
* So we really don't want to do a g_object_notify() here for out-of-band
|
||||
* events with the streaming thread possibly also doing a g_object_notify()
|
||||
* for an in-band buffer or event. This is fixed in GLib >= 2.26 */
|
||||
#if !GLIB_CHECK_VERSION(2,26,0)
|
||||
g_static_rec_mutex_lock (&sink->notify_lock);
|
||||
g_object_notify ((GObject *) sink, "last-message");
|
||||
g_static_rec_mutex_unlock (&sink->notify_lock);
|
||||
#else
|
||||
g_object_notify_by_pspec ((GObject *) sink, pspec_last_message);
|
||||
#endif
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -82,9 +82,6 @@ struct _GstFakeSink {
|
|||
gchar *last_message;
|
||||
gint num_buffers;
|
||||
gint num_buffers_left;
|
||||
#if !GLIB_CHECK_VERSION(2,26,0)
|
||||
GStaticRecMutex notify_lock;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _GstFakeSinkClass {
|
||||
|
|
|
@ -446,11 +446,7 @@ gst_fake_src_event_handler (GstBaseSrc * basesrc, GstEvent * event)
|
|||
g_free (sstr);
|
||||
GST_OBJECT_UNLOCK (src);
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2,26,0)
|
||||
g_object_notify ((GObject *) src, "last-message");
|
||||
#else
|
||||
g_object_notify_by_pspec ((GObject *) src, pspec_last_message);
|
||||
#endif
|
||||
}
|
||||
|
||||
return GST_BASE_SRC_CLASS (parent_class)->event (basesrc, event);
|
||||
|
@ -881,11 +877,7 @@ gst_fake_src_create (GstBaseSrc * basesrc, guint64 offset, guint length,
|
|||
GST_MINI_OBJECT_CAST (buf)->flags, flag_str, buf);
|
||||
GST_OBJECT_UNLOCK (src);
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2,26,0)
|
||||
g_object_notify ((GObject *) src, "last-message");
|
||||
#else
|
||||
g_object_notify_by_pspec ((GObject *) src, pspec_last_message);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (src->signal_handoffs) {
|
||||
|
|
|
@ -128,10 +128,6 @@ gst_identity_finalize (GObject * object)
|
|||
|
||||
g_free (identity->last_message);
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2,26,0)
|
||||
g_static_rec_mutex_free (&identity->notify_lock);
|
||||
#endif
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -298,29 +294,13 @@ gst_identity_init (GstIdentity * identity)
|
|||
identity->last_message = NULL;
|
||||
identity->signal_handoffs = DEFAULT_SIGNAL_HANDOFFS;
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2,26,0)
|
||||
g_static_rec_mutex_init (&identity->notify_lock);
|
||||
#endif
|
||||
|
||||
gst_base_transform_set_gap_aware (GST_BASE_TRANSFORM_CAST (identity), TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_identity_notify_last_message (GstIdentity * identity)
|
||||
{
|
||||
/* FIXME: this hacks around a bug in GLib/GObject: doing concurrent
|
||||
* g_object_notify() on the same object might lead to crashes, see
|
||||
* http://bugzilla.gnome.org/show_bug.cgi?id=166020#c60 and follow-ups.
|
||||
* So we really don't want to do a g_object_notify() here for out-of-band
|
||||
* events with the streaming thread possibly also doing a g_object_notify()
|
||||
* for an in-band buffer or event. This is fixed in GLib >= 2.26 */
|
||||
#if !GLIB_CHECK_VERSION(2,26,0)
|
||||
g_static_rec_mutex_lock (&identity->notify_lock);
|
||||
g_object_notify ((GObject *) identity, "last-message");
|
||||
g_static_rec_mutex_unlock (&identity->notify_lock);
|
||||
#else
|
||||
g_object_notify_by_pspec ((GObject *) identity, pspec_last_message);
|
||||
#endif
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -73,10 +73,6 @@ struct _GstIdentity {
|
|||
gchar *last_message;
|
||||
guint64 offset;
|
||||
gboolean signal_handoffs;
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2,26,0)
|
||||
GStaticRecMutex notify_lock;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _GstIdentityClass {
|
||||
|
|
|
@ -64,15 +64,6 @@
|
|||
GST_DEBUG_CATEGORY_STATIC (input_selector_debug);
|
||||
#define GST_CAT_DEFAULT input_selector_debug
|
||||
|
||||
#if GLIB_CHECK_VERSION(2, 26, 0)
|
||||
#define NOTIFY_MUTEX_LOCK()
|
||||
#define NOTIFY_MUTEX_UNLOCK()
|
||||
#else
|
||||
static GStaticRecMutex notify_mutex = G_STATIC_REC_MUTEX_INIT;
|
||||
#define NOTIFY_MUTEX_LOCK() g_rec_mutex_lock (¬ify_mutex)
|
||||
#define NOTIFY_MUTEX_UNLOCK() g_rec_mutex_unlock (¬ify_mutex)
|
||||
#endif
|
||||
|
||||
static GstStaticPadTemplate gst_input_selector_sink_factory =
|
||||
GST_STATIC_PAD_TEMPLATE ("sink_%u",
|
||||
GST_PAD_SINK,
|
||||
|
@ -370,9 +361,7 @@ gst_selector_pad_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
GST_INPUT_SELECTOR_UNLOCK (sel);
|
||||
|
||||
if (prev_active_sinkpad != active_sinkpad && pad == active_sinkpad) {
|
||||
NOTIFY_MUTEX_LOCK ();
|
||||
g_object_notify (G_OBJECT (sel), "active-pad");
|
||||
NOTIFY_MUTEX_UNLOCK ();
|
||||
}
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
|
@ -683,9 +672,7 @@ gst_selector_pad_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
|||
GST_INPUT_SELECTOR_UNLOCK (sel);
|
||||
|
||||
if (prev_active_sinkpad != active_sinkpad && pad == active_sinkpad) {
|
||||
NOTIFY_MUTEX_LOCK ();
|
||||
g_object_notify (G_OBJECT (sel), "active-pad");
|
||||
NOTIFY_MUTEX_UNLOCK ();
|
||||
}
|
||||
|
||||
if (start_event)
|
||||
|
|
|
@ -1346,7 +1346,7 @@ gst_multi_queue_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
|||
goto was_eos;
|
||||
|
||||
/* Get a unique incrementing id */
|
||||
curid = G_ATOMIC_INT_ADD ((gint *) & mq->counter, 1);
|
||||
curid = g_atomic_int_add ((gint *) & mq->counter, 1);
|
||||
|
||||
GST_LOG_OBJECT (mq, "SingleQueue %d : about to enqueue buffer %p with id %d",
|
||||
sq->id, buffer, curid);
|
||||
|
@ -1462,7 +1462,7 @@ gst_multi_queue_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
goto was_eos;
|
||||
|
||||
/* Get an unique incrementing id. */
|
||||
curid = G_ATOMIC_INT_ADD ((gint *) & mq->counter, 1);
|
||||
curid = g_atomic_int_add ((gint *) & mq->counter, 1);
|
||||
|
||||
item = gst_multi_queue_event_item_new ((GstMiniObject *) event, curid);
|
||||
|
||||
|
|
|
@ -273,11 +273,7 @@ gst_tee_init (GstTee * tee)
|
|||
static void
|
||||
gst_tee_notify_alloc_pad (GstTee * tee)
|
||||
{
|
||||
#if !GLIB_CHECK_VERSION(2,26,0)
|
||||
g_object_notify ((GObject *) tee, "alloc-pad");
|
||||
#else
|
||||
g_object_notify_by_pspec ((GObject *) tee, pspec_alloc_pad);
|
||||
#endif
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -529,11 +525,7 @@ gst_tee_do_message (GstTee * tee, GstPad * pad, gpointer data, gboolean is_list)
|
|||
}
|
||||
GST_OBJECT_UNLOCK (tee);
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2,26,0)
|
||||
g_object_notify ((GObject *) tee, "last-message");
|
||||
#else
|
||||
g_object_notify_by_pspec ((GObject *) tee, pspec_last_message);
|
||||
#endif
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
|
|
@ -96,12 +96,9 @@ main (gint argc, gchar * argv[])
|
|||
for (t = 0; t < num_threads; t++) {
|
||||
GError *error = NULL;
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
threads[t] = g_thread_create (run_test, GINT_TO_POINTER (t), TRUE, &error);
|
||||
#else
|
||||
threads[t] = g_thread_try_new ("bufferstresstest", run_test,
|
||||
GINT_TO_POINTER (t), &error);
|
||||
#endif
|
||||
|
||||
if (error) {
|
||||
printf ("ERROR: g_thread_create() %s\n", error->message);
|
||||
exit (-1);
|
||||
|
|
|
@ -35,7 +35,7 @@ run_test (void *user_data)
|
|||
|
||||
while (running) {
|
||||
gst_clock_get_time (sysclock);
|
||||
prev = G_ATOMIC_INT_ADD (&count, 1);
|
||||
prev = g_atomic_int_add (&count, 1);
|
||||
if (prev == G_MAXINT)
|
||||
g_warning ("overflow");
|
||||
}
|
||||
|
@ -65,12 +65,9 @@ main (gint argc, gchar * argv[])
|
|||
for (t = 0; t < num_threads; t++) {
|
||||
GError *error = NULL;
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
threads[t] = g_thread_create (run_test, sysclock, TRUE, &error);
|
||||
#else
|
||||
threads[t] = g_thread_try_new ("clockstresstest", run_test,
|
||||
sysclock, &error);
|
||||
#endif
|
||||
|
||||
if (error) {
|
||||
printf ("ERROR: g_thread_create() %s\n", error->message);
|
||||
exit (-1);
|
||||
|
|
|
@ -160,12 +160,9 @@ main (gint argc, gchar * argv[])
|
|||
for (t = 0; t < num_threads; t++) {
|
||||
GError *error = NULL;
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
threads[t] = g_thread_create (run_test, GINT_TO_POINTER (t), TRUE, &error);
|
||||
#else
|
||||
threads[t] = g_thread_try_new ("pollstresstest", run_test,
|
||||
GINT_TO_POINTER (t), &error);
|
||||
#endif
|
||||
|
||||
if (error) {
|
||||
printf ("ERROR: g_thread_create() %s\n", error->message);
|
||||
exit (-1);
|
||||
|
|
|
@ -1527,10 +1527,6 @@ main (int argc, char *argv[])
|
|||
textdomain (GETTEXT_PACKAGE);
|
||||
#endif
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
g_thread_init (NULL);
|
||||
#endif
|
||||
|
||||
gst_tools_set_prgname ("gst-inspect");
|
||||
|
||||
#ifndef GST_DISABLE_OPTION_PARSING
|
||||
|
|
|
@ -873,10 +873,6 @@ main (int argc, char *argv[])
|
|||
textdomain (GETTEXT_PACKAGE);
|
||||
#endif
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
g_thread_init (NULL);
|
||||
#endif
|
||||
|
||||
gst_tools_set_prgname ("gst-launch");
|
||||
|
||||
#ifndef GST_DISABLE_OPTION_PARSING
|
||||
|
|
|
@ -153,10 +153,6 @@ main (int argc, char *argv[])
|
|||
textdomain (GETTEXT_PACKAGE);
|
||||
#endif
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
||||
g_thread_init (NULL);
|
||||
#endif
|
||||
|
||||
gst_tools_set_prgname ("gst-typefind");
|
||||
|
||||
ctx = g_option_context_new ("FILES");
|
||||
|
|
Loading…
Reference in a new issue