Don't use deprecated GLib API
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Sun, 22 Jan 2012 23:31:19 +0000 (23:31 +0000)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Sun, 22 Jan 2012 23:32:51 +0000 (23:32 +0000)
15 files changed:
gst-libs/gst/glib-compat-private.h
gst/audiofx/audiochebband.c
gst/audiofx/audiochebband.h
gst/audiofx/audiocheblimit.c
gst/audiofx/audiocheblimit.h
gst/audiofx/audiofirfilter.c
gst/audiofx/audiofirfilter.h
gst/audiofx/audioiirfilter.c
gst/audiofx/audioiirfilter.h
gst/audiofx/audiowsincband.c
gst/audiofx/audiowsincband.h
gst/audiofx/audiowsinclimit.c
gst/audiofx/audiowsinclimit.h
gst/videocrop/gstaspectratiocrop.c
gst/videocrop/gstaspectratiocrop.h

index 91fe1ff..9a92993 100644 (file)
 
 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
index c37cdbb..b6c01eb 100644 (file)
@@ -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);
index 3261032..6af3148 100644 (file)
@@ -50,7 +50,7 @@ struct _GstAudioChebBand
   gfloat ripple;
 
   /* < private > */
-  GMutex *lock;
+  GMutex lock;
 };
 
 struct _GstAudioChebBandClass
index 894152f..e1fcdfa 100644 (file)
@@ -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);
index 6f79852..a9f42ba 100644 (file)
@@ -51,7 +51,7 @@ struct _GstAudioChebLimit
   gfloat ripple;
 
   /* < private > */
-  GMutex *lock;
+  GMutex lock;
 };
 
 struct _GstAudioChebLimitClass
index 9fa2111..100df0c 100644 (file)
@@ -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);
index 8b24885..6ade86f 100644 (file)
@@ -55,7 +55,7 @@ struct _GstAudioFIRFilter {
   guint64 latency;
 
   /* < private > */
-  GMutex *lock;
+  GMutex lock;
 };
 
 struct _GstAudioFIRFilterClass {
index 09d0282..5907a16 100644 (file)
@@ -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);
index 2a80c09..1cf72f4 100644 (file)
@@ -54,7 +54,7 @@ struct _GstAudioIIRFilter {
   GValueArray *a, *b;
 
   /* < private > */
-  GMutex *lock;
+  GMutex lock;
 };
 
 struct _GstAudioIIRFilterClass {
index cd50b06..682e00a 100644 (file)
@@ -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);
index 2ade91c..8933fe9 100644 (file)
@@ -66,7 +66,7 @@ struct _GstAudioWSincBand {
   gint kernel_length;           /* length of the filter kernel */
 
   /* < private > */
-  GMutex *lock;
+  GMutex lock;
 };
 
 struct _GstAudioWSincBandClass {
index 7a9f571..f46f5d3 100644 (file)
@@ -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);
index 1a67169..3afdf13 100644 (file)
@@ -66,7 +66,7 @@ struct _GstAudioWSincLimit {
   gint kernel_length;
 
   /* < private > */
-  GMutex *lock;
+  GMutex lock;
 };
 
 struct _GstAudioWSincLimitClass {
index 1be97fa..be0f451 100644 (file)
@@ -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) {
index d089f17..e6ceae6 100644 (file)
@@ -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