use ff_thread_once
Suggested-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
... | ... |
@@ -19,6 +19,7 @@ |
19 | 19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20 | 20 |
*/ |
21 | 21 |
|
22 |
+#include "libavutil/thread.h" |
|
22 | 23 |
#include "avfilter.h" |
23 | 24 |
#include "config.h" |
24 | 25 |
#include "opencl_allkernels.h" |
... | ... |
@@ -37,14 +38,8 @@ |
37 | 37 |
avfilter_register(&ff_##x); \ |
38 | 38 |
} |
39 | 39 |
|
40 |
-void avfilter_register_all(void) |
|
40 |
+static void register_all(void) |
|
41 | 41 |
{ |
42 |
- static int initialized; |
|
43 |
- |
|
44 |
- if (initialized) |
|
45 |
- return; |
|
46 |
- initialized = 1; |
|
47 |
- |
|
48 | 42 |
REGISTER_FILTER(ABENCH, abench, af); |
49 | 43 |
REGISTER_FILTER(ACOMPRESSOR, acompressor, af); |
50 | 44 |
REGISTER_FILTER(ACROSSFADE, acrossfade, af); |
... | ... |
@@ -380,3 +375,10 @@ void avfilter_register_all(void) |
380 | 380 |
REGISTER_FILTER_UNCONDITIONAL(vf_fifo); |
381 | 381 |
ff_opencl_register_filter_kernel_code_all(); |
382 | 382 |
} |
383 |
+ |
|
384 |
+void avfilter_register_all(void) |
|
385 |
+{ |
|
386 |
+ AVOnce control = AV_ONCE_INIT; |
|
387 |
+ |
|
388 |
+ ff_thread_once(&control, register_all); |
|
389 |
+} |