Commit 0413c382 authored by NzSN's avatar NzSN

update

parent f2d27d70
[submodule "lib/ffmpeg.protos"]
path = lib/ffmpeg.protos
url = git@gitlab.ilaihua.com:linshizhi/ffmpeg.sharedmemoryproto.git
[submodule "lib/ffmpeg.wasm-core"]
path = lib/ffmpeg.wasm-core
url = git@gitlab.ilaihua.com:linshizhi/ffmpeg.wasm-core.git
#!/bin/bash
set -euo pipefail
EM_VERSION=2.0.24
if [[ "$(docker images -q emscripten/emsdk:2.0.24 2> /dev/null)" == "" ]]; then
docker pull emscripten/emsdk:$EM_VERSION
fi
docker run \
--rm \
-v $PWD:/src \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/group:/etc/group:ro \
emscripten/emsdk:$EM_VERSION \
bash ./wasm-build.sh "$(id -u) $(id -g) $@"
ffmpeg.protos @ 851d6559
Subproject commit 50376482d7c9b580263ad9a2266de34d07b95a2f
Subproject commit 851d655949f1b42fe4e47785516117a0aa86e96d
ffmpeg.wasm-core @ f5fb3d57
Subproject commit f5fb3d572a09f34731f164378ef43e92b1aee832
......@@ -22,7 +22,7 @@ self.importScripts('defs.js');
// Load wasm encoder
self.importScripts('mp4encoder.js');
createMP4Encoder().then(m => {
createParaEncoder().then(m => {
encoder = m;
});
......
......@@ -19,7 +19,7 @@ self.importScripts('defs.js');
// Load wasm encoder
self.importScripts('./mp4encoder.js');
createMP4Encoder().then(m => {
createParaEncoder().then(m => {
muxer = m;
});
......
......@@ -219,8 +219,8 @@ EM_PORT_API(int) getPackets(uint8_t *buffer, uint32_t size, uint32_t *osize) {
// Muxing Parts //
///////////////////////////////////////////////////////////////////////////////
#include "../protos/src/ioctx.h"
#include "../protos/src/proto/movMemProto.h"
#include "ioctx.h"
#include "proto/movMemProto.h"
#include <vector>
#include <queue>
#include <memory>
......
......@@ -8,7 +8,7 @@ DEMO_PATH=$WORKPATH
echo "WORKPATH"=$WORKPATH
rm -rf ${DEMO_PATH}/mp4encoder.js ${DEMO_PATH}/mp4encoder.wasm
rm -rf ${DEMO_PATH}/resources/workers/paraencoder.js ${DEMO_PATH}/resources/workers/paraencoder.wasm
FFMPEG_ST=yes
......@@ -23,10 +23,38 @@ WASM_DIR=${WORKPATH}/src/wasms
DEBUG="-O3"
#DEBUG="-O1 -g -fno-inline -gseparate-dwarf=/src/demo2/temp.debug.wasm -s SEPARATE_DWARF_URL=http://localhost:5000/temp.debug.wasm"
BUILD_DIR=${WORKPATH}/Build
if [ ! -d "${BUILD_DIR}" ]; then
mkdir ${BUILD_DIR}
fi
if [ ! -d "${BUILD_DIR}/include" ]; then
mkdir ${BUILD_DIR}/include
fi
if [ ! -d "${BUILD_DIR}/lib" ]; then
mkdir ${BUILD_DIR}/lib
fi
# Build ffmpeg.wasm-core
cd ${LIB_DIR}/ffmpeg.wasm-core
bash ./build.sh
cp lib*/*.a ${BUILD_DIR}/lib
cp build/include/* ${BUILD_DIR}/include
cp build/lib/* ${BUILD_DIR}/lib
# Build Protocols
cd ${LIB_DIR}/ffmpeg.sharedmemproto
cd ${LIB_DIR}/ffmpeg.protos
mkdir build
cd build
emcmake cmake .. -DCMAKE_INSTALL_PREFIX=${BUILD_DIR} -Denable_trmem=OFF -Denable_movmem=ON -DDEBUG=OFF -DIS_EMCC_ENV=ON \
-DCMAKE_CXX_FLAGS=-isystem\ ${LIB_DIR}/ffmpeg.wasm-core
emmake make
emmake make install
chown -R $1:$2 ${BUILD_DIR}
chown -R $1:$2 ${LIB_DIR}/ffmpeg.protos/build
###############################################################################
# FFMPEG Core #
......@@ -40,19 +68,18 @@ if [[ "$FFMPEG_ST" != "yes" ]]; then
-pthread
-s USE_PTHREADS=1 # enable pthreads support
-s PROXY_TO_PTHREAD=1 # detach main() from browser/UI main thread
-o ${DEMO_PATH}/resources/workers/mp4encoder.js
-o ${DEMO_PATH}/resources/workers/paraencoder.js
)
else
EXTRA_FLAGS=(
-o ${DEMO_PATH}/resources/workers/mp4encoder.js
-o ${DEMO_PATH}/resources/workers/paraencoder.js
)
fi
FLAGS=(
-I$WORKPATH/lib/ffmpeg-emcc/include -L$WORKPATH/lib/ffmpeg-emcc/lib -I$THIRD_DIR/include -L$THIRD_DIR/lib -Wno-deprecated-declarations
-I$BUILD_DIR/include -L$BUILD_DIR/lib -I$LIB_DIR/ffmpeg.wasm-core -Wno-deprecated-declarations
-Wno-pointer-sign -Wno-implicit-int-float-conversion -Wno-switch -Wno-parentheses -Qunused-arguments -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
-lswresample -lswscale -lavutil -lpostproc -lm -lx264 -lz -lshmproto
$WASM_DIR/interfaces.cc
......@@ -77,3 +104,6 @@ FLAGS=(
)
emcc "${FLAGS[@]}"
chown $1:$2 ${DEMO_PATH}/resources/workers/paraencoder.js
chown $1:$2 ${DEMO_PATH}/resources/workers/paraencoder.wasm
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment