Commit bb0f1fe9 authored by NzSN's avatar NzSN

update

parent a5adc0f9
#!/bin/bash
bash build-with-docker.sh "EXTERNAL"
...@@ -21,7 +21,7 @@ let encBuf = null; ...@@ -21,7 +21,7 @@ let encBuf = null;
self.importScripts('defs.js'); self.importScripts('defs.js');
// Load wasm encoder // Load wasm encoder
self.importScripts('mp4encoder.js'); self.importScripts('paraencoder.js');
createParaEncoder().then(m => { createParaEncoder().then(m => {
encoder = m; encoder = m;
}); });
......
...@@ -18,7 +18,7 @@ let muxBuffer = null; ...@@ -18,7 +18,7 @@ let muxBuffer = null;
self.importScripts('defs.js'); self.importScripts('defs.js');
// Load wasm encoder // Load wasm encoder
self.importScripts('./mp4encoder.js'); self.importScripts('./paraencoder.js');
createParaEncoder().then(m => { createParaEncoder().then(m => {
muxer = m; muxer = m;
}); });
......
...@@ -40,6 +40,8 @@ EM_PORT_API(int) getPackets(uint8_t *buffer, uint32_t size, uint32_t *osize); ...@@ -40,6 +40,8 @@ EM_PORT_API(int) getPackets(uint8_t *buffer, uint32_t size, uint32_t *osize);
EM_PORT_API(uint8_t) encodeInit(int width, int height, int fps) { EM_PORT_API(uint8_t) encodeInit(int width, int height, int fps) {
int ret = 0;
width_ = width; width_ = width;
height_ = height; height_ = height;
framerate_ = fps; framerate_ = fps;
...@@ -62,8 +64,9 @@ EM_PORT_API(uint8_t) encodeInit(int width, int height, int fps) { ...@@ -62,8 +64,9 @@ EM_PORT_API(uint8_t) encodeInit(int width, int height, int fps) {
cc->time_base = (AVRational){1, timescale}; cc->time_base = (AVRational){1, timescale};
cc->gop_size = 0; cc->gop_size = 0;
if (avcodec_open2(cc, encoder, NULL) < 0) { if ((ret = avcodec_open2(cc, encoder, NULL) < 0)) {
fprintf(stderr, "Unable to open codec context\n"); fprintf(stderr, "Unable to open codec context: %s\n",
av_err2str(ret));
return 3; return 3;
} }
...@@ -76,7 +79,8 @@ EM_PORT_API(uint8_t) encodeInit(int width, int height, int fps) { ...@@ -76,7 +79,8 @@ EM_PORT_API(uint8_t) encodeInit(int width, int height, int fps) {
frame->format = cc->pix_fmt; frame->format = cc->pix_fmt;
frame->width = cc->width; frame->width = cc->width;
frame->height = cc->height; frame->height = cc->height;
int ret = av_frame_get_buffer(frame, 0);
ret = av_frame_get_buffer(frame, 0);
if (ret < 0) { if (ret < 0) {
fprintf(stderr, "Could not allocate the video frame data\n"); fprintf(stderr, "Could not allocate the video frame data\n");
return 4; return 4;
...@@ -210,6 +214,7 @@ EM_PORT_API(int) getPackets(uint8_t *buffer, uint32_t size, uint32_t *osize) { ...@@ -210,6 +214,7 @@ EM_PORT_API(int) getPackets(uint8_t *buffer, uint32_t size, uint32_t *osize) {
} }
DONE: DONE:
*osize = size - remainSize; *osize = size - remainSize;
return ret; return ret;
......
...@@ -25,6 +25,8 @@ DEBUG="-O3" ...@@ -25,6 +25,8 @@ DEBUG="-O3"
BUILD_DIR=${WORKPATH}/Build BUILD_DIR=${WORKPATH}/Build
if [ "$3" ]; then
if [ ! -d "${BUILD_DIR}" ]; then if [ ! -d "${BUILD_DIR}" ]; then
mkdir ${BUILD_DIR} mkdir ${BUILD_DIR}
fi fi
...@@ -55,6 +57,7 @@ emmake make install ...@@ -55,6 +57,7 @@ emmake make install
chown -R "$1:$2" ${BUILD_DIR} chown -R "$1:$2" ${BUILD_DIR}
chown -R "$1:$2" ${LIB_DIR}/ffmpeg.protos/build chown -R "$1:$2" ${LIB_DIR}/ffmpeg.protos/build
fi
############################################################################### ###############################################################################
# FFMPEG Core # # FFMPEG Core #
...@@ -78,8 +81,9 @@ fi ...@@ -78,8 +81,9 @@ fi
FLAGS=( FLAGS=(
-I$BUILD_DIR/include -L$BUILD_DIR/lib -I$LIB_DIR/ffmpeg.wasm-core -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 -Wno-pointer-sign -Wno-implicit-int-float-conversion -Wno-switch -Wno-parentheses -Qunused-arguments
-lswresample -lswscale -lavutil -lpostproc -lm -lx264 -lz -lshmproto -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
-lshmproto
$WASM_DIR/interfaces.cc $WASM_DIR/interfaces.cc
......
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