From 82b7cb7bc0eb889d8d24075cd39d5fb54e1bfb89 Mon Sep 17 00:00:00 2001 From: Yahweasel Date: Sat, 25 Jan 2025 16:33:59 -0500 Subject: [PATCH] Making builds more modular Specifically, splitting out bindings for components so that we don't need to link against every component and bring in extra code for, e.g., a demuxing-only build. --- Makefile | 527 +++---------- Makefile.m4 | 63 +- configs/configs/a-few-formats/components.txt | 4 + configs/configs/a-few-formats/config.json | 1 + configs/configs/a-few-formats/deps.mk | 0 .../configs/a-few-formats/ffmpeg-config.txt | 10 + configs/configs/a-few-formats/libs.txt | 3 + configs/configs/a-few-formats/license.js | 567 ++++++++++++++ configs/configs/a-few-formats/link-flags.txt | 2 + configs/configs/aac-af/components.txt | 6 + configs/configs/aac-af/config.json | 2 +- configs/configs/aac-af/libs.txt | 5 + configs/configs/aac-af/link-flags.txt | 4 + configs/configs/aac/components.txt | 5 + configs/configs/aac/config.json | 2 +- configs/configs/aac/libs.txt | 3 + configs/configs/aac/link-flags.txt | 2 + configs/configs/all/components.txt | 9 + configs/configs/all/config.json | 2 +- configs/configs/all/ffmpeg-config.txt | 6 + configs/configs/all/libs.txt | 7 + configs/configs/all/link-flags.txt | 5 + configs/configs/av1-opus-avf/components.txt | 7 + configs/configs/av1-opus-avf/config.json | 2 +- .../configs/av1-opus-avf/ffmpeg-config.txt | 2 +- configs/configs/av1-opus-avf/libs.txt | 6 + configs/configs/av1-opus-avf/link-flags.txt | 4 + configs/configs/av1-opus/components.txt | 5 + configs/configs/av1-opus/config.json | 2 +- configs/configs/av1-opus/libs.txt | 3 + configs/configs/av1-opus/link-flags.txt | 2 + configs/configs/common-formats/components.txt | 4 + configs/configs/common-formats/config.json | 1 + configs/configs/common-formats/deps.mk | 0 .../configs/common-formats/ffmpeg-config.txt | 25 + configs/configs/common-formats/libs.txt | 3 + configs/configs/common-formats/license.js | 567 ++++++++++++++ configs/configs/common-formats/link-flags.txt | 2 + configs/configs/default-cli/components.txt | 7 + configs/configs/default-cli/config.json | 2 +- configs/configs/default-cli/libs.txt | 5 + configs/configs/default-cli/link-flags.txt | 4 + configs/configs/default/components.txt | 6 + configs/configs/default/config.json | 2 +- configs/configs/default/libs.txt | 5 + configs/configs/default/link-flags.txt | 4 + configs/configs/empty/components.txt | 2 + configs/configs/empty/libs.txt | 1 + configs/configs/extras/components.txt | 7 + configs/configs/extras/config.json | 2 +- configs/configs/extras/ffmpeg-config.txt | 1 + configs/configs/extras/libs.txt | 6 + configs/configs/extras/link-flags.txt | 5 + configs/configs/flac-af/components.txt | 6 + configs/configs/flac-af/config.json | 2 +- configs/configs/flac-af/libs.txt | 5 + configs/configs/flac-af/link-flags.txt | 4 + configs/configs/flac/components.txt | 5 + configs/configs/flac/config.json | 2 +- configs/configs/flac/libs.txt | 3 + configs/configs/flac/link-flags.txt | 2 + configs/configs/h264-aac-avf/components.txt | 7 + configs/configs/h264-aac-avf/config.json | 2 +- .../configs/h264-aac-avf/ffmpeg-config.txt | 2 +- configs/configs/h264-aac-avf/libs.txt | 6 + configs/configs/h264-aac-avf/link-flags.txt | 4 + configs/configs/h264-aac/components.txt | 5 + configs/configs/h264-aac/config.json | 2 +- configs/configs/h264-aac/libs.txt | 3 + configs/configs/h264-aac/link-flags.txt | 2 + configs/configs/hevc-aac-avf/components.txt | 7 + configs/configs/hevc-aac-avf/config.json | 2 +- .../configs/hevc-aac-avf/ffmpeg-config.txt | 2 +- configs/configs/hevc-aac-avf/libs.txt | 6 + configs/configs/hevc-aac-avf/link-flags.txt | 4 + configs/configs/hevc-aac/components.txt | 5 + configs/configs/hevc-aac/config.json | 2 +- configs/configs/hevc-aac/libs.txt | 3 + configs/configs/hevc-aac/link-flags.txt | 2 + configs/configs/obsolete/components.txt | 6 + configs/configs/obsolete/config.json | 2 +- configs/configs/obsolete/libs.txt | 5 + configs/configs/obsolete/link-flags.txt | 4 + configs/configs/opus-af/components.txt | 6 + configs/configs/opus-af/config.json | 2 +- configs/configs/opus-af/libs.txt | 5 + configs/configs/opus-af/link-flags.txt | 4 + configs/configs/opus/components.txt | 5 + configs/configs/opus/config.json | 2 +- configs/configs/opus/libs.txt | 3 + configs/configs/opus/link-flags.txt | 2 + configs/configs/vp8-opus-avf/components.txt | 7 + configs/configs/vp8-opus-avf/config.json | 2 +- .../configs/vp8-opus-avf/ffmpeg-config.txt | 2 +- configs/configs/vp8-opus-avf/libs.txt | 6 + configs/configs/vp8-opus-avf/link-flags.txt | 4 + configs/configs/vp8-opus/components.txt | 5 + configs/configs/vp8-opus/config.json | 2 +- configs/configs/vp8-opus/libs.txt | 3 + configs/configs/vp8-opus/link-flags.txt | 2 + configs/configs/vp9-opus-avf/components.txt | 7 + configs/configs/vp9-opus-avf/config.json | 2 +- .../configs/vp9-opus-avf/ffmpeg-config.txt | 2 +- configs/configs/vp9-opus-avf/libs.txt | 6 + configs/configs/vp9-opus-avf/link-flags.txt | 4 + configs/configs/vp9-opus/components.txt | 5 + configs/configs/vp9-opus/config.json | 2 +- configs/configs/vp9-opus/libs.txt | 3 + configs/configs/vp9-opus/link-flags.txt | 2 + configs/configs/wav-af/components.txt | 6 + configs/configs/wav-af/config.json | 2 +- configs/configs/wav-af/libs.txt | 5 + configs/configs/wav-af/link-flags.txt | 4 + configs/configs/wav/components.txt | 5 + configs/configs/wav/config.json | 2 +- configs/configs/wav/libs.txt | 3 + configs/configs/wav/link-flags.txt | 2 + configs/configs/webcodecs-avf/components.txt | 7 + configs/configs/webcodecs-avf/config.json | 2 +- .../configs/webcodecs-avf/ffmpeg-config.txt | 2 +- configs/configs/webcodecs-avf/libs.txt | 6 + configs/configs/webcodecs-avf/link-flags.txt | 4 + configs/configs/webcodecs/components.txt | 5 + configs/configs/webcodecs/config.json | 2 +- configs/configs/webcodecs/libs.txt | 3 + configs/configs/webcodecs/link-flags.txt | 2 + configs/configs/webm-cli/components.txt | 7 + configs/configs/webm-cli/config.json | 2 +- configs/configs/webm-cli/libs.txt | 4 + configs/configs/webm-cli/link-flags.txt | 2 + configs/configs/webm-vp9-cli/components.txt | 7 + configs/configs/webm-vp9-cli/config.json | 2 +- configs/configs/webm-vp9-cli/libs.txt | 4 + configs/configs/webm-vp9-cli/link-flags.txt | 2 + configs/configs/webm-vp9/components.txt | 6 + configs/configs/webm-vp9/config.json | 2 +- configs/configs/webm-vp9/libs.txt | 4 + configs/configs/webm-vp9/link-flags.txt | 2 + configs/configs/webm/components.txt | 6 + configs/configs/webm/config.json | 2 +- configs/configs/webm/libs.txt | 4 + configs/configs/webm/link-flags.txt | 2 + configs/fragments/avcodec/components.txt | 2 + configs/fragments/avcodec/libs.txt | 1 + configs/fragments/avcodec/link-flags.txt | 1 + configs/fragments/avfcbridge/components.txt | 1 + configs/fragments/avfcbridge/libs.txt | 1 + configs/fragments/avfcbridge/link-flags.txt | 1 + configs/fragments/avfilter/components.txt | 1 + configs/fragments/avfilter/libs.txt | 1 + configs/fragments/avfilter/link-flags.txt | 1 + configs/fragments/avformat/components.txt | 1 + configs/fragments/avformat/libs.txt | 1 + configs/fragments/avformat/link-flags.txt | 1 + configs/fragments/cli/components.txt | 1 + configs/fragments/default/components.txt | 2 + configs/fragments/default/libs.txt | 1 + configs/fragments/swresample/libs.txt | 1 + configs/fragments/swresample/link-flags.txt | 1 + configs/fragments/swscale/components.txt | 1 + configs/fragments/swscale/libs.txt | 1 + configs/mkconfig.js | 2 +- configs/mkconfigs.js | 41 +- funcs.json | 739 ++++++++++-------- src/b-avcodec.c | 157 ++++ src/b-avfilter.c | 58 ++ src/b-avformat.c | 90 +++ bindings.c => src/bindings.c | 342 +------- extern-post.js => src/extern-post.js | 0 libav.in.js => src/frontend.in.js | 6 +- .../libav.types.in.d.ts | 0 post.in.js => src/post.in.js | 0 pre.js => src/pre.js | 0 tools/adjust-sourcemap.js | 3 +- tools/apply-funcs.js | 377 --------- tools/mk-exports.js | 67 ++ tools/mk-frontend.js | 97 +++ tools/mk-post.js | 142 ++++ tools/mk-types-dts.js | 189 +++++ 179 files changed, 3063 insertions(+), 1524 deletions(-) create mode 100644 configs/configs/a-few-formats/components.txt create mode 100644 configs/configs/a-few-formats/config.json create mode 100644 configs/configs/a-few-formats/deps.mk create mode 100644 configs/configs/a-few-formats/ffmpeg-config.txt create mode 100644 configs/configs/a-few-formats/libs.txt create mode 100644 configs/configs/a-few-formats/license.js create mode 100644 configs/configs/a-few-formats/link-flags.txt create mode 100644 configs/configs/aac-af/components.txt create mode 100644 configs/configs/aac/components.txt create mode 100644 configs/configs/all/components.txt create mode 100644 configs/configs/av1-opus-avf/components.txt create mode 100644 configs/configs/av1-opus/components.txt create mode 100644 configs/configs/common-formats/components.txt create mode 100644 configs/configs/common-formats/config.json create mode 100644 configs/configs/common-formats/deps.mk create mode 100644 configs/configs/common-formats/ffmpeg-config.txt create mode 100644 configs/configs/common-formats/libs.txt create mode 100644 configs/configs/common-formats/license.js create mode 100644 configs/configs/common-formats/link-flags.txt create mode 100644 configs/configs/default-cli/components.txt create mode 100644 configs/configs/default/components.txt create mode 100644 configs/configs/empty/components.txt create mode 100644 configs/configs/extras/components.txt create mode 100644 configs/configs/flac-af/components.txt create mode 100644 configs/configs/flac/components.txt create mode 100644 configs/configs/h264-aac-avf/components.txt create mode 100644 configs/configs/h264-aac/components.txt create mode 100644 configs/configs/hevc-aac-avf/components.txt create mode 100644 configs/configs/hevc-aac/components.txt create mode 100644 configs/configs/obsolete/components.txt create mode 100644 configs/configs/opus-af/components.txt create mode 100644 configs/configs/opus/components.txt create mode 100644 configs/configs/vp8-opus-avf/components.txt create mode 100644 configs/configs/vp8-opus/components.txt create mode 100644 configs/configs/vp9-opus-avf/components.txt create mode 100644 configs/configs/vp9-opus/components.txt create mode 100644 configs/configs/wav-af/components.txt create mode 100644 configs/configs/wav/components.txt create mode 100644 configs/configs/webcodecs-avf/components.txt create mode 100644 configs/configs/webcodecs/components.txt create mode 100644 configs/configs/webm-cli/components.txt create mode 100644 configs/configs/webm-vp9-cli/components.txt create mode 100644 configs/configs/webm-vp9/components.txt create mode 100644 configs/configs/webm/components.txt create mode 100644 configs/fragments/avcodec/components.txt create mode 100644 configs/fragments/avcodec/libs.txt create mode 100644 configs/fragments/avcodec/link-flags.txt create mode 100644 configs/fragments/avfcbridge/components.txt create mode 100644 configs/fragments/avfcbridge/libs.txt create mode 100644 configs/fragments/avfcbridge/link-flags.txt create mode 100644 configs/fragments/avfilter/components.txt create mode 100644 configs/fragments/avfilter/libs.txt create mode 100644 configs/fragments/avfilter/link-flags.txt create mode 100644 configs/fragments/avformat/components.txt create mode 100644 configs/fragments/avformat/libs.txt create mode 100644 configs/fragments/avformat/link-flags.txt create mode 100644 configs/fragments/cli/components.txt create mode 100644 configs/fragments/default/components.txt create mode 100644 configs/fragments/default/libs.txt create mode 100644 configs/fragments/swresample/libs.txt create mode 100644 configs/fragments/swresample/link-flags.txt create mode 100644 configs/fragments/swscale/components.txt create mode 100644 configs/fragments/swscale/libs.txt create mode 100644 src/b-avcodec.c create mode 100644 src/b-avfilter.c create mode 100644 src/b-avformat.c rename bindings.c => src/bindings.c (60%) rename extern-post.js => src/extern-post.js (100%) rename libav.in.js => src/frontend.in.js (99%) rename libav.types.in.d.ts => src/libav.types.in.d.ts (100%) rename post.in.js => src/post.in.js (100%) rename pre.js => src/pre.js (100%) delete mode 100755 tools/apply-funcs.js create mode 100755 tools/mk-exports.js create mode 100755 tools/mk-frontend.js create mode 100755 tools/mk-post.js create mode 100755 tools/mk-types-dts.js diff --git a/Makefile b/Makefile index cb9cd068..79e9f046 100644 --- a/Makefile +++ b/Makefile @@ -18,10 +18,9 @@ THRFLAGS=-pthread $(EMFTFLAGS) ES6FLAGS=-sEXPORT_ES6=1 -sUSE_ES6_IMPORT_META=1 EFLAGS=\ `tools/memory-init-file-emcc.sh` \ - --pre-js pre.js \ - --post-js build/post.js --extern-post-js extern-post.js \ + --pre-js src/pre.js \ + --extern-post-js src/extern-post.js \ -s "EXPORT_NAME='LibAVFactory'" \ - -s "EXPORTED_FUNCTIONS=@build/exports.json" \ -s "EXPORTED_RUNTIME_METHODS=['ccall', 'cwrap', 'PThread']" \ -s MODULARIZE=1 \ -s STACK_SIZE=1048576 \ @@ -71,41 +70,37 @@ build-%: \ -dist/libav-$(LIBAVJS_VERSION)-%.js: build/libav-$(LIBAVJS_VERSION).js \ - dist/libav-$(LIBAVJS_VERSION)-%.wasm.js \ +dist/libav-$(LIBAVJS_VERSION)-%.js: build/frontend-$(LIBAVJS_VERSION)-%.js \ node_modules/.bin/terser mkdir -p dist - sed "s/@CONFIG/$(*)/g ; s/@DBG//g" < $< | $(MINIFIER) > $(@) + sed "s/@DBG//g" < $< | $(MINIFIER) > $(@) dist/libav-%.js: dist/libav-$(LIBAVJS_VERSION)-%.js cp $(<) $(@) -dist/libav-$(LIBAVJS_VERSION)-%.mjs: build/libav-$(LIBAVJS_VERSION).mjs \ - dist/libav-$(LIBAVJS_VERSION)-%.wasm.mjs \ +dist/libav-$(LIBAVJS_VERSION)-%.mjs: build/frontend-$(LIBAVJS_VERSION)-%.mjs \ node_modules/.bin/terser mkdir -p dist - sed "s/@CONFIG/$(*)/g ; s/@DBG//g" < $< | $(MINIFIER) > $(@) + sed "s/@DBG//g" < $< | $(MINIFIER) > $(@) dist/libav-%.mjs: dist/libav-$(LIBAVJS_VERSION)-%.mjs cp $(<) $(@) -dist/libav-$(LIBAVJS_VERSION)-%.dbg.js: build/libav-$(LIBAVJS_VERSION).js \ - dist/libav-$(LIBAVJS_VERSION)-%.dbg.wasm.js \ +dist/libav-$(LIBAVJS_VERSION)-%.dbg.js: build/frontend-$(LIBAVJS_VERSION)-%.js \ node_modules/.bin/terser mkdir -p dist - sed "s/@CONFIG/$(*)/g ; s/@DBG/.dbg/g" < $< | cat > $(@) + sed "s/@DBG/.dbg/g" < $< | cat > $(@) dist/libav-%.dbg.js: dist/libav-$(LIBAVJS_VERSION)-%.dbg.js cp $(<) $(@) -dist/libav-$(LIBAVJS_VERSION)-%.dbg.mjs: build/libav-$(LIBAVJS_VERSION).mjs \ - dist/libav-$(LIBAVJS_VERSION)-%.dbg.wasm.mjs \ +dist/libav-$(LIBAVJS_VERSION)-%.dbg.mjs: build/frontend-$(LIBAVJS_VERSION)-%.mjs \ node_modules/.bin/terser mkdir -p dist - sed "s/@CONFIG/$(*)/g ; s/@DBG/.dbg/g" < $< | cat > $(@) + sed "s/@DBG/.dbg/g" < $< | cat > $(@) dist/libav-%.dbg.mjs: dist/libav-$(LIBAVJS_VERSION)-%.dbg.mjs cp $(<) $(@) @@ -115,10 +110,6 @@ dist/libav.types.d.ts: build/libav.types.d.ts mkdir -p dist cp $< $@ -# Link rule that checks for a library's existence before linking it -# Use: linkfflib(library name, target inst name) - - # General build rule for any target # Use: buildrule(target file name, debug infix, target inst name, extra link flags, target file suffix) @@ -126,47 +117,20 @@ dist/libav.types.d.ts: build/libav.types.d.ts # asm.js version dist/libav-$(LIBAVJS_VERSION)-%.asm.js: build/ffmpeg-$(FFMPEG_VERSION)/build-base-%/libavformat/libavformat.a \ - build/exports.json pre.js build/post.js extern-post.js bindings.c + build/exports-%.json src/pre.js build/post-%.js src/extern-post.js \ + src/bindings.c src/b-*.c mkdir -p $(@).d $(EMCC) $(OPTFLAGS) $(EFLAGS) \ + --post-js build/post-$(*).js \ + -s "EXPORTED_FUNCTIONS=@build/exports-$(*).json" \ -Ibuild/ffmpeg-$(FFMPEG_VERSION) -Ibuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*) \ `test ! -e configs/configs/$(*)/link-flags.txt || cat configs/configs/$(*)/link-flags.txt` \ - bindings.c \ + src/bindings.c \ `grep LIBAVJS_WITH_CLI configs/configs/$(*)/link-flags.txt > /dev/null 2>&1 && echo ' \ build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/fftools/*.o \ -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavdevice -lavdevice \ '` \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavutil/libavutil.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavutil -lavutil \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavformat/libavformat.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavformat -lavformat \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavcodec/libavcodec.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavcodec -lavcodec \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavfilter/libavfilter.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavfilter -lavfilter \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswresample/libswresample.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswresample -lswresample \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswscale/libswscale.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswscale -lswscale \ - '` \ - \ - `test ! -e configs/configs/$(*)/libs.txt || sed 's/@TARGET/base/' configs/configs/$(*)/libs.txt` \ + `test ! -e configs/configs/$(*)/libs.txt || sed 's/@FFVER/$(FFMPEG_VERSION)/ ; s/@TARGET/base/ ; s/@VARIANT/$(*)/' configs/configs/$(*)/libs.txt` \ $(EMFTFLAGS) -s WASM=0 \ -o $(@).d/libav-$(LIBAVJS_VERSION)-$(*).asm.js if [ -e $(@).d/libav-$(LIBAVJS_VERSION)-$(*).asm.wasm.map ] ; then \ @@ -190,47 +154,20 @@ dist/libav-$(LIBAVJS_VERSION)-%.asm.js: build/ffmpeg-$(FFMPEG_VERSION)/build-bas dist/libav-$(LIBAVJS_VERSION)-%.asm.mjs: build/ffmpeg-$(FFMPEG_VERSION)/build-base-%/libavformat/libavformat.a \ - build/exports.json pre.js build/post.js extern-post.js bindings.c + build/exports-%.json src/pre.js build/post-%.js src/extern-post.js \ + src/bindings.c src/b-*.c mkdir -p $(@).d $(EMCC) $(OPTFLAGS) $(EFLAGS) \ + --post-js build/post-$(*).js \ + -s "EXPORTED_FUNCTIONS=@build/exports-$(*).json" \ -Ibuild/ffmpeg-$(FFMPEG_VERSION) -Ibuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*) \ `test ! -e configs/configs/$(*)/link-flags.txt || cat configs/configs/$(*)/link-flags.txt` \ - bindings.c \ + src/bindings.c \ `grep LIBAVJS_WITH_CLI configs/configs/$(*)/link-flags.txt > /dev/null 2>&1 && echo ' \ build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/fftools/*.o \ -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavdevice -lavdevice \ '` \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavutil/libavutil.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavutil -lavutil \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavformat/libavformat.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavformat -lavformat \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavcodec/libavcodec.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavcodec -lavcodec \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavfilter/libavfilter.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavfilter -lavfilter \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswresample/libswresample.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswresample -lswresample \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswscale/libswscale.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswscale -lswscale \ - '` \ - \ - `test ! -e configs/configs/$(*)/libs.txt || sed 's/@TARGET/base/' configs/configs/$(*)/libs.txt` \ + `test ! -e configs/configs/$(*)/libs.txt || sed 's/@FFVER/$(FFMPEG_VERSION)/ ; s/@TARGET/base/ ; s/@VARIANT/$(*)/' configs/configs/$(*)/libs.txt` \ $(EMFTFLAGS) $(ES6FLAGS) -s WASM=0 \ -o $(@).d/libav-$(LIBAVJS_VERSION)-$(*).asm.mjs if [ -e $(@).d/libav-$(LIBAVJS_VERSION)-$(*).asm.wasm.map ] ; then \ @@ -254,47 +191,20 @@ dist/libav-$(LIBAVJS_VERSION)-%.asm.mjs: build/ffmpeg-$(FFMPEG_VERSION)/build-ba dist/libav-$(LIBAVJS_VERSION)-%.dbg.asm.js: build/ffmpeg-$(FFMPEG_VERSION)/build-base-%/libavformat/libavformat.a \ - build/exports.json pre.js build/post.js extern-post.js bindings.c + build/exports-%.json src/pre.js build/post-%.js src/extern-post.js \ + src/bindings.c src/b-*.c mkdir -p $(@).d $(EMCC) $(OPTFLAGS) $(EFLAGS) \ + --post-js build/post-$(*).js \ + -s "EXPORTED_FUNCTIONS=@build/exports-$(*).json" \ -Ibuild/ffmpeg-$(FFMPEG_VERSION) -Ibuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*) \ `test ! -e configs/configs/$(*)/link-flags.txt || cat configs/configs/$(*)/link-flags.txt` \ - bindings.c \ + src/bindings.c \ `grep LIBAVJS_WITH_CLI configs/configs/$(*)/link-flags.txt > /dev/null 2>&1 && echo ' \ build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/fftools/*.o \ -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavdevice -lavdevice \ '` \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavutil/libavutil.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavutil -lavutil \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavformat/libavformat.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavformat -lavformat \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavcodec/libavcodec.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavcodec -lavcodec \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavfilter/libavfilter.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavfilter -lavfilter \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswresample/libswresample.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswresample -lswresample \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswscale/libswscale.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswscale -lswscale \ - '` \ - \ - `test ! -e configs/configs/$(*)/libs.txt || sed 's/@TARGET/base/' configs/configs/$(*)/libs.txt` \ + `test ! -e configs/configs/$(*)/libs.txt || sed 's/@FFVER/$(FFMPEG_VERSION)/ ; s/@TARGET/base/ ; s/@VARIANT/$(*)/' configs/configs/$(*)/libs.txt` \ $(EMFTFLAGS) -g2 -s WASM=0 \ -o $(@).d/libav-$(LIBAVJS_VERSION)-$(*).dbg.asm.js if [ -e $(@).d/libav-$(LIBAVJS_VERSION)-$(*).dbg.asm.wasm.map ] ; then \ @@ -318,47 +228,20 @@ dist/libav-$(LIBAVJS_VERSION)-%.dbg.asm.js: build/ffmpeg-$(FFMPEG_VERSION)/build dist/libav-$(LIBAVJS_VERSION)-%.dbg.asm.mjs: build/ffmpeg-$(FFMPEG_VERSION)/build-base-%/libavformat/libavformat.a \ - build/exports.json pre.js build/post.js extern-post.js bindings.c + build/exports-%.json src/pre.js build/post-%.js src/extern-post.js \ + src/bindings.c src/b-*.c mkdir -p $(@).d $(EMCC) $(OPTFLAGS) $(EFLAGS) \ + --post-js build/post-$(*).js \ + -s "EXPORTED_FUNCTIONS=@build/exports-$(*).json" \ -Ibuild/ffmpeg-$(FFMPEG_VERSION) -Ibuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*) \ `test ! -e configs/configs/$(*)/link-flags.txt || cat configs/configs/$(*)/link-flags.txt` \ - bindings.c \ + src/bindings.c \ `grep LIBAVJS_WITH_CLI configs/configs/$(*)/link-flags.txt > /dev/null 2>&1 && echo ' \ build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/fftools/*.o \ -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavdevice -lavdevice \ '` \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavutil/libavutil.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavutil -lavutil \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavformat/libavformat.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavformat -lavformat \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavcodec/libavcodec.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavcodec -lavcodec \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavfilter/libavfilter.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavfilter -lavfilter \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswresample/libswresample.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswresample -lswresample \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswscale/libswscale.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswscale -lswscale \ - '` \ - \ - `test ! -e configs/configs/$(*)/libs.txt || sed 's/@TARGET/base/' configs/configs/$(*)/libs.txt` \ + `test ! -e configs/configs/$(*)/libs.txt || sed 's/@FFVER/$(FFMPEG_VERSION)/ ; s/@TARGET/base/ ; s/@VARIANT/$(*)/' configs/configs/$(*)/libs.txt` \ $(EMFTFLAGS) -g2 $(ES6FLAGS) -s WASM=0 \ -o $(@).d/libav-$(LIBAVJS_VERSION)-$(*).dbg.asm.mjs if [ -e $(@).d/libav-$(LIBAVJS_VERSION)-$(*).dbg.asm.wasm.map ] ; then \ @@ -383,47 +266,20 @@ dist/libav-$(LIBAVJS_VERSION)-%.dbg.asm.mjs: build/ffmpeg-$(FFMPEG_VERSION)/buil # wasm version with no added features dist/libav-$(LIBAVJS_VERSION)-%.wasm.js: build/ffmpeg-$(FFMPEG_VERSION)/build-base-%/libavformat/libavformat.a \ - build/exports.json pre.js build/post.js extern-post.js bindings.c + build/exports-%.json src/pre.js build/post-%.js src/extern-post.js \ + src/bindings.c src/b-*.c mkdir -p $(@).d $(EMCC) $(OPTFLAGS) $(EFLAGS) \ + --post-js build/post-$(*).js \ + -s "EXPORTED_FUNCTIONS=@build/exports-$(*).json" \ -Ibuild/ffmpeg-$(FFMPEG_VERSION) -Ibuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*) \ `test ! -e configs/configs/$(*)/link-flags.txt || cat configs/configs/$(*)/link-flags.txt` \ - bindings.c \ + src/bindings.c \ `grep LIBAVJS_WITH_CLI configs/configs/$(*)/link-flags.txt > /dev/null 2>&1 && echo ' \ build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/fftools/*.o \ -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavdevice -lavdevice \ '` \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavutil/libavutil.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavutil -lavutil \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavformat/libavformat.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavformat -lavformat \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavcodec/libavcodec.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavcodec -lavcodec \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavfilter/libavfilter.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavfilter -lavfilter \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswresample/libswresample.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswresample -lswresample \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswscale/libswscale.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswscale -lswscale \ - '` \ - \ - `test ! -e configs/configs/$(*)/libs.txt || sed 's/@TARGET/base/' configs/configs/$(*)/libs.txt` \ + `test ! -e configs/configs/$(*)/libs.txt || sed 's/@FFVER/$(FFMPEG_VERSION)/ ; s/@TARGET/base/ ; s/@VARIANT/$(*)/' configs/configs/$(*)/libs.txt` \ $(EMFTFLAGS) \ -o $(@).d/libav-$(LIBAVJS_VERSION)-$(*).wasm.js if [ -e $(@).d/libav-$(LIBAVJS_VERSION)-$(*).wasm.wasm.map ] ; then \ @@ -447,47 +303,20 @@ dist/libav-$(LIBAVJS_VERSION)-%.wasm.js: build/ffmpeg-$(FFMPEG_VERSION)/build-ba dist/libav-$(LIBAVJS_VERSION)-%.wasm.mjs: build/ffmpeg-$(FFMPEG_VERSION)/build-base-%/libavformat/libavformat.a \ - build/exports.json pre.js build/post.js extern-post.js bindings.c + build/exports-%.json src/pre.js build/post-%.js src/extern-post.js \ + src/bindings.c src/b-*.c mkdir -p $(@).d $(EMCC) $(OPTFLAGS) $(EFLAGS) \ + --post-js build/post-$(*).js \ + -s "EXPORTED_FUNCTIONS=@build/exports-$(*).json" \ -Ibuild/ffmpeg-$(FFMPEG_VERSION) -Ibuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*) \ `test ! -e configs/configs/$(*)/link-flags.txt || cat configs/configs/$(*)/link-flags.txt` \ - bindings.c \ + src/bindings.c \ `grep LIBAVJS_WITH_CLI configs/configs/$(*)/link-flags.txt > /dev/null 2>&1 && echo ' \ build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/fftools/*.o \ -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavdevice -lavdevice \ '` \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavutil/libavutil.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavutil -lavutil \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavformat/libavformat.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavformat -lavformat \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavcodec/libavcodec.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavcodec -lavcodec \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavfilter/libavfilter.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavfilter -lavfilter \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswresample/libswresample.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswresample -lswresample \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswscale/libswscale.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswscale -lswscale \ - '` \ - \ - `test ! -e configs/configs/$(*)/libs.txt || sed 's/@TARGET/base/' configs/configs/$(*)/libs.txt` \ + `test ! -e configs/configs/$(*)/libs.txt || sed 's/@FFVER/$(FFMPEG_VERSION)/ ; s/@TARGET/base/ ; s/@VARIANT/$(*)/' configs/configs/$(*)/libs.txt` \ $(EMFTFLAGS) $(ES6FLAGS) \ -o $(@).d/libav-$(LIBAVJS_VERSION)-$(*).wasm.mjs if [ -e $(@).d/libav-$(LIBAVJS_VERSION)-$(*).wasm.wasm.map ] ; then \ @@ -511,47 +340,20 @@ dist/libav-$(LIBAVJS_VERSION)-%.wasm.mjs: build/ffmpeg-$(FFMPEG_VERSION)/build-b dist/libav-$(LIBAVJS_VERSION)-%.dbg.wasm.js: build/ffmpeg-$(FFMPEG_VERSION)/build-base-%/libavformat/libavformat.a \ - build/exports.json pre.js build/post.js extern-post.js bindings.c + build/exports-%.json src/pre.js build/post-%.js src/extern-post.js \ + src/bindings.c src/b-*.c mkdir -p $(@).d $(EMCC) $(OPTFLAGS) $(EFLAGS) \ + --post-js build/post-$(*).js \ + -s "EXPORTED_FUNCTIONS=@build/exports-$(*).json" \ -Ibuild/ffmpeg-$(FFMPEG_VERSION) -Ibuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*) \ `test ! -e configs/configs/$(*)/link-flags.txt || cat configs/configs/$(*)/link-flags.txt` \ - bindings.c \ + src/bindings.c \ `grep LIBAVJS_WITH_CLI configs/configs/$(*)/link-flags.txt > /dev/null 2>&1 && echo ' \ build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/fftools/*.o \ -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavdevice -lavdevice \ '` \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavutil/libavutil.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavutil -lavutil \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavformat/libavformat.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavformat -lavformat \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavcodec/libavcodec.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavcodec -lavcodec \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavfilter/libavfilter.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavfilter -lavfilter \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswresample/libswresample.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswresample -lswresample \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswscale/libswscale.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswscale -lswscale \ - '` \ - \ - `test ! -e configs/configs/$(*)/libs.txt || sed 's/@TARGET/base/' configs/configs/$(*)/libs.txt` \ + `test ! -e configs/configs/$(*)/libs.txt || sed 's/@FFVER/$(FFMPEG_VERSION)/ ; s/@TARGET/base/ ; s/@VARIANT/$(*)/' configs/configs/$(*)/libs.txt` \ $(EMFTFLAGS) -gsource-map \ -o $(@).d/libav-$(LIBAVJS_VERSION)-$(*).dbg.wasm.js if [ -e $(@).d/libav-$(LIBAVJS_VERSION)-$(*).dbg.wasm.wasm.map ] ; then \ @@ -575,47 +377,20 @@ dist/libav-$(LIBAVJS_VERSION)-%.dbg.wasm.js: build/ffmpeg-$(FFMPEG_VERSION)/buil dist/libav-$(LIBAVJS_VERSION)-%.dbg.wasm.mjs: build/ffmpeg-$(FFMPEG_VERSION)/build-base-%/libavformat/libavformat.a \ - build/exports.json pre.js build/post.js extern-post.js bindings.c + build/exports-%.json src/pre.js build/post-%.js src/extern-post.js \ + src/bindings.c src/b-*.c mkdir -p $(@).d $(EMCC) $(OPTFLAGS) $(EFLAGS) \ + --post-js build/post-$(*).js \ + -s "EXPORTED_FUNCTIONS=@build/exports-$(*).json" \ -Ibuild/ffmpeg-$(FFMPEG_VERSION) -Ibuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*) \ `test ! -e configs/configs/$(*)/link-flags.txt || cat configs/configs/$(*)/link-flags.txt` \ - bindings.c \ + src/bindings.c \ `grep LIBAVJS_WITH_CLI configs/configs/$(*)/link-flags.txt > /dev/null 2>&1 && echo ' \ build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/fftools/*.o \ -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavdevice -lavdevice \ '` \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavutil/libavutil.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavutil -lavutil \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavformat/libavformat.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavformat -lavformat \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavcodec/libavcodec.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavcodec -lavcodec \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavfilter/libavfilter.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libavfilter -lavfilter \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswresample/libswresample.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswresample -lswresample \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswscale/libswscale.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-base-$(*)/libswscale -lswscale \ - '` \ - \ - `test ! -e configs/configs/$(*)/libs.txt || sed 's/@TARGET/base/' configs/configs/$(*)/libs.txt` \ + `test ! -e configs/configs/$(*)/libs.txt || sed 's/@FFVER/$(FFMPEG_VERSION)/ ; s/@TARGET/base/ ; s/@VARIANT/$(*)/' configs/configs/$(*)/libs.txt` \ $(EMFTFLAGS) -gsource-map $(ES6FLAGS) \ -o $(@).d/libav-$(LIBAVJS_VERSION)-$(*).dbg.wasm.mjs if [ -e $(@).d/libav-$(LIBAVJS_VERSION)-$(*).dbg.wasm.wasm.map ] ; then \ @@ -640,47 +415,20 @@ dist/libav-$(LIBAVJS_VERSION)-%.dbg.wasm.mjs: build/ffmpeg-$(FFMPEG_VERSION)/bui # wasm + threads dist/libav-$(LIBAVJS_VERSION)-%.thr.js: build/ffmpeg-$(FFMPEG_VERSION)/build-thr-%/libavformat/libavformat.a \ - build/exports.json pre.js build/post.js extern-post.js bindings.c + build/exports-%.json src/pre.js build/post-%.js src/extern-post.js \ + src/bindings.c src/b-*.c mkdir -p $(@).d $(EMCC) $(OPTFLAGS) $(EFLAGS) \ + --post-js build/post-$(*).js \ + -s "EXPORTED_FUNCTIONS=@build/exports-$(*).json" \ -Ibuild/ffmpeg-$(FFMPEG_VERSION) -Ibuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*) \ `test ! -e configs/configs/$(*)/link-flags.txt || cat configs/configs/$(*)/link-flags.txt` \ - bindings.c \ + src/bindings.c \ `grep LIBAVJS_WITH_CLI configs/configs/$(*)/link-flags.txt > /dev/null 2>&1 && echo ' \ build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/fftools/*.o \ -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavdevice -lavdevice \ '` \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavutil/libavutil.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavutil -lavutil \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavformat/libavformat.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavformat -lavformat \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavcodec/libavcodec.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavcodec -lavcodec \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavfilter/libavfilter.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavfilter -lavfilter \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libswresample/libswresample.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libswresample -lswresample \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libswscale/libswscale.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libswscale -lswscale \ - '` \ - \ - `test ! -e configs/configs/$(*)/libs.txt || sed 's/@TARGET/thr/' configs/configs/$(*)/libs.txt` \ + `test ! -e configs/configs/$(*)/libs.txt || sed 's/@FFVER/$(FFMPEG_VERSION)/ ; s/@TARGET/thr/ ; s/@VARIANT/$(*)/' configs/configs/$(*)/libs.txt` \ $(THRFLAGS) -sPTHREAD_POOL_SIZE=navigator.hardwareConcurrency \ -o $(@).d/libav-$(LIBAVJS_VERSION)-$(*).thr.js if [ -e $(@).d/libav-$(LIBAVJS_VERSION)-$(*).thr.wasm.map ] ; then \ @@ -704,47 +452,20 @@ dist/libav-$(LIBAVJS_VERSION)-%.thr.js: build/ffmpeg-$(FFMPEG_VERSION)/build-thr dist/libav-$(LIBAVJS_VERSION)-%.thr.mjs: build/ffmpeg-$(FFMPEG_VERSION)/build-thr-%/libavformat/libavformat.a \ - build/exports.json pre.js build/post.js extern-post.js bindings.c + build/exports-%.json src/pre.js build/post-%.js src/extern-post.js \ + src/bindings.c src/b-*.c mkdir -p $(@).d $(EMCC) $(OPTFLAGS) $(EFLAGS) \ + --post-js build/post-$(*).js \ + -s "EXPORTED_FUNCTIONS=@build/exports-$(*).json" \ -Ibuild/ffmpeg-$(FFMPEG_VERSION) -Ibuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*) \ `test ! -e configs/configs/$(*)/link-flags.txt || cat configs/configs/$(*)/link-flags.txt` \ - bindings.c \ + src/bindings.c \ `grep LIBAVJS_WITH_CLI configs/configs/$(*)/link-flags.txt > /dev/null 2>&1 && echo ' \ build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/fftools/*.o \ -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavdevice -lavdevice \ '` \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavutil/libavutil.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavutil -lavutil \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavformat/libavformat.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavformat -lavformat \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavcodec/libavcodec.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavcodec -lavcodec \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavfilter/libavfilter.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavfilter -lavfilter \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libswresample/libswresample.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libswresample -lswresample \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libswscale/libswscale.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libswscale -lswscale \ - '` \ - \ - `test ! -e configs/configs/$(*)/libs.txt || sed 's/@TARGET/thr/' configs/configs/$(*)/libs.txt` \ + `test ! -e configs/configs/$(*)/libs.txt || sed 's/@FFVER/$(FFMPEG_VERSION)/ ; s/@TARGET/thr/ ; s/@VARIANT/$(*)/' configs/configs/$(*)/libs.txt` \ $(ES6FLAGS) $(THRFLAGS) -sPTHREAD_POOL_SIZE=navigator.hardwareConcurrency \ -o $(@).d/libav-$(LIBAVJS_VERSION)-$(*).thr.mjs if [ -e $(@).d/libav-$(LIBAVJS_VERSION)-$(*).thr.wasm.map ] ; then \ @@ -768,47 +489,20 @@ dist/libav-$(LIBAVJS_VERSION)-%.thr.mjs: build/ffmpeg-$(FFMPEG_VERSION)/build-th dist/libav-$(LIBAVJS_VERSION)-%.dbg.thr.js: build/ffmpeg-$(FFMPEG_VERSION)/build-thr-%/libavformat/libavformat.a \ - build/exports.json pre.js build/post.js extern-post.js bindings.c + build/exports-%.json src/pre.js build/post-%.js src/extern-post.js \ + src/bindings.c src/b-*.c mkdir -p $(@).d $(EMCC) $(OPTFLAGS) $(EFLAGS) \ + --post-js build/post-$(*).js \ + -s "EXPORTED_FUNCTIONS=@build/exports-$(*).json" \ -Ibuild/ffmpeg-$(FFMPEG_VERSION) -Ibuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*) \ `test ! -e configs/configs/$(*)/link-flags.txt || cat configs/configs/$(*)/link-flags.txt` \ - bindings.c \ + src/bindings.c \ `grep LIBAVJS_WITH_CLI configs/configs/$(*)/link-flags.txt > /dev/null 2>&1 && echo ' \ build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/fftools/*.o \ -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavdevice -lavdevice \ '` \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavutil/libavutil.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavutil -lavutil \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavformat/libavformat.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavformat -lavformat \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavcodec/libavcodec.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavcodec -lavcodec \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavfilter/libavfilter.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavfilter -lavfilter \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libswresample/libswresample.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libswresample -lswresample \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libswscale/libswscale.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libswscale -lswscale \ - '` \ - \ - `test ! -e configs/configs/$(*)/libs.txt || sed 's/@TARGET/thr/' configs/configs/$(*)/libs.txt` \ + `test ! -e configs/configs/$(*)/libs.txt || sed 's/@FFVER/$(FFMPEG_VERSION)/ ; s/@TARGET/thr/ ; s/@VARIANT/$(*)/' configs/configs/$(*)/libs.txt` \ -gsource-map $(THRFLAGS) -sPTHREAD_POOL_SIZE=navigator.hardwareConcurrency \ -o $(@).d/libav-$(LIBAVJS_VERSION)-$(*).dbg.thr.js if [ -e $(@).d/libav-$(LIBAVJS_VERSION)-$(*).dbg.thr.wasm.map ] ; then \ @@ -832,47 +526,20 @@ dist/libav-$(LIBAVJS_VERSION)-%.dbg.thr.js: build/ffmpeg-$(FFMPEG_VERSION)/build dist/libav-$(LIBAVJS_VERSION)-%.dbg.thr.mjs: build/ffmpeg-$(FFMPEG_VERSION)/build-thr-%/libavformat/libavformat.a \ - build/exports.json pre.js build/post.js extern-post.js bindings.c + build/exports-%.json src/pre.js build/post-%.js src/extern-post.js \ + src/bindings.c src/b-*.c mkdir -p $(@).d $(EMCC) $(OPTFLAGS) $(EFLAGS) \ + --post-js build/post-$(*).js \ + -s "EXPORTED_FUNCTIONS=@build/exports-$(*).json" \ -Ibuild/ffmpeg-$(FFMPEG_VERSION) -Ibuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*) \ `test ! -e configs/configs/$(*)/link-flags.txt || cat configs/configs/$(*)/link-flags.txt` \ - bindings.c \ + src/bindings.c \ `grep LIBAVJS_WITH_CLI configs/configs/$(*)/link-flags.txt > /dev/null 2>&1 && echo ' \ build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/fftools/*.o \ -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavdevice -lavdevice \ '` \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavutil/libavutil.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavutil -lavutil \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavformat/libavformat.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavformat -lavformat \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavcodec/libavcodec.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavcodec -lavcodec \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavfilter/libavfilter.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libavfilter -lavfilter \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libswresample/libswresample.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libswresample -lswresample \ - '` \ - \ - \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libswscale/libswscale.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-thr-$(*)/libswscale -lswscale \ - '` \ - \ - `test ! -e configs/configs/$(*)/libs.txt || sed 's/@TARGET/thr/' configs/configs/$(*)/libs.txt` \ + `test ! -e configs/configs/$(*)/libs.txt || sed 's/@FFVER/$(FFMPEG_VERSION)/ ; s/@TARGET/thr/ ; s/@VARIANT/$(*)/' configs/configs/$(*)/libs.txt` \ -gsource-map $(ES6FLAGS) $(THRFLAGS) -sPTHREAD_POOL_SIZE=navigator.hardwareConcurrency \ -o $(@).d/libav-$(LIBAVJS_VERSION)-$(*).dbg.thr.mjs if [ -e $(@).d/libav-$(LIBAVJS_VERSION)-$(*).dbg.thr.wasm.map ] ; then \ @@ -895,15 +562,31 @@ dist/libav-$(LIBAVJS_VERSION)-%.dbg.thr.mjs: build/ffmpeg-$(FFMPEG_VERSION)/buil rmdir $(@).d -build/libav-$(LIBAVJS_VERSION).js: libav.in.js libav.types.in.d.ts post.in.js funcs.json tools/apply-funcs.js - mkdir -p build dist - ./tools/apply-funcs.js $(LIBAVJS_VERSION) +# Built source files +build/exports-%.json: configs/configs/%/components.txt funcs.json \ + tools/mk-exports.js + mkdir -p build + ./tools/mk-exports.js $(*) > $@ + +build/frontend-$(LIBAVJS_VERSION)-%.js: configs/configs/%/components.txt \ + funcs.json src/frontend.in.js tools/mk-frontend.js + mkdir -p build + ./tools/mk-frontend.js $(*) $(LIBAVJS_VERSION) js > $@ + +build/frontend-$(LIBAVJS_VERSION)-%.mjs: build/frontend-$(LIBAVJS_VERSION)-%.js \ + configs/configs/%/components.txt funcs.json src/frontend.in.js \ + tools/mk-frontend.js + ./tools/mk-frontend.js $(*) $(LIBAVJS_VERSION) mjs > $@.tmp + ./tools/mk-es6.js ../build/frontend-$(LIBAVJS_VERSION)-$(*).js $@.tmp > $@ + rm -f $@.tmp -build/libav.types.d.ts build/libav-$(LIBAVJS_VERSION).in.mjs build/exports.json build/post.js: build/libav-$(LIBAVJS_VERSION).js - touch $@ +build/post-%.js: configs/configs/%/components.txt funcs.json tools/mk-post.js + mkdir -p build + ./tools/mk-post.js $(*) > $@ -build/libav-$(LIBAVJS_VERSION).mjs: build/libav-$(LIBAVJS_VERSION).in.mjs - ./tools/mk-es6.js ../build/libav-$(LIBAVJS_VERSION).js $< > $@ +build/libav.types.d.ts: funcs.json mk/doxygen.json tools/mk-types-dts.js + mkdir -p build + ./tools/mk-types-dts.js > $@ node_modules/.bin/terser: npm install diff --git a/Makefile.m4 b/Makefile.m4 index 0cb60ca2..fde4364d 100644 --- a/Makefile.m4 +++ b/Makefile.m4 @@ -18,10 +18,9 @@ THRFLAGS=-pthread $(EMFTFLAGS) ES6FLAGS=-sEXPORT_ES6=1 -sUSE_ES6_IMPORT_META=1 EFLAGS=\ `tools/memory-init-file-emcc.sh` \ - --pre-js pre.js \ - --post-js build/post.js --extern-post-js extern-post.js \ + --pre-js src/pre.js \ + --extern-post-js src/extern-post.js \ -s "EXPORT_NAME='LibAVFactory'" \ - -s "EXPORTED_FUNCTIONS=@build/exports.json" \ -s "EXPORTED_RUNTIME_METHODS=['ccall', 'cwrap', 'PThread']" \ -s MODULARIZE=1 \ -s STACK_SIZE=1048576 \ @@ -69,11 +68,10 @@ build-%: \ # Generic rule for frontend builds # Use: febuildrule(debug infix, target extension, minifier) define([[[febuildrule]]], [[[ -dist/libav-$(LIBAVJS_VERSION)-%$1.$2: build/libav-$(LIBAVJS_VERSION).$2 \ - dist/libav-$(LIBAVJS_VERSION)-%$1.wasm.$2 \ +dist/libav-$(LIBAVJS_VERSION)-%$1.$2: build/frontend-$(LIBAVJS_VERSION)-%.$2 \ node_modules/.bin/terser mkdir -p dist - sed "s/@CONFIG/$(*)/g ; s/@DBG/$1/g" < $< | $3 > $(@) + sed "s/@DBG/$1/g" < $< | $3 > $(@) dist/libav-%$1.$2: dist/libav-$(LIBAVJS_VERSION)-%$1.$2 cp $(<) $(@) @@ -88,35 +86,24 @@ dist/libav.types.d.ts: build/libav.types.d.ts mkdir -p dist cp $< $@ -# Link rule that checks for a library's existence before linking it -# Use: linkfflib(library name, target inst name) -define([[[linkfflib]]], [[[ \ - `test ! -e build/ffmpeg-$(FFMPEG_VERSION)/build-$2-$(*)/lib$1/lib$1.a || echo ' \ - -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-$2-$(*)/lib$1 -l$1 \ - '` \ -]]]) - # General build rule for any target # Use: buildrule(target file name, debug infix, target inst name, extra link flags, target file suffix) define([[[buildrule]]], [[[ dist/libav-$(LIBAVJS_VERSION)-%.$2$1.$5: build/ffmpeg-$(FFMPEG_VERSION)/build-$3-%/libavformat/libavformat.a \ - build/exports.json pre.js build/post.js extern-post.js bindings.c + build/exports-%.json src/pre.js build/post-%.js src/extern-post.js \ + src/bindings.c src/b-*.c mkdir -p $(@).d $(EMCC) $(OPTFLAGS) $(EFLAGS) \ + --post-js build/post-$(*).js \ + -s "EXPORTED_FUNCTIONS=@build/exports-$(*).json" \ -Ibuild/ffmpeg-$(FFMPEG_VERSION) -Ibuild/ffmpeg-$(FFMPEG_VERSION)/build-$3-$(*) \ `test ! -e configs/configs/$(*)/link-flags.txt || cat configs/configs/$(*)/link-flags.txt` \ - bindings.c \ + src/bindings.c \ `grep LIBAVJS_WITH_CLI configs/configs/$(*)/link-flags.txt > /dev/null 2>&1 && echo ' \ build/ffmpeg-$(FFMPEG_VERSION)/build-$3-$(*)/fftools/*.o \ -Lbuild/ffmpeg-$(FFMPEG_VERSION)/build-$3-$(*)/libavdevice -lavdevice \ '` \ - linkfflib(avutil, $3) \ - linkfflib(avformat, $3) \ - linkfflib(avcodec, $3) \ - linkfflib(avfilter, $3) \ - linkfflib(swresample, $3) \ - linkfflib(swscale, $3) \ - `test ! -e configs/configs/$(*)/libs.txt || sed 's/@TARGET/$3/' configs/configs/$(*)/libs.txt` \ + `test ! -e configs/configs/$(*)/libs.txt || sed 's/@FFVER/$(FFMPEG_VERSION)/ ; s/@TARGET/$3/ ; s/@VARIANT/$(*)/' configs/configs/$(*)/libs.txt` \ $4 \ -o $(@).d/libav-$(LIBAVJS_VERSION)-$(*).$2$1.$5 if [ -e $(@).d/libav-$(LIBAVJS_VERSION)-$(*).$2$1.wasm.map ] ; then \ @@ -155,15 +142,31 @@ buildrule(thr, [[[]]], thr, [[[$(ES6FLAGS) $(THRFLAGS) -sPTHREAD_POOL_SIZE=navig buildrule(thr, dbg., thr, [[[-gsource-map $(THRFLAGS) -sPTHREAD_POOL_SIZE=navigator.hardwareConcurrency]]], js) buildrule(thr, dbg., thr, [[[-gsource-map $(ES6FLAGS) $(THRFLAGS) -sPTHREAD_POOL_SIZE=navigator.hardwareConcurrency]]], mjs) -build/libav-$(LIBAVJS_VERSION).js: libav.in.js libav.types.in.d.ts post.in.js funcs.json tools/apply-funcs.js - mkdir -p build dist - ./tools/apply-funcs.js $(LIBAVJS_VERSION) +# Built source files +build/exports-%.json: configs/configs/%/components.txt funcs.json \ + tools/mk-exports.js + mkdir -p build + ./tools/mk-exports.js $(*) > $@ + +build/frontend-$(LIBAVJS_VERSION)-%.js: configs/configs/%/components.txt \ + funcs.json src/frontend.in.js tools/mk-frontend.js + mkdir -p build + ./tools/mk-frontend.js $(*) $(LIBAVJS_VERSION) js > $@ + +build/frontend-$(LIBAVJS_VERSION)-%.mjs: build/frontend-$(LIBAVJS_VERSION)-%.js \ + configs/configs/%/components.txt funcs.json src/frontend.in.js \ + tools/mk-frontend.js + ./tools/mk-frontend.js $(*) $(LIBAVJS_VERSION) mjs > $@.tmp + ./tools/mk-es6.js ../build/frontend-$(LIBAVJS_VERSION)-$(*).js $@.tmp > $@ + rm -f $@.tmp -build/libav.types.d.ts build/libav-$(LIBAVJS_VERSION).in.mjs build/exports.json build/post.js: build/libav-$(LIBAVJS_VERSION).js - touch $@ +build/post-%.js: configs/configs/%/components.txt funcs.json tools/mk-post.js + mkdir -p build + ./tools/mk-post.js $(*) > $@ -build/libav-$(LIBAVJS_VERSION).mjs: build/libav-$(LIBAVJS_VERSION).in.mjs - ./tools/mk-es6.js ../build/libav-$(LIBAVJS_VERSION).js $< > $@ +build/libav.types.d.ts: funcs.json mk/doxygen.json tools/mk-types-dts.js + mkdir -p build + ./tools/mk-types-dts.js > $@ node_modules/.bin/terser: npm install diff --git a/configs/configs/a-few-formats/components.txt b/configs/configs/a-few-formats/components.txt new file mode 100644 index 00000000..ed392a9a --- /dev/null +++ b/configs/configs/a-few-formats/components.txt @@ -0,0 +1,4 @@ +c +avutil +avformat +avfcbridge diff --git a/configs/configs/a-few-formats/config.json b/configs/configs/a-few-formats/config.json new file mode 100644 index 00000000..74aa2b58 --- /dev/null +++ b/configs/configs/a-few-formats/config.json @@ -0,0 +1 @@ +["avformat","avfcbridge","format-ogg","format-webm","format-wav"] diff --git a/configs/configs/a-few-formats/deps.mk b/configs/configs/a-few-formats/deps.mk new file mode 100644 index 00000000..e69de29b diff --git a/configs/configs/a-few-formats/ffmpeg-config.txt b/configs/configs/a-few-formats/ffmpeg-config.txt new file mode 100644 index 00000000..c2e2185c --- /dev/null +++ b/configs/configs/a-few-formats/ffmpeg-config.txt @@ -0,0 +1,10 @@ +--enable-protocol=data --enable-protocol=file +--enable-filter=aresample +--enable-demuxer=ogg +--enable-muxer=ogg +--enable-demuxer=matroska +--enable-muxer=matroska --enable-muxer=webm +--enable-decoder=pcm_s16le --enable-decoder=pcm_s24le +--enable-demuxer=wav +--enable-encoder=pcm_s16le --enable-encoder=pcm_s24le +--enable-muxer=wav diff --git a/configs/configs/a-few-formats/libs.txt b/configs/configs/a-few-formats/libs.txt new file mode 100644 index 00000000..a1af5902 --- /dev/null +++ b/configs/configs/a-few-formats/libs.txt @@ -0,0 +1,3 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a diff --git a/configs/configs/a-few-formats/license.js b/configs/configs/a-few-formats/license.js new file mode 100644 index 00000000..a5c49432 --- /dev/null +++ b/configs/configs/a-few-formats/license.js @@ -0,0 +1,567 @@ + * + * This software is compiled from several sources, the licenses for which are + * included herein. + * + * --- + * + * ffmpeg: + * + * Copyright (c) 2000-2024 Fabrice Bellard et al + * + * GNU LESSER GENERAL PUBLIC LICENSE + * Version 2.1, February 1999 + * + * Copyright (C) 1991, 1999 Free Software Foundation, Inc. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Everyone is permitted to copy and distribute verbatim copies + * of this license document, but changing it is not allowed. + * + * [This is the first released version of the Lesser GPL. It also counts + * as the successor of the GNU Library Public License, version 2, hence + * the version number 2.1.] + * + * Preamble + * + * The licenses for most software are designed to take away your + * freedom to share and change it. By contrast, the GNU General Public + * Licenses are intended to guarantee your freedom to share and change + * free software--to make sure the software is free for all its users. + * + * This license, the Lesser General Public License, applies to some + * specially designated software packages--typically libraries--of the + * Free Software Foundation and other authors who decide to use it. You + * can use it too, but we suggest you first think carefully about whether + * this license or the ordinary General Public License is the better + * strategy to use in any particular case, based on the explanations below. + * + * When we speak of free software, we are referring to freedom of use, + * not price. Our General Public Licenses are designed to make sure that + * you have the freedom to distribute copies of free software (and charge + * for this service if you wish); that you receive source code or can get + * it if you want it; that you can change the software and use pieces of + * it in new free programs; and that you are informed that you can do + * these things. + * + * To protect your rights, we need to make restrictions that forbid + * distributors to deny you these rights or to ask you to surrender these + * rights. These restrictions translate to certain responsibilities for + * you if you distribute copies of the library or if you modify it. + * + * For example, if you distribute copies of the library, whether gratis + * or for a fee, you must give the recipients all the rights that we gave + * you. You must make sure that they, too, receive or can get the source + * code. If you link other code with the library, you must provide + * complete object files to the recipients, so that they can relink them + * with the library after making changes to the library and recompiling + * it. And you must show them these terms so they know their rights. + * + * We protect your rights with a two-step method: (1) we copyright the + * library, and (2) we offer you this license, which gives you legal + * permission to copy, distribute and/or modify the library. + * + * To protect each distributor, we want to make it very clear that + * there is no warranty for the free library. Also, if the library is + * modified by someone else and passed on, the recipients should know + * that what they have is not the original version, so that the original + * author's reputation will not be affected by problems that might be + * introduced by others. + * + * Finally, software patents pose a constant threat to the existence of + * any free program. We wish to make sure that a company cannot + * effectively restrict the users of a free program by obtaining a + * restrictive license from a patent holder. Therefore, we insist that + * any patent license obtained for a version of the library must be + * consistent with the full freedom of use specified in this license. + * + * Most GNU software, including some libraries, is covered by the + * ordinary GNU General Public License. This license, the GNU Lesser + * General Public License, applies to certain designated libraries, and + * is quite different from the ordinary General Public License. We use + * this license for certain libraries in order to permit linking those + * libraries into non-free programs. + * + * When a program is linked with a library, whether statically or using + * a shared library, the combination of the two is legally speaking a + * combined work, a derivative of the original library. The ordinary + * General Public License therefore permits such linking only if the + * entire combination fits its criteria of freedom. The Lesser General + * Public License permits more lax criteria for linking other code with + * the library. + * + * We call this license the "Lesser" General Public License because it + * does Less to protect the user's freedom than the ordinary General + * Public License. It also provides other free software developers Less + * of an advantage over competing non-free programs. These disadvantages + * are the reason we use the ordinary General Public License for many + * libraries. However, the Lesser license provides advantages in certain + * special circumstances. + * + * For example, on rare occasions, there may be a special need to + * encourage the widest possible use of a certain library, so that it becomes + * a de-facto standard. To achieve this, non-free programs must be + * allowed to use the library. A more frequent case is that a free + * library does the same job as widely used non-free libraries. In this + * case, there is little to gain by limiting the free library to free + * software only, so we use the Lesser General Public License. + * + * In other cases, permission to use a particular library in non-free + * programs enables a greater number of people to use a large body of + * free software. For example, permission to use the GNU C Library in + * non-free programs enables many more people to use the whole GNU + * operating system, as well as its variant, the GNU/Linux operating + * system. + * + * Although the Lesser General Public License is Less protective of the + * users' freedom, it does ensure that the user of a program that is + * linked with the Library has the freedom and the wherewithal to run + * that program using a modified version of the Library. + * + * The precise terms and conditions for copying, distribution and + * modification follow. Pay close attention to the difference between a + * "work based on the library" and a "work that uses the library". The + * former contains code derived from the library, whereas the latter must + * be combined with the library in order to run. + * + * GNU LESSER GENERAL PUBLIC LICENSE + * TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + * + * 0. This License Agreement applies to any software library or other + * program which contains a notice placed by the copyright holder or + * other authorized party saying it may be distributed under the terms of + * this Lesser General Public License (also called "this License"). + * Each licensee is addressed as "you". + * + * A "library" means a collection of software functions and/or data + * prepared so as to be conveniently linked with application programs + * (which use some of those functions and data) to form executables. + * + * The "Library", below, refers to any such software library or work + * which has been distributed under these terms. A "work based on the + * Library" means either the Library or any derivative work under + * copyright law: that is to say, a work containing the Library or a + * portion of it, either verbatim or with modifications and/or translated + * straightforwardly into another language. (Hereinafter, translation is + * included without limitation in the term "modification".) + * + * "Source code" for a work means the preferred form of the work for + * making modifications to it. For a library, complete source code means + * all the source code for all modules it contains, plus any associated + * interface definition files, plus the scripts used to control compilation + * and installation of the library. + * + * Activities other than copying, distribution and modification are not + * covered by this License; they are outside its scope. The act of + * running a program using the Library is not restricted, and output from + * such a program is covered only if its contents constitute a work based + * on the Library (independent of the use of the Library in a tool for + * writing it). Whether that is true depends on what the Library does + * and what the program that uses the Library does. + * + * 1. You may copy and distribute verbatim copies of the Library's + * complete source code as you receive it, in any medium, provided that + * you conspicuously and appropriately publish on each copy an + * appropriate copyright notice and disclaimer of warranty; keep intact + * all the notices that refer to this License and to the absence of any + * warranty; and distribute a copy of this License along with the + * Library. + * + * You may charge a fee for the physical act of transferring a copy, + * and you may at your option offer warranty protection in exchange for a + * fee. + * + * 2. You may modify your copy or copies of the Library or any portion + * of it, thus forming a work based on the Library, and copy and + * distribute such modifications or work under the terms of Section 1 + * above, provided that you also meet all of these conditions: + * + * a) The modified work must itself be a software library. + * + * b) You must cause the files modified to carry prominent notices + * stating that you changed the files and the date of any change. + * + * c) You must cause the whole of the work to be licensed at no + * charge to all third parties under the terms of this License. + * + * d) If a facility in the modified Library refers to a function or a + * table of data to be supplied by an application program that uses + * the facility, other than as an argument passed when the facility + * is invoked, then you must make a good faith effort to ensure that, + * in the event an application does not supply such function or + * table, the facility still operates, and performs whatever part of + * its purpose remains meaningful. + * + * (For example, a function in a library to compute square roots has + * a purpose that is entirely well-defined independent of the + * application. Therefore, Subsection 2d requires that any + * application-supplied function or table used by this function must + * be optional: if the application does not supply it, the square + * root function must still compute square roots.) + * + * These requirements apply to the modified work as a whole. If + * identifiable sections of that work are not derived from the Library, + * and can be reasonably considered independent and separate works in + * themselves, then this License, and its terms, do not apply to those + * sections when you distribute them as separate works. But when you + * distribute the same sections as part of a whole which is a work based + * on the Library, the distribution of the whole must be on the terms of + * this License, whose permissions for other licensees extend to the + * entire whole, and thus to each and every part regardless of who wrote + * it. + * + * Thus, it is not the intent of this section to claim rights or contest + * your rights to work written entirely by you; rather, the intent is to + * exercise the right to control the distribution of derivative or + * collective works based on the Library. + * + * In addition, mere aggregation of another work not based on the Library + * with the Library (or with a work based on the Library) on a volume of + * a storage or distribution medium does not bring the other work under + * the scope of this License. + * + * 3. You may opt to apply the terms of the ordinary GNU General Public + * License instead of this License to a given copy of the Library. To do + * this, you must alter all the notices that refer to this License, so + * that they refer to the ordinary GNU General Public License, version 2, + * instead of to this License. (If a newer version than version 2 of the + * ordinary GNU General Public License has appeared, then you can specify + * that version instead if you wish.) Do not make any other change in + * these notices. + * + * Once this change is made in a given copy, it is irreversible for + * that copy, so the ordinary GNU General Public License applies to all + * subsequent copies and derivative works made from that copy. + * + * This option is useful when you wish to copy part of the code of + * the Library into a program that is not a library. + * + * 4. You may copy and distribute the Library (or a portion or + * derivative of it, under Section 2) in object code or executable form + * under the terms of Sections 1 and 2 above provided that you accompany + * it with the complete corresponding machine-readable source code, which + * must be distributed under the terms of Sections 1 and 2 above on a + * medium customarily used for software interchange. + * + * If distribution of object code is made by offering access to copy + * from a designated place, then offering equivalent access to copy the + * source code from the same place satisfies the requirement to + * distribute the source code, even though third parties are not + * compelled to copy the source along with the object code. + * + * 5. A program that contains no derivative of any portion of the + * Library, but is designed to work with the Library by being compiled or + * linked with it, is called a "work that uses the Library". Such a + * work, in isolation, is not a derivative work of the Library, and + * therefore falls outside the scope of this License. + * + * However, linking a "work that uses the Library" with the Library + * creates an executable that is a derivative of the Library (because it + * contains portions of the Library), rather than a "work that uses the + * library". The executable is therefore covered by this License. + * Section 6 states terms for distribution of such executables. + * + * When a "work that uses the Library" uses material from a header file + * that is part of the Library, the object code for the work may be a + * derivative work of the Library even though the source code is not. + * Whether this is true is especially significant if the work can be + * linked without the Library, or if the work is itself a library. The + * threshold for this to be true is not precisely defined by law. + * + * If such an object file uses only numerical parameters, data + * structure layouts and accessors, and small macros and small inline + * functions (ten lines or less in length), then the use of the object + * file is unrestricted, regardless of whether it is legally a derivative + * work. (Executables containing this object code plus portions of the + * Library will still fall under Section 6.) + * + * Otherwise, if the work is a derivative of the Library, you may + * distribute the object code for the work under the terms of Section 6. + * Any executables containing that work also fall under Section 6, + * whether or not they are linked directly with the Library itself. + * + * 6. As an exception to the Sections above, you may also combine or + * link a "work that uses the Library" with the Library to produce a + * work containing portions of the Library, and distribute that work + * under terms of your choice, provided that the terms permit + * modification of the work for the customer's own use and reverse + * engineering for debugging such modifications. + * + * You must give prominent notice with each copy of the work that the + * Library is used in it and that the Library and its use are covered by + * this License. You must supply a copy of this License. If the work + * during execution displays copyright notices, you must include the + * copyright notice for the Library among them, as well as a reference + * directing the user to the copy of this License. Also, you must do one + * of these things: + * + * a) Accompany the work with the complete corresponding + * machine-readable source code for the Library including whatever + * changes were used in the work (which must be distributed under + * Sections 1 and 2 above); and, if the work is an executable linked + * with the Library, with the complete machine-readable "work that + * uses the Library", as object code and/or source code, so that the + * user can modify the Library and then relink to produce a modified + * executable containing the modified Library. (It is understood + * that the user who changes the contents of definitions files in the + * Library will not necessarily be able to recompile the application + * to use the modified definitions.) + * + * b) Use a suitable shared library mechanism for linking with the + * Library. A suitable mechanism is one that (1) uses at run time a + * copy of the library already present on the user's computer system, + * rather than copying library functions into the executable, and (2) + * will operate properly with a modified version of the library, if + * the user installs one, as long as the modified version is + * interface-compatible with the version that the work was made with. + * + * c) Accompany the work with a written offer, valid for at + * least three years, to give the same user the materials + * specified in Subsection 6a, above, for a charge no more + * than the cost of performing this distribution. + * + * d) If distribution of the work is made by offering access to copy + * from a designated place, offer equivalent access to copy the above + * specified materials from the same place. + * + * e) Verify that the user has already received a copy of these + * materials or that you have already sent this user a copy. + * + * For an executable, the required form of the "work that uses the + * Library" must include any data and utility programs needed for + * reproducing the executable from it. However, as a special exception, + * the materials to be distributed need not include anything that is + * normally distributed (in either source or binary form) with the major + * components (compiler, kernel, and so on) of the operating system on + * which the executable runs, unless that component itself accompanies + * the executable. + * + * It may happen that this requirement contradicts the license + * restrictions of other proprietary libraries that do not normally + * accompany the operating system. Such a contradiction means you cannot + * use both them and the Library together in an executable that you + * distribute. + * + * 7. You may place library facilities that are a work based on the + * Library side-by-side in a single library together with other library + * facilities not covered by this License, and distribute such a combined + * library, provided that the separate distribution of the work based on + * the Library and of the other library facilities is otherwise + * permitted, and provided that you do these two things: + * + * a) Accompany the combined library with a copy of the same work + * based on the Library, uncombined with any other library + * facilities. This must be distributed under the terms of the + * Sections above. + * + * b) Give prominent notice with the combined library of the fact + * that part of it is a work based on the Library, and explaining + * where to find the accompanying uncombined form of the same work. + * + * 8. You may not copy, modify, sublicense, link with, or distribute + * the Library except as expressly provided under this License. Any + * attempt otherwise to copy, modify, sublicense, link with, or + * distribute the Library is void, and will automatically terminate your + * rights under this License. However, parties who have received copies, + * or rights, from you under this License will not have their licenses + * terminated so long as such parties remain in full compliance. + * + * 9. You are not required to accept this License, since you have not + * signed it. However, nothing else grants you permission to modify or + * distribute the Library or its derivative works. These actions are + * prohibited by law if you do not accept this License. Therefore, by + * modifying or distributing the Library (or any work based on the + * Library), you indicate your acceptance of this License to do so, and + * all its terms and conditions for copying, distributing or modifying + * the Library or works based on it. + * + * 10. Each time you redistribute the Library (or any work based on the + * Library), the recipient automatically receives a license from the + * original licensor to copy, distribute, link with or modify the Library + * subject to these terms and conditions. You may not impose any further + * restrictions on the recipients' exercise of the rights granted herein. + * You are not responsible for enforcing compliance by third parties with + * this License. + * + * 11. If, as a consequence of a court judgment or allegation of patent + * infringement or for any other reason (not limited to patent issues), + * conditions are imposed on you (whether by court order, agreement or + * otherwise) that contradict the conditions of this License, they do not + * excuse you from the conditions of this License. If you cannot + * distribute so as to satisfy simultaneously your obligations under this + * License and any other pertinent obligations, then as a consequence you + * may not distribute the Library at all. For example, if a patent + * license would not permit royalty-free redistribution of the Library by + * all those who receive copies directly or indirectly through you, then + * the only way you could satisfy both it and this License would be to + * refrain entirely from distribution of the Library. + * + * If any portion of this section is held invalid or unenforceable under any + * particular circumstance, the balance of the section is intended to apply, + * and the section as a whole is intended to apply in other circumstances. + * + * It is not the purpose of this section to induce you to infringe any + * patents or other property right claims or to contest validity of any + * such claims; this section has the sole purpose of protecting the + * integrity of the free software distribution system which is + * implemented by public license practices. Many people have made + * generous contributions to the wide range of software distributed + * through that system in reliance on consistent application of that + * system; it is up to the author/donor to decide if he or she is willing + * to distribute software through any other system and a licensee cannot + * impose that choice. + * + * This section is intended to make thoroughly clear what is believed to + * be a consequence of the rest of this License. + * + * 12. If the distribution and/or use of the Library is restricted in + * certain countries either by patents or by copyrighted interfaces, the + * original copyright holder who places the Library under this License may add + * an explicit geographical distribution limitation excluding those countries, + * so that distribution is permitted only in or among countries not thus + * excluded. In such case, this License incorporates the limitation as if + * written in the body of this License. + * + * 13. The Free Software Foundation may publish revised and/or new + * versions of the Lesser General Public License from time to time. + * Such new versions will be similar in spirit to the present version, + * but may differ in detail to address new problems or concerns. + * + * Each version is given a distinguishing version number. If the Library + * specifies a version number of this License which applies to it and + * "any later version", you have the option of following the terms and + * conditions either of that version or of any later version published by + * the Free Software Foundation. If the Library does not specify a + * license version number, you may choose any version ever published by + * the Free Software Foundation. + * + * 14. If you wish to incorporate parts of the Library into other free + * programs whose distribution conditions are incompatible with these, + * write to the author to ask for permission. For software which is + * copyrighted by the Free Software Foundation, write to the Free + * Software Foundation; we sometimes make exceptions for this. Our + * decision will be guided by the two goals of preserving the free status + * of all derivatives of our free software and of promoting the sharing + * and reuse of software generally. + * + * NO WARRANTY + * + * 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO + * WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. + * EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR + * OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY + * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE + * LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME + * THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + * + * 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN + * WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY + * AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU + * FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR + * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE + * LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING + * RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A + * FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF + * SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGES. + * + * END OF TERMS AND CONDITIONS + * + * How to Apply These Terms to Your New Libraries + * + * If you develop a new library, and you want it to be of the greatest + * possible use to the public, we recommend making it free software that + * everyone can redistribute and change. You can do so by permitting + * redistribution under these terms (or, alternatively, under the terms of the + * ordinary General Public License). + * + * To apply these terms, attach the following notices to the library. It is + * safest to attach them to the start of each source file to most effectively + * convey the exclusion of warranty; and each file should have at least the + * "copyright" line and a pointer to where the full notice is found. + * + * + * Copyright (C) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Also add information on how to contact you by electronic and paper mail. + * + * You should also get your employer (if you work as a programmer) or your + * school, if any, to sign a "copyright disclaimer" for the library, if + * necessary. Here is a sample; alter the names: + * + * Yoyodyne, Inc., hereby disclaims all copyright interest in the + * library `Frob' (a library for tweaking knobs) written by James Random Hacker. + * + * , 1 April 1990 + * Ty Coon, President of Vice + * + * That's all there is to it! + * + * + * --- + * + * ffmpeg oggdec: + * + * Copyright (C) 2005 Michael Ahlberg, Måns Rullgård + * Copyright (C) 2005 Matthieu CASTET, Alex Beregszaszi + * Copyright (C) 2008 Reimar Döffinger + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * + * --- + * + * emscripten and musl: + * + * Copyright (c) 2010-2024 Emscripten authors, see AUTHORS file. + * Copyright © 2005-2024 Rich Felker, et al. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * diff --git a/configs/configs/a-few-formats/link-flags.txt b/configs/configs/a-few-formats/link-flags.txt new file mode 100644 index 00000000..5e7d7613 --- /dev/null +++ b/configs/configs/a-few-formats/link-flags.txt @@ -0,0 +1,2 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 diff --git a/configs/configs/aac-af/components.txt b/configs/configs/aac-af/components.txt new file mode 100644 index 00000000..228f8505 --- /dev/null +++ b/configs/configs/aac-af/components.txt @@ -0,0 +1,6 @@ +c +avutil +avformat +avfcbridge +avcodec +avfilter diff --git a/configs/configs/aac-af/config.json b/configs/configs/aac-af/config.json index 3e5d0235..4ec0d3e8 100644 --- a/configs/configs/aac-af/config.json +++ b/configs/configs/aac-af/config.json @@ -1 +1 @@ -["format-mp4","format-aac","format-webm","parser-aac","codec-aac","audio-filters"] +["avformat","avcodec","format-mp4","format-aac","format-webm","parser-aac","codec-aac","avfilter","swresample","audio-filters"] diff --git a/configs/configs/aac-af/libs.txt b/configs/configs/aac-af/libs.txt index e69de29b..9a14ba31 100644 --- a/configs/configs/aac-af/libs.txt +++ b/configs/configs/aac-af/libs.txt @@ -0,0 +1,5 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavfilter/libavfilter.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswresample/libswresample.a diff --git a/configs/configs/aac-af/link-flags.txt b/configs/configs/aac-af/link-flags.txt index e69de29b..e3e72004 100644 --- a/configs/configs/aac-af/link-flags.txt +++ b/configs/configs/aac-af/link-flags.txt @@ -0,0 +1,4 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 +-DLIBAVJS_WITH_AVFILTER=1 +-DLIBAVJS_WITH_SWRESAMPLE=1 diff --git a/configs/configs/aac/components.txt b/configs/configs/aac/components.txt new file mode 100644 index 00000000..25dcbb1f --- /dev/null +++ b/configs/configs/aac/components.txt @@ -0,0 +1,5 @@ +c +avutil +avformat +avfcbridge +avcodec diff --git a/configs/configs/aac/config.json b/configs/configs/aac/config.json index b4d8857b..dacb4304 100644 --- a/configs/configs/aac/config.json +++ b/configs/configs/aac/config.json @@ -1 +1 @@ -["format-mp4","format-aac","format-webm","parser-aac","codec-aac"] +["avformat","avcodec","format-mp4","format-aac","format-webm","parser-aac","codec-aac"] diff --git a/configs/configs/aac/libs.txt b/configs/configs/aac/libs.txt index e69de29b..a1af5902 100644 --- a/configs/configs/aac/libs.txt +++ b/configs/configs/aac/libs.txt @@ -0,0 +1,3 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a diff --git a/configs/configs/aac/link-flags.txt b/configs/configs/aac/link-flags.txt index e69de29b..bd0c5e59 100644 --- a/configs/configs/aac/link-flags.txt +++ b/configs/configs/aac/link-flags.txt @@ -0,0 +1,2 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 diff --git a/configs/configs/all/components.txt b/configs/configs/all/components.txt new file mode 100644 index 00000000..20d0c5fb --- /dev/null +++ b/configs/configs/all/components.txt @@ -0,0 +1,9 @@ +c +avutil +avformat +avfcbridge +avcodec +avfilter +cli +swscale +avfcbridge diff --git a/configs/configs/all/config.json b/configs/configs/all/config.json index 5eec9e95..8c05fa0a 100644 --- a/configs/configs/all/config.json +++ b/configs/configs/all/config.json @@ -1 +1 @@ -["format-ogg","format-webm","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","audio-filters","cli","codec-libvorbis","format-mp3","decoder-mp3","encoder-libmp3lame","format-mp4","format-aac","parser-aac","codec-aac","libvpx","parser-vp8","codec-libvpx_vp8","swscale","video-filters","parser-vp9","codec-libvpx_vp9","parser-av1","codec-libaom_av1","parser-h264","decoder-h264","codec-libopenh264","parser-hevc","decoder-hevc","bsf-extract_extradata","bsf-vp9_metadata","bsf-av1_metadata","bsf-h264_metadata","bsf-hevc_metadata","format-image2","demuxer-image_gif_pipe","demuxer-image_jpeg_pipe","demuxer-image_png_pipe","parser-gif","codec-gif","parser-mjpeg","codec-mjpeg","parser-png","codec-png","parser-webp","decoder-webp","format-rawvideo","codec-rawvideo","format-pcm_f32le","codec-alac","codec-prores","codec-qtrle","format-hls","protocol-jsfetch"] +["avformat","avcodec","avfilter","swresample","format-ogg","format-webm","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","audio-filters","cli","codec-libvorbis","format-mp3","decoder-mp3","encoder-libmp3lame","format-mp4","format-aac","parser-aac","codec-aac","libvpx","parser-vp8","codec-libvpx_vp8","swscale","video-filters","parser-vp9","codec-libvpx_vp9","parser-av1","codec-libaom_av1","parser-h264","decoder-h264","codec-libopenh264","parser-hevc","decoder-hevc","bsf-extract_extradata","bsf-vp9_metadata","bsf-av1_metadata","bsf-h264_metadata","bsf-hevc_metadata","avfcbridge","format-avi","format-mpeg","format-mpegts","format-image2","demuxer-image_gif_pipe","demuxer-image_jpeg_pipe","demuxer-image_png_pipe","parser-gif","codec-gif","parser-mjpeg","codec-mjpeg","parser-png","codec-png","parser-webp","decoder-webp","format-rawvideo","codec-rawvideo","format-pcm_f32le","codec-alac","codec-prores","codec-qtrle","format-hls","protocol-jsfetch"] diff --git a/configs/configs/all/ffmpeg-config.txt b/configs/configs/all/ffmpeg-config.txt index 4d2315ad..9f69fa34 100644 --- a/configs/configs/all/ffmpeg-config.txt +++ b/configs/configs/all/ffmpeg-config.txt @@ -81,6 +81,12 @@ --enable-bsf=av1_metadata --enable-bsf=h264_metadata --enable-bsf=hevc_metadata +--enable-demuxer=avi +--enable-muxer=avi +--enable-demuxer=mpeg +--enable-muxer=mpeg +--enable-demuxer=mpegts +--enable-muxer=mpegts --enable-demuxer=image2 --enable-muxer=image2 --enable-demuxer=image_gif_pipe diff --git a/configs/configs/all/libs.txt b/configs/configs/all/libs.txt index cd6afead..05462d9d 100644 --- a/configs/configs/all/libs.txt +++ b/configs/configs/all/libs.txt @@ -1,9 +1,16 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavfilter/libavfilter.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswresample/libswresample.a build/inst/@TARGET/lib/libopus.a build/inst/@TARGET/lib/libvorbis.a build/inst/@TARGET/lib/libvorbisenc.a build/inst/@TARGET/lib/libogg.a build/inst/@TARGET/lib/libmp3lame.a build/inst/@TARGET/lib/libvpx.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswscale/libswscale.a build/inst/@TARGET/lib/libaom.a build/inst/@TARGET/lib/libopenh264.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a build/inst/@TARGET/lib/libz.a diff --git a/configs/configs/all/link-flags.txt b/configs/configs/all/link-flags.txt index 7710eac3..900b9265 100644 --- a/configs/configs/all/link-flags.txt +++ b/configs/configs/all/link-flags.txt @@ -1,4 +1,9 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 +-DLIBAVJS_WITH_AVFILTER=1 +-DLIBAVJS_WITH_SWRESAMPLE=1 -DLIBAVJS_WITH_CLI=1 -DLIBAVJS_WITH_SWSCALE=1 -DLIBAVJS_WITH_SWSCALE=1 -lstdc++ -lm -lpthread -s ERROR_ON_UNDEFINED_SYMBOLS=0 +-DLIBAVJS_WITH_AVCODEC=1 diff --git a/configs/configs/av1-opus-avf/components.txt b/configs/configs/av1-opus-avf/components.txt new file mode 100644 index 00000000..d8421f3d --- /dev/null +++ b/configs/configs/av1-opus-avf/components.txt @@ -0,0 +1,7 @@ +c +avutil +avformat +avfcbridge +avcodec +avfilter +swscale diff --git a/configs/configs/av1-opus-avf/config.json b/configs/configs/av1-opus-avf/config.json index 6e551035..0f767e65 100644 --- a/configs/configs/av1-opus-avf/config.json +++ b/configs/configs/av1-opus-avf/config.json @@ -1 +1 @@ -["format-ogg","format-webm","parser-opus","codec-libopus","parser-av1","codec-libaom_av1","audio-filters","swscale","video-filters"] +["avformat","avcodec","format-ogg","format-webm","parser-opus","codec-libopus","parser-av1","codec-libaom_av1","avfilter","swresample","swscale","audio-filters","video-filters"] diff --git a/configs/configs/av1-opus-avf/ffmpeg-config.txt b/configs/configs/av1-opus-avf/ffmpeg-config.txt index 564d785b..602bb081 100644 --- a/configs/configs/av1-opus-avf/ffmpeg-config.txt +++ b/configs/configs/av1-opus-avf/ffmpeg-config.txt @@ -15,6 +15,7 @@ --enable-bsf=av1_metadata --enable-bsf=extract_extradata --enable-encoder=libaom_av1 +--enable-filter=scale --enable-filter=acompressor --enable-filter=adeclick --enable-filter=adeclip --enable-filter=aecho --enable-filter=afade --enable-filter=aformat --enable-filter=agate --enable-filter=alimiter --enable-filter=amix @@ -23,6 +24,5 @@ --enable-filter=bandreject --enable-filter=dynaudnorm --enable-filter=equalizer --enable-filter=loudnorm --enable-filter=pan --enable-filter=amix --enable-filter=volume --enable-filter=anull ---enable-filter=scale --enable-filter=crop --enable-filter=fps --enable-filter=null --enable-filter=settb --enable-filter=split --enable-filter=trim diff --git a/configs/configs/av1-opus-avf/libs.txt b/configs/configs/av1-opus-avf/libs.txt index 102c70d8..fa555646 100644 --- a/configs/configs/av1-opus-avf/libs.txt +++ b/configs/configs/av1-opus-avf/libs.txt @@ -1,2 +1,8 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a build/inst/@TARGET/lib/libopus.a build/inst/@TARGET/lib/libaom.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavfilter/libavfilter.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswresample/libswresample.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswscale/libswscale.a diff --git a/configs/configs/av1-opus-avf/link-flags.txt b/configs/configs/av1-opus-avf/link-flags.txt index 308036f3..4d12cb08 100644 --- a/configs/configs/av1-opus-avf/link-flags.txt +++ b/configs/configs/av1-opus-avf/link-flags.txt @@ -1 +1,5 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 +-DLIBAVJS_WITH_AVFILTER=1 +-DLIBAVJS_WITH_SWRESAMPLE=1 -DLIBAVJS_WITH_SWSCALE=1 diff --git a/configs/configs/av1-opus/components.txt b/configs/configs/av1-opus/components.txt new file mode 100644 index 00000000..25dcbb1f --- /dev/null +++ b/configs/configs/av1-opus/components.txt @@ -0,0 +1,5 @@ +c +avutil +avformat +avfcbridge +avcodec diff --git a/configs/configs/av1-opus/config.json b/configs/configs/av1-opus/config.json index 31e83709..d77ffa64 100644 --- a/configs/configs/av1-opus/config.json +++ b/configs/configs/av1-opus/config.json @@ -1 +1 @@ -["format-ogg","format-webm","parser-opus","codec-libopus","parser-av1","codec-libaom_av1"] +["avformat","avcodec","format-ogg","format-webm","parser-opus","codec-libopus","parser-av1","codec-libaom_av1"] diff --git a/configs/configs/av1-opus/libs.txt b/configs/configs/av1-opus/libs.txt index 102c70d8..911caf89 100644 --- a/configs/configs/av1-opus/libs.txt +++ b/configs/configs/av1-opus/libs.txt @@ -1,2 +1,5 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a build/inst/@TARGET/lib/libopus.a build/inst/@TARGET/lib/libaom.a diff --git a/configs/configs/av1-opus/link-flags.txt b/configs/configs/av1-opus/link-flags.txt index e69de29b..bd0c5e59 100644 --- a/configs/configs/av1-opus/link-flags.txt +++ b/configs/configs/av1-opus/link-flags.txt @@ -0,0 +1,2 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 diff --git a/configs/configs/common-formats/components.txt b/configs/configs/common-formats/components.txt new file mode 100644 index 00000000..ed392a9a --- /dev/null +++ b/configs/configs/common-formats/components.txt @@ -0,0 +1,4 @@ +c +avutil +avformat +avfcbridge diff --git a/configs/configs/common-formats/config.json b/configs/configs/common-formats/config.json new file mode 100644 index 00000000..69849049 --- /dev/null +++ b/configs/configs/common-formats/config.json @@ -0,0 +1 @@ +["avformat","avfcbridge","format-webm","format-mp4","format-ogg","format-flac","format-aac","format-avi","format-wav","format-mpeg","format-mpegts","format-mp3"] diff --git a/configs/configs/common-formats/deps.mk b/configs/configs/common-formats/deps.mk new file mode 100644 index 00000000..e69de29b diff --git a/configs/configs/common-formats/ffmpeg-config.txt b/configs/configs/common-formats/ffmpeg-config.txt new file mode 100644 index 00000000..59c47895 --- /dev/null +++ b/configs/configs/common-formats/ffmpeg-config.txt @@ -0,0 +1,25 @@ +--enable-protocol=data --enable-protocol=file +--enable-filter=aresample +--enable-demuxer=matroska +--enable-muxer=matroska --enable-muxer=webm +--enable-demuxer=mov +--enable-muxer=ipod +--enable-muxer=mov +--enable-muxer=mp4 +--enable-demuxer=ogg +--enable-muxer=ogg +--enable-demuxer=flac +--enable-muxer=flac +--enable-demuxer=aac +--enable-demuxer=avi +--enable-muxer=avi +--enable-decoder=pcm_s16le --enable-decoder=pcm_s24le +--enable-demuxer=wav +--enable-encoder=pcm_s16le --enable-encoder=pcm_s24le +--enable-muxer=wav +--enable-demuxer=mpeg +--enable-muxer=mpeg +--enable-demuxer=mpegts +--enable-muxer=mpegts +--enable-demuxer=mp3 +--enable-muxer=mp3 diff --git a/configs/configs/common-formats/libs.txt b/configs/configs/common-formats/libs.txt new file mode 100644 index 00000000..a1af5902 --- /dev/null +++ b/configs/configs/common-formats/libs.txt @@ -0,0 +1,3 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a diff --git a/configs/configs/common-formats/license.js b/configs/configs/common-formats/license.js new file mode 100644 index 00000000..a5c49432 --- /dev/null +++ b/configs/configs/common-formats/license.js @@ -0,0 +1,567 @@ + * + * This software is compiled from several sources, the licenses for which are + * included herein. + * + * --- + * + * ffmpeg: + * + * Copyright (c) 2000-2024 Fabrice Bellard et al + * + * GNU LESSER GENERAL PUBLIC LICENSE + * Version 2.1, February 1999 + * + * Copyright (C) 1991, 1999 Free Software Foundation, Inc. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Everyone is permitted to copy and distribute verbatim copies + * of this license document, but changing it is not allowed. + * + * [This is the first released version of the Lesser GPL. It also counts + * as the successor of the GNU Library Public License, version 2, hence + * the version number 2.1.] + * + * Preamble + * + * The licenses for most software are designed to take away your + * freedom to share and change it. By contrast, the GNU General Public + * Licenses are intended to guarantee your freedom to share and change + * free software--to make sure the software is free for all its users. + * + * This license, the Lesser General Public License, applies to some + * specially designated software packages--typically libraries--of the + * Free Software Foundation and other authors who decide to use it. You + * can use it too, but we suggest you first think carefully about whether + * this license or the ordinary General Public License is the better + * strategy to use in any particular case, based on the explanations below. + * + * When we speak of free software, we are referring to freedom of use, + * not price. Our General Public Licenses are designed to make sure that + * you have the freedom to distribute copies of free software (and charge + * for this service if you wish); that you receive source code or can get + * it if you want it; that you can change the software and use pieces of + * it in new free programs; and that you are informed that you can do + * these things. + * + * To protect your rights, we need to make restrictions that forbid + * distributors to deny you these rights or to ask you to surrender these + * rights. These restrictions translate to certain responsibilities for + * you if you distribute copies of the library or if you modify it. + * + * For example, if you distribute copies of the library, whether gratis + * or for a fee, you must give the recipients all the rights that we gave + * you. You must make sure that they, too, receive or can get the source + * code. If you link other code with the library, you must provide + * complete object files to the recipients, so that they can relink them + * with the library after making changes to the library and recompiling + * it. And you must show them these terms so they know their rights. + * + * We protect your rights with a two-step method: (1) we copyright the + * library, and (2) we offer you this license, which gives you legal + * permission to copy, distribute and/or modify the library. + * + * To protect each distributor, we want to make it very clear that + * there is no warranty for the free library. Also, if the library is + * modified by someone else and passed on, the recipients should know + * that what they have is not the original version, so that the original + * author's reputation will not be affected by problems that might be + * introduced by others. + * + * Finally, software patents pose a constant threat to the existence of + * any free program. We wish to make sure that a company cannot + * effectively restrict the users of a free program by obtaining a + * restrictive license from a patent holder. Therefore, we insist that + * any patent license obtained for a version of the library must be + * consistent with the full freedom of use specified in this license. + * + * Most GNU software, including some libraries, is covered by the + * ordinary GNU General Public License. This license, the GNU Lesser + * General Public License, applies to certain designated libraries, and + * is quite different from the ordinary General Public License. We use + * this license for certain libraries in order to permit linking those + * libraries into non-free programs. + * + * When a program is linked with a library, whether statically or using + * a shared library, the combination of the two is legally speaking a + * combined work, a derivative of the original library. The ordinary + * General Public License therefore permits such linking only if the + * entire combination fits its criteria of freedom. The Lesser General + * Public License permits more lax criteria for linking other code with + * the library. + * + * We call this license the "Lesser" General Public License because it + * does Less to protect the user's freedom than the ordinary General + * Public License. It also provides other free software developers Less + * of an advantage over competing non-free programs. These disadvantages + * are the reason we use the ordinary General Public License for many + * libraries. However, the Lesser license provides advantages in certain + * special circumstances. + * + * For example, on rare occasions, there may be a special need to + * encourage the widest possible use of a certain library, so that it becomes + * a de-facto standard. To achieve this, non-free programs must be + * allowed to use the library. A more frequent case is that a free + * library does the same job as widely used non-free libraries. In this + * case, there is little to gain by limiting the free library to free + * software only, so we use the Lesser General Public License. + * + * In other cases, permission to use a particular library in non-free + * programs enables a greater number of people to use a large body of + * free software. For example, permission to use the GNU C Library in + * non-free programs enables many more people to use the whole GNU + * operating system, as well as its variant, the GNU/Linux operating + * system. + * + * Although the Lesser General Public License is Less protective of the + * users' freedom, it does ensure that the user of a program that is + * linked with the Library has the freedom and the wherewithal to run + * that program using a modified version of the Library. + * + * The precise terms and conditions for copying, distribution and + * modification follow. Pay close attention to the difference between a + * "work based on the library" and a "work that uses the library". The + * former contains code derived from the library, whereas the latter must + * be combined with the library in order to run. + * + * GNU LESSER GENERAL PUBLIC LICENSE + * TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + * + * 0. This License Agreement applies to any software library or other + * program which contains a notice placed by the copyright holder or + * other authorized party saying it may be distributed under the terms of + * this Lesser General Public License (also called "this License"). + * Each licensee is addressed as "you". + * + * A "library" means a collection of software functions and/or data + * prepared so as to be conveniently linked with application programs + * (which use some of those functions and data) to form executables. + * + * The "Library", below, refers to any such software library or work + * which has been distributed under these terms. A "work based on the + * Library" means either the Library or any derivative work under + * copyright law: that is to say, a work containing the Library or a + * portion of it, either verbatim or with modifications and/or translated + * straightforwardly into another language. (Hereinafter, translation is + * included without limitation in the term "modification".) + * + * "Source code" for a work means the preferred form of the work for + * making modifications to it. For a library, complete source code means + * all the source code for all modules it contains, plus any associated + * interface definition files, plus the scripts used to control compilation + * and installation of the library. + * + * Activities other than copying, distribution and modification are not + * covered by this License; they are outside its scope. The act of + * running a program using the Library is not restricted, and output from + * such a program is covered only if its contents constitute a work based + * on the Library (independent of the use of the Library in a tool for + * writing it). Whether that is true depends on what the Library does + * and what the program that uses the Library does. + * + * 1. You may copy and distribute verbatim copies of the Library's + * complete source code as you receive it, in any medium, provided that + * you conspicuously and appropriately publish on each copy an + * appropriate copyright notice and disclaimer of warranty; keep intact + * all the notices that refer to this License and to the absence of any + * warranty; and distribute a copy of this License along with the + * Library. + * + * You may charge a fee for the physical act of transferring a copy, + * and you may at your option offer warranty protection in exchange for a + * fee. + * + * 2. You may modify your copy or copies of the Library or any portion + * of it, thus forming a work based on the Library, and copy and + * distribute such modifications or work under the terms of Section 1 + * above, provided that you also meet all of these conditions: + * + * a) The modified work must itself be a software library. + * + * b) You must cause the files modified to carry prominent notices + * stating that you changed the files and the date of any change. + * + * c) You must cause the whole of the work to be licensed at no + * charge to all third parties under the terms of this License. + * + * d) If a facility in the modified Library refers to a function or a + * table of data to be supplied by an application program that uses + * the facility, other than as an argument passed when the facility + * is invoked, then you must make a good faith effort to ensure that, + * in the event an application does not supply such function or + * table, the facility still operates, and performs whatever part of + * its purpose remains meaningful. + * + * (For example, a function in a library to compute square roots has + * a purpose that is entirely well-defined independent of the + * application. Therefore, Subsection 2d requires that any + * application-supplied function or table used by this function must + * be optional: if the application does not supply it, the square + * root function must still compute square roots.) + * + * These requirements apply to the modified work as a whole. If + * identifiable sections of that work are not derived from the Library, + * and can be reasonably considered independent and separate works in + * themselves, then this License, and its terms, do not apply to those + * sections when you distribute them as separate works. But when you + * distribute the same sections as part of a whole which is a work based + * on the Library, the distribution of the whole must be on the terms of + * this License, whose permissions for other licensees extend to the + * entire whole, and thus to each and every part regardless of who wrote + * it. + * + * Thus, it is not the intent of this section to claim rights or contest + * your rights to work written entirely by you; rather, the intent is to + * exercise the right to control the distribution of derivative or + * collective works based on the Library. + * + * In addition, mere aggregation of another work not based on the Library + * with the Library (or with a work based on the Library) on a volume of + * a storage or distribution medium does not bring the other work under + * the scope of this License. + * + * 3. You may opt to apply the terms of the ordinary GNU General Public + * License instead of this License to a given copy of the Library. To do + * this, you must alter all the notices that refer to this License, so + * that they refer to the ordinary GNU General Public License, version 2, + * instead of to this License. (If a newer version than version 2 of the + * ordinary GNU General Public License has appeared, then you can specify + * that version instead if you wish.) Do not make any other change in + * these notices. + * + * Once this change is made in a given copy, it is irreversible for + * that copy, so the ordinary GNU General Public License applies to all + * subsequent copies and derivative works made from that copy. + * + * This option is useful when you wish to copy part of the code of + * the Library into a program that is not a library. + * + * 4. You may copy and distribute the Library (or a portion or + * derivative of it, under Section 2) in object code or executable form + * under the terms of Sections 1 and 2 above provided that you accompany + * it with the complete corresponding machine-readable source code, which + * must be distributed under the terms of Sections 1 and 2 above on a + * medium customarily used for software interchange. + * + * If distribution of object code is made by offering access to copy + * from a designated place, then offering equivalent access to copy the + * source code from the same place satisfies the requirement to + * distribute the source code, even though third parties are not + * compelled to copy the source along with the object code. + * + * 5. A program that contains no derivative of any portion of the + * Library, but is designed to work with the Library by being compiled or + * linked with it, is called a "work that uses the Library". Such a + * work, in isolation, is not a derivative work of the Library, and + * therefore falls outside the scope of this License. + * + * However, linking a "work that uses the Library" with the Library + * creates an executable that is a derivative of the Library (because it + * contains portions of the Library), rather than a "work that uses the + * library". The executable is therefore covered by this License. + * Section 6 states terms for distribution of such executables. + * + * When a "work that uses the Library" uses material from a header file + * that is part of the Library, the object code for the work may be a + * derivative work of the Library even though the source code is not. + * Whether this is true is especially significant if the work can be + * linked without the Library, or if the work is itself a library. The + * threshold for this to be true is not precisely defined by law. + * + * If such an object file uses only numerical parameters, data + * structure layouts and accessors, and small macros and small inline + * functions (ten lines or less in length), then the use of the object + * file is unrestricted, regardless of whether it is legally a derivative + * work. (Executables containing this object code plus portions of the + * Library will still fall under Section 6.) + * + * Otherwise, if the work is a derivative of the Library, you may + * distribute the object code for the work under the terms of Section 6. + * Any executables containing that work also fall under Section 6, + * whether or not they are linked directly with the Library itself. + * + * 6. As an exception to the Sections above, you may also combine or + * link a "work that uses the Library" with the Library to produce a + * work containing portions of the Library, and distribute that work + * under terms of your choice, provided that the terms permit + * modification of the work for the customer's own use and reverse + * engineering for debugging such modifications. + * + * You must give prominent notice with each copy of the work that the + * Library is used in it and that the Library and its use are covered by + * this License. You must supply a copy of this License. If the work + * during execution displays copyright notices, you must include the + * copyright notice for the Library among them, as well as a reference + * directing the user to the copy of this License. Also, you must do one + * of these things: + * + * a) Accompany the work with the complete corresponding + * machine-readable source code for the Library including whatever + * changes were used in the work (which must be distributed under + * Sections 1 and 2 above); and, if the work is an executable linked + * with the Library, with the complete machine-readable "work that + * uses the Library", as object code and/or source code, so that the + * user can modify the Library and then relink to produce a modified + * executable containing the modified Library. (It is understood + * that the user who changes the contents of definitions files in the + * Library will not necessarily be able to recompile the application + * to use the modified definitions.) + * + * b) Use a suitable shared library mechanism for linking with the + * Library. A suitable mechanism is one that (1) uses at run time a + * copy of the library already present on the user's computer system, + * rather than copying library functions into the executable, and (2) + * will operate properly with a modified version of the library, if + * the user installs one, as long as the modified version is + * interface-compatible with the version that the work was made with. + * + * c) Accompany the work with a written offer, valid for at + * least three years, to give the same user the materials + * specified in Subsection 6a, above, for a charge no more + * than the cost of performing this distribution. + * + * d) If distribution of the work is made by offering access to copy + * from a designated place, offer equivalent access to copy the above + * specified materials from the same place. + * + * e) Verify that the user has already received a copy of these + * materials or that you have already sent this user a copy. + * + * For an executable, the required form of the "work that uses the + * Library" must include any data and utility programs needed for + * reproducing the executable from it. However, as a special exception, + * the materials to be distributed need not include anything that is + * normally distributed (in either source or binary form) with the major + * components (compiler, kernel, and so on) of the operating system on + * which the executable runs, unless that component itself accompanies + * the executable. + * + * It may happen that this requirement contradicts the license + * restrictions of other proprietary libraries that do not normally + * accompany the operating system. Such a contradiction means you cannot + * use both them and the Library together in an executable that you + * distribute. + * + * 7. You may place library facilities that are a work based on the + * Library side-by-side in a single library together with other library + * facilities not covered by this License, and distribute such a combined + * library, provided that the separate distribution of the work based on + * the Library and of the other library facilities is otherwise + * permitted, and provided that you do these two things: + * + * a) Accompany the combined library with a copy of the same work + * based on the Library, uncombined with any other library + * facilities. This must be distributed under the terms of the + * Sections above. + * + * b) Give prominent notice with the combined library of the fact + * that part of it is a work based on the Library, and explaining + * where to find the accompanying uncombined form of the same work. + * + * 8. You may not copy, modify, sublicense, link with, or distribute + * the Library except as expressly provided under this License. Any + * attempt otherwise to copy, modify, sublicense, link with, or + * distribute the Library is void, and will automatically terminate your + * rights under this License. However, parties who have received copies, + * or rights, from you under this License will not have their licenses + * terminated so long as such parties remain in full compliance. + * + * 9. You are not required to accept this License, since you have not + * signed it. However, nothing else grants you permission to modify or + * distribute the Library or its derivative works. These actions are + * prohibited by law if you do not accept this License. Therefore, by + * modifying or distributing the Library (or any work based on the + * Library), you indicate your acceptance of this License to do so, and + * all its terms and conditions for copying, distributing or modifying + * the Library or works based on it. + * + * 10. Each time you redistribute the Library (or any work based on the + * Library), the recipient automatically receives a license from the + * original licensor to copy, distribute, link with or modify the Library + * subject to these terms and conditions. You may not impose any further + * restrictions on the recipients' exercise of the rights granted herein. + * You are not responsible for enforcing compliance by third parties with + * this License. + * + * 11. If, as a consequence of a court judgment or allegation of patent + * infringement or for any other reason (not limited to patent issues), + * conditions are imposed on you (whether by court order, agreement or + * otherwise) that contradict the conditions of this License, they do not + * excuse you from the conditions of this License. If you cannot + * distribute so as to satisfy simultaneously your obligations under this + * License and any other pertinent obligations, then as a consequence you + * may not distribute the Library at all. For example, if a patent + * license would not permit royalty-free redistribution of the Library by + * all those who receive copies directly or indirectly through you, then + * the only way you could satisfy both it and this License would be to + * refrain entirely from distribution of the Library. + * + * If any portion of this section is held invalid or unenforceable under any + * particular circumstance, the balance of the section is intended to apply, + * and the section as a whole is intended to apply in other circumstances. + * + * It is not the purpose of this section to induce you to infringe any + * patents or other property right claims or to contest validity of any + * such claims; this section has the sole purpose of protecting the + * integrity of the free software distribution system which is + * implemented by public license practices. Many people have made + * generous contributions to the wide range of software distributed + * through that system in reliance on consistent application of that + * system; it is up to the author/donor to decide if he or she is willing + * to distribute software through any other system and a licensee cannot + * impose that choice. + * + * This section is intended to make thoroughly clear what is believed to + * be a consequence of the rest of this License. + * + * 12. If the distribution and/or use of the Library is restricted in + * certain countries either by patents or by copyrighted interfaces, the + * original copyright holder who places the Library under this License may add + * an explicit geographical distribution limitation excluding those countries, + * so that distribution is permitted only in or among countries not thus + * excluded. In such case, this License incorporates the limitation as if + * written in the body of this License. + * + * 13. The Free Software Foundation may publish revised and/or new + * versions of the Lesser General Public License from time to time. + * Such new versions will be similar in spirit to the present version, + * but may differ in detail to address new problems or concerns. + * + * Each version is given a distinguishing version number. If the Library + * specifies a version number of this License which applies to it and + * "any later version", you have the option of following the terms and + * conditions either of that version or of any later version published by + * the Free Software Foundation. If the Library does not specify a + * license version number, you may choose any version ever published by + * the Free Software Foundation. + * + * 14. If you wish to incorporate parts of the Library into other free + * programs whose distribution conditions are incompatible with these, + * write to the author to ask for permission. For software which is + * copyrighted by the Free Software Foundation, write to the Free + * Software Foundation; we sometimes make exceptions for this. Our + * decision will be guided by the two goals of preserving the free status + * of all derivatives of our free software and of promoting the sharing + * and reuse of software generally. + * + * NO WARRANTY + * + * 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO + * WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. + * EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR + * OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY + * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE + * LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME + * THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + * + * 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN + * WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY + * AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU + * FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR + * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE + * LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING + * RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A + * FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF + * SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGES. + * + * END OF TERMS AND CONDITIONS + * + * How to Apply These Terms to Your New Libraries + * + * If you develop a new library, and you want it to be of the greatest + * possible use to the public, we recommend making it free software that + * everyone can redistribute and change. You can do so by permitting + * redistribution under these terms (or, alternatively, under the terms of the + * ordinary General Public License). + * + * To apply these terms, attach the following notices to the library. It is + * safest to attach them to the start of each source file to most effectively + * convey the exclusion of warranty; and each file should have at least the + * "copyright" line and a pointer to where the full notice is found. + * + * + * Copyright (C) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Also add information on how to contact you by electronic and paper mail. + * + * You should also get your employer (if you work as a programmer) or your + * school, if any, to sign a "copyright disclaimer" for the library, if + * necessary. Here is a sample; alter the names: + * + * Yoyodyne, Inc., hereby disclaims all copyright interest in the + * library `Frob' (a library for tweaking knobs) written by James Random Hacker. + * + * , 1 April 1990 + * Ty Coon, President of Vice + * + * That's all there is to it! + * + * + * --- + * + * ffmpeg oggdec: + * + * Copyright (C) 2005 Michael Ahlberg, Måns Rullgård + * Copyright (C) 2005 Matthieu CASTET, Alex Beregszaszi + * Copyright (C) 2008 Reimar Döffinger + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * + * --- + * + * emscripten and musl: + * + * Copyright (c) 2010-2024 Emscripten authors, see AUTHORS file. + * Copyright © 2005-2024 Rich Felker, et al. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * diff --git a/configs/configs/common-formats/link-flags.txt b/configs/configs/common-formats/link-flags.txt new file mode 100644 index 00000000..5e7d7613 --- /dev/null +++ b/configs/configs/common-formats/link-flags.txt @@ -0,0 +1,2 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 diff --git a/configs/configs/default-cli/components.txt b/configs/configs/default-cli/components.txt new file mode 100644 index 00000000..6449902d --- /dev/null +++ b/configs/configs/default-cli/components.txt @@ -0,0 +1,7 @@ +c +avutil +avformat +avfcbridge +avcodec +avfilter +cli diff --git a/configs/configs/default-cli/config.json b/configs/configs/default-cli/config.json index f940a8e2..56c75e08 100644 --- a/configs/configs/default-cli/config.json +++ b/configs/configs/default-cli/config.json @@ -1 +1 @@ -["format-ogg","format-webm","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","audio-filters","cli"] +["avformat","avcodec","avfilter","swresample","format-ogg","format-webm","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","audio-filters","cli"] diff --git a/configs/configs/default-cli/libs.txt b/configs/configs/default-cli/libs.txt index 0edff23f..bd78b736 100644 --- a/configs/configs/default-cli/libs.txt +++ b/configs/configs/default-cli/libs.txt @@ -1 +1,6 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavfilter/libavfilter.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswresample/libswresample.a build/inst/@TARGET/lib/libopus.a diff --git a/configs/configs/default-cli/link-flags.txt b/configs/configs/default-cli/link-flags.txt index 0370e419..bd72b815 100644 --- a/configs/configs/default-cli/link-flags.txt +++ b/configs/configs/default-cli/link-flags.txt @@ -1,2 +1,6 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 +-DLIBAVJS_WITH_AVFILTER=1 +-DLIBAVJS_WITH_SWRESAMPLE=1 -DLIBAVJS_WITH_CLI=1 -DLIBAVJS_WITH_SWSCALE=1 diff --git a/configs/configs/default/components.txt b/configs/configs/default/components.txt new file mode 100644 index 00000000..228f8505 --- /dev/null +++ b/configs/configs/default/components.txt @@ -0,0 +1,6 @@ +c +avutil +avformat +avfcbridge +avcodec +avfilter diff --git a/configs/configs/default/config.json b/configs/configs/default/config.json index 3cb565ef..576ebe9a 100644 --- a/configs/configs/default/config.json +++ b/configs/configs/default/config.json @@ -1 +1 @@ -["format-ogg","format-webm","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","audio-filters"] +["avformat","avcodec","avfilter","swresample","format-ogg","format-webm","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","audio-filters"] diff --git a/configs/configs/default/libs.txt b/configs/configs/default/libs.txt index 0edff23f..bd78b736 100644 --- a/configs/configs/default/libs.txt +++ b/configs/configs/default/libs.txt @@ -1 +1,6 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavfilter/libavfilter.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswresample/libswresample.a build/inst/@TARGET/lib/libopus.a diff --git a/configs/configs/default/link-flags.txt b/configs/configs/default/link-flags.txt index e69de29b..e3e72004 100644 --- a/configs/configs/default/link-flags.txt +++ b/configs/configs/default/link-flags.txt @@ -0,0 +1,4 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 +-DLIBAVJS_WITH_AVFILTER=1 +-DLIBAVJS_WITH_SWRESAMPLE=1 diff --git a/configs/configs/empty/components.txt b/configs/configs/empty/components.txt new file mode 100644 index 00000000..0d47ce4f --- /dev/null +++ b/configs/configs/empty/components.txt @@ -0,0 +1,2 @@ +c +avutil diff --git a/configs/configs/empty/libs.txt b/configs/configs/empty/libs.txt index e69de29b..7c0a6cf6 100644 --- a/configs/configs/empty/libs.txt +++ b/configs/configs/empty/libs.txt @@ -0,0 +1 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a diff --git a/configs/configs/extras/components.txt b/configs/configs/extras/components.txt new file mode 100644 index 00000000..d8421f3d --- /dev/null +++ b/configs/configs/extras/components.txt @@ -0,0 +1,7 @@ +c +avutil +avformat +avfcbridge +avcodec +avfilter +swscale diff --git a/configs/configs/extras/config.json b/configs/configs/extras/config.json index e6520da3..8760d502 100644 --- a/configs/configs/extras/config.json +++ b/configs/configs/extras/config.json @@ -1 +1 @@ -["format-image2","demuxer-image_gif_pipe","demuxer-image_jpeg_pipe","demuxer-image_png_pipe","parser-gif","codec-gif","parser-mjpeg","codec-mjpeg","parser-png","codec-png","parser-webp","decoder-webp","format-rawvideo","codec-rawvideo","format-pcm_f32le","codec-pcm_f32le","codec-alac","codec-prores","codec-qtrle","format-hls","protocol-jsfetch"] +["avformat","avcodec","avfilter","swresample","swscale","format-image2","demuxer-image_gif_pipe","demuxer-image_jpeg_pipe","demuxer-image_png_pipe","parser-gif","codec-gif","parser-mjpeg","codec-mjpeg","parser-png","codec-png","parser-webp","decoder-webp","format-rawvideo","codec-rawvideo","format-pcm_f32le","codec-pcm_f32le","codec-alac","codec-prores","codec-qtrle","format-hls","protocol-jsfetch"] diff --git a/configs/configs/extras/ffmpeg-config.txt b/configs/configs/extras/ffmpeg-config.txt index 11b4acac..28bd19f8 100644 --- a/configs/configs/extras/ffmpeg-config.txt +++ b/configs/configs/extras/ffmpeg-config.txt @@ -1,5 +1,6 @@ --enable-protocol=data --enable-protocol=file --enable-filter=aresample +--enable-filter=scale --enable-demuxer=image2 --enable-muxer=image2 --enable-demuxer=image_gif_pipe diff --git a/configs/configs/extras/libs.txt b/configs/configs/extras/libs.txt index 18bc7ef3..cf9e530d 100644 --- a/configs/configs/extras/libs.txt +++ b/configs/configs/extras/libs.txt @@ -1 +1,7 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavfilter/libavfilter.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswresample/libswresample.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswscale/libswscale.a build/inst/@TARGET/lib/libz.a diff --git a/configs/configs/extras/link-flags.txt b/configs/configs/extras/link-flags.txt index e69de29b..4d12cb08 100644 --- a/configs/configs/extras/link-flags.txt +++ b/configs/configs/extras/link-flags.txt @@ -0,0 +1,5 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 +-DLIBAVJS_WITH_AVFILTER=1 +-DLIBAVJS_WITH_SWRESAMPLE=1 +-DLIBAVJS_WITH_SWSCALE=1 diff --git a/configs/configs/flac-af/components.txt b/configs/configs/flac-af/components.txt new file mode 100644 index 00000000..228f8505 --- /dev/null +++ b/configs/configs/flac-af/components.txt @@ -0,0 +1,6 @@ +c +avutil +avformat +avfcbridge +avcodec +avfilter diff --git a/configs/configs/flac-af/config.json b/configs/configs/flac-af/config.json index f8e61420..cfcc9d99 100644 --- a/configs/configs/flac-af/config.json +++ b/configs/configs/flac-af/config.json @@ -1 +1 @@ -["format-ogg","format-flac","parser-flac","codec-flac","audio-filters"] +["avformat","avcodec","format-ogg","format-flac","parser-flac","codec-flac","avfilter","swresample","audio-filters"] diff --git a/configs/configs/flac-af/libs.txt b/configs/configs/flac-af/libs.txt index e69de29b..9a14ba31 100644 --- a/configs/configs/flac-af/libs.txt +++ b/configs/configs/flac-af/libs.txt @@ -0,0 +1,5 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavfilter/libavfilter.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswresample/libswresample.a diff --git a/configs/configs/flac-af/link-flags.txt b/configs/configs/flac-af/link-flags.txt index e69de29b..e3e72004 100644 --- a/configs/configs/flac-af/link-flags.txt +++ b/configs/configs/flac-af/link-flags.txt @@ -0,0 +1,4 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 +-DLIBAVJS_WITH_AVFILTER=1 +-DLIBAVJS_WITH_SWRESAMPLE=1 diff --git a/configs/configs/flac/components.txt b/configs/configs/flac/components.txt new file mode 100644 index 00000000..25dcbb1f --- /dev/null +++ b/configs/configs/flac/components.txt @@ -0,0 +1,5 @@ +c +avutil +avformat +avfcbridge +avcodec diff --git a/configs/configs/flac/config.json b/configs/configs/flac/config.json index 7a38fcec..25b3068e 100644 --- a/configs/configs/flac/config.json +++ b/configs/configs/flac/config.json @@ -1 +1 @@ -["format-ogg","format-flac","parser-flac","codec-flac"] +["avformat","avcodec","format-ogg","format-flac","parser-flac","codec-flac"] diff --git a/configs/configs/flac/libs.txt b/configs/configs/flac/libs.txt index e69de29b..a1af5902 100644 --- a/configs/configs/flac/libs.txt +++ b/configs/configs/flac/libs.txt @@ -0,0 +1,3 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a diff --git a/configs/configs/flac/link-flags.txt b/configs/configs/flac/link-flags.txt index e69de29b..bd0c5e59 100644 --- a/configs/configs/flac/link-flags.txt +++ b/configs/configs/flac/link-flags.txt @@ -0,0 +1,2 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 diff --git a/configs/configs/h264-aac-avf/components.txt b/configs/configs/h264-aac-avf/components.txt new file mode 100644 index 00000000..d8421f3d --- /dev/null +++ b/configs/configs/h264-aac-avf/components.txt @@ -0,0 +1,7 @@ +c +avutil +avformat +avfcbridge +avcodec +avfilter +swscale diff --git a/configs/configs/h264-aac-avf/config.json b/configs/configs/h264-aac-avf/config.json index 6f24965c..4fc9cfee 100644 --- a/configs/configs/h264-aac-avf/config.json +++ b/configs/configs/h264-aac-avf/config.json @@ -1 +1 @@ -["format-mp4","format-aac","format-webm","parser-aac","codec-aac","parser-h264","decoder-h264","codec-libopenh264","audio-filters","swscale","video-filters"] +["avformat","avcodec","format-mp4","format-aac","format-webm","parser-aac","codec-aac","parser-h264","decoder-h264","codec-libopenh264","avfilter","swresample","swscale","audio-filters","video-filters"] diff --git a/configs/configs/h264-aac-avf/ffmpeg-config.txt b/configs/configs/h264-aac-avf/ffmpeg-config.txt index 931d31a7..6f966afd 100644 --- a/configs/configs/h264-aac-avf/ffmpeg-config.txt +++ b/configs/configs/h264-aac-avf/ffmpeg-config.txt @@ -17,6 +17,7 @@ --enable-libopenh264 --enable-decoder=libopenh264 --enable-encoder=libopenh264 +--enable-filter=scale --enable-filter=acompressor --enable-filter=adeclick --enable-filter=adeclip --enable-filter=aecho --enable-filter=afade --enable-filter=aformat --enable-filter=agate --enable-filter=alimiter --enable-filter=amix @@ -25,6 +26,5 @@ --enable-filter=bandreject --enable-filter=dynaudnorm --enable-filter=equalizer --enable-filter=loudnorm --enable-filter=pan --enable-filter=amix --enable-filter=volume --enable-filter=anull ---enable-filter=scale --enable-filter=crop --enable-filter=fps --enable-filter=null --enable-filter=settb --enable-filter=split --enable-filter=trim diff --git a/configs/configs/h264-aac-avf/libs.txt b/configs/configs/h264-aac-avf/libs.txt index 11aaa1c1..7a51a012 100644 --- a/configs/configs/h264-aac-avf/libs.txt +++ b/configs/configs/h264-aac-avf/libs.txt @@ -1 +1,7 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a build/inst/@TARGET/lib/libopenh264.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavfilter/libavfilter.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswresample/libswresample.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswscale/libswscale.a diff --git a/configs/configs/h264-aac-avf/link-flags.txt b/configs/configs/h264-aac-avf/link-flags.txt index 42bcf371..3b3f79ea 100644 --- a/configs/configs/h264-aac-avf/link-flags.txt +++ b/configs/configs/h264-aac-avf/link-flags.txt @@ -1,2 +1,6 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 -lstdc++ -lm -lpthread -s ERROR_ON_UNDEFINED_SYMBOLS=0 +-DLIBAVJS_WITH_AVFILTER=1 +-DLIBAVJS_WITH_SWRESAMPLE=1 -DLIBAVJS_WITH_SWSCALE=1 diff --git a/configs/configs/h264-aac/components.txt b/configs/configs/h264-aac/components.txt new file mode 100644 index 00000000..25dcbb1f --- /dev/null +++ b/configs/configs/h264-aac/components.txt @@ -0,0 +1,5 @@ +c +avutil +avformat +avfcbridge +avcodec diff --git a/configs/configs/h264-aac/config.json b/configs/configs/h264-aac/config.json index abc0d624..9159838f 100644 --- a/configs/configs/h264-aac/config.json +++ b/configs/configs/h264-aac/config.json @@ -1 +1 @@ -["format-mp4","format-aac","format-webm","parser-aac","codec-aac","parser-h264","decoder-h264","codec-libopenh264"] +["avformat","avcodec","format-mp4","format-aac","format-webm","parser-aac","codec-aac","parser-h264","decoder-h264","codec-libopenh264"] diff --git a/configs/configs/h264-aac/libs.txt b/configs/configs/h264-aac/libs.txt index 11aaa1c1..f8a1fcf7 100644 --- a/configs/configs/h264-aac/libs.txt +++ b/configs/configs/h264-aac/libs.txt @@ -1 +1,4 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a build/inst/@TARGET/lib/libopenh264.a diff --git a/configs/configs/h264-aac/link-flags.txt b/configs/configs/h264-aac/link-flags.txt index d12d02a3..acdaf251 100644 --- a/configs/configs/h264-aac/link-flags.txt +++ b/configs/configs/h264-aac/link-flags.txt @@ -1 +1,3 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 -lstdc++ -lm -lpthread -s ERROR_ON_UNDEFINED_SYMBOLS=0 diff --git a/configs/configs/hevc-aac-avf/components.txt b/configs/configs/hevc-aac-avf/components.txt new file mode 100644 index 00000000..d8421f3d --- /dev/null +++ b/configs/configs/hevc-aac-avf/components.txt @@ -0,0 +1,7 @@ +c +avutil +avformat +avfcbridge +avcodec +avfilter +swscale diff --git a/configs/configs/hevc-aac-avf/config.json b/configs/configs/hevc-aac-avf/config.json index 38560abf..d5f8399d 100644 --- a/configs/configs/hevc-aac-avf/config.json +++ b/configs/configs/hevc-aac-avf/config.json @@ -1 +1 @@ -["format-mp4","format-aac","format-webm","parser-aac","codec-aac","parser-hevc","decoder-hevc","audio-filters","swscale","video-filters"] +["avformat","avcodec","format-mp4","format-aac","format-webm","parser-aac","codec-aac","parser-hevc","decoder-hevc","avfilter","swresample","swscale","audio-filters","video-filters"] diff --git a/configs/configs/hevc-aac-avf/ffmpeg-config.txt b/configs/configs/hevc-aac-avf/ffmpeg-config.txt index 30b80d84..1afe30dc 100644 --- a/configs/configs/hevc-aac-avf/ffmpeg-config.txt +++ b/configs/configs/hevc-aac-avf/ffmpeg-config.txt @@ -14,6 +14,7 @@ --enable-decoder=hevc --enable-bsf=hevc_metadata --enable-bsf=extract_extradata +--enable-filter=scale --enable-filter=acompressor --enable-filter=adeclick --enable-filter=adeclip --enable-filter=aecho --enable-filter=afade --enable-filter=aformat --enable-filter=agate --enable-filter=alimiter --enable-filter=amix @@ -22,6 +23,5 @@ --enable-filter=bandreject --enable-filter=dynaudnorm --enable-filter=equalizer --enable-filter=loudnorm --enable-filter=pan --enable-filter=amix --enable-filter=volume --enable-filter=anull ---enable-filter=scale --enable-filter=crop --enable-filter=fps --enable-filter=null --enable-filter=settb --enable-filter=split --enable-filter=trim diff --git a/configs/configs/hevc-aac-avf/libs.txt b/configs/configs/hevc-aac-avf/libs.txt index e69de29b..113b4864 100644 --- a/configs/configs/hevc-aac-avf/libs.txt +++ b/configs/configs/hevc-aac-avf/libs.txt @@ -0,0 +1,6 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavfilter/libavfilter.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswresample/libswresample.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswscale/libswscale.a diff --git a/configs/configs/hevc-aac-avf/link-flags.txt b/configs/configs/hevc-aac-avf/link-flags.txt index 308036f3..4d12cb08 100644 --- a/configs/configs/hevc-aac-avf/link-flags.txt +++ b/configs/configs/hevc-aac-avf/link-flags.txt @@ -1 +1,5 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 +-DLIBAVJS_WITH_AVFILTER=1 +-DLIBAVJS_WITH_SWRESAMPLE=1 -DLIBAVJS_WITH_SWSCALE=1 diff --git a/configs/configs/hevc-aac/components.txt b/configs/configs/hevc-aac/components.txt new file mode 100644 index 00000000..25dcbb1f --- /dev/null +++ b/configs/configs/hevc-aac/components.txt @@ -0,0 +1,5 @@ +c +avutil +avformat +avfcbridge +avcodec diff --git a/configs/configs/hevc-aac/config.json b/configs/configs/hevc-aac/config.json index 1f922226..2f3d9cdd 100644 --- a/configs/configs/hevc-aac/config.json +++ b/configs/configs/hevc-aac/config.json @@ -1 +1 @@ -["format-mp4","format-aac","format-webm","parser-aac","codec-aac","parser-hevc","decoder-hevc"] +["avformat","avcodec","format-mp4","format-aac","format-webm","parser-aac","codec-aac","parser-hevc","decoder-hevc"] diff --git a/configs/configs/hevc-aac/libs.txt b/configs/configs/hevc-aac/libs.txt index e69de29b..a1af5902 100644 --- a/configs/configs/hevc-aac/libs.txt +++ b/configs/configs/hevc-aac/libs.txt @@ -0,0 +1,3 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a diff --git a/configs/configs/hevc-aac/link-flags.txt b/configs/configs/hevc-aac/link-flags.txt index e69de29b..bd0c5e59 100644 --- a/configs/configs/hevc-aac/link-flags.txt +++ b/configs/configs/hevc-aac/link-flags.txt @@ -0,0 +1,2 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 diff --git a/configs/configs/obsolete/components.txt b/configs/configs/obsolete/components.txt new file mode 100644 index 00000000..228f8505 --- /dev/null +++ b/configs/configs/obsolete/components.txt @@ -0,0 +1,6 @@ +c +avutil +avformat +avfcbridge +avcodec +avfilter diff --git a/configs/configs/obsolete/config.json b/configs/configs/obsolete/config.json index 84047f39..9fa89e3d 100644 --- a/configs/configs/obsolete/config.json +++ b/configs/configs/obsolete/config.json @@ -1 +1 @@ -["format-ogg","format-webm","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","codec-libvorbis","format-mp3","decoder-mp3","encoder-libmp3lame","audio-filters"] +["avformat","avcodec","avfilter","swresample","format-ogg","format-webm","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","codec-libvorbis","format-mp3","decoder-mp3","encoder-libmp3lame","audio-filters"] diff --git a/configs/configs/obsolete/libs.txt b/configs/configs/obsolete/libs.txt index c702da53..52a2d984 100644 --- a/configs/configs/obsolete/libs.txt +++ b/configs/configs/obsolete/libs.txt @@ -1,3 +1,8 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavfilter/libavfilter.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswresample/libswresample.a build/inst/@TARGET/lib/libopus.a build/inst/@TARGET/lib/libvorbis.a build/inst/@TARGET/lib/libvorbisenc.a diff --git a/configs/configs/obsolete/link-flags.txt b/configs/configs/obsolete/link-flags.txt index e69de29b..e3e72004 100644 --- a/configs/configs/obsolete/link-flags.txt +++ b/configs/configs/obsolete/link-flags.txt @@ -0,0 +1,4 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 +-DLIBAVJS_WITH_AVFILTER=1 +-DLIBAVJS_WITH_SWRESAMPLE=1 diff --git a/configs/configs/opus-af/components.txt b/configs/configs/opus-af/components.txt new file mode 100644 index 00000000..228f8505 --- /dev/null +++ b/configs/configs/opus-af/components.txt @@ -0,0 +1,6 @@ +c +avutil +avformat +avfcbridge +avcodec +avfilter diff --git a/configs/configs/opus-af/config.json b/configs/configs/opus-af/config.json index 5ee06636..df40589f 100644 --- a/configs/configs/opus-af/config.json +++ b/configs/configs/opus-af/config.json @@ -1 +1 @@ -["format-ogg","format-webm","parser-opus","codec-libopus","audio-filters"] +["avformat","avcodec","format-ogg","format-webm","parser-opus","codec-libopus","avfilter","swresample","audio-filters"] diff --git a/configs/configs/opus-af/libs.txt b/configs/configs/opus-af/libs.txt index 0edff23f..78ddf00a 100644 --- a/configs/configs/opus-af/libs.txt +++ b/configs/configs/opus-af/libs.txt @@ -1 +1,6 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a build/inst/@TARGET/lib/libopus.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavfilter/libavfilter.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswresample/libswresample.a diff --git a/configs/configs/opus-af/link-flags.txt b/configs/configs/opus-af/link-flags.txt index e69de29b..e3e72004 100644 --- a/configs/configs/opus-af/link-flags.txt +++ b/configs/configs/opus-af/link-flags.txt @@ -0,0 +1,4 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 +-DLIBAVJS_WITH_AVFILTER=1 +-DLIBAVJS_WITH_SWRESAMPLE=1 diff --git a/configs/configs/opus/components.txt b/configs/configs/opus/components.txt new file mode 100644 index 00000000..25dcbb1f --- /dev/null +++ b/configs/configs/opus/components.txt @@ -0,0 +1,5 @@ +c +avutil +avformat +avfcbridge +avcodec diff --git a/configs/configs/opus/config.json b/configs/configs/opus/config.json index 61df08bd..2f360de4 100644 --- a/configs/configs/opus/config.json +++ b/configs/configs/opus/config.json @@ -1 +1 @@ -["format-ogg","format-webm","parser-opus","codec-libopus"] +["avformat","avcodec","format-ogg","format-webm","parser-opus","codec-libopus"] diff --git a/configs/configs/opus/libs.txt b/configs/configs/opus/libs.txt index 0edff23f..370df537 100644 --- a/configs/configs/opus/libs.txt +++ b/configs/configs/opus/libs.txt @@ -1 +1,4 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a build/inst/@TARGET/lib/libopus.a diff --git a/configs/configs/opus/link-flags.txt b/configs/configs/opus/link-flags.txt index e69de29b..bd0c5e59 100644 --- a/configs/configs/opus/link-flags.txt +++ b/configs/configs/opus/link-flags.txt @@ -0,0 +1,2 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 diff --git a/configs/configs/vp8-opus-avf/components.txt b/configs/configs/vp8-opus-avf/components.txt new file mode 100644 index 00000000..d8421f3d --- /dev/null +++ b/configs/configs/vp8-opus-avf/components.txt @@ -0,0 +1,7 @@ +c +avutil +avformat +avfcbridge +avcodec +avfilter +swscale diff --git a/configs/configs/vp8-opus-avf/config.json b/configs/configs/vp8-opus-avf/config.json index 71d417e3..7c37c098 100644 --- a/configs/configs/vp8-opus-avf/config.json +++ b/configs/configs/vp8-opus-avf/config.json @@ -1 +1 @@ -["format-ogg","format-webm","parser-opus","codec-libopus","libvpx","parser-vp8","codec-libvpx_vp8","audio-filters","swscale","video-filters"] +["avformat","avcodec","format-ogg","format-webm","parser-opus","codec-libopus","libvpx","parser-vp8","codec-libvpx_vp8","avfilter","swresample","swscale","audio-filters","video-filters"] diff --git a/configs/configs/vp8-opus-avf/ffmpeg-config.txt b/configs/configs/vp8-opus-avf/ffmpeg-config.txt index ece5fea2..fc22ae23 100644 --- a/configs/configs/vp8-opus-avf/ffmpeg-config.txt +++ b/configs/configs/vp8-opus-avf/ffmpeg-config.txt @@ -14,6 +14,7 @@ --enable-decoder=libvpx_vp8 --enable-libvpx --enable-encoder=libvpx_vp8 +--enable-filter=scale --enable-filter=acompressor --enable-filter=adeclick --enable-filter=adeclip --enable-filter=aecho --enable-filter=afade --enable-filter=aformat --enable-filter=agate --enable-filter=alimiter --enable-filter=amix @@ -22,6 +23,5 @@ --enable-filter=bandreject --enable-filter=dynaudnorm --enable-filter=equalizer --enable-filter=loudnorm --enable-filter=pan --enable-filter=amix --enable-filter=volume --enable-filter=anull ---enable-filter=scale --enable-filter=crop --enable-filter=fps --enable-filter=null --enable-filter=settb --enable-filter=split --enable-filter=trim diff --git a/configs/configs/vp8-opus-avf/libs.txt b/configs/configs/vp8-opus-avf/libs.txt index ef1a3d4c..f0c07280 100644 --- a/configs/configs/vp8-opus-avf/libs.txt +++ b/configs/configs/vp8-opus-avf/libs.txt @@ -1,2 +1,8 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a build/inst/@TARGET/lib/libopus.a build/inst/@TARGET/lib/libvpx.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavfilter/libavfilter.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswresample/libswresample.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswscale/libswscale.a diff --git a/configs/configs/vp8-opus-avf/link-flags.txt b/configs/configs/vp8-opus-avf/link-flags.txt index 308036f3..4d12cb08 100644 --- a/configs/configs/vp8-opus-avf/link-flags.txt +++ b/configs/configs/vp8-opus-avf/link-flags.txt @@ -1 +1,5 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 +-DLIBAVJS_WITH_AVFILTER=1 +-DLIBAVJS_WITH_SWRESAMPLE=1 -DLIBAVJS_WITH_SWSCALE=1 diff --git a/configs/configs/vp8-opus/components.txt b/configs/configs/vp8-opus/components.txt new file mode 100644 index 00000000..25dcbb1f --- /dev/null +++ b/configs/configs/vp8-opus/components.txt @@ -0,0 +1,5 @@ +c +avutil +avformat +avfcbridge +avcodec diff --git a/configs/configs/vp8-opus/config.json b/configs/configs/vp8-opus/config.json index 210a4734..61701604 100644 --- a/configs/configs/vp8-opus/config.json +++ b/configs/configs/vp8-opus/config.json @@ -1 +1 @@ -["format-ogg","format-webm","parser-opus","codec-libopus","libvpx","parser-vp8","codec-libvpx_vp8"] +["avformat","avcodec","format-ogg","format-webm","parser-opus","codec-libopus","libvpx","parser-vp8","codec-libvpx_vp8"] diff --git a/configs/configs/vp8-opus/libs.txt b/configs/configs/vp8-opus/libs.txt index ef1a3d4c..4ab73dc7 100644 --- a/configs/configs/vp8-opus/libs.txt +++ b/configs/configs/vp8-opus/libs.txt @@ -1,2 +1,5 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a build/inst/@TARGET/lib/libopus.a build/inst/@TARGET/lib/libvpx.a diff --git a/configs/configs/vp8-opus/link-flags.txt b/configs/configs/vp8-opus/link-flags.txt index e69de29b..bd0c5e59 100644 --- a/configs/configs/vp8-opus/link-flags.txt +++ b/configs/configs/vp8-opus/link-flags.txt @@ -0,0 +1,2 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 diff --git a/configs/configs/vp9-opus-avf/components.txt b/configs/configs/vp9-opus-avf/components.txt new file mode 100644 index 00000000..d8421f3d --- /dev/null +++ b/configs/configs/vp9-opus-avf/components.txt @@ -0,0 +1,7 @@ +c +avutil +avformat +avfcbridge +avcodec +avfilter +swscale diff --git a/configs/configs/vp9-opus-avf/config.json b/configs/configs/vp9-opus-avf/config.json index 0934e521..a6265373 100644 --- a/configs/configs/vp9-opus-avf/config.json +++ b/configs/configs/vp9-opus-avf/config.json @@ -1 +1 @@ -["format-ogg","format-webm","parser-opus","codec-libopus","libvpx","parser-vp9","codec-libvpx_vp9","audio-filters","swscale","video-filters"] +["avformat","avcodec","format-ogg","format-webm","parser-opus","codec-libopus","libvpx","parser-vp9","codec-libvpx_vp9","avfilter","swresample","swscale","audio-filters","video-filters"] diff --git a/configs/configs/vp9-opus-avf/ffmpeg-config.txt b/configs/configs/vp9-opus-avf/ffmpeg-config.txt index 454f9226..43cb0fbe 100644 --- a/configs/configs/vp9-opus-avf/ffmpeg-config.txt +++ b/configs/configs/vp9-opus-avf/ffmpeg-config.txt @@ -15,6 +15,7 @@ --enable-bsf=vp9_metadata --enable-libvpx --enable-encoder=libvpx_vp9 +--enable-filter=scale --enable-filter=acompressor --enable-filter=adeclick --enable-filter=adeclip --enable-filter=aecho --enable-filter=afade --enable-filter=aformat --enable-filter=agate --enable-filter=alimiter --enable-filter=amix @@ -23,6 +24,5 @@ --enable-filter=bandreject --enable-filter=dynaudnorm --enable-filter=equalizer --enable-filter=loudnorm --enable-filter=pan --enable-filter=amix --enable-filter=volume --enable-filter=anull ---enable-filter=scale --enable-filter=crop --enable-filter=fps --enable-filter=null --enable-filter=settb --enable-filter=split --enable-filter=trim diff --git a/configs/configs/vp9-opus-avf/libs.txt b/configs/configs/vp9-opus-avf/libs.txt index ef1a3d4c..f0c07280 100644 --- a/configs/configs/vp9-opus-avf/libs.txt +++ b/configs/configs/vp9-opus-avf/libs.txt @@ -1,2 +1,8 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a build/inst/@TARGET/lib/libopus.a build/inst/@TARGET/lib/libvpx.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavfilter/libavfilter.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswresample/libswresample.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswscale/libswscale.a diff --git a/configs/configs/vp9-opus-avf/link-flags.txt b/configs/configs/vp9-opus-avf/link-flags.txt index 308036f3..4d12cb08 100644 --- a/configs/configs/vp9-opus-avf/link-flags.txt +++ b/configs/configs/vp9-opus-avf/link-flags.txt @@ -1 +1,5 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 +-DLIBAVJS_WITH_AVFILTER=1 +-DLIBAVJS_WITH_SWRESAMPLE=1 -DLIBAVJS_WITH_SWSCALE=1 diff --git a/configs/configs/vp9-opus/components.txt b/configs/configs/vp9-opus/components.txt new file mode 100644 index 00000000..25dcbb1f --- /dev/null +++ b/configs/configs/vp9-opus/components.txt @@ -0,0 +1,5 @@ +c +avutil +avformat +avfcbridge +avcodec diff --git a/configs/configs/vp9-opus/config.json b/configs/configs/vp9-opus/config.json index e8f2c2c1..f204540c 100644 --- a/configs/configs/vp9-opus/config.json +++ b/configs/configs/vp9-opus/config.json @@ -1 +1 @@ -["format-ogg","format-webm","parser-opus","codec-libopus","libvpx","parser-vp9","codec-libvpx_vp9"] +["avformat","avcodec","format-ogg","format-webm","parser-opus","codec-libopus","libvpx","parser-vp9","codec-libvpx_vp9"] diff --git a/configs/configs/vp9-opus/libs.txt b/configs/configs/vp9-opus/libs.txt index ef1a3d4c..4ab73dc7 100644 --- a/configs/configs/vp9-opus/libs.txt +++ b/configs/configs/vp9-opus/libs.txt @@ -1,2 +1,5 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a build/inst/@TARGET/lib/libopus.a build/inst/@TARGET/lib/libvpx.a diff --git a/configs/configs/vp9-opus/link-flags.txt b/configs/configs/vp9-opus/link-flags.txt index e69de29b..bd0c5e59 100644 --- a/configs/configs/vp9-opus/link-flags.txt +++ b/configs/configs/vp9-opus/link-flags.txt @@ -0,0 +1,2 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 diff --git a/configs/configs/wav-af/components.txt b/configs/configs/wav-af/components.txt new file mode 100644 index 00000000..228f8505 --- /dev/null +++ b/configs/configs/wav-af/components.txt @@ -0,0 +1,6 @@ +c +avutil +avformat +avfcbridge +avcodec +avfilter diff --git a/configs/configs/wav-af/config.json b/configs/configs/wav-af/config.json index 72279d19..09e4e226 100644 --- a/configs/configs/wav-af/config.json +++ b/configs/configs/wav-af/config.json @@ -1 +1 @@ -["format-wav","codec-pcm_f32le","audio-filters"] +["avformat","avcodec","format-wav","codec-pcm_f32le","avfilter","swresample","audio-filters"] diff --git a/configs/configs/wav-af/libs.txt b/configs/configs/wav-af/libs.txt index e69de29b..9a14ba31 100644 --- a/configs/configs/wav-af/libs.txt +++ b/configs/configs/wav-af/libs.txt @@ -0,0 +1,5 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavfilter/libavfilter.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswresample/libswresample.a diff --git a/configs/configs/wav-af/link-flags.txt b/configs/configs/wav-af/link-flags.txt index e69de29b..e3e72004 100644 --- a/configs/configs/wav-af/link-flags.txt +++ b/configs/configs/wav-af/link-flags.txt @@ -0,0 +1,4 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 +-DLIBAVJS_WITH_AVFILTER=1 +-DLIBAVJS_WITH_SWRESAMPLE=1 diff --git a/configs/configs/wav/components.txt b/configs/configs/wav/components.txt new file mode 100644 index 00000000..25dcbb1f --- /dev/null +++ b/configs/configs/wav/components.txt @@ -0,0 +1,5 @@ +c +avutil +avformat +avfcbridge +avcodec diff --git a/configs/configs/wav/config.json b/configs/configs/wav/config.json index 1fb356d6..9767dd46 100644 --- a/configs/configs/wav/config.json +++ b/configs/configs/wav/config.json @@ -1 +1 @@ -["format-wav","codec-pcm_f32le"] +["avformat","avcodec","format-wav","codec-pcm_f32le"] diff --git a/configs/configs/wav/libs.txt b/configs/configs/wav/libs.txt index e69de29b..a1af5902 100644 --- a/configs/configs/wav/libs.txt +++ b/configs/configs/wav/libs.txt @@ -0,0 +1,3 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a diff --git a/configs/configs/wav/link-flags.txt b/configs/configs/wav/link-flags.txt index e69de29b..bd0c5e59 100644 --- a/configs/configs/wav/link-flags.txt +++ b/configs/configs/wav/link-flags.txt @@ -0,0 +1,2 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 diff --git a/configs/configs/webcodecs-avf/components.txt b/configs/configs/webcodecs-avf/components.txt new file mode 100644 index 00000000..d8421f3d --- /dev/null +++ b/configs/configs/webcodecs-avf/components.txt @@ -0,0 +1,7 @@ +c +avutil +avformat +avfcbridge +avcodec +avfilter +swscale diff --git a/configs/configs/webcodecs-avf/config.json b/configs/configs/webcodecs-avf/config.json index 38e61940..ee6fbd96 100644 --- a/configs/configs/webcodecs-avf/config.json +++ b/configs/configs/webcodecs-avf/config.json @@ -1 +1 @@ -["format-ogg","format-webm","format-mp4","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","parser-aac","parser-vp8","parser-vp9","parser-av1","parser-h264","parser-hevc","bsf-extract_extradata","bsf-vp9_metadata","bsf-av1_metadata","bsf-h264_metadata","bsf-hevc_metadata","audio-filters","swscale","video-filters"] +["avformat","avcodec","format-ogg","format-webm","format-mp4","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","parser-aac","parser-vp8","parser-vp9","parser-av1","parser-h264","parser-hevc","bsf-extract_extradata","bsf-vp9_metadata","bsf-av1_metadata","bsf-h264_metadata","bsf-hevc_metadata","avfilter","swresample","swscale","audio-filters","video-filters"] diff --git a/configs/configs/webcodecs-avf/ffmpeg-config.txt b/configs/configs/webcodecs-avf/ffmpeg-config.txt index e9492784..183817bc 100644 --- a/configs/configs/webcodecs-avf/ffmpeg-config.txt +++ b/configs/configs/webcodecs-avf/ffmpeg-config.txt @@ -35,6 +35,7 @@ --enable-bsf=av1_metadata --enable-bsf=h264_metadata --enable-bsf=hevc_metadata +--enable-filter=scale --enable-filter=acompressor --enable-filter=adeclick --enable-filter=adeclip --enable-filter=aecho --enable-filter=afade --enable-filter=aformat --enable-filter=agate --enable-filter=alimiter --enable-filter=amix @@ -43,6 +44,5 @@ --enable-filter=bandreject --enable-filter=dynaudnorm --enable-filter=equalizer --enable-filter=loudnorm --enable-filter=pan --enable-filter=amix --enable-filter=volume --enable-filter=anull ---enable-filter=scale --enable-filter=crop --enable-filter=fps --enable-filter=null --enable-filter=settb --enable-filter=split --enable-filter=trim diff --git a/configs/configs/webcodecs-avf/libs.txt b/configs/configs/webcodecs-avf/libs.txt index 0edff23f..9f970d5a 100644 --- a/configs/configs/webcodecs-avf/libs.txt +++ b/configs/configs/webcodecs-avf/libs.txt @@ -1 +1,7 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a build/inst/@TARGET/lib/libopus.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavfilter/libavfilter.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswresample/libswresample.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswscale/libswscale.a diff --git a/configs/configs/webcodecs-avf/link-flags.txt b/configs/configs/webcodecs-avf/link-flags.txt index 308036f3..4d12cb08 100644 --- a/configs/configs/webcodecs-avf/link-flags.txt +++ b/configs/configs/webcodecs-avf/link-flags.txt @@ -1 +1,5 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 +-DLIBAVJS_WITH_AVFILTER=1 +-DLIBAVJS_WITH_SWRESAMPLE=1 -DLIBAVJS_WITH_SWSCALE=1 diff --git a/configs/configs/webcodecs/components.txt b/configs/configs/webcodecs/components.txt new file mode 100644 index 00000000..25dcbb1f --- /dev/null +++ b/configs/configs/webcodecs/components.txt @@ -0,0 +1,5 @@ +c +avutil +avformat +avfcbridge +avcodec diff --git a/configs/configs/webcodecs/config.json b/configs/configs/webcodecs/config.json index b3a9aed5..0928895f 100644 --- a/configs/configs/webcodecs/config.json +++ b/configs/configs/webcodecs/config.json @@ -1 +1 @@ -["format-ogg","format-webm","format-mp4","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","parser-aac","parser-vp8","parser-vp9","parser-av1","parser-h264","parser-hevc","bsf-extract_extradata","bsf-vp9_metadata","bsf-av1_metadata","bsf-h264_metadata","bsf-hevc_metadata"] +["avformat","avcodec","format-ogg","format-webm","format-mp4","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","parser-aac","parser-vp8","parser-vp9","parser-av1","parser-h264","parser-hevc","bsf-extract_extradata","bsf-vp9_metadata","bsf-av1_metadata","bsf-h264_metadata","bsf-hevc_metadata"] diff --git a/configs/configs/webcodecs/libs.txt b/configs/configs/webcodecs/libs.txt index 0edff23f..370df537 100644 --- a/configs/configs/webcodecs/libs.txt +++ b/configs/configs/webcodecs/libs.txt @@ -1 +1,4 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a build/inst/@TARGET/lib/libopus.a diff --git a/configs/configs/webcodecs/link-flags.txt b/configs/configs/webcodecs/link-flags.txt index e69de29b..bd0c5e59 100644 --- a/configs/configs/webcodecs/link-flags.txt +++ b/configs/configs/webcodecs/link-flags.txt @@ -0,0 +1,2 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 diff --git a/configs/configs/webm-cli/components.txt b/configs/configs/webm-cli/components.txt new file mode 100644 index 00000000..80670eda --- /dev/null +++ b/configs/configs/webm-cli/components.txt @@ -0,0 +1,7 @@ +c +avutil +avformat +avfcbridge +avcodec +swscale +cli diff --git a/configs/configs/webm-cli/config.json b/configs/configs/webm-cli/config.json index b52dd303..cc359837 100644 --- a/configs/configs/webm-cli/config.json +++ b/configs/configs/webm-cli/config.json @@ -1 +1 @@ -["format-ogg","format-webm","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","audio-filters","libvpx","parser-vp8","codec-libvpx_vp8","swscale","video-filters","cli"] +["avformat","avcodec","format-ogg","format-webm","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","audio-filters","libvpx","parser-vp8","codec-libvpx_vp8","swscale","video-filters","cli"] diff --git a/configs/configs/webm-cli/libs.txt b/configs/configs/webm-cli/libs.txt index ef1a3d4c..b974494c 100644 --- a/configs/configs/webm-cli/libs.txt +++ b/configs/configs/webm-cli/libs.txt @@ -1,2 +1,6 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a build/inst/@TARGET/lib/libopus.a build/inst/@TARGET/lib/libvpx.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswscale/libswscale.a diff --git a/configs/configs/webm-cli/link-flags.txt b/configs/configs/webm-cli/link-flags.txt index d2926df7..bfc94ea1 100644 --- a/configs/configs/webm-cli/link-flags.txt +++ b/configs/configs/webm-cli/link-flags.txt @@ -1,3 +1,5 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 -DLIBAVJS_WITH_SWSCALE=1 -DLIBAVJS_WITH_CLI=1 -DLIBAVJS_WITH_SWSCALE=1 diff --git a/configs/configs/webm-vp9-cli/components.txt b/configs/configs/webm-vp9-cli/components.txt new file mode 100644 index 00000000..80670eda --- /dev/null +++ b/configs/configs/webm-vp9-cli/components.txt @@ -0,0 +1,7 @@ +c +avutil +avformat +avfcbridge +avcodec +swscale +cli diff --git a/configs/configs/webm-vp9-cli/config.json b/configs/configs/webm-vp9-cli/config.json index c64e33e8..339437c3 100644 --- a/configs/configs/webm-vp9-cli/config.json +++ b/configs/configs/webm-vp9-cli/config.json @@ -1 +1 @@ -["format-ogg","format-webm","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","audio-filters","libvpx","parser-vp8","codec-libvpx_vp8","swscale","video-filters","parser-vp9","codec-libvpx_vp9","cli"] +["avformat","avcodec","format-ogg","format-webm","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","audio-filters","libvpx","parser-vp8","codec-libvpx_vp8","swscale","video-filters","parser-vp9","codec-libvpx_vp9","cli"] diff --git a/configs/configs/webm-vp9-cli/libs.txt b/configs/configs/webm-vp9-cli/libs.txt index ef1a3d4c..b974494c 100644 --- a/configs/configs/webm-vp9-cli/libs.txt +++ b/configs/configs/webm-vp9-cli/libs.txt @@ -1,2 +1,6 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a build/inst/@TARGET/lib/libopus.a build/inst/@TARGET/lib/libvpx.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswscale/libswscale.a diff --git a/configs/configs/webm-vp9-cli/link-flags.txt b/configs/configs/webm-vp9-cli/link-flags.txt index d2926df7..bfc94ea1 100644 --- a/configs/configs/webm-vp9-cli/link-flags.txt +++ b/configs/configs/webm-vp9-cli/link-flags.txt @@ -1,3 +1,5 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 -DLIBAVJS_WITH_SWSCALE=1 -DLIBAVJS_WITH_CLI=1 -DLIBAVJS_WITH_SWSCALE=1 diff --git a/configs/configs/webm-vp9/components.txt b/configs/configs/webm-vp9/components.txt new file mode 100644 index 00000000..13571a76 --- /dev/null +++ b/configs/configs/webm-vp9/components.txt @@ -0,0 +1,6 @@ +c +avutil +avformat +avfcbridge +avcodec +swscale diff --git a/configs/configs/webm-vp9/config.json b/configs/configs/webm-vp9/config.json index 25c209da..a9588241 100644 --- a/configs/configs/webm-vp9/config.json +++ b/configs/configs/webm-vp9/config.json @@ -1 +1 @@ -["format-ogg","format-webm","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","audio-filters","libvpx","parser-vp8","codec-libvpx_vp8","swscale","video-filters","parser-vp9","codec-libvpx_vp9"] +["avformat","avcodec","format-ogg","format-webm","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","audio-filters","libvpx","parser-vp8","codec-libvpx_vp8","swscale","video-filters","parser-vp9","codec-libvpx_vp9"] diff --git a/configs/configs/webm-vp9/libs.txt b/configs/configs/webm-vp9/libs.txt index ef1a3d4c..b974494c 100644 --- a/configs/configs/webm-vp9/libs.txt +++ b/configs/configs/webm-vp9/libs.txt @@ -1,2 +1,6 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a build/inst/@TARGET/lib/libopus.a build/inst/@TARGET/lib/libvpx.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswscale/libswscale.a diff --git a/configs/configs/webm-vp9/link-flags.txt b/configs/configs/webm-vp9/link-flags.txt index 308036f3..8acce6f1 100644 --- a/configs/configs/webm-vp9/link-flags.txt +++ b/configs/configs/webm-vp9/link-flags.txt @@ -1 +1,3 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 -DLIBAVJS_WITH_SWSCALE=1 diff --git a/configs/configs/webm/components.txt b/configs/configs/webm/components.txt new file mode 100644 index 00000000..13571a76 --- /dev/null +++ b/configs/configs/webm/components.txt @@ -0,0 +1,6 @@ +c +avutil +avformat +avfcbridge +avcodec +swscale diff --git a/configs/configs/webm/config.json b/configs/configs/webm/config.json index fa1ed3c1..61f41539 100644 --- a/configs/configs/webm/config.json +++ b/configs/configs/webm/config.json @@ -1 +1 @@ -["format-ogg","format-webm","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","audio-filters","libvpx","parser-vp8","codec-libvpx_vp8","swscale","video-filters"] +["avformat","avcodec","format-ogg","format-webm","parser-opus","codec-libopus","format-flac","parser-flac","codec-flac","format-wav","codec-pcm_f32le","audio-filters","libvpx","parser-vp8","codec-libvpx_vp8","swscale","video-filters"] diff --git a/configs/configs/webm/libs.txt b/configs/configs/webm/libs.txt index ef1a3d4c..b974494c 100644 --- a/configs/configs/webm/libs.txt +++ b/configs/configs/webm/libs.txt @@ -1,2 +1,6 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a build/inst/@TARGET/lib/libopus.a build/inst/@TARGET/lib/libvpx.a +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswscale/libswscale.a diff --git a/configs/configs/webm/link-flags.txt b/configs/configs/webm/link-flags.txt index 308036f3..8acce6f1 100644 --- a/configs/configs/webm/link-flags.txt +++ b/configs/configs/webm/link-flags.txt @@ -1 +1,3 @@ +-DLIBAVJS_WITH_AVFORMAT=1 +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 -DLIBAVJS_WITH_SWSCALE=1 diff --git a/configs/fragments/avcodec/components.txt b/configs/fragments/avcodec/components.txt new file mode 100644 index 00000000..b22624dd --- /dev/null +++ b/configs/fragments/avcodec/components.txt @@ -0,0 +1,2 @@ +avfcbridge +avcodec diff --git a/configs/fragments/avcodec/libs.txt b/configs/fragments/avcodec/libs.txt new file mode 100644 index 00000000..ea67317c --- /dev/null +++ b/configs/fragments/avcodec/libs.txt @@ -0,0 +1 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a diff --git a/configs/fragments/avcodec/link-flags.txt b/configs/fragments/avcodec/link-flags.txt new file mode 100644 index 00000000..fc890c3c --- /dev/null +++ b/configs/fragments/avcodec/link-flags.txt @@ -0,0 +1 @@ +-DLIBAVJS_WITH_AVCODEC=1 -DLIBAVJS_FULL_AVCODEC=1 diff --git a/configs/fragments/avfcbridge/components.txt b/configs/fragments/avfcbridge/components.txt new file mode 100644 index 00000000..995054f6 --- /dev/null +++ b/configs/fragments/avfcbridge/components.txt @@ -0,0 +1 @@ +avfcbridge diff --git a/configs/fragments/avfcbridge/libs.txt b/configs/fragments/avfcbridge/libs.txt new file mode 100644 index 00000000..ea67317c --- /dev/null +++ b/configs/fragments/avfcbridge/libs.txt @@ -0,0 +1 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavcodec/libavcodec.a diff --git a/configs/fragments/avfcbridge/link-flags.txt b/configs/fragments/avfcbridge/link-flags.txt new file mode 100644 index 00000000..f1c3f529 --- /dev/null +++ b/configs/fragments/avfcbridge/link-flags.txt @@ -0,0 +1 @@ +-DLIBAVJS_WITH_AVCODEC=1 diff --git a/configs/fragments/avfilter/components.txt b/configs/fragments/avfilter/components.txt new file mode 100644 index 00000000..ce01158d --- /dev/null +++ b/configs/fragments/avfilter/components.txt @@ -0,0 +1 @@ +avfilter diff --git a/configs/fragments/avfilter/libs.txt b/configs/fragments/avfilter/libs.txt new file mode 100644 index 00000000..dec0c8df --- /dev/null +++ b/configs/fragments/avfilter/libs.txt @@ -0,0 +1 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavfilter/libavfilter.a diff --git a/configs/fragments/avfilter/link-flags.txt b/configs/fragments/avfilter/link-flags.txt new file mode 100644 index 00000000..9b75f8ba --- /dev/null +++ b/configs/fragments/avfilter/link-flags.txt @@ -0,0 +1 @@ +-DLIBAVJS_WITH_AVFILTER=1 diff --git a/configs/fragments/avformat/components.txt b/configs/fragments/avformat/components.txt new file mode 100644 index 00000000..27bb7a4b --- /dev/null +++ b/configs/fragments/avformat/components.txt @@ -0,0 +1 @@ +avformat diff --git a/configs/fragments/avformat/libs.txt b/configs/fragments/avformat/libs.txt new file mode 100644 index 00000000..63eb74b8 --- /dev/null +++ b/configs/fragments/avformat/libs.txt @@ -0,0 +1 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavformat/libavformat.a diff --git a/configs/fragments/avformat/link-flags.txt b/configs/fragments/avformat/link-flags.txt new file mode 100644 index 00000000..674e5b6c --- /dev/null +++ b/configs/fragments/avformat/link-flags.txt @@ -0,0 +1 @@ +-DLIBAVJS_WITH_AVFORMAT=1 diff --git a/configs/fragments/cli/components.txt b/configs/fragments/cli/components.txt new file mode 100644 index 00000000..573c0c4f --- /dev/null +++ b/configs/fragments/cli/components.txt @@ -0,0 +1 @@ +cli diff --git a/configs/fragments/default/components.txt b/configs/fragments/default/components.txt new file mode 100644 index 00000000..0d47ce4f --- /dev/null +++ b/configs/fragments/default/components.txt @@ -0,0 +1,2 @@ +c +avutil diff --git a/configs/fragments/default/libs.txt b/configs/fragments/default/libs.txt new file mode 100644 index 00000000..7c0a6cf6 --- /dev/null +++ b/configs/fragments/default/libs.txt @@ -0,0 +1 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libavutil/libavutil.a diff --git a/configs/fragments/swresample/libs.txt b/configs/fragments/swresample/libs.txt new file mode 100644 index 00000000..b2c6df8c --- /dev/null +++ b/configs/fragments/swresample/libs.txt @@ -0,0 +1 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswresample/libswresample.a diff --git a/configs/fragments/swresample/link-flags.txt b/configs/fragments/swresample/link-flags.txt new file mode 100644 index 00000000..cd3f9a25 --- /dev/null +++ b/configs/fragments/swresample/link-flags.txt @@ -0,0 +1 @@ +-DLIBAVJS_WITH_SWRESAMPLE=1 diff --git a/configs/fragments/swscale/components.txt b/configs/fragments/swscale/components.txt new file mode 100644 index 00000000..b8eb1b47 --- /dev/null +++ b/configs/fragments/swscale/components.txt @@ -0,0 +1 @@ +swscale diff --git a/configs/fragments/swscale/libs.txt b/configs/fragments/swscale/libs.txt new file mode 100644 index 00000000..e2265ba1 --- /dev/null +++ b/configs/fragments/swscale/libs.txt @@ -0,0 +1 @@ +build/ffmpeg-@FFVER/build-@TARGET-@VARIANT/libswscale/libswscale.a diff --git a/configs/mkconfig.js b/configs/mkconfig.js index 8b89e56f..26b83a28 100755 --- a/configs/mkconfig.js +++ b/configs/mkconfig.js @@ -17,7 +17,7 @@ const fs = require("fs"); const name = process.argv[2]; const parts = JSON.parse(process.argv[3]); -const files = ["ffmpeg-config.txt", "libs.txt", "license.js", "link-flags.txt"]; +const files = ["components.txt", "ffmpeg-config.txt", "libs.txt", "license.js", "link-flags.txt"]; try { fs.mkdirSync("configs"); diff --git a/configs/mkconfigs.js b/configs/mkconfigs.js index 51679eea..cca2acb1 100755 --- a/configs/mkconfigs.js +++ b/configs/mkconfigs.js @@ -34,17 +34,20 @@ const hevc = ["parser-hevc", "decoder-hevc"]; const configsRaw = [ // Audio sensible: ["default", [ + "avformat", "avcodec", "avfilter", "swresample", "format-ogg", "format-webm", opus, flac, "format-wav", "codec-pcm_f32le", "audio-filters" ], {cli: true}], - ["opus", ["format-ogg", "format-webm", opus], {af: true}], - ["flac", ["format-ogg", flac], {af: true}], - ["wav", ["format-wav", "codec-pcm_f32le"], {af: true}], + ["opus", ["avformat", "avcodec", "format-ogg", "format-webm", opus], {af: true}], + ["flac", ["avformat", "avcodec", "format-ogg", flac], {af: true}], + ["wav", ["avformat", "avcodec", "format-wav", "codec-pcm_f32le"], {af: true}], // Audio silly: ["obsolete", [ + "avformat", "avcodec", "avfilter", "swresample", + // Modern: "format-ogg", "format-webm", opus, flac, @@ -60,10 +63,11 @@ const configsRaw = [ ]], // Audio reprobate: - ["aac", ["format-mp4", "format-aac", "format-webm", aac], {af: true}], + ["aac", ["avformat", "avcodec", "format-mp4", "format-aac", "format-webm", aac], {af: true}], // Video sensible: ["webm", [ + "avformat", "avcodec", "format-ogg", "format-webm", opus, flac, "format-wav", "codec-pcm_f32le", "audio-filters", @@ -72,16 +76,17 @@ const configsRaw = [ "swscale", "video-filters" ], {vp9: true, cli: true}], - ["vp8-opus", ["format-ogg", "format-webm", opus, "libvpx", vp8], {avf: true}], - ["vp9-opus", ["format-ogg", "format-webm", opus, "libvpx", vp9], {avf: true}], - ["av1-opus", ["format-ogg", "format-webm", opus, aomav1], {avf: true}], + ["vp8-opus", ["avformat", "avcodec", "format-ogg", "format-webm", opus, "libvpx", vp8], {avf: true}], + ["vp9-opus", ["avformat", "avcodec", "format-ogg", "format-webm", opus, "libvpx", vp9], {avf: true}], + ["av1-opus", ["avformat", "avcodec", "format-ogg", "format-webm", opus, aomav1], {avf: true}], // Video reprobate: - ["h264-aac", ["format-mp4", "format-aac", "format-webm", aac, h264], {avf: true}], - ["hevc-aac", ["format-mp4", "format-aac", "format-webm", aac, hevc], {avf: true}], + ["h264-aac", ["avformat", "avcodec", "format-mp4", "format-aac", "format-webm", aac, h264], {avf: true}], + ["hevc-aac", ["avformat", "avcodec", "format-mp4", "format-aac", "format-webm", aac, hevc], {avf: true}], // Mostly parsing: ["webcodecs", [ + "avformat", "avcodec", "format-ogg", "format-webm", "format-mp4", opus, flac, "format-wav", "codec-pcm_f32le", "parser-aac", @@ -94,8 +99,22 @@ const configsRaw = [ "bsf-h264_metadata", "bsf-hevc_metadata" ], {avf: true}], + // Strictly formats + ["common-formats", [ + "avformat", "avfcbridge", + "format-webm", "format-mp4", "format-ogg", "format-flac", "format-aac", + "format-avi", "format-wav", "format-mpeg", "format-mpegts", "format-mp3" + ]], + + ["a-few-formats", [ + "avformat", "avfcbridge", + "format-ogg", "format-webm", "format-wav" + ]], + // These are here so that "all" will have them for testing ["extras", [ + "avformat", "avcodec", "avfilter", "swresample", "swscale", + // Images "format-image2", "demuxer-image_gif_pipe", "demuxer-image_jpeg_pipe", "demuxer-image_png_pipe", @@ -146,9 +165,9 @@ for (const config of configsRaw) { if (extra && extra.vp9) configGroup(toAdd, "vp9", vp9); if (extra && extra.af) - configGroup(toAdd, "af", ["audio-filters"]); + configGroup(toAdd, "af", ["avfilter", "swresample", "audio-filters"]); if (extra && extra.avf) - configGroup(toAdd, "avf", ["audio-filters", "swscale", "video-filters"]); + configGroup(toAdd, "avf", ["avfilter", "swresample", "swscale", "audio-filters", "video-filters"]); if (extra && extra.cli) configGroup(toAdd, "cli", ["cli"]); diff --git a/funcs.json b/funcs.json index ea7c3bea..82bc2d33 100644 --- a/funcs.json +++ b/funcs.json @@ -1,353 +1,422 @@ { - "functions": [ - ["av_get_bytes_per_sample", "number", ["number"]], - ["av_compare_ts_js", "number", ["number", "number", "number", "number", "number", "number", "number", "number"]], - ["av_opt_set", "number", ["number", "string", "string", "number"]], - ["av_opt_set_int_list_js", "number", ["number", "string", "number", "number", "number", "number"]], - ["av_frame_alloc", "number", []], - ["av_frame_clone", "number", ["number", "number"]], - ["av_frame_free", null, ["number"]], - ["av_frame_get_buffer", "number", ["number", "number"]], - ["av_frame_make_writable", "number", ["number"]], - ["av_frame_ref", "number", ["number", "number"]], - ["av_frame_unref", null, ["number"]], - ["ff_frame_rescale_ts_js", null, ["number", "number", "number", "number", "number"]], - ["av_log_get_level", "number", []], - ["av_log_set_level", null, ["number"]], - ["av_packet_alloc", "number", []], - ["av_packet_clone", "number", ["number"]], - ["av_packet_free", null, ["number"]], - ["av_packet_new_side_data", "number", ["number", "number", "number"]], - ["av_packet_ref", "number", ["number", "number"]], - ["av_packet_rescale_ts_js", null, ["number", "number", "number", "number", "number"]], - ["av_packet_unref", null, ["number"]], - ["av_strdup", "number", ["string"]], + "c": { + "functions": [ + ["calloc", "number", ["number", "number"]], + ["close", "number", ["number"]], + ["dup2", "number", ["number", "number"]], + ["free", null, ["number"]], + ["malloc", "number", ["number"]], + ["mallinfo_uordblks", "number", []], + ["open", "number", ["string", "number", "number"]], + ["strerror", "string", ["number"]], - ["av_buffersink_get_frame", "number", ["number", "number"]], - ["av_buffersink_get_time_base_num", "number", ["number"]], - ["av_buffersink_get_time_base_den", "number", ["number"]], - ["av_buffersink_set_frame_size", null, ["number", "number"]], - ["ff_buffersink_set_ch_layout", "number", ["number", "number", "number"]], - ["av_buffersrc_add_frame_flags", "number", ["number", "number", "number"]], - ["avfilter_free", null, ["number"]], - ["avfilter_get_by_name", "number", ["string"]], - ["avfilter_graph_alloc", "number", []], - ["avfilter_graph_config", "number", ["number", "number"]], - ["avfilter_graph_create_filter_js", "number", ["number", "string", "string", "number", "number"]], - ["avfilter_graph_free", null, ["number"]], - ["avfilter_graph_parse", "number", ["number", "string", "number", "number", "number"]], - ["avfilter_inout_alloc", "number", []], - ["avfilter_inout_free", null, ["number"]], - ["avfilter_link", "number", ["number", "number", "number", "number"]], + ["libavjs_create_main_thread", "number", []], + ["libavjs_with_swscale", "number", []] + ], + + "meta": [ + "ff_malloc_int32_list", + "ff_malloc_int64_list" + ], + + "copiers": [ + ["u8", "Uint8Array"], + ["s16", "Int16Array"], + ["s32", "Int32Array"], + ["f32", "Float32Array"] + ] + }, + + "avutil": { + "functions": [ + ["av_compare_ts_js", "number", ["number", "number", "number", "number", "number", "number", "number", "number"]], + ["av_dict_copy_js", "number", ["number", "number", "number"]], + ["av_dict_free", null, ["number"]], + ["av_dict_set_js", "number", ["number", "string", "string", "number"]], + ["av_frame_alloc", "number", []], + ["av_frame_clone", "number", ["number", "number"]], + ["av_frame_free", null, ["number"]], + ["av_frame_get_buffer", "number", ["number", "number"]], + ["av_frame_make_writable", "number", ["number"]], + ["av_frame_ref", "number", ["number", "number"]], + ["av_frame_unref", null, ["number"]], + ["av_get_bytes_per_sample", "number", ["number"]], + ["av_get_sample_fmt_name", "string", ["number"]], + ["av_log_get_level", "number", []], + ["av_log_set_level", null, ["number"]], + ["av_opt_set", "number", ["number", "string", "string", "number"]], + ["av_opt_set_int_list_js", "number", ["number", "string", "number", "number", "number", "number"]], + ["av_pix_fmt_desc_get", "number", ["number"]], + ["AVPixFmtDescriptor_comp_depth", "number", ["number", "number"]], + ["av_strdup", "number", ["string"]], + ["ff_error", "string", ["number"]], + ["ff_frame_rescale_ts_js", null, ["number", "number", "number", "number", "number"]], + ["ff_nothing", null, [], {"async": true}] + ], + + "meta": [ + "ff_copyout_frame", + "ff_copyout_frame_video", + "ff_frame_video_packed_size", + "ff_copyout_frame_video_packed", + "ff_copyout_frame_video_imagedata", + "ff_copyout_frame_ptr", + "ff_copyin_frame" + ], - ["avcodec_alloc_context3", "number", ["number"]], - ["avcodec_close", "number", ["number"]], - ["avcodec_descriptor_get", "number", ["number"]], - ["avcodec_descriptor_get_by_name", "number", ["string"]], - ["avcodec_descriptor_next", "number", ["number"]], - ["avcodec_find_decoder", "number", ["number"]], - ["avcodec_find_decoder_by_name", "number", ["string"]], - ["avcodec_find_encoder", "number", ["number"]], - ["avcodec_find_encoder_by_name", "number", ["string"]], - ["avcodec_flush_buffers", null, ["number"]], - ["avcodec_free_context", null, ["number"]], - ["avcodec_get_name", "string", ["number"]], - ["avcodec_open2", "number", ["number", "number", "number"]], - ["avcodec_open2_js", "number", ["number", "number", "number"]], - ["avcodec_parameters_alloc", "number", []], - ["avcodec_parameters_copy", "number", ["number", "number"]], - ["avcodec_parameters_free", null, ["number"]], - ["avcodec_parameters_from_context" ,"number", ["number", "number"]], - ["avcodec_parameters_to_context" ,"number", ["number", "number"]], - ["avcodec_receive_frame", "number", ["number", "number"]], - ["avcodec_receive_packet", "number", ["number", "number"]], - ["avcodec_send_frame", "number", ["number", "number"]], - ["avcodec_send_packet", "number", ["number", "number"]], + "accessors": [ + ["AVFrame", [ + "channel_layout", + "channel_layouthi", + "channels", + "channel_layoutmask", + "ch_layout_nb_channels", + "crop_bottom", + "crop_left", + "crop_right", + "crop_top", + {"name": "data", "array": true}, + "format", + "height", + "key_frame", + {"name": "linesize", "array": true}, + "nb_samples", + "pict_type", + "pts", + "ptshi", + {"name": "sample_aspect_ratio", "rational": true}, + "sample_rate", + {"name": "time_base", "rational": true}, + "width" + ]], + ["AVPixFmtDescriptor", [ + "flags", + "log2_chroma_h", + "log2_chroma_w", + "nb_components" + ]] + ], - ["av_find_input_format", "number", ["string"]], - ["avformat_alloc_context", "number", []], - ["avformat_alloc_output_context2_js", "number", ["number", "string", "string"]], - ["avformat_close_input", null, ["number"]], - ["avformat_find_stream_info", "number", ["number", "number"], {"async": true, "returnsErrno": true}], - ["avformat_flush", "number", ["number"]], - ["avformat_free_context", null, ["number"]], - ["avformat_new_stream", "number", ["number", "number"]], - ["avformat_open_input", "number", ["number", "string", "number", "number"], {"async": true, "returnsErrno": true}], - ["avformat_open_input_js", "number", ["string", "number", "number"], {"async": true, "returnsErrno": true}], - ["av_seek_frame", "number", ["number", "number", "number", "number"], {"async": true, "returnsErrno": true, "notypes": true}], - ["avformat_seek_file", "number", ["number", "number", "number", "number", "number", "number"], {"async": true, "returnsErrno": true, "notypes": true}], - ["avformat_seek_file_min", "number", ["number", "number", "number", "number"], {"async": true, "returnsErrno": true, "notypes": true}], - ["avformat_seek_file_max", "number", ["number", "number", "number", "number"], {"async": true, "returnsErrno": true, "notypes": true}], - ["avformat_seek_file_approx", "number", ["number", "number", "number", "number"], {"async": true, "returnsErrno": true, "notypes": true}], - ["avformat_write_header", "number", ["number", "number"]], - ["avio_open2_js", "number", ["string", "number", "number", "number"]], - ["avio_close", "number", ["number"]], - ["avio_flush", null, ["number"]], - ["av_find_best_stream", "number", ["number", "number", "number", "number", "number", "number"]], - ["av_get_sample_fmt_name", "string", ["number"]], - ["av_grow_packet", "number", ["number", "number"]], - ["av_interleaved_write_frame", "number", ["number", "number"]], - ["av_packet_make_writable", "number", ["number"]], - ["av_pix_fmt_desc_get", "number", ["number"]], - ["av_read_frame", "number", ["number", "number"], {"async": true, "returnsErrno": true}], - ["av_shrink_packet", null, ["number", "number"]], - ["av_write_frame", "number", ["number", "number"]], - ["av_write_trailer", "number", ["number"]], + "freers": [ + "av_frame_free", + "av_dict_free" + ] + }, - ["av_dict_copy_js", "number", ["number", "number", "number"]], - ["av_dict_free", null, ["number"]], - ["av_dict_set_js", "number", ["number", "string", "string", "number"]], + "avfcbridge": { + "//": "This is not a real library. This is the avcodec symbols that are needed to make use of avformat.", - ["sws_getContext", "number", - ["number", "number", "number", "number", "number", "number", - "number", "number", "number", "number"] + "functions": [ + ["av_grow_packet", "number", ["number", "number"]], + ["av_packet_alloc", "number", []], + ["av_packet_clone", "number", ["number"]], + ["av_packet_free", null, ["number"]], + ["av_packet_make_writable", "number", ["number"]], + ["av_packet_new_side_data", "number", ["number", "number", "number"]], + ["av_packet_ref", "number", ["number", "number"]], + ["av_packet_rescale_ts_js", null, ["number", "number", "number", "number", "number"]], + ["AVPacketSideData_data", "number", ["number", "number"]], + ["AVPacketSideData_size", "number", ["number", "number"]], + ["AVPacketSideData_type", "number", ["number", "number"]], + ["av_packet_unref", null, ["number"]], + ["av_shrink_packet", null, ["number", "number"]] ], - ["sws_freeContext", null, ["number"]], - ["sws_scale_frame", "number", ["number", "number", "number"]], - ["AVPacketSideData_data", "number", ["number", "number"]], - ["AVPacketSideData_size", "number", ["number", "number"]], - ["AVPacketSideData_type", "number", ["number", "number"]], - ["AVPixFmtDescriptor_comp_depth", "number", ["number", "number"]], + "meta": [ + "ff_set_packet", + "ff_copyout_packet", + "ff_copyout_packet_ptr", + "ff_copyin_packet" + ], - ["ff_error", "string", ["number"]], - ["ff_nothing", null, [], {"async": true}], + "accessors": [ + ["AVCodecDescriptor", [ + "id", + "long_name", + {"name": "mime_types", "array": true}, + "name", + "props", + "type" + ]], + ["AVCodecParameters", [ + "bit_rate", + "channel_layoutmask", + "channels", + "ch_layout_nb_channels", + "chroma_location", + "codec_id", + "codec_tag", + "codec_type", + "color_primaries", + "color_range", + "color_space", + "color_trc", + "extradata", + "extradata_size", + "format", + {"name": "framerate", "rational": true}, + "height", + "level", + "profile", + "sample_rate", + "width" + ]], + ["AVPacket", [ + "data", + "dts", + "dtshi", + "duration", + "durationhi", + "flags", + "pos", + "poshi", + "pts", + "ptshi", + "side_data", + "side_data_elems", + "size", + "stream_index", + {"name": "time_base", "rational": true} + ]] + ], - ["calloc", "number", ["number", "number"]], - ["close", "number", ["number"]], - ["dup2", "number", ["number", "number"]], - ["free", null, ["number"]], - ["malloc", "number", ["number"]], - ["mallinfo_uordblks", "number", []], - ["open", "number", ["string", "number", "number"]], - ["strerror", "string", ["number"]], + "freers": [ + "av_packet_free", + "avcodec_parameters_free" + ] + }, - ["libavjs_with_swscale", "number", []], - ["libavjs_create_main_thread", "number", []], + "avformat": { + "functions": [ + ["av_find_best_stream", "number", ["number", "number", "number", "number", "number", "number"]], + ["av_find_input_format", "number", ["string"]], + ["avformat_alloc_context", "number", []], + ["avformat_alloc_output_context2_js", "number", ["number", "string", "string"]], + ["avformat_close_input", null, ["number"]], + ["avformat_find_stream_info", "number", ["number", "number"], {"async": true, "returnsErrno": true}], + ["avformat_flush", "number", ["number"]], + ["avformat_free_context", null, ["number"]], + ["avformat_new_stream", "number", ["number", "number"]], + ["avformat_open_input", "number", ["number", "string", "number", "number"], {"async": true, "returnsErrno": true}], + ["avformat_open_input_js", "number", ["string", "number", "number"], {"async": true, "returnsErrno": true}], + ["avformat_seek_file", "number", ["number", "number", "number", "number", "number", "number"], {"async": true, "returnsErrno": true, "notypes": true}], + ["avformat_seek_file_min", "number", ["number", "number", "number", "number"], {"async": true, "returnsErrno": true, "notypes": true}], + ["avformat_seek_file_max", "number", ["number", "number", "number", "number"], {"async": true, "returnsErrno": true, "notypes": true}], + ["avformat_seek_file_approx", "number", ["number", "number", "number", "number"], {"async": true, "returnsErrno": true, "notypes": true}], + ["avformat_write_header", "number", ["number", "number"]], + ["av_interleaved_write_frame", "number", ["number", "number"]], + ["avio_open2_js", "number", ["string", "number", "number", "number"]], + ["avio_close", "number", ["number"]], + ["avio_flush", null, ["number"]], + ["av_read_frame", "number", ["number", "number"], {"async": true, "returnsErrno": true}], + ["av_seek_frame", "number", ["number", "number", "number", "number"], {"async": true, "returnsErrno": true, "notypes": true}], + ["av_write_frame", "number", ["number", "number"]], + ["av_write_trailer", "number", ["number"]] + ], - ["ffmpeg_main", "number", ["number", "number"], {"async": true}], - ["ffprobe_main", "number", ["number", "number"], {"async": true}] - ], + "fs": [ + "createLazyFile", + "ff_block_reader_dev_send", + "ff_reader_dev_send", + "ff_reader_dev_waiting", + "mkblockreaderdev", + "mkdev", + "mkfsfhfile", + "mkreadaheadfile", + "mkreaderdev", + "mkstreamwriterdev", + "mkworkerfsfile", + "mkwriterdev", + "mountwriterfs", + "readFile", + "unlink", + "unlinkfsfhfile", + "unlinkreadaheadfile", + "unlinkworkerfsfile", + "unmount", + "writeFile" + ], - "fs": [ - "readFile", - "writeFile", - "unlink", - "unmount", - "mkdev", - "createLazyFile", - "mkreaderdev", - "mkblockreaderdev", - "mkreadaheadfile", - "unlinkreadaheadfile", - "mkwriterdev", - "mkstreamwriterdev", - "mountwriterfs", - "mkfsfhfile", - "unlinkfsfhfile", - "mkworkerfsfile", - "unlinkworkerfsfile", - "ff_reader_dev_send", - "ff_block_reader_dev_send", - "ff_reader_dev_waiting" - ], + "meta": [ + "ff_init_muxer", + "ff_free_muxer", + "ff_init_demuxer_file", + "ff_write_multi", + "ff_read_frame_multi", + "ff_read_multi" + ], - "meta": [ - "ff_init_encoder", - "ff_init_decoder", - "ff_free_encoder", - "ff_free_decoder", - "ff_encode_multi", - "ff_decode_multi", - "ff_set_packet", - "ff_init_muxer", - "ff_free_muxer", - "ff_init_demuxer_file", - "ff_write_multi", - "ff_read_frame_multi", - "ff_read_multi", - "ff_init_filter_graph", - "ff_filter_multi", - "ff_decode_filter_multi", - "ff_copyout_frame", - "ff_copyout_frame_video", - "ff_frame_video_packed_size", - "ff_copyout_frame_video_packed", - "ff_copyout_frame_video_imagedata", - "ff_copyout_frame_ptr", - "ff_copyin_frame", - "ff_copyout_packet", - "ff_copyout_packet_ptr", - "ff_copyin_packet", - "ff_copyout_codecpar", - "ff_copyin_codecpar", - "ff_malloc_int32_list", - "ff_malloc_int64_list", - "ffmpeg", - "ffprobe" - ], + "accessors": [ + ["AVFormatContext", [ + "duration", + "durationhi", + "flags", + "nb_streams", + "oformat", + "pb", + "start_time", + "start_timehi", + {"name": "streams", "array": true} + ]], + ["AVStream", [ + "codecpar", + "discard", + "duration", + "durationhi", + {"name": "time_base", "rational": true} + ]] + ], - "accessors": [ - ["AVFrame", [ - "channel_layout", - "channel_layouthi", - "channels", - "channel_layoutmask", - "ch_layout_nb_channels", - "crop_bottom", - "crop_left", - "crop_right", - "crop_top", - {"name": "data", "array": true}, - "format", - "height", - "key_frame", - {"name": "linesize", "array": true}, - "nb_samples", - "pict_type", - "pts", - "ptshi", - {"name": "sample_aspect_ratio", "rational": true}, - "sample_rate", - {"name": "time_base", "rational": true}, - "width" - ]], - ["AVPixFmtDescriptor", [ - "flags", - "log2_chroma_h", - "log2_chroma_w", - "nb_components" - ]], - ["AVCodec", [ - {"name": "name", "string": true}, - "sample_fmts", - {"name": "sample_fmts", "array": true}, - "supported_samplerates", - {"name": "supported_samplerates", "array": true}, - "type" - ]], - ["AVCodecContext", [ - "codec_id", - "codec_type", - "bit_rate", - "bit_ratehi", - "channel_layout", - "channel_layouthi", - "channels", - "channel_layoutmask", - "ch_layout_nb_channels", - "extradata", - "extradata_size", - "frame_size", - {"name": "framerate", "rational": true}, - "gop_size", - "height", - "keyint_min", - "level", - "max_b_frames", - "pix_fmt", - "profile", - "rc_max_rate", - "rc_max_ratehi", - "rc_min_rate", - "rc_min_ratehi", - {"name": "sample_aspect_ratio", "rational": true}, - "sample_fmt", - "sample_rate", - {"name": "time_base", "rational": true}, - "qmax", - "qmin", - "width" - ]], - ["AVCodecDescriptor", [ - "id", - "long_name", - {"name": "mime_types", "array": true}, - "name", - "props", - "type" - ]], - ["AVCodecParameters", [ - "bit_rate", - "channel_layoutmask", - "channels", - "ch_layout_nb_channels", - "chroma_location", - "codec_id", - "codec_tag", - "codec_type", - "color_primaries", - "color_range", - "color_space", - "color_trc", - "extradata", - "extradata_size", - "format", - {"name": "framerate", "rational": true}, - "height", - "level", - "profile", - "sample_rate", - "width" - ]], - ["AVPacket", [ - "data", - "dts", - "dtshi", - "duration", - "durationhi", - "flags", - "pos", - "poshi", - "pts", - "ptshi", - "side_data", - "side_data_elems", - "size", - "stream_index", - {"name": "time_base", "rational": true} - ]], - ["AVFormatContext", [ - "duration", - "durationhi", - "flags", - "nb_streams", - "oformat", - "pb", - "start_time", - "start_timehi", - {"name": "streams", "array": true} - ]], - ["AVStream", [ - "codecpar", - "discard", - "duration", - "durationhi", - {"name": "time_base", "rational": true} - ]], - ["AVFilterInOut", [ - "filter_ctx", - "name", - "next", - "pad_idx" - ]] - ], + "freers": [ + "avformat_close_input" + ] + }, - "freers": [ - "av_frame_free", - "av_packet_free", - "avformat_close_input", - "avcodec_free_context", - "avcodec_parameters_free", - "avfilter_graph_free", - "avfilter_inout_free", - "av_dict_free" - ], + "avcodec": { + "functions": [ + ["avcodec_alloc_context3", "number", ["number"]], + ["avcodec_close", "number", ["number"]], + ["avcodec_descriptor_get", "number", ["number"]], + ["avcodec_descriptor_get_by_name", "number", ["string"]], + ["avcodec_descriptor_next", "number", ["number"]], + ["avcodec_find_decoder", "number", ["number"]], + ["avcodec_find_decoder_by_name", "number", ["string"]], + ["avcodec_find_encoder", "number", ["number"]], + ["avcodec_find_encoder_by_name", "number", ["string"]], + ["avcodec_flush_buffers", null, ["number"]], + ["avcodec_free_context", null, ["number"]], + ["avcodec_get_name", "string", ["number"]], + ["avcodec_open2", "number", ["number", "number", "number"]], + ["avcodec_open2_js", "number", ["number", "number", "number"]], + ["avcodec_parameters_alloc", "number", []], + ["avcodec_parameters_copy", "number", ["number", "number"]], + ["avcodec_parameters_free", null, ["number"]], + ["avcodec_parameters_from_context" ,"number", ["number", "number"]], + ["avcodec_parameters_to_context" ,"number", ["number", "number"]], + ["avcodec_receive_frame", "number", ["number", "number"]], + ["avcodec_receive_packet", "number", ["number", "number"]], + ["avcodec_send_frame", "number", ["number", "number"]], + ["avcodec_send_packet", "number", ["number", "number"]] + ], + + "meta": [ + "ff_init_encoder", + "ff_init_decoder", + "ff_free_encoder", + "ff_free_decoder", + "ff_encode_multi", + "ff_decode_multi", + "ff_copyout_codecpar", + "ff_copyin_codecpar" + ], + + "accessors": [ + ["AVCodec", [ + {"name": "name", "string": true}, + "sample_fmts", + {"name": "sample_fmts", "array": true}, + "supported_samplerates", + {"name": "supported_samplerates", "array": true}, + "type" + ]], + ["AVCodecContext", [ + "codec_id", + "codec_type", + "bit_rate", + "bit_ratehi", + "channel_layout", + "channel_layouthi", + "channels", + "channel_layoutmask", + "ch_layout_nb_channels", + "extradata", + "extradata_size", + "frame_size", + {"name": "framerate", "rational": true}, + "gop_size", + "height", + "keyint_min", + "level", + "max_b_frames", + "pix_fmt", + "profile", + "rc_max_rate", + "rc_max_ratehi", + "rc_min_rate", + "rc_min_ratehi", + {"name": "sample_aspect_ratio", "rational": true}, + "sample_fmt", + "sample_rate", + {"name": "time_base", "rational": true}, + "qmax", + "qmin", + "width" + ]] + ], + + "freers": [ + "avcodec_free_context" + ] + }, + + "avfilter": { + "functions": [ + ["av_buffersink_get_frame", "number", ["number", "number"]], + ["av_buffersink_get_time_base_num", "number", ["number"]], + ["av_buffersink_get_time_base_den", "number", ["number"]], + ["av_buffersink_set_frame_size", null, ["number", "number"]], + ["ff_buffersink_set_ch_layout", "number", ["number", "number", "number"]], + ["av_buffersrc_add_frame_flags", "number", ["number", "number", "number"]], + ["avfilter_free", null, ["number"]], + ["avfilter_get_by_name", "number", ["string"]], + ["avfilter_graph_alloc", "number", []], + ["avfilter_graph_config", "number", ["number", "number"]], + ["avfilter_graph_create_filter_js", "number", ["number", "string", "string", "number", "number"]], + ["avfilter_graph_free", null, ["number"]], + ["avfilter_graph_parse", "number", ["number", "string", "number", "number", "number"]], + ["avfilter_inout_alloc", "number", []], + ["avfilter_inout_free", null, ["number"]], + ["avfilter_link", "number", ["number", "number", "number", "number"]] + ], + + "meta": [ + "ff_init_filter_graph", + "ff_filter_multi", + "ff_decode_filter_multi" + ], + + "accessors": [ + ["AVFilterInOut", [ + "filter_ctx", + "name", + "next", + "pad_idx" + ]] + ], + + "freers": [ + "avfilter_graph_free", + "avfilter_inout_free" + ] + }, + + "swscale": { + "functions": [ + ["sws_getContext", "number", ["number", "number", "number", "number", "number", "number", "number", "number", "number", "number"]], + ["sws_freeContext", null, ["number"]], + ["sws_scale_frame", "number", ["number", "number", "number"]] + ] + }, + + "cli": { + "functions": [ + ["ffmpeg_main", "number", ["number", "number"], {"async": true}], + ["ffprobe_main", "number", ["number", "number"], {"async": true}] + ], - "copiers": [ - ["u8", "Uint8Array"], - ["s16", "Int16Array"], - ["s32", "Int32Array"], - ["f32", "Float32Array"] - ] + "meta": [ + "ffmpeg", + "ffprobe" + ] + } } diff --git a/src/b-avcodec.c b/src/b-avcodec.c new file mode 100644 index 00000000..4ac435d6 --- /dev/null +++ b/src/b-avcodec.c @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2019-2025 Yahweasel and contributors + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#if LIBAVJS_FULL_AVCODEC +/* AVCodec */ +#define B(type, field) A(AVCodec, type, field) +#define BA(type, field) AA(AVCodec, type, field) +B(const char *, name) +B(const char *, long_name) +B(const enum AVSampleFormat *, sample_fmts) +BA(enum AVSampleFormat, sample_fmts) +B(const int *, supported_samplerates) +BA(int, supported_samplerates) +B(enum AVMediaType, type) +#undef B +#undef BA + +/* AVCodecContext */ +#define B(type, field) A(AVCodecContext, type, field) +#define BL(type, field) AL(AVCodecContext, type, field) +B(enum AVCodecID, codec_id) +B(enum AVMediaType, codec_type) +BL(int64_t, bit_rate) +B(uint8_t *, extradata) +B(int, extradata_size) +B(int, frame_size) +B(int, gop_size) +B(int, height) +B(int, keyint_min) +B(int, level) +B(int, max_b_frames) +B(int, pix_fmt) +B(int, profile) +BL(int64_t, rc_max_rate) +BL(int64_t, rc_min_rate) +B(int, sample_fmt) +B(int, sample_rate) +B(int, qmax) +B(int, qmin) +B(int, width) +#undef B +#undef BL + +RAT(AVCodecContext, framerate) +RAT(AVCodecContext, sample_aspect_ratio) +RAT(AVCodecContext, time_base) +CHL(AVCodecContext) + +#endif + + +/* AVCodecDescriptor */ +#define B(type, field) A(AVCodecDescriptor, type, field) +B(enum AVCodecID, id) +B(const char *, long_name) +AA(AVCodecDescriptor, const char *, mime_types) +B(const char *, name) +B(int, props) +B(enum AVMediaType, type) +#undef B + +/* AVCodecParameters */ +#define B(type, field) A(AVCodecParameters, type, field) +B(enum AVCodecID, codec_id) +B(uint32_t, codec_tag) +B(enum AVMediaType, codec_type) +B(uint8_t *, extradata) +B(int, extradata_size) +B(int, format) +B(int64_t, bit_rate) +B(int, profile) +B(int, level) +B(int, width) +B(int, height) +B(enum AVColorRange, color_range) +B(enum AVColorPrimaries, color_primaries) +B(enum AVColorTransferCharacteristic, color_trc) +B(enum AVColorSpace, color_space) +B(enum AVChromaLocation, chroma_location) +B(int, sample_rate) +#undef B + +#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(60, 10, 100) +RAT(AVCodecParameters, framerate) +#else +RAT_FAKE(AVCodecParameters, framerate, 60, 1) +#endif + +CHL(AVCodecParameters) + + +/* AVPacket */ +#define B(type, field) A(AVPacket, type, field) +#define BL(type, field) AL(AVPacket, type, field) +B(uint8_t *, data) +BL(int64_t, dts) +BL(int64_t, duration) +B(int, flags) +BL(int64_t, pos) +BL(int64_t, pts) +B(AVPacketSideData *, side_data) +B(int, side_data_elems) +B(int, size) +B(int, stream_index) +#undef B +#undef BL + +#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(59, 4, 100) +RAT(AVPacket, time_base) +#else +RAT_FAKE(AVPacket, time_base, 1, 1000) +#endif + + +/* AVPacketSideData uses special accessors because it's usually an array */ +uint8_t *AVPacketSideData_data(AVPacketSideData *a, int idx) { + return a[idx].data; +} + +int AVPacketSideData_size(AVPacketSideData *a, int idx) { + return a[idx].size; +} + +enum AVPacketSideDataType AVPacketSideData_type(AVPacketSideData *a, int idx) { + return a[idx].type; +} + +#if LIBAVJS_FULL_AVCODEC +int avcodec_open2_js( + AVCodecContext *avctx, const AVCodec *codec, AVDictionary *options +) { + return avcodec_open2(avctx, codec, &options); +} +#endif + +/* Implemented as a binding so that we don't have to worry about struct copies */ +void av_packet_rescale_ts_js( + AVPacket *pkt, + int tb_src_num, int tb_src_den, + int tb_dst_num, int tb_dst_den +) { + AVRational tb_src = {tb_src_num, tb_src_den}, + tb_dst = {tb_dst_num, tb_dst_den}; + av_packet_rescale_ts(pkt, tb_src, tb_dst); +} diff --git a/src/b-avfilter.c b/src/b-avfilter.c new file mode 100644 index 00000000..87d9d1b6 --- /dev/null +++ b/src/b-avfilter.c @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2019-2025 Yahweasel and contributors + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* AVFilterInOut */ +#define B(type, field) A(AVFilterInOut, type, field) +B(AVFilterContext *, filter_ctx) +B(char *, name) +B(AVFilterInOut *, next) +B(int, pad_idx) +#undef B + +/* Buffer sink */ +int av_buffersink_get_time_base_num(const AVFilterContext *ctx) { + return av_buffersink_get_time_base(ctx).num; +} + +int av_buffersink_get_time_base_den(const AVFilterContext *ctx) { + return av_buffersink_get_time_base(ctx).den; +} + +#if LIBAVFILTER_VERSION_INT > AV_VERSION_INT(8, 27, 100) +int ff_buffersink_set_ch_layout(AVFilterContext *ctx, unsigned int layoutlo, unsigned int layouthi) { + uint64_t layout; + char layoutStr[20]; + layout = ((uint64_t) layouthi << 32) | ((uint64_t) layoutlo); + sprintf(layoutStr, "0x%llx", layout); + return av_opt_set(ctx, "ch_layouts", layoutStr, AV_OPT_SEARCH_CHILDREN); +} +#else +int ff_buffersink_set_ch_layout(AVFilterContext *ctx, unsigned int layoutlo, unsigned int layouthi) { + uint64_t layout[2]; + layout[0] = ((uint64_t) layouthi << 32) | ((uint64_t) layoutlo); + layout[1] = -1; + return av_opt_set_int_list(ctx, "channel_layouts", layout, -1, AV_OPT_SEARCH_CHILDREN); +} +#endif + +AVFilterContext *avfilter_graph_create_filter_js(const AVFilter *filt, + const char *name, const char *args, void *opaque, AVFilterGraph *graph_ctx) +{ + AVFilterContext *ret = NULL; + int err = avfilter_graph_create_filter(&ret, filt, name, args, opaque, graph_ctx); + if (err < 0) + fprintf(stderr, "[avfilter_graph_create_filter_js] %s\n", av_err2str(err)); + return ret; +} diff --git a/src/b-avformat.c b/src/b-avformat.c new file mode 100644 index 00000000..d8b8f227 --- /dev/null +++ b/src/b-avformat.c @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2019-2025 Yahweasel and contributors + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* AVFormatContext */ +#define B(type, field) A(AVFormatContext, type, field) +#define BA(type, field) AA(AVFormatContext, type, field) +#define BL(type, field) AL(AVFormatContext, type, field) +BL(int64_t, duration) +B(int, flags) +B(unsigned int, nb_streams) +B(const struct AVOutputFormat *, oformat) +B(AVIOContext *, pb) +BL(int64_t, start_time) +BA(AVStream *, streams) +#undef B +#undef BA +#undef BL + +/* AVStream */ +#define B(type, field) A(AVStream, type, field) +#define BL(type, field) AL(AVStream, type, field) +B(AVCodecParameters *, codecpar) +B(enum AVDiscard, discard) +BL(int64_t, duration) +#undef B +#undef BL + +RAT(AVStream, time_base) + +int avformat_seek_file_min( + AVFormatContext *s, int stream_index, int64_t ts, int flags +) { + return avformat_seek_file(s, stream_index, ts, ts, INT64_MAX, flags); +} + +int avformat_seek_file_max( + AVFormatContext *s, int stream_index, int64_t ts, int flags +) { + return avformat_seek_file(s, stream_index, INT64_MIN, ts, ts, flags); +} + +int avformat_seek_file_approx( + AVFormatContext *s, int stream_index, int64_t ts, int flags +) { + return avformat_seek_file(s, stream_index, INT64_MIN, ts, INT64_MAX, flags); +} + +AVFormatContext *avformat_alloc_output_context2_js(AVOutputFormat *oformat, + const char *format_name, const char *filename) +{ + AVFormatContext *ret = NULL; + int err = avformat_alloc_output_context2(&ret, oformat, format_name, filename); + if (err < 0) + fprintf(stderr, "[avformat_alloc_output_context2_js] %s\n", av_err2str(err)); + return ret; +} + +AVFormatContext *avformat_open_input_js(const char *url, AVInputFormat *fmt, + AVDictionary *options) +{ + AVFormatContext *ret = NULL; + AVDictionary** options_p = &options; + int err = avformat_open_input(&ret, url, fmt, options_p); + if (err < 0) + fprintf(stderr, "[avformat_open_input_js] %s\n", av_err2str(err)); + return ret; +} + +AVIOContext *avio_open2_js(const char *url, int flags, + const AVIOInterruptCB *int_cb, AVDictionary *options) +{ + AVIOContext *ret = NULL; + AVDictionary** options_p = &options; + int err = avio_open2(&ret, url, flags, int_cb, options_p); + if (err < 0) + fprintf(stderr, "[avio_open2_js] %s\n", av_err2str(err)); + return ret; +} diff --git a/bindings.c b/src/bindings.c similarity index 60% rename from bindings.c rename to src/bindings.c index 4c234ac8..6d5aa309 100644 --- a/bindings.c +++ b/src/bindings.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2024 Yahweasel and contributors + * Copyright (C) 2019-2025 Yahweasel and contributors * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted. @@ -224,238 +224,58 @@ int av_opt_set_int_list_js(void *obj, const char *name, int width, void *val, in } } - -/**************************************************************** - * libavcodec - ***************************************************************/ - -/* AVCodec */ -#define B(type, field) A(AVCodec, type, field) -#define BA(type, field) AA(AVCodec, type, field) -B(const char *, name) -B(const char *, long_name) -B(const enum AVSampleFormat *, sample_fmts) -BA(enum AVSampleFormat, sample_fmts) -B(const int *, supported_samplerates) -BA(int, supported_samplerates) -B(enum AVMediaType, type) -#undef B -#undef BA - -/* AVCodecContext */ -#define B(type, field) A(AVCodecContext, type, field) -#define BL(type, field) AL(AVCodecContext, type, field) -B(enum AVCodecID, codec_id) -B(enum AVMediaType, codec_type) -BL(int64_t, bit_rate) -B(uint8_t *, extradata) -B(int, extradata_size) -B(int, frame_size) -B(int, gop_size) -B(int, height) -B(int, keyint_min) -B(int, level) -B(int, max_b_frames) -B(int, pix_fmt) -B(int, profile) -BL(int64_t, rc_max_rate) -BL(int64_t, rc_min_rate) -B(int, sample_fmt) -B(int, sample_rate) -B(int, qmax) -B(int, qmin) -B(int, width) -#undef B -#undef BL - -RAT(AVCodecContext, framerate) -RAT(AVCodecContext, sample_aspect_ratio) -RAT(AVCodecContext, time_base) -CHL(AVCodecContext) - - -/* AVCodecDescriptor */ -#define B(type, field) A(AVCodecDescriptor, type, field) -B(enum AVCodecID, id) -B(const char *, long_name) -AA(AVCodecDescriptor, const char *, mime_types) -B(const char *, name) -B(int, props) -B(enum AVMediaType, type) -#undef B - -/* AVCodecParameters */ -#define B(type, field) A(AVCodecParameters, type, field) -B(enum AVCodecID, codec_id) -B(uint32_t, codec_tag) -B(enum AVMediaType, codec_type) -B(uint8_t *, extradata) -B(int, extradata_size) -B(int, format) -B(int64_t, bit_rate) -B(int, profile) -B(int, level) -B(int, width) -B(int, height) -B(enum AVColorRange, color_range) -B(enum AVColorPrimaries, color_primaries) -B(enum AVColorTransferCharacteristic, color_trc) -B(enum AVColorSpace, color_space) -B(enum AVChromaLocation, chroma_location) -B(int, sample_rate) -#undef B - -#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(60, 10, 100) -RAT(AVCodecParameters, framerate) -#else -RAT_FAKE(AVCodecParameters, framerate, 60, 1) -#endif - -CHL(AVCodecParameters) - - -/* AVPacket */ -#define B(type, field) A(AVPacket, type, field) -#define BL(type, field) AL(AVPacket, type, field) -B(uint8_t *, data) -BL(int64_t, dts) -BL(int64_t, duration) -B(int, flags) -BL(int64_t, pos) -BL(int64_t, pts) -B(AVPacketSideData *, side_data) -B(int, side_data_elems) -B(int, size) -B(int, stream_index) -#undef B -#undef BL - -#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(59, 4, 100) -RAT(AVPacket, time_base) -#else -RAT_FAKE(AVPacket, time_base, 1, 1000) -#endif - - -/* AVPacketSideData uses special accessors because it's usually an array */ -uint8_t *AVPacketSideData_data(AVPacketSideData *a, int idx) { - return a[idx].data; -} - -int AVPacketSideData_size(AVPacketSideData *a, int idx) { - return a[idx].size; -} - -enum AVPacketSideDataType AVPacketSideData_type(AVPacketSideData *a, int idx) { - return a[idx].type; +AVDictionary *av_dict_copy_js( + AVDictionary *dst, const AVDictionary *src, int flags +) { + av_dict_copy(&dst, src, flags); + return dst; } -int avcodec_open2_js( - AVCodecContext *avctx, const AVCodec *codec, AVDictionary *options +AVDictionary *av_dict_set_js( + AVDictionary *pm, const char *key, const char *value, int flags ) { - return avcodec_open2(avctx, codec, &options); + av_dict_set(&pm, key, value, flags); + return pm; } -/* Implemented as a binding so that we don't have to worry about struct copies */ -void av_packet_rescale_ts_js( - AVPacket *pkt, - int tb_src_num, int tb_src_den, - int tb_dst_num, int tb_dst_den +int av_compare_ts_js( + unsigned int ts_a_lo, int ts_a_hi, + int tb_a_num, int tb_a_den, + unsigned int ts_b_lo, int ts_b_hi, + int tb_b_num, int tb_b_den ) { - AVRational tb_src = {tb_src_num, tb_src_den}, - tb_dst = {tb_dst_num, tb_dst_den}; - av_packet_rescale_ts(pkt, tb_src, tb_dst); + int64_t ts_a = (int64_t) ts_a_lo + ((int64_t) ts_a_hi << 32); + int64_t ts_b = (int64_t) ts_b_lo + ((int64_t) ts_b_hi << 32); + AVRational tb_a = {tb_a_num, tb_b_den}, + tb_b = {tb_b_num, tb_b_den}; + return av_compare_ts(ts_a, tb_a, ts_b, tb_b); } /**************************************************************** - * avformat + * libavcodec ***************************************************************/ -/* AVFormatContext */ -#define B(type, field) A(AVFormatContext, type, field) -#define BA(type, field) AA(AVFormatContext, type, field) -#define BL(type, field) AL(AVFormatContext, type, field) -BL(int64_t, duration) -B(int, flags) -B(unsigned int, nb_streams) -B(const struct AVOutputFormat *, oformat) -B(AVIOContext *, pb) -BL(int64_t, start_time) -BA(AVStream *, streams) -#undef B -#undef BA -#undef BL - -/* AVStream */ -#define B(type, field) A(AVStream, type, field) -#define BL(type, field) AL(AVStream, type, field) -B(AVCodecParameters *, codecpar) -B(enum AVDiscard, discard) -BL(int64_t, duration) -#undef B -#undef BL - -RAT(AVStream, time_base) - -int avformat_seek_file_min( - AVFormatContext *s, int stream_index, int64_t ts, int flags -) { - return avformat_seek_file(s, stream_index, ts, ts, INT64_MAX, flags); -} - -int avformat_seek_file_max( - AVFormatContext *s, int stream_index, int64_t ts, int flags -) { - return avformat_seek_file(s, stream_index, INT64_MIN, ts, ts, flags); -} +#if LIBAVJS_WITH_AVCODEC +#include "b-avcodec.c" +#endif -int avformat_seek_file_approx( - AVFormatContext *s, int stream_index, int64_t ts, int flags -) { - return avformat_seek_file(s, stream_index, INT64_MIN, ts, INT64_MAX, flags); -} +/**************************************************************** + * avformat + ***************************************************************/ +#if LIBAVJS_WITH_AVFORMAT +#include "b-avformat.c" +#endif /**************************************************************** * libavfilter ***************************************************************/ -/* AVFilterInOut */ -#define B(type, field) A(AVFilterInOut, type, field) -B(AVFilterContext *, filter_ctx) -B(char *, name) -B(AVFilterInOut *, next) -B(int, pad_idx) -#undef B - -/* Buffer sink */ -int av_buffersink_get_time_base_num(const AVFilterContext *ctx) { - return av_buffersink_get_time_base(ctx).num; -} - -int av_buffersink_get_time_base_den(const AVFilterContext *ctx) { - return av_buffersink_get_time_base(ctx).den; -} - -#if LIBAVFILTER_VERSION_INT > AV_VERSION_INT(8, 27, 100) -int ff_buffersink_set_ch_layout(AVFilterContext *ctx, unsigned int layoutlo, unsigned int layouthi) { - uint64_t layout; - char layoutStr[20]; - layout = ((uint64_t) layouthi << 32) | ((uint64_t) layoutlo); - sprintf(layoutStr, "0x%llx", layout); - return av_opt_set(ctx, "ch_layouts", layoutStr, AV_OPT_SEARCH_CHILDREN); -} -#else -int ff_buffersink_set_ch_layout(AVFilterContext *ctx, unsigned int layoutlo, unsigned int layouthi) { - uint64_t layout[2]; - layout[0] = ((uint64_t) layouthi << 32) | ((uint64_t) layoutlo); - layout[1] = -1; - return av_opt_set_int_list(ctx, "channel_layouts", layout, -1, AV_OPT_SEARCH_CHILDREN); -} +#if LIBAVJS_WITH_AVFILTER +#include "b-avfilter.c" #endif - /**************************************************************** * swscale ***************************************************************/ @@ -467,33 +287,9 @@ int libavjs_with_swscale() { #endif } -#ifndef LIBAVJS_WITH_SWSCALE -/* swscale isn't included, but we need the symbols */ -void sws_getContext() {} -void sws_freeContext() {} -void sws_scale_frame() {} - -#elif LIBAVUTIL_VERSION_INT <= AV_VERSION_INT(57, 4, 101) +#if LIBAVJS_WITH_SWSCALE && LIBAVUTIL_VERSION_INT <= AV_VERSION_INT(57, 4, 101) /* No sws_scale_frame in this version */ void sws_scale_frame() {} - -#endif - - -/**************************************************************** - * CLI - ***************************************************************/ -int libavjs_with_cli() { -#ifdef LIBAVJS_WITH_CLI - return 1; -#else - return 0; -#endif -} - -#ifndef LIBAVJS_WITH_CLI -int ffmpeg_main() { return 0; } -int ffprobe_main() { return 0; } #endif @@ -571,78 +367,6 @@ void *libavjs_create_main_thread() { return NULL; } /**************************************************************** * Other bindings ***************************************************************/ - -AVFormatContext *avformat_alloc_output_context2_js(AVOutputFormat *oformat, - const char *format_name, const char *filename) -{ - AVFormatContext *ret = NULL; - int err = avformat_alloc_output_context2(&ret, oformat, format_name, filename); - if (err < 0) - fprintf(stderr, "[avformat_alloc_output_context2_js] %s\n", av_err2str(err)); - return ret; -} - -AVFormatContext *avformat_open_input_js(const char *url, AVInputFormat *fmt, - AVDictionary *options) -{ - AVFormatContext *ret = NULL; - AVDictionary** options_p = &options; - int err = avformat_open_input(&ret, url, fmt, options_p); - if (err < 0) - fprintf(stderr, "[avformat_open_input_js] %s\n", av_err2str(err)); - return ret; -} - -AVIOContext *avio_open2_js(const char *url, int flags, - const AVIOInterruptCB *int_cb, AVDictionary *options) -{ - AVIOContext *ret = NULL; - AVDictionary** options_p = &options; - int err = avio_open2(&ret, url, flags, int_cb, options_p); - if (err < 0) - fprintf(stderr, "[avio_open2_js] %s\n", av_err2str(err)); - return ret; -} - -AVFilterContext *avfilter_graph_create_filter_js(const AVFilter *filt, - const char *name, const char *args, void *opaque, AVFilterGraph *graph_ctx) -{ - AVFilterContext *ret = NULL; - int err = avfilter_graph_create_filter(&ret, filt, name, args, opaque, graph_ctx); - if (err < 0) - fprintf(stderr, "[avfilter_graph_create_filter_js] %s\n", av_err2str(err)); - return ret; -} - -AVDictionary *av_dict_copy_js( - AVDictionary *dst, const AVDictionary *src, int flags -) { - av_dict_copy(&dst, src, flags); - return dst; -} - -AVDictionary *av_dict_set_js( - AVDictionary *pm, const char *key, const char *value, int flags -) { - av_dict_set(&pm, key, value, flags); - return pm; -} - -int av_compare_ts_js( - unsigned int ts_a_lo, int ts_a_hi, - int tb_a_num, int tb_a_den, - unsigned int ts_b_lo, int ts_b_hi, - int tb_b_num, int tb_b_den -) { - int64_t ts_a = (int64_t) ts_a_lo + ((int64_t) ts_a_hi << 32); - int64_t ts_b = (int64_t) ts_b_lo + ((int64_t) ts_b_hi << 32); - AVRational tb_a = {tb_a_num, tb_b_den}, - tb_b = {tb_b_num, tb_b_den}; - return av_compare_ts(ts_a, tb_a, ts_b, tb_b); -} - - -/* Errors */ #define ERR_BUF_SZ 256 static char err_buf[ERR_BUF_SZ]; diff --git a/extern-post.js b/src/extern-post.js similarity index 100% rename from extern-post.js rename to src/extern-post.js diff --git a/libav.in.js b/src/frontend.in.js similarity index 99% rename from libav.in.js rename to src/frontend.in.js index 0a7192ca..be7a9a12 100644 --- a/libav.in.js +++ b/src/frontend.in.js @@ -79,7 +79,7 @@ } libav.target = target; libav.VER = "@VER"; - libav.CONFIG = "@CONFIG"; + libav.CONFIG = "@VARIANT"; libav.DBG = "@DBG"; libav.factories = {}; @@ -261,10 +261,10 @@ opts = opts || {}; var base = opts.base || libav.base; var t = target(opts); - var variant = "@CONFIG"; + var variant = "@VARIANT"; if (t === "asm") { // In asm.js, we can't load alternate wasm - variant = opts.variant || libav.variant || "@CONFIG"; + variant = opts.variant || libav.variant || "@VARIANT"; } // Determine the file to import diff --git a/libav.types.in.d.ts b/src/libav.types.in.d.ts similarity index 100% rename from libav.types.in.d.ts rename to src/libav.types.in.d.ts diff --git a/post.in.js b/src/post.in.js similarity index 100% rename from post.in.js rename to src/post.in.js diff --git a/pre.js b/src/pre.js similarity index 100% rename from pre.js rename to src/pre.js diff --git a/tools/adjust-sourcemap.js b/tools/adjust-sourcemap.js index dd1e1f0e..3d9325d5 100755 --- a/tools/adjust-sourcemap.js +++ b/tools/adjust-sourcemap.js @@ -34,7 +34,8 @@ async function main() { let res = orig; if ( - orig === "../../bindings.c" || + orig === "../../src/bindings.c" || + /^\.\.\/\.\.\/src\/b-/.test(orig) || /^\.\.\/\.\.\/build/.test(orig) ) { // Already a full path diff --git a/tools/apply-funcs.js b/tools/apply-funcs.js deleted file mode 100755 index 4992dfb5..00000000 --- a/tools/apply-funcs.js +++ /dev/null @@ -1,377 +0,0 @@ -#!/usr/bin/env node -/* - * Copyright (C) 2019-2024 Yahweasel and contributors - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -const fs = require("fs"); -const funcs = JSON.parse(fs.readFileSync("funcs.json", "utf8")); -const doxygen = JSON.parse(fs.readFileSync("mk/doxygen.json", "utf8")); - -function s(x) { - return JSON.stringify(x); -} - -function accessors(f) { - funcs.accessors.forEach((type) => { - type[1].forEach((field) => { - if (field && field.array) - f(type[0] + "_" + field.name + "_a", field); - else if (typeof field === "object") - f(type[0] + "_" + field.name, field); - else - f(type[0] + "_" + field, null); - }); - }); -} - -function decls(f, meta) { - funcs.functions.forEach((decl) => { - f(decl[0], "func"); - }); - accessors((decl, field) => { - if (field && field.rational) { - f(`${decl}_num`, "getter"); - f(`${decl}_num_s`, "setter"); - f(`${decl}_den`, "getter"); - f(`${decl}_den_s`, "setter"); - f(`${decl}_s`, "setter"); - } else if (field && field.string) { - f(decl, "getter"); - } else { - f(decl, "getter"); - f(decl+"_s", "setter"); - } - }); - if (meta) { - funcs.fs.forEach((decl) => { - f(decl, "fs"); - }); - funcs.meta.forEach((decl) => { - f(decl, "meta"); - }); - funcs.freers.forEach((decl) => { - f(decl + "_js", "freer"); - }); - funcs.copiers.forEach((type) => { - f("copyin_" + type[0], "copyin"); - f("copyout_" + type[0], "copyout"); - }); - } -} - -// post.js -(function() { - var inp = fs.readFileSync("post.in.js", "utf8"); - - var outp = ""; - funcs.functions.forEach((decl) => { - outp += `var ${decl[0]} = ` + - `Module.${decl[0]} = ` + - `CAccessors.${decl[0]} = ` + - `Module.cwrap(${s(decl[0])}, ${s(decl[1])}, ${s(decl[2])}`; - if (decl[3] && decl[3].async) - outp += `, {async:true}`; - outp += ");\n"; - - if (decl[3] && decl[3].returnsErrno) { - // Need to check for ECANCELED, meaning passthru error - outp += `var ${decl[0]}__raw = ${decl[0]}; ` + - `${decl[0]} = ` + - `Module.${decl[0]} = function() { ` + - "var args = arguments; " + - `var ret = ${decl[0]}__raw.apply(void 0, args); ` + - "if (ret === -11) throw Module.fsThrownError; " + - "else if (ret && ret.then) { " + - "return ret.then(function(ret) { " + - "if (ret === -11) throw Module.fsThrownError; " + - "return ret; " + - "}); " + - "} " + - "return ret; " + - "}; "; - } - - if (decl[3] && decl[3].async) { - // Need to serialize async functions - outp += `Module.${decl[0]} = function() { ` + - "var args = arguments; " + - "return serially(function() { " + - `return ${decl[0]}.apply(void 0, args); ` + - "}); " + - "};\n"; - } - }); - accessors((decl, field) => { - if (field && field.array) { - outp += `var ${decl} = ` + - `Module.${decl} = ` + - `CAccessors.${decl} = ` + - `Module.cwrap(${s(decl)}, "number", ["number", "number"]);\n` + - `var ${decl}_s = ` + - `Module.${decl}_s = ` + - `CAccessors.${decl}_s = ` + - `Module.cwrap(${s(decl+"_s")}, null, ["number", "number", "number"]);\n`; - - } else if (field && field.rational) { - for (const part of ["num", "den"]) { - outp += `var ${decl}_${part} = ` + - `Module.${decl}_${part} = ` + - `CAccessors.${decl}_${part} = ` + - `Module.cwrap(${s(decl+"_"+part)}, "number", ["number"]);\n` + - `var ${decl}_${part}_s = ` + - `Module.${decl}_${part}_s = ` + - `CAccessors.${decl}_${part}_s = ` + - `Module.cwrap(${s(decl+"_"+part+"_s")}, null, ["number", "number"]);\n`; - } - outp += `var ${decl}_s = ` + - `Module.${decl}_s = ` + - `CAccessors.${decl}_s = ` + - `Module.cwrap(${s(decl+"_s")}, null, ["number", "number", "number"]);\n`; - - } else if (field && field.string) { - outp += `var ${decl} = ` + - `Module.${decl} = ` + - `CAccessors.${decl} = ` + - `Module.cwrap(${s(decl)}, "string", ["number"]);\n`; - - } else { - outp += `var ${decl} = ` + - `Module.${decl} = ` + - `CAccessors.${decl} = ` + - `Module.cwrap(${s(decl)}, "number", ["number"]);\n` + - `var ${decl}_s = ` + - `Module.${decl}_s = ` + - `CAccessors.${decl}_s = ` + - `Module.cwrap(${s(decl+"_s")}, null, ["number", "number"]);\n`; - } - }); - - funcs.freers.forEach((decl) => { - outp += `var ${decl}_js = ` + - `Module.${decl}_js = ` + - `CAccessors.${decl}_js = ` + - "function(p) { " + - "var p2 = malloc(4); " + - "if (p2 === 0) throw new Error(\"Could not malloc\"); " + - "(new Uint32Array(Module.HEAPU8.buffer, p2, 1))[0] = p; " + - `CAccessors.${decl}(p2); ` + - "free(p2); " + - "};\n"; - }); - - funcs.copiers.forEach((type) => { - outp += `var copyin_${type[0]} = ` + - `Module.copyin_${type[0]} = ` + - `CAccessors.copyin_${type[0]} = ` + - "function(ptr, arr) { " + - `var buf = new ${type[1]}(Module.HEAPU8.buffer, ptr); ` + - "buf.set(arr); " + - "};\n" + - `var copyout_${type[0]} = ` + - `Module.copyout_${type[0]} = ` + - `CAccessors.copyout_${type[0]} = ` + - "function(ptr, len) { " + - `var ret = (new ${type[1]}(Module.HEAPU8.buffer, ptr, len)).slice(0); ` + - "ret.libavjsTransfer = [ret.buffer]; " + - "return ret; " + - "};\n"; - }); - - outp = inp.replace("@FUNCS", outp); - - fs.writeFileSync("build/post.js", outp); -})(); - -// libav.types.d.ts -(function() { - var inp = fs.readFileSync("libav.types.in.d.ts", "utf8"); - - let outp = "", syncp = ""; - - function ret(x) { - return (x === null) ? "void" : x; - } - - function signature(name, args, ret, async) { - outp += `${name}(${args}): Promise<${ret}>;\n`; - if (async) - syncp += `${name}_sync(${args}): ${ret} | Promise<${ret}>;\n`; - else - syncp += `${name}_sync(${args}): ${ret};\n`; - } - - funcs.functions.forEach((decl) => { - if (decl[3] && decl[3].notypes) - return; - - const nm = decl[0]; - const noJSName = nm.replace(/_js$/, ""); - const doc = doxygen[noJSName]; - let args; - if (doc && doc.param) { - // Try to make the parameters names match the real names - let param = doc.param; - if (!(param instanceof Array)) - param = [param]; - - args = decl[2].map((t, idx) => { - if (param[idx]) - return `${param[idx].declname}: ${t}`; - return `a${idx}: ${t}`; - }).join(","); - - } else { - args = decl[2].map((t, idx) => `a${idx}: ${t}`).join(","); - - } - - // Give the function description - if (doc && doc.raw) { - // The raw description was retrieved from the file - outp += doc.raw + "\n"; - syncp += doc.raw + "\n"; - - } else if (doc && doc.briefdescription && doc.briefdescription.para) { - let desc = doc.briefdescription.para; - if (typeof desc === "object") { - if (desc["#text"] && typeof desc["#text"] === "string") - desc = desc["#text"]; - else - desc = JSON.stringify(desc); - } else if (typeof desc !== "string") - desc = JSON.stringify(desc); - outp += `/**\n * ${desc}\n */\n`; - syncp += `/**\n * ${desc}\n */\n`; - } - - signature(decl[0], args, ret(decl[1]), decl[3] && decl[3].async); - }); - accessors((decl, field) => { - if (field && field.array) { - signature(decl, "ptr: number, idx: number", "number"); - signature(`${decl}_s`, "ptr: number, idx: number, val: number", - "void"); - } else if (field && field.rational) { - for (const part of ["num", "den"]) { - signature(`${decl}_${part}`, "ptr: number", "number"); - signature(`${decl}_${part}_s`, "ptr: number, val: number", "void"); - } - signature(`${decl}_s`, "ptr: number, num: number, den: number", "void"); - } else if (field && field.string) { - signature(decl, "ptr: number", "string"); - } else { - signature(decl, "ptr: number", "number"); - signature(`${decl}_s`, "ptr: number, val: number", "void"); - } - }); - - funcs.freers.forEach((decl) => { - signature(`${decl}_js`, "ptr: number", "void"); - }); - - funcs.copiers.forEach((type) => { - signature(`copyin_${type[0]}`, `ptr: number, arr: ${type[1]}`, "void"); - signature(`copyout_${type[0]}`, "ptr: number, len: number", type[1]); - }); - - inp = inp.replace("@FUNCS", outp).replace("@SYNCFUNCS", syncp); - - /* We also read type declarations out of post.in.js, to keep all the decls - * in one place */ - outp = ""; - syncp = ""; - let lastComment = ""; - let inComment = false; - let lastTypes = ""; - let inTypes = false; - - function commentType(decl) { - let async = decl.replace(/@sync/g, "") - .replace(/@promise@([^@]*)@/g, "Promise<$1>") - .replace(/@promsync@([^@]*)@/g, "Promise<$1>"); - let syncy = decl - .replace(/@sync/g, "_sync") - .replace(/@promise@([^@]*)@/g, "$1") - .replace(/@promsync@([^@]*)@/g, "$1 | Promise<$1>"); - outp += async + ";\n"; - syncp += syncy + ";\n"; - } - - for (const line of fs.readFileSync("post.in.js", "utf8").split("\n")) { - if (line === "/**") { - inComment = true; - lastComment = line + "\n"; - } else if (inComment) { - lastComment += line + "\n"; - if (line === " */") - inComment = false; - } else if (line === "/* @types") { - inTypes = true; - lastTypes = ""; - } else if (inTypes) { - if (line === " */") { - inTypes = false; - commentType(lastComment + lastTypes.trim()); - } else { - lastTypes += line.slice(3) + "\n"; - } - } else if (line.slice(0, 10) === "/// @types") { - commentType(lastComment + line.slice(11)); - } - } - outp = inp.replace("@DECLS", outp).replace("@SYNCDECLS", syncp); - - fs.writeFileSync("build/libav.types.d.ts", outp); -})(); - -// libav.js, libav.mjs -(function() { - var ver = process.argv[2]; - let inp = fs.readFileSync("libav.in.js", "utf8"); - - var normalFuncs = []; - var localFuncs = []; - decls((decl, type) => { - if (type === "fs" || type === "copyin" || type === "copyout") - localFuncs.push(decl); - else - normalFuncs.push(decl); - }, true); - - inp = inp - .replace("@FUNCS", s(normalFuncs)) - .replace("@LOCALFUNCS", s(localFuncs)) - .replace(/@VER/g, ver); - - const outpJS = inp - .replace(/\n@E5 /g, "\n") - .replace(/\n(@E6.*\n)+/g, "\n"); - - const outpMJS = inp - .replace(/\n(@E5.*\n)+/g, "\n") - .replace(/\n@E6 /g, "\n"); - - fs.writeFileSync(`build/libav-${ver}.js`, outpJS); - fs.writeFileSync(`build/libav-${ver}.in.mjs`, outpMJS); -})(); - -// exports.json -(function() { - var outp = ["_emfiberthreads_timeout_expiry"]; - decls((decl) => { - outp.push("_" + decl); - }); - - fs.writeFileSync("build/exports.json", s(outp)); -})(); diff --git a/tools/mk-exports.js b/tools/mk-exports.js new file mode 100755 index 00000000..fe72f212 --- /dev/null +++ b/tools/mk-exports.js @@ -0,0 +1,67 @@ +#!/usr/bin/env node +/* + * Copyright (C) 2019-2025 Yahweasel and contributors + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +const fs = require("fs/promises"); + +const s = JSON.stringify; + +async function main() { + const variant = process.argv[2]; + const version = process.argv[3]; + const jsSuffix = process.argv[4]; + + const funcs = JSON.parse(await fs.readFile("funcs.json", "utf8")); + const exports = []; + const components = ( + await fs.readFile(`configs/configs/${variant}/components.txt`, "utf8") + ).trim().split("\n"); + + for (const component of components) { + const fc = funcs[component]; + + for (const decl of fc.functions) + exports.push(`_${decl[0]}`); + + for (const accFamily of (fc.accessors || [])) { + const klass = accFamily[0]; + for (let acc of accFamily[1]) { + if (typeof acc === "string") + acc = {name: acc}; + const pf = `${klass}_${acc.name}`; + if (acc.array) { + exports.push(`_${pf}_a`, `_${pf}_a_s`) + } else if (acc.rational) { + exports.push( + `_${pf}_num`, `_${pf}_den`, + `_${pf}_num_s`, `_${pf}_den_s`, + `_${pf}_s` + ); + } else if (acc.string) { + exports.push(`_${pf}`); + } else { + exports.push(`_${pf}`, `_${pf}_s`); + } + } + } + + for (const decl of (fc.freers || [])) + exports.push(`_${decl}`); + } + + process.stdout.write(JSON.stringify(exports)); +} + +main(); diff --git a/tools/mk-frontend.js b/tools/mk-frontend.js new file mode 100755 index 00000000..f18ba4ee --- /dev/null +++ b/tools/mk-frontend.js @@ -0,0 +1,97 @@ +#!/usr/bin/env node +/* + * Copyright (C) 2019-2025 Yahweasel and contributors + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +const fs = require("fs/promises"); + +const s = JSON.stringify; + +async function main() { + const variant = process.argv[2]; + const version = process.argv[3]; + const jsSuffix = process.argv[4]; + + const funcs = JSON.parse(await fs.readFile("funcs.json", "utf8")); + let inp = await fs.readFile("src/frontend.in.js", "utf8"); + const components = ( + await fs.readFile(`configs/configs/${variant}/components.txt`, "utf8") + ).trim().split("\n"); + + let normalFuncs = []; + let localFuncs = []; + + for (const component of components) { + const fc = funcs[component]; + + for (const decl of fc.functions) + normalFuncs.push(decl[0]); + + for (const decl of (fc.fs || [])) + localFuncs.push(decl); + + for (const decl of (fc.meta || [])) + normalFuncs.push(decl); + + for (const accFamily of (fc.accessors || [])) { + const klass = accFamily[0]; + for (let acc of accFamily[1]) { + if (typeof acc === "string") + acc = {name: acc}; + const pf = `${klass}_${acc.name}`; + if (acc.array) { + normalFuncs.push(`${pf}_a`, `${pf}_a_s`) + } else if (acc.rational) { + normalFuncs.push( + `${pf}_num`, `${pf}_den`, + `${pf}_num_s`, `${pf}_den_s`, + `${pf}_s` + ); + } else if (acc.string) { + normalFuncs.push(pf); + } else { + normalFuncs.push(pf, `${pf}_s`); + } + } + } + + for (const decl of (fc.freers || [])) + normalFuncs.push(`${decl}_js`); + + for (const copier of (fc.copiers || [])) { + const type = copier[0]; + localFuncs.push(`copyin_${type}`, `copyout_${type}`); + } + } + + let out = inp + .replace(/@VARIANT/g, variant) + .replace("@FUNCS", JSON.stringify(normalFuncs)) + .replace("@LOCALFUNCS", JSON.stringify(localFuncs)) + .replace(/@VER/g, version); + + if (jsSuffix === "mjs") { + out = out + .replace(/\n(@E5.*\n)+/g, "\n") + .replace(/\n@E6 /g, "\n"); + } else { + out = out + .replace(/\n@E5 /g, "\n") + .replace(/\n(@E6.*\n)+/g, "\n"); + } + + process.stdout.write(out); +} + +main(); diff --git a/tools/mk-post.js b/tools/mk-post.js new file mode 100755 index 00000000..00fa0fbb --- /dev/null +++ b/tools/mk-post.js @@ -0,0 +1,142 @@ +#!/usr/bin/env node +/* + * Copyright (C) 2019-2025 Yahweasel and contributors + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +const fs = require("fs/promises"); + +const s = JSON.stringify; + +async function main() { + const funcs = JSON.parse(await fs.readFile("funcs.json", "utf8")); + let inp = await fs.readFile("src/post.in.js", "utf8"); + let out = ""; + const components = ( + await fs.readFile(`configs/configs/${process.argv[2]}/components.txt`, "utf8") + ).trim().split("\n"); + + for (const component of components) { + const fc = funcs[component]; + + // Create functions for accessors + for (const accFamily of (fc.accessors || [])) { + const klass = accFamily[0]; + for (let acc of accFamily[1]) { + if (typeof acc === "string") + acc = {name: acc}; + const pf = `${klass}_${acc.name}`; + if (acc.array) { + fc.functions.push( + [`${pf}_a`, "number", ["number", "number"]], + [`${pf}_a_s`, null, ["number", "number", "number"]] + ); + } else if (acc.rational) { + fc.functions.push( + [`${pf}_num`, "number", ["number"]], + [`${pf}_den`, "number", ["number"]], + [`${pf}_num_s`, null, ["number", "number"]], + [`${pf}_den_s`, null, ["number", "number"]], + [`${pf}_s`, null, ["number", "number", "number"]] + ); + } else if (acc.string) { + fc.functions.push( + [pf, "string", ["number"]] + ); + } else { + fc.functions.push( + [pf, "number", ["number"]], + [`${pf}_s`, null, ["number", "number"]] + ); + } + } + } + + for (const decl of fc.functions) { + out += `var ${decl[0]} = ` + + `Module.${decl[0]} = ` + + `CAccessors.${decl[0]} = ` + + `Module.cwrap(${s(decl[0])}, ${s(decl[1])}, ${s(decl[2])}`; + if (decl[3] && decl[3].async) + out += ", {async:true}"; + out += ");\n"; + + if (decl[3] && decl[3].returnsErrno) { + // Need to check for ECANCELED, meaning passthru error + out += `var ${decl[0]}__raw = ${decl[0]}; ` + + `${decl[0]} = ` + + `Module.${decl[0]} = function() { ` + + "var args = arguments; " + + `var ret = ${decl[0]}__raw.apply(void 0, args); ` + + "if (ret === -11) throw Module.fsThrownError; " + + "else if (ret && ret.then) { " + + "return ret.then(function(ret) { " + + "if (ret === -11) throw Module.fsThrownError; " + + "return ret; " + + "}); " + + "} " + + "return ret; " + + "};\n"; + } + + if (decl[3] && decl[3].async) { + // Need to serialize async functions + out += `Module.${decl[0]} = function() { ` + + "var args = arguments; " + + "return serially(function() { " + + `return ${decl[0]}.apply(void 0, args); ` + + "}); " + + "};\n"; + } + } + + for (const freer of (fc.freers || [])) { + out += `var ${freer}_js = ` + + `Module.${freer}_js = ` + + `CAccessors.${freer}_js = ` + + "function(p) { " + + "var p2 = malloc(4); " + + "if (p2 === 0) throw new Error(\"Could not malloc\"); " + + "(new Uint32Array(Module.HEAPU8.buffer, p2, 1))[0] = p; " + + `CAccessors.${freer}(p2); ` + + "free(p2); " + + "};\n"; + } + + for (const copier of (fc.copiers || [])) { + const type = copier[0]; + const typedArr = copier[1]; + out += `var copyin_${type} = ` + + `Module.copyin_${type} = ` + + `CAccessors.copyin_${type} = ` + + "function(ptr, arr) { " + + `var buf = new ${typedArr}(Module.HEAPU8.buffer, ptr); ` + + "buf.set(arr); " + + "};\n" + + `var copyout_${type} = ` + + `Module.copyout_${type} = ` + + `CAccessors.copyout_${type} = ` + + "function(ptr, len) { " + + `var ret = (new ${typedArr}(Module.HEAPU8.buffer, ptr, len)).slice(0); ` + + "ret.libavjsTransfer = [ret.buffer]; " + + "return ret; " + + "};\n"; + } + } + + out = inp.replace("@FUNCS", out); + + process.stdout.write(out); +} + +main(); diff --git a/tools/mk-types-dts.js b/tools/mk-types-dts.js new file mode 100755 index 00000000..0dfc07fd --- /dev/null +++ b/tools/mk-types-dts.js @@ -0,0 +1,189 @@ +#!/usr/bin/env node +/* + * Copyright (C) 2019-2025 Yahweasel and contributors + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +const fs = require("fs/promises"); + +const s = JSON.stringify; + +async function main() { + const funcs = JSON.parse(await fs.readFile("funcs.json", "utf8")); + let inp = await fs.readFile("src/libav.types.in.d.ts", "utf8"); + let asyncOut = "", syncOut = ""; + const doxygen = JSON.parse(await fs.readFile("mk/doxygen.json", "utf8")); + + function paramNames() { + return { + doc: { + param: Array.from(arguments).map(x => ({declname: x})) + } + }; + } + + for (const component in funcs) { + const fc = funcs[component]; + + // Convert accessors into function declarations + for (const accFamily of (fc.accessors || [])) { + const klass = accFamily[0]; + for (let acc of accFamily[1]) { + if (typeof acc === "string") + acc = {name: acc}; + const pf = `${klass}_${acc.name}`; + if (acc.array) { + fc.functions.push( + [ + `${pf}_a`, "number", ["number", "number"], + paramNames("ptr", "idx") + ], + [ + `${pf}_a_s`, null, ["number", "number", "number"], + paramNames("ptr", "idx", "val") + ] + ); + + } else if (acc.rational) { + fc.functions.push( + [ + `${pf}_num`, "number", ["number"], + paramNames("ptr") + ], + [ + `${pf}_den`, "number", ["number"], + paramNames("ptr") + ], + [ + `${pf}_num_s`, "number", ["number", "number"], + paramNames("ptr", "val") + ], + [ + `${pf}_den_s`, "number", ["number", "number"], + paramNames("ptr", "val") + ], + [ + `${pf}_s`, "number", ["number", "number", "number"], + paramNames("ptr", "num", "den") + ] + ); + + } else if (acc.string) { + fc.functions.push( + [ + pf, "string", ["number"], + paramNames("ptr") + ] + ); + + } else { + fc.functions.push( + [ + pf, "number", ["number"], + paramNames("ptr") + ] + ); + fc.functions.push( + [ + `${pf}_s`, null, ["number", "number"], + paramNames("ptr", "val") + ] + ); + + } + } + } + + // Convert freers to function declarations + for (const freer of (fc.freers || [])) { + fc.functions.push([ + `${freer}_js`, null, ["number"], + paramNames("ptr") + ]); + } + + // Convert copiers to function declarations + for (const copier of (fc.copiers || [])) { + const type = copier[0]; + const typedArr = copier[1]; + fc.functions.push( + [ + `copyin_${type}`, null, ["number", typedArr], + paramNames("ptr", "arr") + ], + [ + `copyout_${type}`, typedArr, ["number", "number"], + paramNames("ptr", "len") + ] + ); + } + + for (const decl of fc.functions) { + if (decl[3] && decl[3].notypes) + continue; + + const nm = decl[0]; + const noJSName = nm.replace(/_js$/, ""); + const doc = (decl[3] && decl[3].doc) ? decl[3].doc : doxygen[noJSName]; + let args; + if (doc && doc.param) { + // Try to make the parameters names match the real names + let param = doc.param; + if (!(param instanceof Array)) + param = [param]; + + args = decl[2].map((t, idx) => { + if (param[idx]) + return `${param[idx].declname}: ${t}`; + return `a${idx}: ${t}`; + }).join(","); + + } else { + args = decl[2].map((t, idx) => `a${idx}: ${t}`).join(","); + + } + + // Give the function description + if (doc && doc.raw) { + // The raw description was retrieved from the file + asyncOut += doc.raw + "\n"; + syncOut += doc.raw + "\n"; + + } else if (doc && doc.briefdescription && doc.briefdescription.para) { + let desc = doc.briefdescription.para; + if (typeof desc === "object") { + if (desc["#text"] && typeof desc["#text"] === "string") + desc = desc["#text"]; + else + desc = JSON.stringify(desc); + } else if (typeof desc !== "string") + desc = JSON.stringify(desc); + asyncOut += `/**\n * ${desc}\n */\n`; + syncOut += `/**\n * ${desc}\n */\n`; + } + + const ret = decl[1] || "void"; + asyncOut += `${decl[0]}(${args}): Promise<${ret}>;\n`; + syncOut += `${decl[0]}_sync(${args}): ${ret}`; + if (decl[3] && decl[3].async) + syncOut += ` | Promise<${ret}>`; + syncOut += ";\n"; + } + } + + const out = inp.replace("@FUNCS", asyncOut).replace("@SYNCFUNCS", syncOut); + + process.stdout.write(out); +} + +main();