summaryrefslogtreecommitdiffstats
path: root/media/ffvpx/libavcodec/parser.c
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2018-09-30 10:40:30 -0500
committertrav90 <travawine@palemoon.org>2018-09-30 10:40:30 -0500
commitedc124b92beccd55e5277062e95efb62a8b3ec7b (patch)
tree3486b32f85152ff76b1bee03a8d84b3c34c70a5f /media/ffvpx/libavcodec/parser.c
parent8ba6dd1bd12a3d13f9e2c683216dd8778011a72e (diff)
downloadUXP-edc124b92beccd55e5277062e95efb62a8b3ec7b.tar
UXP-edc124b92beccd55e5277062e95efb62a8b3ec7b.tar.gz
UXP-edc124b92beccd55e5277062e95efb62a8b3ec7b.tar.lz
UXP-edc124b92beccd55e5277062e95efb62a8b3ec7b.tar.xz
UXP-edc124b92beccd55e5277062e95efb62a8b3ec7b.zip
[ffvpx] Update ffvp9/ffvp8 to release 4.0.2
Diffstat (limited to 'media/ffvpx/libavcodec/parser.c')
-rw-r--r--media/ffvpx/libavcodec/parser.c86
1 files changed, 77 insertions, 9 deletions
diff --git a/media/ffvpx/libavcodec/parser.c b/media/ffvpx/libavcodec/parser.c
index 670680ea7..f43b197d5 100644
--- a/media/ffvpx/libavcodec/parser.c
+++ b/media/ffvpx/libavcodec/parser.c
@@ -25,40 +25,108 @@
#include <string.h>
#include "libavutil/avassert.h"
-#include "libavutil/atomic.h"
#include "libavutil/internal.h"
#include "libavutil/mem.h"
+#include "libavutil/thread.h"
#include "internal.h"
#include "parser.h"
-static AVCodecParser *av_first_parser = NULL;
+/* Parsers */
+extern AVCodecParser ff_aac_parser;
+extern AVCodecParser ff_aac_latm_parser;
+extern AVCodecParser ff_ac3_parser;
+extern AVCodecParser ff_adx_parser;
+extern AVCodecParser ff_bmp_parser;
+extern AVCodecParser ff_cavsvideo_parser;
+extern AVCodecParser ff_cook_parser;
+extern AVCodecParser ff_dca_parser;
+extern AVCodecParser ff_dirac_parser;
+extern AVCodecParser ff_dnxhd_parser;
+extern AVCodecParser ff_dpx_parser;
+extern AVCodecParser ff_dvaudio_parser;
+extern AVCodecParser ff_dvbsub_parser;
+extern AVCodecParser ff_dvdsub_parser;
+extern AVCodecParser ff_dvd_nav_parser;
+extern AVCodecParser ff_flac_parser;
+extern AVCodecParser ff_g729_parser;
+extern AVCodecParser ff_gsm_parser;
+extern AVCodecParser ff_h261_parser;
+extern AVCodecParser ff_h263_parser;
+extern AVCodecParser ff_h264_parser;
+extern AVCodecParser ff_hevc_parser;
+extern AVCodecParser ff_mjpeg_parser;
+extern AVCodecParser ff_mlp_parser;
+extern AVCodecParser ff_mpeg4video_parser;
+extern AVCodecParser ff_mpegaudio_parser;
+extern AVCodecParser ff_mpegvideo_parser;
+extern AVCodecParser ff_opus_parser;
+extern AVCodecParser ff_png_parser;
+extern AVCodecParser ff_pnm_parser;
+extern AVCodecParser ff_rv30_parser;
+extern AVCodecParser ff_rv40_parser;
+extern AVCodecParser ff_sbc_parser;
+extern AVCodecParser ff_sipr_parser;
+extern AVCodecParser ff_tak_parser;
+extern AVCodecParser ff_vc1_parser;
+extern AVCodecParser ff_vorbis_parser;
+extern AVCodecParser ff_vp3_parser;
+extern AVCodecParser ff_vp8_parser;
+extern AVCodecParser ff_vp9_parser;
+extern AVCodecParser ff_xma_parser;
+
+#include "libavcodec/parser_list.c"
+
+static AVOnce av_parser_next_init = AV_ONCE_INIT;
+
+static void av_parser_init_next(void)
+{
+ AVCodecParser *prev = NULL, *p;
+ int i = 0;
+ while ((p = (AVCodecParser*)parser_list[i++])) {
+ if (prev)
+ prev->next = p;
+ prev = p;
+ }
+}
AVCodecParser *av_parser_next(const AVCodecParser *p)
{
+ ff_thread_once(&av_parser_next_init, av_parser_init_next);
+
if (p)
return p->next;
else
- return av_first_parser;
+ return (AVCodecParser*)parser_list[0];
+}
+
+const AVCodecParser *av_parser_iterate(void **opaque)
+{
+ uintptr_t i = (uintptr_t)*opaque;
+ const AVCodecParser *p = parser_list[i];
+
+ if (p)
+ *opaque = (void*)(i + 1);
+
+ return p;
}
void av_register_codec_parser(AVCodecParser *parser)
{
- do {
- parser->next = av_first_parser;
- } while (parser->next != avpriv_atomic_ptr_cas((void * volatile *)&av_first_parser, parser->next, parser));
+ ff_thread_once(&av_parser_next_init, av_parser_init_next);
}
AVCodecParserContext *av_parser_init(int codec_id)
{
AVCodecParserContext *s = NULL;
- AVCodecParser *parser;
+ const AVCodecParser *parser;
+ void *i = 0;
int ret;
if (codec_id == AV_CODEC_ID_NONE)
return NULL;
- for (parser = av_first_parser; parser; parser = parser->next) {
+ while ((parser = av_parser_iterate(&i))) {
if (parser->codec_ids[0] == codec_id ||
parser->codec_ids[1] == codec_id ||
parser->codec_ids[2] == codec_id ||
@@ -72,7 +140,7 @@ found:
s = av_mallocz(sizeof(AVCodecParserContext));
if (!s)
goto err_out;
- s->parser = parser;
+ s->parser = (AVCodecParser*)parser;
s->priv_data = av_mallocz(parser->priv_data_size);
if (!s->priv_data)
goto err_out;