mbox series

[FFmpeg-devel,0/2] Add wasi(WebAssembly System Interface) support

Message ID tencent_26F44E0270622DD69A6040579A6A9F22AB08@qq.com
Headers show
Series Add wasi(WebAssembly System Interface) support | expand

Message

Zhao Zhili June 28, 2024, 4:45 a.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

With wasi-sdk toolchain [1], now you can

./configure --cc=${wasi-sdk}/bin/clang \
	--cxx=${wasi-sdk}/bin/clang++ \
	--ar=${wasi-sdk}/bin/ar \
	--strip=${wasi-sdk}/bin/strip \
	--nm=${wasi-sdk}/bin/llvm-nm \
	--ranlib=${wasi-sdk}/bin/ranlib \
	--extra-cflags="--target=wasm32-wasi -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_PROCESS_CLOCKS"
	--extra-libs="-lwasi-emulated-signal -lwasi-emulated-process-clocks"
	--disable-inline-asm \
	--disable-x86asm \
	--disable-network \
	--disable-protocol=fd \
	--disable-protocol=pipe \
	--enable-cross-compile \

After make, you can run examples directly on cmdline with wasi runtime,
for example, wasmtime [2] and wasmer [3]

wasmtime --dir . ./demux_decode ./bbb.mp4 bbb-v bbb-a
wasmer --dir . ./demux_decode ./bbb.mp4 bbb-v bbb-a

Besides trying out wasm, I don't know what else it can be used for.

[1] https://github.com/WebAssembly/wasi-sdk
[2] https://github.com/bytecodealliance/wasmtime
[3] https://github.com/wasmerio/wasmer

Zhao Zhili (2):
  avutil/file_open: Fix build error with wasi
  avformat/file: guard fd_dup by FD_PROTOCOL or PIPE_PROTOCOL

 configure             | 2 ++
 libavformat/file.c    | 2 ++
 libavutil/file_open.c | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)