if (pipe (ret->pfd) == -1)
goto error;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_static_rec_mutex_init (&ret->rec_mutex);
-#else
g_rec_mutex_init (&ret->rec_mutex);
-#endif
g_static_rec_mutex_init (&ret->task_mutex);
ret->task = gst_task_new (task_monitor_alsa, ret);
snd_mixer_close (mixer->handle);
mixer->handle = NULL;
}
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_static_rec_mutex_free (&mixer->rec_mutex);
-#else
g_rec_mutex_clear (&mixer->rec_mutex);
-#endif
g_free (mixer);
}
GstTask * task;
GStaticRecMutex task_mutex;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- GStaticRecMutex rec_mutex;
-#else
GRecMutex rec_mutex;
-#endif
int pfd[2];
GstAlsaMixerDirection dir;
};
-#if !GLIB_CHECK_VERSION (2, 31, 0)
-#define GST_ALSA_MIXER_LOCK(mixer) g_static_rec_mutex_lock (&mixer->rec_mutex)
-#define GST_ALSA_MIXER_UNLOCK(mixer) g_static_rec_mutex_unlock (&mixer->rec_mutex)
-#else
#define GST_ALSA_MIXER_LOCK(mixer) g_rec_mutex_lock (&mixer->rec_mutex)
#define GST_ALSA_MIXER_UNLOCK(mixer) g_rec_mutex_unlock (&mixer->rec_mutex)
-#endif
GstAlsaMixer* gst_alsa_mixer_new (const gchar *device,
GstAlsaMixerDirection dir);
GST_DEBUG_OBJECT (sink, "starting thread");
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- sink->thread =
- g_thread_create ((GThreadFunc) audioringbuffer_thread_func, buf, TRUE,
- &error);
-#else
sink->thread = g_thread_try_new ("audiosink-ringbuffer",
(GThreadFunc) audioringbuffer_thread_func, buf, &error);
-#endif
if (!sink->thread || error != NULL)
goto thread_failed;
abuf->running = TRUE;
/* FIXME: handle thread creation failure */
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- src->thread =
- g_thread_create ((GThreadFunc) audioringbuffer_thread_func, buf, TRUE,
- NULL);
-#else
src->thread = g_thread_try_new ("audiosrc-ringbuffer",
(GThreadFunc) audioringbuffer_thread_func, buf, NULL);
-#endif
GST_AUDIO_RING_BUFFER_WAIT (buf);
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)
+/* FIXME: can use unconditionally now */
#define GLIB_HAS_GDATETIME
-#endif
-/* See bug #651514 */
-#if GLIB_CHECK_VERSION(2,29,5)
+/* FIXME: can use the new functions unconditionally now */
#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 */
-#if GLIB_CHECK_VERSION (2, 31, 0)
+/* FIXME: use new GLib API */
#define g_mutex_new gst_g_mutex_new
static inline GMutex *
gst_g_mutex_new (void)
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 */
#endif
#ifdef ENABLE_NLS
-
-#if !GLIB_CHECK_VERSION(2,28,0)
-static GVariant *
-gst_g_variant_lookup_value (GVariant * dictionary, const gchar * key,
- const GVariantType * expected_type)
-{
- GVariantIter iter;
- GVariant *entry;
- GVariant *value;
-
- GST_ERROR ("here, using fallback");
-
- g_assert (g_variant_is_of_type (dictionary, G_VARIANT_TYPE ("a{s*}")));
- g_assert (expected_type != NULL);
-
- g_variant_iter_init (&iter, dictionary);
- while ((entry = g_variant_iter_next_value (&iter))) {
- GVariant *entry_key;
- gboolean matches;
-
- entry_key = g_variant_get_child_value (entry, 0);
- matches = strcmp (g_variant_get_string (entry_key, NULL), key) == 0;
- g_variant_unref (entry_key);
-
- if (matches)
- break;
-
- g_variant_unref (entry);
- }
-
- if (entry == NULL)
- return NULL;
-
- value = g_variant_get_child_value (entry, 1);
- g_variant_unref (entry);
-
- if (g_variant_is_of_type (value, G_VARIANT_TYPE_VARIANT)) {
- GVariant *tmp;
-
- tmp = g_variant_get_variant (value);
- g_variant_unref (value);
-
- if (expected_type && !g_variant_is_of_type (tmp, expected_type)) {
- g_variant_unref (tmp);
- tmp = NULL;
- }
-
- value = tmp;
- }
-
- g_assert (value == NULL || g_variant_is_of_type (value, expected_type));
-
- return value;
-}
-
-#define g_variant_lookup_value gst_g_variant_lookup_value
-#endif /* !GLIB_CHECK_VERSION(2,28,0) */
-
static gboolean
gst_variant_lookup_string_value (GVariant * dict, const gchar * lang,
const gchar ** translation)
typedef struct
{
GSList *schemas;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- GStaticMutex lock;
-#else
GMutex lock;
-#endif
} GstTagXmpWriterData;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
-#define GST_TAG_XMP_WRITER_DATA_LOCK(data) g_static_mutex_lock(&data->lock)
-#define GST_TAG_XMP_WRITER_DATA_UNLOCK(data) g_static_mutex_unlock(&data->lock)
-#else
#define GST_TAG_XMP_WRITER_DATA_LOCK(data) g_mutex_lock(&data->lock)
#define GST_TAG_XMP_WRITER_DATA_UNLOCK(data) g_mutex_unlock(&data->lock)
-#endif
GType
gst_tag_xmp_writer_get_type (void)
}
g_slist_free (data->schemas);
}
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_static_mutex_free (&data->lock);
-#else
g_mutex_clear (&data->lock);
-#endif
g_slice_free (GstTagXmpWriterData, data);
}
data = g_object_get_qdata (G_OBJECT (xmpconfig), tag_xmp_writer_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 (xmpconfig), tag_xmp_writer_key);
if (!data) {
data = g_slice_new (GstTagXmpWriterData);
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_static_mutex_init (&data->lock);
-#else
g_mutex_init (&data->lock);
-#endif
data->schemas = NULL;
gst_tag_xmp_writer_data_add_all_schemas_unlocked (data);
g_object_set_qdata_full (G_OBJECT (xmpconfig), tag_xmp_writer_key, data,
gst_tag_xmp_writer_data_free);
}
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_static_mutex_unlock (&create_mutex);
-#else
g_mutex_unlock (&create_mutex);
-#endif
}
return data;
/* FIXME: we may also need a (private) way to cache converted/scaled
* pixel blobs */
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- GStaticMutex lock;
-#else
GMutex lock;
-#endif
GList *scaled_rectangles;
};
GstMiniObjectClass parent_class;
};
-#if !GLIB_CHECK_VERSION (2, 31, 0)
-#define GST_RECTANGLE_LOCK(rect) g_static_mutex_lock(&rect->lock)
-#define GST_RECTANGLE_UNLOCK(rect) g_static_mutex_unlock(&rect->lock)
-#else
#define GST_RECTANGLE_LOCK(rect) g_mutex_lock(&rect->lock)
#define GST_RECTANGLE_UNLOCK(rect) g_mutex_unlock(&rect->lock)
-#endif
static void gst_video_overlay_composition_class_init (GstMiniObjectClass * k);
static void gst_video_overlay_composition_finalize (GstMiniObject * comp);
{
static gint seqnum; /* 0 */
-#if GLIB_CHECK_VERSION(2,29,5)
return (guint) g_atomic_int_add (&seqnum, 1);
-#else
- return (guint) g_atomic_int_exchange_and_add (&seqnum, 1);
-#endif
}
#define GST_OVERLAY_COMPOSITION_QUARK gst_overlay_composition_quark_get()
rect->scaled_rectangles =
g_list_delete_link (rect->scaled_rectangles, rect->scaled_rectangles);
}
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_static_mutex_free (&rect->lock);
-#else
g_mutex_clear (&rect->lock);
-#endif
+
/* not chaining up to GstMiniObject's finalize for now, we know it's empty */
}
{
GstVideoOverlayRectangle *rect = (GstVideoOverlayRectangle *) mini_obj;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_static_mutex_init (&rect->lock);
-#else
g_mutex_init (&rect->lock);
-#endif
}
static inline gboolean
*/
/* Element-Checklist-Version: 5 */
+/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
+ * with newer GLib versions (>= 2.31.0) */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
adder = GST_ADDER (element);
/* increment pad counter */
-#if GLIB_CHECK_VERSION(2,29,5)
padcount = g_atomic_int_add (&adder->padcount, 1);
-#else
- padcount = g_atomic_int_exchange_and_add (&adder->padcount, 1);
-#endif
name = g_strdup_printf ("sink_%u", padcount);
newpad = gst_pad_new_from_template (templ, name);
static void
gst_audio_rate_notify_drop (GstAudioRate * audiorate)
{
-#if !GLIB_CHECK_VERSION(2,26,0)
- g_object_notify ((GObject *) audiorate, "drop");
-#else
g_object_notify_by_pspec ((GObject *) audiorate, pspec_drop);
-#endif
}
static void
gst_audio_rate_notify_add (GstAudioRate * audiorate)
{
-#if !GLIB_CHECK_VERSION(2,26,0)
- g_object_notify ((GObject *) audiorate, "add");
-#else
g_object_notify_by_pspec ((GObject *) audiorate, pspec_add);
-#endif
}
static GstFlowReturn
this->running = TRUE;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- this->thread = g_thread_create ((GThreadFunc) gst_multi_socket_sink_thread,
- this, TRUE, NULL);
-#else
this->thread = g_thread_new ("multisocketsink",
(GThreadFunc) gst_multi_socket_sink_thread, this);
-#endif
GST_OBJECT_FLAG_SET (this, GST_MULTI_SOCKET_SINK_OPEN);
static void
gst_video_rate_notify_drop (GstVideoRate * videorate)
{
-#if !GLIB_CHECK_VERSION(2,26,0)
- g_object_notify ((GObject *) videorate, "drop");
-#else
g_object_notify_by_pspec ((GObject *) videorate, pspec_drop);
-#endif
}
static void
gst_video_rate_notify_duplicate (GstVideoRate * videorate)
{
-#if !GLIB_CHECK_VERSION(2,26,0)
- g_object_notify ((GObject *) videorate, "duplicate");
-#else
g_object_notify_by_pspec ((GObject *) videorate, pspec_duplicate);
-#endif
}
#define MAGIC_LIMIT 25
GST_DEBUG_OBJECT (ximagesink, "run xevent thread, expose %d, events %d",
ximagesink->handle_expose, ximagesink->handle_events);
ximagesink->running = TRUE;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- ximagesink->event_thread = g_thread_create (
- (GThreadFunc) gst_ximagesink_event_thread, ximagesink, TRUE, NULL);
-#else
ximagesink->event_thread = g_thread_try_new ("ximagesink-events",
(GThreadFunc) gst_ximagesink_event_thread, ximagesink, NULL);
-#endif
}
} else {
if (ximagesink->event_thread) {
GST_DEBUG_OBJECT (xvimagesink, "run xevent thread, expose %d, events %d",
xvimagesink->handle_expose, xvimagesink->handle_events);
xvimagesink->running = TRUE;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- xvimagesink->event_thread = g_thread_create (
- (GThreadFunc) gst_xvimagesink_event_thread, xvimagesink, TRUE, NULL);
-#else
xvimagesink->event_thread = g_thread_try_new ("xvimagesink-events",
(GThreadFunc) gst_xvimagesink_event_thread, xvimagesink, NULL);
-#endif
}
} else {
if (xvimagesink->event_thread) {
GstEncodingProfile *prof;
gchar *inputuri;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- if (!g_thread_supported ())
- g_thread_init (NULL);
-#endif
-
ctx = g_option_context_new ("- encode URIs with GstProfile and encodebin");
g_option_context_add_main_entries (ctx, options, NULL);
g_option_context_add_group (ctx, gst_init_get_option_group ());
gulong embed_xid;
GstStateChangeReturn sret;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- if (!g_thread_supported ())
- g_thread_init (NULL);
-#endif
-
gst_init (&argc, &argv);
gtk_init (&argc, &argv);
int main(int argc, char *argv[])
{
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- if (!g_thread_supported ())
- g_thread_init (NULL);
-#endif
-
gst_init (&argc, &argv);
QApplication app(argc, argv);
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit ()));
GOptionContext *ctx;
GError *err = NULL;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- if (!g_thread_supported ())
- g_thread_init (NULL);
-#endif
-
ctx = g_option_context_new ("- test seeking in gsteamer");
g_option_context_add_main_entries (ctx, options, NULL);
g_option_context_add_group (ctx, gst_init_get_option_group ());
GOptionContext *ctx;
GError *err = NULL;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- if (!g_thread_supported ())
- g_thread_init (NULL);
-#endif
-
ctx = g_option_context_new ("seek");
g_option_context_add_main_entries (ctx, options, NULL);
g_option_context_add_group (ctx, gst_init_get_option_group ());
GOptionContext *ctx;
GError *err = NULL;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- if (!g_thread_supported ())
- g_thread_init (NULL);
-#endif
-
ctx = g_option_context_new ("- test seeking in gsteamer");
g_option_context_add_main_entries (ctx, options, NULL);
g_option_context_add_group (ctx, gst_init_get_option_group ());
};
GTimer *timer;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- if (!g_thread_supported ())
- g_thread_init (NULL);
-#endif
-
ctx = g_option_context_new ("FILES OR DIRECTORIES WITH AUDIO FILES");
g_option_context_add_main_entries (ctx, options, NULL);
g_option_context_add_group (ctx, gst_init_get_option_group ());
GValueArray *arr;
#endif
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- if (!g_thread_supported ())
- g_thread_init (NULL);
-#endif
-
gst_init (&argc, &argv);
gtk_init (&argc, &argv);
gulong embed_xid = 0;
gboolean force_aspect = FALSE, draw_borders = FALSE;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- if (!g_thread_supported ())
- g_thread_init (NULL);
-#endif
-
gst_init (&argc, &argv);
gtk_init (&argc, &argv);
};
GOptionContext *ctx;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- if (!g_thread_supported ())
- g_thread_init (NULL);
-#endif
-
ctx =
g_option_context_new
("- discover files synchronously with GstDiscoverer");