[vlc-commits] scaletempo: use <stdatomic.h> directly

Rémi Denis-Courmont git at videolan.org
Wed Feb 26 20:25:52 CET 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Feb 26 21:21:05 2020 +0200| [f824651ebb156edd58cdcc7efcae327984e5dd26] | committer: Rémi Denis-Courmont

scaletempo: use <stdatomic.h> directly

instead of <vlc_atomic.h>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f824651ebb156edd58cdcc7efcae327984e5dd26
---

 modules/audio_filter/scaletempo.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/modules/audio_filter/scaletempo.c b/modules/audio_filter/scaletempo.c
index 41c62eca34..c67e01a50f 100644
--- a/modules/audio_filter/scaletempo.c
+++ b/modules/audio_filter/scaletempo.c
@@ -30,10 +30,10 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_aout.h>
-#include <vlc_atomic.h>
 #include <vlc_filter.h>
 #include <vlc_modules.h>
 
+#include <stdatomic.h>
 #include <string.h> /* for memset */
 #include <limits.h> /* form INT_MIN */
 
@@ -132,7 +132,7 @@ typedef struct
 #ifdef PITCH_SHIFTER
     /* pitch */
     filter_t * resampler;
-    vlc_atomic_float rate_shift;
+    _Atomic float rate_shift;
 #endif
 } filter_sys_t;
 
@@ -452,8 +452,8 @@ static int Open( vlc_object_t *p_this )
 #ifdef PITCH_SHIFTER
 static inline void PitchSetRateShift( filter_sys_t *p_sys, float pitch_shift )
 {
-    vlc_atomic_store_float( &p_sys->rate_shift,
-                            p_sys->sample_rate / powf(2, pitch_shift / 12) );
+    atomic_store( &p_sys->rate_shift,
+                  p_sys->sample_rate / powf(2, pitch_shift / 12) );
 }
 
 static int PitchCallback( vlc_object_t *p_this, char const *psz_var,
@@ -478,8 +478,7 @@ static filter_t *ResamplerCreate(filter_t *p_filter)
     p_resampler->p_cfg = NULL;
     p_resampler->fmt_in = p_filter->fmt_in;
     p_resampler->fmt_out = p_filter->fmt_in;
-    p_resampler->fmt_out.audio.i_rate =
-        vlc_atomic_load_float( &p_sys->rate_shift );
+    p_resampler->fmt_out.audio.i_rate = atomic_load( &p_sys->rate_shift );
     aout_FormatPrepare( &p_resampler->fmt_out.audio );
     p_resampler->p_module = module_need( p_resampler, "audio resampler", NULL,
                                          false );
@@ -603,7 +602,7 @@ static block_t *DoPitchWork( filter_t * p_filter, block_t * p_in_buf )
 {
     filter_sys_t *p = p_filter->p_sys;
 
-    float rate_shift = vlc_atomic_load_float( &p->rate_shift );
+    float rate_shift = atomic_load( &p->rate_shift );
 
     /* Set matching rates for resampler's output and scaletempo's input */
     p->resampler->fmt_out.audio.i_rate = rate_shift;



More information about the vlc-commits mailing list