This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 4ce1a456f2061c305209819928f081d016c676a3
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Fri Aug 21 12:46:39 2026 +0200
Commit:     Kacper Michajłow <[email protected]>
CommitDate: Mon Sep 14 04:35:12 2026 +0200

    avformat/allformats, avutil/log: Use proper atomic types
    
    Up until now, these files use atomic_uintptr_t instead
    of the proper atomic types because _Atomic has not been supported
    by our stdatomics.h fallback. This is ugly and in case of log.c
    also entailed storing a function pointer in uintptr_t, although
    uintptr_t is only guaranteed to be capable of storing object pointers.
    
    The recent changes to the fallbacks allow using _Atomic unconditionally,
    so avoid atomic_uintptr_t.
    
    Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavformat/allformats.c | 22 ++++++++++------------
 libavutil/log.c          |  6 +++---
 2 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index e121c7441c..162eaa42b9 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -591,21 +591,20 @@ extern const FFInputFormat  ff_vapoursynth_demuxer;
 #include "libavformat/muxer_list.c"
 #include "libavformat/demuxer_list.c"
 
-static atomic_uintptr_t indev_list_intptr  = 0;
-static atomic_uintptr_t outdev_list_intptr = 0;
+static const FFInputFormat  * const *_Atomic indev_list  = NULL;
+static const FFOutputFormat * const *_Atomic outdev_list = NULL;
 
 const AVOutputFormat *av_muxer_iterate(void **opaque)
 {
     static const uintptr_t size = sizeof(muxer_list)/sizeof(muxer_list[0]) - 1;
     uintptr_t i = (uintptr_t)*opaque;
+    const FFOutputFormat *const *outdevs;
     const FFOutputFormat *f = NULL;
-    uintptr_t tmp;
 
     if (i < size) {
         f = muxer_list[i];
-    } else if (tmp = atomic_load_explicit(&outdev_list_intptr, 
memory_order_relaxed)) {
-        const FFOutputFormat *const *outdev_list = (const FFOutputFormat 
*const *)tmp;
-        f = outdev_list[i - size];
+    } else if (outdevs = atomic_load_explicit(&outdev_list, 
memory_order_relaxed)) {
+        f = outdevs[i - size];
     }
 
     if (f) {
@@ -619,14 +618,13 @@ const AVInputFormat *av_demuxer_iterate(void **opaque)
 {
     static const uintptr_t size = sizeof(demuxer_list)/sizeof(demuxer_list[0]) 
- 1;
     uintptr_t i = (uintptr_t)*opaque;
+    const FFInputFormat *const *indevs;
     const FFInputFormat *f = NULL;
-    uintptr_t tmp;
 
     if (i < size) {
         f = demuxer_list[i];
-    } else if (tmp = atomic_load_explicit(&indev_list_intptr, 
memory_order_relaxed)) {
-        const FFInputFormat *const *indev_list = (const FFInputFormat *const 
*)tmp;
-        f = indev_list[i - size];
+    } else if (indevs = atomic_load_explicit(&indev_list, 
memory_order_relaxed)) {
+        f = indevs[i - size];
     }
 
     if (f) {
@@ -638,6 +636,6 @@ const AVInputFormat *av_demuxer_iterate(void **opaque)
 
 void avpriv_register_devices(const FFOutputFormat * const o[], const 
FFInputFormat * const i[])
 {
-    atomic_store_explicit(&outdev_list_intptr, (uintptr_t)o, 
memory_order_relaxed);
-    atomic_store_explicit(&indev_list_intptr,  (uintptr_t)i, 
memory_order_relaxed);
+    atomic_store_explicit(&outdev_list, o, memory_order_relaxed);
+    atomic_store_explicit(&indev_list,  i, memory_order_relaxed);
 }
diff --git a/libavutil/log.c b/libavutil/log.c
index 11193eb238..966522b013 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -437,7 +437,7 @@ end:
     ff_mutex_unlock(&mutex);
 }
 
-static atomic_uintptr_t av_log_callback = (uintptr_t)av_log_default_callback;
+static void (*_Atomic av_log_callback)(void*, int, const char*, va_list) = 
av_log_default_callback;
 
 void av_log(void* avcl, int level, const char *fmt, ...)
 {
@@ -460,7 +460,7 @@ void av_vlog(void* avcl, int level, const char *fmt, 
va_list vl)
 {
     AVClass* avc = avcl ? *(AVClass **) avcl : NULL;
     void (*log_callback)(void*, int, const char*, va_list) =
-        (void *)atomic_load_explicit(&av_log_callback, memory_order_relaxed);
+        atomic_load_explicit(&av_log_callback, memory_order_relaxed);
     if (avc && avc->version >= (50 << 16 | 15 << 8 | 2) &&
         avc->log_level_offset_offset && level >= AV_LOG_FATAL)
         level += *(int *) (((uint8_t *) avcl) + avc->log_level_offset_offset);
@@ -490,7 +490,7 @@ int av_log_get_flags(void)
 
 void av_log_set_callback(void (*callback)(void*, int, const char*, va_list))
 {
-    atomic_store_explicit(&av_log_callback, (uintptr_t)callback, 
memory_order_relaxed);
+    atomic_store_explicit(&av_log_callback, callback, memory_order_relaxed);
 }
 
 static void missing_feature_sample(int sample, void *avc, const char *msg,

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to