Commit 49635f0a authored by Muhammad Faiz's avatar Muhammad Faiz

avfilter/allformats: make av_register_all thread safe

use ff_thread_once
Suggested-by: 's avatarwm4 <nfxjfg@googlemail.com>
Signed-off-by: 's avatarMuhammad Faiz <mfcc64@gmail.com>
parent e85e8408
...@@ -19,6 +19,7 @@ ...@@ -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 "avformat.h" #include "avformat.h"
#include "rtp.h" #include "rtp.h"
#include "rdt.h" #include "rdt.h"
...@@ -41,13 +42,8 @@ ...@@ -41,13 +42,8 @@
#define REGISTER_MUXDEMUX(X, x) REGISTER_MUXER(X, x); REGISTER_DEMUXER(X, x) #define REGISTER_MUXDEMUX(X, x) REGISTER_MUXER(X, x); REGISTER_DEMUXER(X, x)
void av_register_all(void) static void register_all(void)
{ {
static int initialized;
if (initialized)
return;
avcodec_register_all(); avcodec_register_all();
/* (de)muxers */ /* (de)muxers */
...@@ -383,6 +379,11 @@ void av_register_all(void) ...@@ -383,6 +379,11 @@ void av_register_all(void)
REGISTER_DEMUXER (LIBMODPLUG, libmodplug); REGISTER_DEMUXER (LIBMODPLUG, libmodplug);
REGISTER_MUXDEMUX(LIBNUT, libnut); REGISTER_MUXDEMUX(LIBNUT, libnut);
REGISTER_DEMUXER (LIBOPENMPT, libopenmpt); REGISTER_DEMUXER (LIBOPENMPT, libopenmpt);
}
void av_register_all(void)
{
AVOnce control = AV_ONCE_INIT;
initialized = 1; ff_thread_once(&control, register_all);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment