mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-19 09:02:26 +02:00
avfilter/allfilters: make avfilter_register_all thread safe
use ff_thread_once Suggested-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
This commit is contained in:
parent
49635f0a46
commit
af7010ad05
@ -19,6 +19,7 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "libavutil/thread.h"
|
||||||
#include "avfilter.h"
|
#include "avfilter.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "opencl_allkernels.h"
|
#include "opencl_allkernels.h"
|
||||||
@ -37,14 +38,8 @@
|
|||||||
avfilter_register(&ff_##x); \
|
avfilter_register(&ff_##x); \
|
||||||
}
|
}
|
||||||
|
|
||||||
void avfilter_register_all(void)
|
static void register_all(void)
|
||||||
{
|
{
|
||||||
static int initialized;
|
|
||||||
|
|
||||||
if (initialized)
|
|
||||||
return;
|
|
||||||
initialized = 1;
|
|
||||||
|
|
||||||
REGISTER_FILTER(ABENCH, abench, af);
|
REGISTER_FILTER(ABENCH, abench, af);
|
||||||
REGISTER_FILTER(ACOMPRESSOR, acompressor, af);
|
REGISTER_FILTER(ACOMPRESSOR, acompressor, af);
|
||||||
REGISTER_FILTER(ACROSSFADE, acrossfade, af);
|
REGISTER_FILTER(ACROSSFADE, acrossfade, af);
|
||||||
@ -380,3 +375,10 @@ void avfilter_register_all(void)
|
|||||||
REGISTER_FILTER_UNCONDITIONAL(vf_fifo);
|
REGISTER_FILTER_UNCONDITIONAL(vf_fifo);
|
||||||
ff_opencl_register_filter_kernel_code_all();
|
ff_opencl_register_filter_kernel_code_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void avfilter_register_all(void)
|
||||||
|
{
|
||||||
|
AVOnce control = AV_ONCE_INIT;
|
||||||
|
|
||||||
|
ff_thread_once(&control, register_all);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user