Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 09ebfee

Browse files
committed
Update tests and fix st version
1 parent 782f3da commit 09ebfee

36 files changed

+559
-426
lines changed

wasm/build-scripts/build-ffmpeg.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ FLAGS=(
2323
-I. -I./fftools -I$BUILD_DIR/include
2424
-Llibavcodec -Llibavdevice -Llibavfilter -Llibavformat -Llibavresample -Llibavutil -Lharfbuzz -Llibass -Lfribidi -Llibpostproc -Llibswscale -Llibswresample -L$BUILD_DIR/lib
2525
-Wno-deprecated-declarations -Wno-pointer-sign -Wno-implicit-int-float-conversion -Wno-switch -Wno-parentheses -Qunused-arguments
26-
-lavdevice -lavfilter -lavformat -lavcodec -lswresample -lswscale -lavutil -lpostproc -lm -lharfbuzz -lfribidi -llibass -lx264 -lx265 -lvpx -lwavpack -lmp3lame -lfdk-aac -lvorbis -lvorbisenc -lvorbisfile -logg -ltheora -ltheoraenc -ltheoradec -lz -lfreetype -lopus -lwebp
26+
-lavdevice -lavfilter -lavformat -lavcodec -lswresample -lswscale -lavutil -lpostproc -lm -lharfbuzz -lfribidi -lass -lx264 -lx265 -lvpx -lwavpack -lmp3lame -lfdk-aac -lvorbis -lvorbisenc -lvorbisfile -logg -ltheora -ltheoraenc -ltheoradec -lz -lfreetype -lopus -lwebp
2727
fftools/ffmpeg_opt.c fftools/ffmpeg_filter.c fftools/ffmpeg_hw.c fftools/cmdutils.c fftools/ffmpeg.c
28-
-o wasm/dist/ffmpeg-core.js
2928
-s USE_SDL=2 # use SDL2
3029
-s INVOKE_RUN=0 # not to run the main() in the beginning
3130
-s EXIT_RUNTIME=1 # exit runtime after execution
@@ -34,7 +33,8 @@ FLAGS=(
3433
-s EXPORTED_FUNCTIONS="$EXPORTED_FUNCTIONS" # export main and proxy_main funcs
3534
-s EXTRA_EXPORTED_RUNTIME_METHODS="[FS, cwrap, ccall, setValue, writeAsciiToMemory]" # export preamble funcs
3635
-s INITIAL_MEMORY=2146435072 # 64 KB * 1024 * 16 * 2047 = 2146435072 bytes ~= 2 GB
37-
--post-js wasm/src/post-js.js
36+
--post-js wasm/src/post.js
37+
--pre-js wasm/src/pre.js
3838
$OPTIM_FLAGS
3939
${EXTRA_FLAGS[@]}
4040
)

wasm/build-scripts/build-harfbuzz.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ set -euo pipefail
44
source $(dirname $0)/var.sh
55

66
LIB_PATH=third_party/harfbuzz
7+
CFLAGS="$CFLAGS -DHB_NO_PRAGMA_GCC_DIAGNOSTIC_ERROR"
8+
# A hacky way to disable pthread
9+
if [[ "$FFMPEG_ST" == "yes" ]]; then
10+
sed -i 's#\[have_pthread=true\]#\[have_pthread=false\]#g' $LIB_PATH/configure.ac
11+
else
12+
sed -i 's#\[have_pthread=false\]#\[have_pthread=true\]#g' $LIB_PATH/configure.ac
13+
fi
14+
CXXFLAGS=$CFLAGS
715
CONF_FLAGS=(
816
--prefix=$BUILD_DIR # install library in a build directory for FFmpeg to include
917
--host=i686-gnu # use i686 linux

wasm/build-scripts/build-libvpx.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ source $(dirname $0)/var.sh
66
LIB_PATH=third_party/libvpx
77

88
if [[ "$FFMPEG_ST" == "yes" ]]; then
9-
EXTRA_CONF_FLAGS=(
10-
--disable-multithread
11-
)
9+
EXTRA_CONF_FLAGS="--disable-multithread"
1210
fi
1311

1412
CONF_FLAGS=(

wasm/build-scripts/build-x264.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ source $(dirname $0)/var.sh
66
LIB_PATH=third_party/x264
77

88
if [[ "$FFMPEG_ST" == "yes" ]]; then
9-
EXTRA_CONF_FLAGS=(
10-
--disable-thread
11-
)
9+
EXTRA_CONF_FLAGS="--disable-thread"
1210
fi
1311

1412
CONF_FLAGS=(

wasm/build-scripts/var.sh

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,22 @@ TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmak
2626

2727
# Flags for code optimization, focus on speed instead
2828
# of size
29-
OPTIM_FLAGS=(
30-
-O3
31-
)
29+
OPTIM_FLAGS="-O3"
3230

3331
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
3432
# Use closure complier only in linux environment
35-
OPTIM_FLAGS=(
36-
"${OPTIM_FLAGS[@]}"
37-
--closure 1
38-
)
33+
OPTIM_FLAGS="$OPTIM_FLAGS --closure 1"
3934
fi
4035

41-
# Convert array to string
42-
OPTIM_FLAGS="${OPTIM_FLAGS[@]}"
36+
# Unset OPTIM_FLAGS can speed up build
37+
# OPTIM_FLAGS=""
4338

44-
CFLAGS_BASE="-I$BUILD_DIR/include $OPTIM_FLAGS"
39+
CFLAGS_BASE="$OPTIM_FLAGS -I$BUILD_DIR/include"
4540
CFLAGS="$CFLAGS_BASE -s USE_PTHREADS=1"
4641

4742
if [[ "$FFMPEG_ST" == "yes" ]]; then
48-
CFLAGS="$CFLAGS_BASE -s USE_PTHREADS=0"
49-
EXTRA_FFMPEG_CONF_FLAGS=(
50-
--disable-pthreads
51-
)
43+
CFLAGS="$CFLAGS_BASE"
44+
EXTRA_FFMPEG_CONF_FLAGS="--disable-pthreads --disable-w32threads --disable-os2threads"
5245
fi
5346

5447
export CFLAGS=$CFLAGS

wasm/package-lock.json

Lines changed: 91 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wasm/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"author": "[email protected]",
1111
"license": "MIT",
1212
"devDependencies": {
13+
"file-type": "^16.5.1",
1314
"jest": "^27.0.6",
1415
"serve": "^12.0.0"
1516
}

wasm/src/post-js.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

wasm/src/post.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Module['exit'] = exit;

wasm/src/pre.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Replace Moudle['quit'] to avoid process.exit();
3+
*
4+
* @ref: https://github.com/Kagami/ffmpeg.js/blob/v4.2.9003/build/pre.js#L48
5+
*/
6+
Module['quit'] = function(status) {
7+
if (Module["onExit"]) Module["onExit"](status);
8+
throw new ExitStatus(status);
9+
}

0 commit comments

Comments
 (0)