* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libavutil/atomic.h"
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "libavutil/opt.h"
+#include "libavutil/thread.h"
#include "avio_internal.h"
#include "avformat.h"
* @file
* Format register and lookup
*/
-/** head of registered input format linked list */
-static AVInputFormat *first_iformat = NULL;
-/** head of registered output format linked list */
-static AVOutputFormat *first_oformat = NULL;
-
-static AVInputFormat **last_iformat = &first_iformat;
-static AVOutputFormat **last_oformat = &first_oformat;
-
-AVInputFormat *av_iformat_next(const AVInputFormat *f)
-{
- if (f)
- return f->next;
- else
- return first_iformat;
-}
-
-AVOutputFormat *av_oformat_next(const AVOutputFormat *f)
-{
- if (f)
- return f->next;
- else
- return first_oformat;
-}
-
-void av_register_input_format(AVInputFormat *format)
-{
- AVInputFormat **p = last_iformat;
-
- // Note, format could be added after the first 2 checks but that implies that *p is no longer NULL
- while(p != &format->next && !format->next && avpriv_atomic_ptr_cas((void * volatile *)p, NULL, format))
- p = &(*p)->next;
-
- if (!format->next)
- last_iformat = &format->next;
-}
-
-void av_register_output_format(AVOutputFormat *format)
-{
- AVOutputFormat **p = last_oformat;
-
- // Note, format could be added after the first 2 checks but that implies that *p is no longer NULL
- while(p != &format->next && !format->next && avpriv_atomic_ptr_cas((void * volatile *)p, NULL, format))
- p = &(*p)->next;
-
- if (!format->next)
- last_oformat = &format->next;
-}
int av_match_ext(const char *filename, const char *extensions)
{
const char *mime_type)
{
AVOutputFormat *fmt = NULL, *fmt_found;
+#if !FF_API_NEXT
+ void *i = 0;
+#endif
int score_max, score;
/* specific test for image sequences */
/* Find the proper file type. */
fmt_found = NULL;
score_max = 0;
- while ((fmt = av_oformat_next(fmt))) {
+#if FF_API_NEXT
+FF_DISABLE_DEPRECATION_WARNINGS
+ while ((fmt = av_oformat_next(fmt)))
+#else
+ while ((fmt = av_muxer_iterate(&i)))
+#endif
+ {
score = 0;
if (fmt->name && short_name && av_match_name(short_name, fmt->name))
score += 100;
fmt_found = fmt;
}
}
+#if FF_API_NEXT
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
return fmt_found;
}
AVInputFormat *av_find_input_format(const char *short_name)
{
AVInputFormat *fmt = NULL;
+#if FF_API_NEXT
+FF_DISABLE_DEPRECATION_WARNINGS
while ((fmt = av_iformat_next(fmt)))
if (av_match_name(short_name, fmt->name))
return fmt;
+FF_ENABLE_DEPRECATION_WARNINGS
+#else
+ void *i = 0;
+ while ((fmt = av_demuxer_iterate(&i)))
+ if (av_match_name(short_name, fmt->name))
+ return fmt;
+#endif
return NULL;
}
AVProbeData lpd = *pd;
AVInputFormat *fmt1 = NULL, *fmt;
int score, score_max = 0;
+ void *i = 0;
const static uint8_t zerobuffer[AVPROBE_PADDING_SIZE];
enum nodat {
NO_ID3,
}
fmt = NULL;
- while ((fmt1 = av_iformat_next(fmt1))) {
+ while ((fmt1 = av_demuxer_iterate(&i))) {
if (!is_opened == !(fmt1->flags & AVFMT_NOFILE) && strcmp(fmt1->name, "image2"))
continue;
score = 0;