From 37409d4d6595db5f7f00e88240bd12c76ff7950f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sun, 22 Jan 2012 23:31:19 +0000 Subject: [PATCH] Don't use deprecated GLib API --- gst-libs/gst/glib-compat-private.h | 69 ------------------------------ gst/audiofx/audiochebband.c | 29 ++++++------- gst/audiofx/audiochebband.h | 2 +- gst/audiofx/audiocheblimit.c | 25 ++++++----- gst/audiofx/audiocheblimit.h | 2 +- gst/audiofx/audiofirfilter.c | 13 +++--- gst/audiofx/audiofirfilter.h | 2 +- gst/audiofx/audioiirfilter.c | 13 +++--- gst/audiofx/audioiirfilter.h | 2 +- gst/audiofx/audiowsincband.c | 25 ++++++----- gst/audiofx/audiowsincband.h | 2 +- gst/audiofx/audiowsinclimit.c | 21 +++++---- gst/audiofx/audiowsinclimit.h | 2 +- gst/videocrop/gstaspectratiocrop.c | 13 +++--- gst/videocrop/gstaspectratiocrop.h | 2 +- 15 files changed, 73 insertions(+), 149 deletions(-) diff --git a/gst-libs/gst/glib-compat-private.h b/gst-libs/gst/glib-compat-private.h index 91fe1ff7f4..9a92993d46 100644 --- a/gst-libs/gst/glib-compat-private.h +++ b/gst-libs/gst/glib-compat-private.h @@ -27,77 +27,8 @@ G_BEGIN_DECLS -#if GLIB_CHECK_VERSION(2,26,0) -#define GLIB_HAS_GDATETIME -#endif - /* copies */ -#if 0 //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 diff --git a/gst/audiofx/audiochebband.c b/gst/audiofx/audiochebband.c index c37cdbb370..b6c01ebd0f 100644 --- a/gst/audiofx/audiochebband.c +++ b/gst/audiofx/audiochebband.c @@ -204,7 +204,7 @@ gst_audio_cheb_band_init (GstAudioChebBand * filter) filter->poles = 4; filter->ripple = 0.25; - filter->lock = g_mutex_new (); + g_mutex_init (&filter->lock); } static void @@ -557,8 +557,7 @@ gst_audio_cheb_band_finalize (GObject * object) { GstAudioChebBand *filter = GST_AUDIO_CHEB_BAND (object); - g_mutex_free (filter->lock); - filter->lock = NULL; + g_mutex_clear (&filter->lock); G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -571,40 +570,40 @@ gst_audio_cheb_band_set_property (GObject * object, guint prop_id, switch (prop_id) { case PROP_MODE: - g_mutex_lock (filter->lock); + g_mutex_lock (&filter->lock); filter->mode = g_value_get_enum (value); generate_coefficients (filter); - g_mutex_unlock (filter->lock); + g_mutex_unlock (&filter->lock); break; case PROP_TYPE: - g_mutex_lock (filter->lock); + g_mutex_lock (&filter->lock); filter->type = g_value_get_int (value); generate_coefficients (filter); - g_mutex_unlock (filter->lock); + g_mutex_unlock (&filter->lock); break; case PROP_LOWER_FREQUENCY: - g_mutex_lock (filter->lock); + g_mutex_lock (&filter->lock); filter->lower_frequency = g_value_get_float (value); generate_coefficients (filter); - g_mutex_unlock (filter->lock); + g_mutex_unlock (&filter->lock); break; case PROP_UPPER_FREQUENCY: - g_mutex_lock (filter->lock); + g_mutex_lock (&filter->lock); filter->upper_frequency = g_value_get_float (value); generate_coefficients (filter); - g_mutex_unlock (filter->lock); + g_mutex_unlock (&filter->lock); break; case PROP_RIPPLE: - g_mutex_lock (filter->lock); + g_mutex_lock (&filter->lock); filter->ripple = g_value_get_float (value); generate_coefficients (filter); - g_mutex_unlock (filter->lock); + g_mutex_unlock (&filter->lock); break; case PROP_POLES: - g_mutex_lock (filter->lock); + g_mutex_lock (&filter->lock); filter->poles = GST_ROUND_UP_4 (g_value_get_int (value)); generate_coefficients (filter); - g_mutex_unlock (filter->lock); + g_mutex_unlock (&filter->lock); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/gst/audiofx/audiochebband.h b/gst/audiofx/audiochebband.h index 32610325db..6af31486bc 100644 --- a/gst/audiofx/audiochebband.h +++ b/gst/audiofx/audiochebband.h @@ -50,7 +50,7 @@ struct _GstAudioChebBand gfloat ripple; /* < private > */ - GMutex *lock; + GMutex lock; }; struct _GstAudioChebBandClass diff --git a/gst/audiofx/audiocheblimit.c b/gst/audiofx/audiocheblimit.c index 894152fe90..e1fcdfa76d 100644 --- a/gst/audiofx/audiocheblimit.c +++ b/gst/audiofx/audiocheblimit.c @@ -196,7 +196,7 @@ gst_audio_cheb_limit_init (GstAudioChebLimit * filter) filter->poles = 4; filter->ripple = 0.25; - filter->lock = g_mutex_new (); + g_mutex_init (&filter->lock); } static void @@ -477,8 +477,7 @@ gst_audio_cheb_limit_finalize (GObject * object) { GstAudioChebLimit *filter = GST_AUDIO_CHEB_LIMIT (object); - g_mutex_free (filter->lock); - filter->lock = NULL; + g_mutex_clear (&filter->lock); G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -491,34 +490,34 @@ gst_audio_cheb_limit_set_property (GObject * object, guint prop_id, switch (prop_id) { case PROP_MODE: - g_mutex_lock (filter->lock); + g_mutex_lock (&filter->lock); filter->mode = g_value_get_enum (value); generate_coefficients (filter); - g_mutex_unlock (filter->lock); + g_mutex_unlock (&filter->lock); break; case PROP_TYPE: - g_mutex_lock (filter->lock); + g_mutex_lock (&filter->lock); filter->type = g_value_get_int (value); generate_coefficients (filter); - g_mutex_unlock (filter->lock); + g_mutex_unlock (&filter->lock); break; case PROP_CUTOFF: - g_mutex_lock (filter->lock); + g_mutex_lock (&filter->lock); filter->cutoff = g_value_get_float (value); generate_coefficients (filter); - g_mutex_unlock (filter->lock); + g_mutex_unlock (&filter->lock); break; case PROP_RIPPLE: - g_mutex_lock (filter->lock); + g_mutex_lock (&filter->lock); filter->ripple = g_value_get_float (value); generate_coefficients (filter); - g_mutex_unlock (filter->lock); + g_mutex_unlock (&filter->lock); break; case PROP_POLES: - g_mutex_lock (filter->lock); + g_mutex_lock (&filter->lock); filter->poles = GST_ROUND_UP_2 (g_value_get_int (value)); generate_coefficients (filter); - g_mutex_unlock (filter->lock); + g_mutex_unlock (&filter->lock); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/gst/audiofx/audiocheblimit.h b/gst/audiofx/audiocheblimit.h index 6f798528a2..a9f42ba399 100644 --- a/gst/audiofx/audiocheblimit.h +++ b/gst/audiofx/audiocheblimit.h @@ -51,7 +51,7 @@ struct _GstAudioChebLimit gfloat ripple; /* < private > */ - GMutex *lock; + GMutex lock; }; struct _GstAudioChebLimitClass diff --git a/gst/audiofx/audiofirfilter.c b/gst/audiofx/audiofirfilter.c index 9fa21111b5..100df0ce09 100644 --- a/gst/audiofx/audiofirfilter.c +++ b/gst/audiofx/audiofirfilter.c @@ -177,7 +177,7 @@ gst_audio_fir_filter_init (GstAudioFIRFilter * self) g_value_unset (&v); gst_audio_fir_filter_update_kernel (self, va); - self->lock = g_mutex_new (); + g_mutex_init (&self->lock); } /* GstAudioFilter vmethod implementations */ @@ -202,8 +202,7 @@ gst_audio_fir_filter_finalize (GObject * object) { GstAudioFIRFilter *self = GST_AUDIO_FIR_FILTER (object); - g_mutex_free (self->lock); - self->lock = NULL; + g_mutex_clear (&self->lock); if (self->kernel) g_value_array_free (self->kernel); @@ -222,16 +221,16 @@ gst_audio_fir_filter_set_property (GObject * object, guint prop_id, switch (prop_id) { case PROP_KERNEL: - g_mutex_lock (self->lock); + g_mutex_lock (&self->lock); /* update kernel already pushes residues */ gst_audio_fir_filter_update_kernel (self, g_value_dup_boxed (value)); - g_mutex_unlock (self->lock); + g_mutex_unlock (&self->lock); break; case PROP_LATENCY: - g_mutex_lock (self->lock); + g_mutex_lock (&self->lock); self->latency = g_value_get_uint64 (value); gst_audio_fir_filter_update_kernel (self, NULL); - g_mutex_unlock (self->lock); + g_mutex_unlock (&self->lock); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/gst/audiofx/audiofirfilter.h b/gst/audiofx/audiofirfilter.h index 8b2488512d..6ade86f2eb 100644 --- a/gst/audiofx/audiofirfilter.h +++ b/gst/audiofx/audiofirfilter.h @@ -55,7 +55,7 @@ struct _GstAudioFIRFilter { guint64 latency; /* < private > */ - GMutex *lock; + GMutex lock; }; struct _GstAudioFIRFilterClass { diff --git a/gst/audiofx/audioiirfilter.c b/gst/audiofx/audioiirfilter.c index 09d02829f9..5907a161df 100644 --- a/gst/audiofx/audioiirfilter.c +++ b/gst/audiofx/audioiirfilter.c @@ -194,7 +194,7 @@ gst_audio_iir_filter_init (GstAudioIIRFilter * self) b = NULL; gst_audio_iir_filter_update_coefficients (self, a, b); - self->lock = g_mutex_new (); + g_mutex_init (&self->lock); } /* GstAudioFilter vmethod implementations */ @@ -219,8 +219,7 @@ gst_audio_iir_filter_finalize (GObject * object) { GstAudioIIRFilter *self = GST_AUDIO_IIR_FILTER (object); - g_mutex_free (self->lock); - self->lock = NULL; + g_mutex_clear (&self->lock); if (self->a) g_value_array_free (self->a); @@ -242,16 +241,16 @@ gst_audio_iir_filter_set_property (GObject * object, guint prop_id, switch (prop_id) { case PROP_A: - g_mutex_lock (self->lock); + g_mutex_lock (&self->lock); gst_audio_iir_filter_update_coefficients (self, g_value_dup_boxed (value), NULL); - g_mutex_unlock (self->lock); + g_mutex_unlock (&self->lock); break; case PROP_B: - g_mutex_lock (self->lock); + g_mutex_lock (&self->lock); gst_audio_iir_filter_update_coefficients (self, NULL, g_value_dup_boxed (value)); - g_mutex_unlock (self->lock); + g_mutex_unlock (&self->lock); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/gst/audiofx/audioiirfilter.h b/gst/audiofx/audioiirfilter.h index 2a80c09bbc..1cf72f4c64 100644 --- a/gst/audiofx/audioiirfilter.h +++ b/gst/audiofx/audioiirfilter.h @@ -54,7 +54,7 @@ struct _GstAudioIIRFilter { GValueArray *a, *b; /* < private > */ - GMutex *lock; + GMutex lock; }; struct _GstAudioIIRFilterClass { diff --git a/gst/audiofx/audiowsincband.c b/gst/audiofx/audiowsincband.c index cd50b0655c..682e00a537 100644 --- a/gst/audiofx/audiowsincband.c +++ b/gst/audiofx/audiowsincband.c @@ -216,7 +216,7 @@ gst_audio_wsincband_init (GstAudioWSincBand * self) self->mode = MODE_BAND_PASS; self->window = WINDOW_HAMMING; - self->lock = g_mutex_new (); + g_mutex_init (&self->lock); } static void @@ -386,8 +386,7 @@ gst_audio_wsincband_finalize (GObject * object) { GstAudioWSincBand *self = GST_AUDIO_WSINC_BAND (object); - g_mutex_free (self->lock); - self->lock = NULL; + g_mutex_clear (&self->lock); G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -404,7 +403,7 @@ gst_audio_wsincband_set_property (GObject * object, guint prop_id, case PROP_LENGTH:{ gint val; - g_mutex_lock (self->lock); + g_mutex_lock (&self->lock); val = g_value_get_int (value); if (val % 2 == 0) val++; @@ -415,32 +414,32 @@ gst_audio_wsincband_set_property (GObject * object, guint prop_id, self->kernel_length = val; gst_audio_wsincband_build_kernel (self); } - g_mutex_unlock (self->lock); + g_mutex_unlock (&self->lock); break; } case PROP_LOWER_FREQUENCY: - g_mutex_lock (self->lock); + g_mutex_lock (&self->lock); self->lower_frequency = g_value_get_float (value); gst_audio_wsincband_build_kernel (self); - g_mutex_unlock (self->lock); + g_mutex_unlock (&self->lock); break; case PROP_UPPER_FREQUENCY: - g_mutex_lock (self->lock); + g_mutex_lock (&self->lock); self->upper_frequency = g_value_get_float (value); gst_audio_wsincband_build_kernel (self); - g_mutex_unlock (self->lock); + g_mutex_unlock (&self->lock); break; case PROP_MODE: - g_mutex_lock (self->lock); + g_mutex_lock (&self->lock); self->mode = g_value_get_enum (value); gst_audio_wsincband_build_kernel (self); - g_mutex_unlock (self->lock); + g_mutex_unlock (&self->lock); break; case PROP_WINDOW: - g_mutex_lock (self->lock); + g_mutex_lock (&self->lock); self->window = g_value_get_enum (value); gst_audio_wsincband_build_kernel (self); - g_mutex_unlock (self->lock); + g_mutex_unlock (&self->lock); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/gst/audiofx/audiowsincband.h b/gst/audiofx/audiowsincband.h index 2ade91c544..8933fe9eb8 100644 --- a/gst/audiofx/audiowsincband.h +++ b/gst/audiofx/audiowsincband.h @@ -66,7 +66,7 @@ struct _GstAudioWSincBand { gint kernel_length; /* length of the filter kernel */ /* < private > */ - GMutex *lock; + GMutex lock; }; struct _GstAudioWSincBandClass { diff --git a/gst/audiofx/audiowsinclimit.c b/gst/audiofx/audiowsinclimit.c index 7a9f5713be..f46f5d3cc0 100644 --- a/gst/audiofx/audiowsinclimit.c +++ b/gst/audiofx/audiowsinclimit.c @@ -211,7 +211,7 @@ gst_audio_wsinclimit_init (GstAudioWSincLimit * self) self->kernel_length = 101; self->cutoff = 0.0; - self->lock = g_mutex_new (); + g_mutex_init (&self->lock); } static void @@ -321,8 +321,7 @@ gst_audio_wsinclimit_finalize (GObject * object) { GstAudioWSincLimit *self = GST_AUDIO_WSINC_LIMIT (object); - g_mutex_free (self->lock); - self->lock = NULL; + g_mutex_clear (&self->lock); G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -339,7 +338,7 @@ gst_audio_wsinclimit_set_property (GObject * object, guint prop_id, case PROP_LENGTH:{ gint val; - g_mutex_lock (self->lock); + g_mutex_lock (&self->lock); val = g_value_get_int (value); if (val % 2 == 0) val++; @@ -350,26 +349,26 @@ gst_audio_wsinclimit_set_property (GObject * object, guint prop_id, self->kernel_length = val; gst_audio_wsinclimit_build_kernel (self); } - g_mutex_unlock (self->lock); + g_mutex_unlock (&self->lock); break; } case PROP_FREQUENCY: - g_mutex_lock (self->lock); + g_mutex_lock (&self->lock); self->cutoff = g_value_get_float (value); gst_audio_wsinclimit_build_kernel (self); - g_mutex_unlock (self->lock); + g_mutex_unlock (&self->lock); break; case PROP_MODE: - g_mutex_lock (self->lock); + g_mutex_lock (&self->lock); self->mode = g_value_get_enum (value); gst_audio_wsinclimit_build_kernel (self); - g_mutex_unlock (self->lock); + g_mutex_unlock (&self->lock); break; case PROP_WINDOW: - g_mutex_lock (self->lock); + g_mutex_lock (&self->lock); self->window = g_value_get_enum (value); gst_audio_wsinclimit_build_kernel (self); - g_mutex_unlock (self->lock); + g_mutex_unlock (&self->lock); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/gst/audiofx/audiowsinclimit.h b/gst/audiofx/audiowsinclimit.h index 1a67169e60..3afdf13a3f 100644 --- a/gst/audiofx/audiowsinclimit.h +++ b/gst/audiofx/audiowsinclimit.h @@ -66,7 +66,7 @@ struct _GstAudioWSincLimit { gint kernel_length; /* < private > */ - GMutex *lock; + GMutex lock; }; struct _GstAudioWSincLimitClass { diff --git a/gst/videocrop/gstaspectratiocrop.c b/gst/videocrop/gstaspectratiocrop.c index 1be97fa796..be0f451157 100644 --- a/gst/videocrop/gstaspectratiocrop.c +++ b/gst/videocrop/gstaspectratiocrop.c @@ -133,7 +133,7 @@ gst_aspect_ratio_crop_set_caps (GstAspectRatioCrop * aspect_ratio_crop, GstStructure *structure; gboolean ret; - g_mutex_lock (aspect_ratio_crop->crop_lock); + g_mutex_lock (&aspect_ratio_crop->crop_lock); structure = gst_caps_get_structure (caps, 0); gst_aspect_ratio_transform_structure (aspect_ratio_crop, structure, NULL, @@ -143,7 +143,7 @@ gst_aspect_ratio_crop_set_caps (GstAspectRatioCrop * aspect_ratio_crop, "sink"); ret = gst_pad_set_caps (peer_pad, caps); gst_object_unref (peer_pad); - g_mutex_unlock (aspect_ratio_crop->crop_lock); + g_mutex_unlock (&aspect_ratio_crop->crop_lock); return ret; } @@ -212,8 +212,7 @@ gst_aspect_ratio_crop_finalize (GObject * object) aspect_ratio_crop = GST_ASPECT_RATIO_CROP (object); - if (aspect_ratio_crop->crop_lock) - g_mutex_free (aspect_ratio_crop->crop_lock); + g_mutex_clear (&aspect_ratio_crop->crop_lock); G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -230,7 +229,7 @@ gst_aspect_ratio_crop_init (GstAspectRatioCrop * aspect_ratio_crop) aspect_ratio_crop->ar_num = 0; aspect_ratio_crop->ar_denom = 1; - aspect_ratio_crop->crop_lock = g_mutex_new (); + g_mutex_init (&aspect_ratio_crop->crop_lock); /* add the transform element */ aspect_ratio_crop->videocrop = gst_element_factory_make ("videocrop", NULL); @@ -393,7 +392,7 @@ gst_aspect_ratio_crop_get_caps (GstPad * pad, GstCaps * filter) aspect_ratio_crop = GST_ASPECT_RATIO_CROP (gst_pad_get_parent (pad)); - g_mutex_lock (aspect_ratio_crop->crop_lock); + g_mutex_lock (&aspect_ratio_crop->crop_lock); peer = gst_pad_get_peer (aspect_ratio_crop->sink); if (peer == NULL) { @@ -409,7 +408,7 @@ gst_aspect_ratio_crop_get_caps (GstPad * pad, GstCaps * filter) gst_object_unref (peer); } - g_mutex_unlock (aspect_ratio_crop->crop_lock); + g_mutex_unlock (&aspect_ratio_crop->crop_lock); gst_object_unref (aspect_ratio_crop); if (return_caps && filter) { diff --git a/gst/videocrop/gstaspectratiocrop.h b/gst/videocrop/gstaspectratiocrop.h index d089f17fc3..e6ceae6ca8 100644 --- a/gst/videocrop/gstaspectratiocrop.h +++ b/gst/videocrop/gstaspectratiocrop.h @@ -52,7 +52,7 @@ struct _GstAspectRatioCrop gint ar_num; /* if < 1 then don't change ar */ gint ar_denom; - GMutex *crop_lock; + GMutex crop_lock; }; struct _GstAspectRatioCropClass