Merge remote-tracking branch 'origin/master' into 0.11

Conflicts:
	gst/gstobject.h
	libs/gst/check/gstcheck.h
	libs/gst/controller/gstcontroller.c
	plugins/elements/gstidentity.c
	tools/gst-xmlinspect.c
This commit is contained in:
Tim-Philipp Müller 2011-12-04 15:38:09 +00:00
commit a1daf846f3
37 changed files with 418 additions and 36 deletions

View file

@ -48,6 +48,71 @@ typedef struct stat GStatBuf;
/* copies */
#if GLIB_CHECK_VERSION (2, 31, 0)
#define g_mutex_new gst_g_mutex_new
static inline GMutex *
gst_g_mutex_new (void)
{
GMutex *mutex = g_slice_new (GMutex);
g_mutex_init (mutex);
return mutex;
}
#define g_mutex_free gst_g_mutex_free
static inline void
gst_g_mutex_free (GMutex *mutex)
{
g_mutex_clear (mutex);
g_slice_free (GMutex, mutex);
}
#define g_static_rec_mutex_init gst_g_static_rec_mutex_init
static inline void
gst_g_static_rec_mutex_init (GStaticRecMutex *mutex)
{
static const GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT;
*mutex = init_mutex;
}
#define g_cond_new gst_g_cond_new
static inline GCond *
gst_g_cond_new (void)
{
GCond *cond = g_slice_new (GCond);
g_cond_init (cond);
return cond;
}
#define g_cond_free gst_g_cond_free
static inline void
gst_g_cond_free (GCond *cond)
{
g_cond_clear (cond);
g_slice_free (GCond, cond);
}
#define g_cond_timed_wait gst_g_cond_timed_wait
static inline gboolean
gst_g_cond_timed_wait (GCond *cond, GMutex *mutex, GTimeVal *abs_time)
{
gint64 end_time;
if (abs_time == NULL) {
g_cond_wait (cond, mutex);
return TRUE;
}
end_time = abs_time->tv_sec;
end_time *= 1000000;
end_time += abs_time->tv_usec;
/* would be nice if we had clock_rtoffset, but that didn't seem to
* make it into the kernel yet...
*/
/* if CLOCK_MONOTONIC is not defined then g_get_montonic_time() and
* g_get_real_time() are returning the same clock and we'd add ~0
*/
end_time += g_get_monotonic_time () - g_get_real_time ();
return g_cond_wait_until (cond, mutex, end_time);
}
#endif /* GLIB_CHECK_VERSION (2, 31, 0) */
/* adaptations */
G_END_DECLS

View file

@ -360,6 +360,9 @@ 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)) {
@ -381,6 +384,7 @@ gst_init_get_option_group (void)
} else {
/* GLib >= 2.23.2 */
}
#endif
group = g_option_group_new ("gst", _("GStreamer Options"),
_("Show GStreamer Options"), NULL, NULL);
@ -424,8 +428,10 @@ 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");
@ -574,8 +580,10 @@ 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 ();

View file

@ -157,6 +157,9 @@
* Last reviewed on 2006-04-28 (0.10.6)
*/
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gst_private.h"
#include "gstevent.h"

View file

@ -78,6 +78,7 @@
#include "gstpoll.h"
#include "gstbus.h"
#include "glib-compat-private.h"
#define GST_CAT_DEFAULT GST_CAT_BUS
/* bus signals */

View file

@ -109,6 +109,7 @@
#include "gstclock.h"
#include "gstinfo.h"
#include "gstutils.h"
#include "glib-compat-private.h"
#ifndef GST_DISABLE_TRACE
/* #define GST_WITH_ALLOC_TRACE */

View file

@ -79,6 +79,9 @@
* Last reviewed on 2009-05-29 (0.10.24)
*/
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gst_private.h"
#include <glib.h>
#include <stdarg.h>
@ -95,6 +98,7 @@
#include "gstinfo.h"
#include "gstvalue.h"
#include "gst-i18n-lib.h"
#include "glib-compat-private.h"
/* Element signals and args */
enum

View file

@ -60,6 +60,9 @@
* Last reviewed on 2006-07-06 (0.10.9)
*/
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gst_private.h"
#include "gstpad.h"

View file

@ -732,8 +732,14 @@ 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;

View file

@ -73,14 +73,23 @@ 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;
#define TAG_LOCK g_mutex_lock (__tag_mutex)
#define TAG_UNLOCK g_mutex_unlock (__tag_mutex)
GType
gst_tag_list_get_type (void)
{
@ -102,7 +111,11 @@ 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,

View file

@ -83,9 +83,21 @@ 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)
{
@ -125,7 +137,11 @@ 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);
}
@ -137,20 +153,35 @@ 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;
/* make sure no other thread is creating a GstTagData at the same time */
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;
@ -174,12 +205,12 @@ gst_tag_setter_reset_tags (GstTagSetter * setter)
data = gst_tag_setter_get_data (setter);
g_static_mutex_lock (&data->lock);
GST_TAG_DATA_LOCK (data);
if (data->list) {
gst_tag_list_free (data->list);
data->list = NULL;
}
g_static_mutex_unlock (&data->lock);
GST_TAG_DATA_UNLOCK (data);
}
/**
@ -202,14 +233,14 @@ gst_tag_setter_merge_tags (GstTagSetter * setter, const GstTagList * list,
data = gst_tag_setter_get_data (setter);
g_static_mutex_lock (&data->lock);
GST_TAG_DATA_LOCK (data);
if (data->list == NULL) {
if (mode != GST_TAG_MERGE_KEEP_ALL)
data->list = gst_tag_list_copy (list);
} else {
gst_tag_list_insert (data->list, list, mode);
}
g_static_mutex_unlock (&data->lock);
GST_TAG_DATA_UNLOCK (data);
}
/**
@ -281,13 +312,13 @@ gst_tag_setter_add_tag_valist (GstTagSetter * setter, GstTagMergeMode mode,
data = gst_tag_setter_get_data (setter);
g_static_mutex_lock (&data->lock);
GST_TAG_DATA_LOCK (data);
if (!data->list)
data->list = gst_tag_list_new_empty ();
gst_tag_list_add_valist (data->list, mode, tag, var_args);
g_static_mutex_unlock (&data->lock);
GST_TAG_DATA_UNLOCK (data);
}
/**
@ -311,14 +342,14 @@ gst_tag_setter_add_tag_valist_values (GstTagSetter * setter,
data = gst_tag_setter_get_data (setter);
g_static_mutex_lock (&data->lock);
GST_TAG_DATA_LOCK (data);
if (!data->list)
data->list = gst_tag_list_new_empty ();
gst_tag_list_add_valist_values (data->list, mode, tag, var_args);
g_static_mutex_unlock (&data->lock);
GST_TAG_DATA_UNLOCK (data);
}
/**
@ -343,14 +374,14 @@ gst_tag_setter_add_tag_value (GstTagSetter * setter,
data = gst_tag_setter_get_data (setter);
g_static_mutex_lock (&data->lock);
GST_TAG_DATA_LOCK (data);
if (!data->list)
data->list = gst_tag_list_new_empty ();
gst_tag_list_add_value (data->list, mode, tag, value);
g_static_mutex_unlock (&data->lock);
GST_TAG_DATA_UNLOCK (data);
}
/**
@ -392,9 +423,9 @@ gst_tag_setter_set_tag_merge_mode (GstTagSetter * setter, GstTagMergeMode mode)
data = gst_tag_setter_get_data (setter);
g_static_mutex_lock (&data->lock);
GST_TAG_DATA_LOCK (data);
data->mode = mode;
g_static_mutex_unlock (&data->lock);
GST_TAG_DATA_UNLOCK (data);
}
/**
@ -416,9 +447,9 @@ gst_tag_setter_get_tag_merge_mode (GstTagSetter * setter)
data = gst_tag_setter_get_data (setter);
g_static_mutex_lock (&data->lock);
GST_TAG_DATA_LOCK (data);
mode = data->mode;
g_static_mutex_unlock (&data->lock);
GST_TAG_DATA_UNLOCK (data);
return mode;
}

View file

@ -68,10 +68,14 @@
* Last reviewed on 2010-03-15 (0.10.29)
*/
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gst_private.h"
#include "gstinfo.h"
#include "gsttask.h"
#include "glib-compat-private.h"
#include <stdio.h>
@ -276,8 +280,13 @@ gst_task_func (GstTask * task)
goto no_lock;
task->thread = tself;
/* only update the priority when it was changed */
if (priv->prio_set)
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);
/* fire the enter_thread callback when we need to */
@ -328,7 +337,9 @@ exit:
} 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
@ -470,7 +481,11 @@ 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);
}

View file

@ -27,6 +27,9 @@
*
*/
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gst_private.h"
#include <stdio.h>
#include <string.h>

View file

@ -201,6 +201,9 @@
#include <stdlib.h>
#include <string.h>
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <gst/base/gstadapter.h>
#include "gstbaseparse.h"
@ -284,7 +287,11 @@ 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;
@ -333,6 +340,18 @@ 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;
static void gst_base_parse_class_init (GstBaseParseClass * klass);
@ -477,8 +496,11 @@ 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);
@ -557,7 +579,11 @@ 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);
@ -1569,11 +1595,11 @@ gst_base_parse_add_index_entry (GstBaseParse * parse, guint64 offset,
associations[1].value = offset;
/* index might change on-the-fly, although that would be nutty app ... */
g_static_mutex_lock (&parse->priv->index_lock);
GST_BASE_PARSE_INDEX_LOCK (parse);
gst_index_add_associationv (parse->priv->index, parse->priv->index_id,
(key) ? GST_ASSOCIATION_FLAG_KEY_UNIT : GST_ASSOCIATION_FLAG_DELTA_UNIT,
2, (const GstIndexAssociation *) &associations);
g_static_mutex_unlock (&parse->priv->index_lock);
GST_BASE_PARSE_INDEX_UNLOCK (parse);
if (key) {
parse->priv->index_last_offset = offset;
@ -3676,7 +3702,7 @@ gst_base_parse_find_offset (GstBaseParse * parse, GstClockTime time,
goto exit;
}
g_static_mutex_lock (&parse->priv->index_lock);
GST_BASE_PARSE_INDEX_LOCK (parse);
if (parse->priv->index) {
/* Let's check if we have an index entry for that time */
entry = gst_index_get_assoc_entry (parse->priv->index,
@ -3700,7 +3726,7 @@ gst_base_parse_find_offset (GstBaseParse * parse, GstClockTime time,
ts = GST_CLOCK_TIME_NONE;
}
}
g_static_mutex_unlock (&parse->priv->index_lock);
GST_BASE_PARSE_INDEX_UNLOCK (parse);
exit:
if (_ts)
@ -3993,7 +4019,7 @@ gst_base_parse_set_index (GstElement * element, GstIndex * index)
{
GstBaseParse *parse = GST_BASE_PARSE (element);
g_static_mutex_lock (&parse->priv->index_lock);
GST_BASE_PARSE_INDEX_LOCK (parse);
if (parse->priv->index)
gst_object_unref (parse->priv->index);
if (index) {
@ -4004,7 +4030,7 @@ gst_base_parse_set_index (GstElement * element, GstIndex * index)
} else {
parse->priv->index = NULL;
}
g_static_mutex_unlock (&parse->priv->index_lock);
GST_BASE_PARSE_INDEX_UNLOCK (parse);
}
static GstIndex *
@ -4013,10 +4039,10 @@ gst_base_parse_get_index (GstElement * element)
GstBaseParse *parse = GST_BASE_PARSE (element);
GstIndex *result = NULL;
g_static_mutex_lock (&parse->priv->index_lock);
GST_BASE_PARSE_INDEX_LOCK (parse);
if (parse->priv->index)
result = gst_object_ref (parse->priv->index);
g_static_mutex_unlock (&parse->priv->index_lock);
GST_BASE_PARSE_INDEX_UNLOCK (parse);
return result;
}
@ -4033,7 +4059,7 @@ gst_base_parse_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_READY_TO_PAUSED:
/* If this is our own index destroy it as the
* old entries might be wrong for the new stream */
g_static_mutex_lock (&parse->priv->index_lock);
GST_BASE_PARSE_INDEX_LOCK (parse);
if (parse->priv->own_index) {
gst_object_unref (parse->priv->index);
parse->priv->index = NULL;
@ -4049,7 +4075,7 @@ gst_base_parse_change_state (GstElement * element, GstStateChange transition)
&parse->priv->index_id);
parse->priv->own_index = TRUE;
}
g_static_mutex_unlock (&parse->priv->index_lock);
GST_BASE_PARSE_INDEX_UNLOCK (parse);
break;
default:
break;

View file

@ -142,6 +142,9 @@
# include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <gst/gst_private.h>
#include "gstbasesink.h"

View file

@ -159,7 +159,11 @@
#include <stdlib.h>
#include <string.h>
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <gst/gst_private.h>
#include <gst/glib-compat-private.h>
#include "gstbasesrc.h"
#include "gsttypefindhelper.h"

View file

@ -205,8 +205,12 @@
#include <stdlib.h>
#include <string.h>
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "../../../gst/gst_private.h"
#include "../../../gst/gst-i18n-lib.h"
#include "../../../gst/glib-compat-private.h"
#include "gstbasetransform.h"
#include <gst/gstmarshal.h>

View file

@ -73,6 +73,7 @@
*/
#include "gstcollectpads.h"
#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_STATIC (collect_pads_debug);
#define GST_CAT_DEFAULT collect_pads_debug

View file

@ -82,8 +82,19 @@
* Since: 0.10.36
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <gst/gst_private.h>
#include "gstcollectpads2.h"
#include "../../../gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_STATIC (collect_pads2_debug);
#define GST_CAT_DEFAULT collect_pads2_debug

View file

@ -278,6 +278,79 @@ MAIN_INIT(); \
MAIN_START_THREAD_FUNCTIONS(count, function, data); \
MAIN_SYNCHRONIZE();
#if GLIB_CHECK_VERSION (2, 31, 0)
#define g_thread_create gst_g_thread_create
static inline GThread *
gst_g_thread_create (GThreadFunc func, gpointer data, gboolean joinable,
GError **error)
{
g_assert (joinable);
return g_thread_try_new ("gst-check", func, data, error);
}
#define g_mutex_new gst_g_mutex_new
static inline GMutex *
gst_g_mutex_new (void)
{
GMutex *mutex = g_slice_new (GMutex);
g_mutex_init (mutex);
return mutex;
}
#define g_mutex_free gst_g_mutex_free
static inline void
gst_g_mutex_free (GMutex *mutex)
{
g_mutex_clear (mutex);
g_slice_free (GMutex, mutex);
}
#define g_static_rec_mutex_init gst_g_static_rec_mutex_init
static inline void
gst_g_static_rec_mutex_init (GStaticRecMutex *mutex)
{
static const GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT;
*mutex = init_mutex;
}
#define g_cond_new gst_g_cond_new
static inline GCond *
gst_g_cond_new (void)
{
GCond *cond = g_slice_new (GCond);
g_cond_init (cond);
return cond;
}
#define g_cond_free gst_g_cond_free
static inline void
gst_g_cond_free (GCond *cond)
{
g_cond_clear (cond);
g_slice_free (GCond, cond);
}
#define g_cond_timed_wait gst_g_cond_timed_wait
static inline gboolean
gst_g_cond_timed_wait (GCond *cond, GMutex *mutex, GTimeVal *abs_time)
{
gint64 end_time;
if (abs_time == NULL) {
g_cond_wait (cond, mutex);
return TRUE;
}
end_time = abs_time->tv_sec;
end_time *= 1000000;
end_time += abs_time->tv_usec;
/* would be nice if we had clock_rtoffset, but that didn't seem to
* make it into the kernel yet...
*/
/* if CLOCK_MONOTONIC is not defined then g_get_montonic_time() and
* g_get_real_time() are returning the same clock and we'd add ~0
*/
end_time += g_get_monotonic_time () - g_get_real_time ();
return g_cond_wait_until (cond, mutex, end_time);
}
#endif
#define MAIN_INIT() \
G_STMT_START { \
_gst_check_threads_running = TRUE; \

View file

@ -42,6 +42,7 @@
#include "gstinterpolationcontrolsource.h"
#include "gstinterpolationcontrolsourceprivate.h"
#include "gst/glib-compat-private.h"
#define GST_CAT_DEFAULT controller_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);

View file

@ -43,6 +43,8 @@
#include "gstlfocontrolsource.h"
#include "gstlfocontrolsourceprivate.h"
#include "gst/glib-compat-private.h"
#include <gst/math-compat.h>
#define GST_CAT_DEFAULT controller_debug

View file

@ -41,8 +41,10 @@ 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 *));

View file

@ -416,7 +416,7 @@ gst_net_client_clock_start (GstNetClientClock * self)
struct sockaddr_in servaddr, myaddr;
socklen_t len;
gint ret;
GError *error;
GError *error = NULL;
g_return_val_if_fail (self->address != NULL, FALSE);
g_return_val_if_fail (self->servaddr == NULL, FALSE);
@ -450,9 +450,15 @@ gst_net_client_clock_start (GstNetClientClock * self)
gst_poll_add_fd (self->priv->fdset, &self->priv->sock);
gst_poll_fd_ctl_read (self->priv->fdset, &self->priv->sock, TRUE);
#if !GLIB_CHECK_VERSION (2, 31, 0)
self->thread = g_thread_create (gst_net_client_clock_thread, self, TRUE,
&error);
if (!self->thread)
#else
self->thread = g_thread_try_new ("GstNetClientClock",
gst_net_client_clock_thread, self, &error);
#endif
if (error != NULL)
goto no_thread;
return TRUE;

View file

@ -349,7 +349,7 @@ gst_net_time_provider_start (GstNetTimeProvider * self)
socklen_t len;
int port;
gint ret;
GError *error;
GError *error = NULL;
if ((ret = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
goto no_socket;
@ -397,9 +397,15 @@ gst_net_time_provider_start (GstNetTimeProvider * self)
gst_poll_add_fd (self->priv->fdset, &self->priv->sock);
gst_poll_fd_ctl_read (self->priv->fdset, &self->priv->sock, TRUE);
#if !GLIB_CHECK_VERSION (2, 31, 0)
self->thread = g_thread_create (gst_net_time_provider_thread, self, TRUE,
&error);
if (!self->thread)
#else
self->thread = g_thread_try_new ("GstNetTimeProvider",
gst_net_time_provider_thread, self, &error);
#endif
if (error != NULL)
goto no_thread;
return TRUE;

View file

@ -33,6 +33,7 @@
#include <gst/gst.h>
#include "string.h"
#include "gstdataqueue.h"
#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_STATIC (data_queue_debug);
#define GST_CAT_DEFAULT (data_queue_debug)

View file

@ -111,6 +111,8 @@ static GstFlowReturn gst_identity_prepare_output_buffer (GstBaseTransform *
trans, GstBuffer * in_buf, GstBuffer ** out_buf);
static gboolean gst_identity_start (GstBaseTransform * trans);
static gboolean gst_identity_stop (GstBaseTransform * trans);
static GstStateChangeReturn gst_identity_change_state (GstElement * element,
GstStateChange transition);
static guint gst_identity_signals[LAST_SIGNAL] = { 0 };
@ -267,6 +269,8 @@ gst_identity_class_init (GstIdentityClass * klass)
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sinktemplate));
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_identity_change_state);
gstbasetrans_class->sink_event = GST_DEBUG_FUNCPTR (gst_identity_sink_event);
gstbasetrans_class->transform_ip =
GST_DEBUG_FUNCPTR (gst_identity_transform_ip);
@ -372,11 +376,22 @@ gst_identity_sink_event (GstBaseTransform * trans, GstEvent * event)
identity->prev_offset = identity->prev_offset_end = GST_BUFFER_OFFSET_NONE;
}
if (identity->single_segment && (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT)) {
if (identity->single_segment && GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) {
/* eat up segments */
gst_event_unref (event);
ret = TRUE;
} else {
if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_START) {
GST_OBJECT_LOCK (identity);
if (identity->clock_id) {
GST_DEBUG_OBJECT (identity, "unlock clock wait");
gst_clock_id_unschedule (identity->clock_id);
gst_clock_id_unref (identity->clock_id);
identity->clock_id = NULL;
}
GST_OBJECT_UNLOCK (identity);
}
ret = GST_BASE_TRANSFORM_CLASS (parent_class)->sink_event (trans, event);
}
@ -646,7 +661,6 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
timestamp = runtimestamp + GST_ELEMENT (identity)->base_time;
/* save id if we need to unlock */
/* FIXME: actually unlock this somewhere in the state changes */
identity->clock_id = gst_clock_new_single_shot_id (clock, timestamp);
GST_OBJECT_UNLOCK (identity);
@ -836,3 +850,46 @@ gst_identity_stop (GstBaseTransform * trans)
return TRUE;
}
static GstStateChangeReturn
gst_identity_change_state (GstElement * element, GstStateChange transition)
{
GstStateChangeReturn ret;
GstIdentity *identity = GST_IDENTITY (element);
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
GST_OBJECT_LOCK (identity);
if (identity->clock_id) {
GST_DEBUG_OBJECT (identity, "unlock clock wait");
gst_clock_id_unschedule (identity->clock_id);
gst_clock_id_unref (identity->clock_id);
identity->clock_id = NULL;
}
GST_OBJECT_UNLOCK (identity);
break;
default:
break;
}
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (transition) {
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
break;
case GST_STATE_CHANGE_READY_TO_NULL:
break;
default:
break;
}
return ret;
}

View file

@ -59,6 +59,8 @@
#include "gstinputselector.h"
#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_STATIC (input_selector_debug);
#define GST_CAT_DEFAULT input_selector_debug

View file

@ -109,6 +109,10 @@
# include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <gst/gst.h>
#include <stdio.h>
#include "gstmultiqueue.h"

View file

@ -61,6 +61,7 @@
#include "gstqueue.h"
#include "../../gst/gst-i18n-lib.h"
#include "../../gst/glib-compat-private.h"
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,

View file

@ -63,6 +63,7 @@
#include <glib/gstdio.h>
#include "gst/gst-i18n-lib.h"
#include "gst/glib-compat-private.h"
#include <string.h>

View file

@ -48,6 +48,7 @@
#endif
#include "gsttee.h"
#include "gst/glib-compat-private.h"
#include <string.h>

View file

@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <gst/gst.h>
#include "gst/glib-compat-private.h"
#define MAX_THREADS 1000
@ -95,7 +96,12 @@ 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);

View file

@ -65,7 +65,12 @@ 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);

View file

@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <gst/gst.h>
#include "gst/glib-compat-private.h"
static GstPoll *set;
static GList *fds = NULL;
@ -159,7 +160,12 @@ 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);

View file

@ -1520,7 +1520,9 @@ 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");

View file

@ -865,7 +865,9 @@ 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");

View file

@ -153,7 +153,9 @@ 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");