mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avformat: make av_register_*put_format() thread safe
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
b36b5edb8f
commit
53fd1ab26b
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "avformat.h"
|
#include "avformat.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
#include "libavutil/atomic.h"
|
||||||
#include "libavutil/avstring.h"
|
#include "libavutil/avstring.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,22 +53,18 @@ void av_register_input_format(AVInputFormat *format)
|
|||||||
{
|
{
|
||||||
AVInputFormat **p = &first_iformat;
|
AVInputFormat **p = &first_iformat;
|
||||||
|
|
||||||
while (*p != NULL)
|
|
||||||
p = &(*p)->next;
|
|
||||||
|
|
||||||
*p = format;
|
|
||||||
format->next = NULL;
|
format->next = NULL;
|
||||||
|
while(avpriv_atomic_ptr_cas((void * volatile *)p, NULL, format))
|
||||||
|
p = &(*p)->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
void av_register_output_format(AVOutputFormat *format)
|
void av_register_output_format(AVOutputFormat *format)
|
||||||
{
|
{
|
||||||
AVOutputFormat **p = &first_oformat;
|
AVOutputFormat **p = &first_oformat;
|
||||||
|
|
||||||
while (*p != NULL)
|
|
||||||
p = &(*p)->next;
|
|
||||||
|
|
||||||
*p = format;
|
|
||||||
format->next = NULL;
|
format->next = NULL;
|
||||||
|
while(avpriv_atomic_ptr_cas((void * volatile *)p, NULL, format))
|
||||||
|
p = &(*p)->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
int av_match_ext(const char *filename, const char *extensions)
|
int av_match_ext(const char *filename, const char *extensions)
|
||||||
|
Loading…
Reference in New Issue
Block a user