From f0c680999e710e069952ede552e12d241d89cb04 Mon Sep 17 00:00:00 2001 From: Sergey Kukunin Date: Mon, 15 Oct 2018 16:05:15 +0300 Subject: [PATCH 1/4] Use and compile latest libogg --- .gitmodules | 6 +++--- compileOgg.sh | 19 ++++++++++--------- libogg | 1 - ogg | 1 + 4 files changed, 14 insertions(+), 13 deletions(-) delete mode 160000 libogg create mode 160000 ogg diff --git a/.gitmodules b/.gitmodules index bb295d1..415f1df 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "libogg"] - path = libogg - url = git://git.xiph.org/mirrors/ogg.git +[submodule "ogg"] + path = ogg + url = https://git.xiph.org/ogg.git diff --git a/compileOgg.sh b/compileOgg.sh index b7066bb..d0aa8b9 100755 --- a/compileOgg.sh +++ b/compileOgg.sh @@ -1,26 +1,27 @@ #!/bin/bash +set -e # configure libogg -cd libogg +cd ogg if [ ! -f configure ]; then # generate configuration script ./autogen.sh - + # -O20 and -04 cause problems # see https://github.com/kripken/emscripten/issues/264 - sed -i '' 's/-O20/-O2/g' configure - sed -i '' 's/-O4/-O2/g' configure - - # finally, run configuration script - emconfigure ./configure --prefix="`pwd`" --disable-static + sed -i 's/-O20/-O2/g' configure + sed -i 's/-O4/-O2/g' configure fi +# finally, run configuration script +emconfigure ./configure --prefix="`pwd`" --disable-shared --enable-static + # compile libogg emmake make -emmake make install +emmake make -i install # compile wrapper cd .. mkdir -p build -emcc -O3 -s RESERVED_FUNCTION_POINTERS=50 -s EXPORTED_FUNCTIONS="['_AVOggInit', '_AVOggRead', '_AVOggDestroy']" -I libogg/include -Llibogg/lib -logg src/ogg.c -o build/libogg.js +emcc -O3 -I ogg/include -s WASM=0 -s RESERVED_FUNCTION_POINTERS=50 -s EXPORTED_FUNCTIONS="['_AVOggInit', '_AVOggRead', '_AVOggDestroy']" src/ogg.c ogg/lib/libogg.a -o build/libogg.js echo "module.exports = Module" >> build/libogg.js diff --git a/libogg b/libogg deleted file mode 160000 index ab78196..0000000 --- a/libogg +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ab78196fd59ad7a329a2b19d2bcec5d840a9a21f diff --git a/ogg b/ogg new file mode 160000 index 0000000..0acd32d --- /dev/null +++ b/ogg @@ -0,0 +1 @@ +Subproject commit 0acd32d7cabf7e41cc29ea7c2bbffde969ff1ba0 From aaef5ea4c0cd32bbc691cb63ee01f0f1ad3f29e8 Mon Sep 17 00:00:00 2001 From: Sergey Kukunin Date: Mon, 15 Oct 2018 17:12:46 +0300 Subject: [PATCH 2/4] Run npm audit fix --force --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6664799..25482b4 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "av": "~0.4.0" }, "devDependencies": { - "browserify": "^4.1.10", + "browserify": "^16.2.3", "browserify-shim": "^3.5.0" }, "browserify-shim": { From 935aed10e504012c70c474e82af0f8c1c6587277 Mon Sep 17 00:00:00 2001 From: Sergey Kukunin Date: Mon, 15 Oct 2018 17:31:35 +0300 Subject: [PATCH 3/4] Don't emit a separate memory file --- compileOgg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compileOgg.sh b/compileOgg.sh index d0aa8b9..65f48db 100755 --- a/compileOgg.sh +++ b/compileOgg.sh @@ -23,5 +23,5 @@ emmake make -i install # compile wrapper cd .. mkdir -p build -emcc -O3 -I ogg/include -s WASM=0 -s RESERVED_FUNCTION_POINTERS=50 -s EXPORTED_FUNCTIONS="['_AVOggInit', '_AVOggRead', '_AVOggDestroy']" src/ogg.c ogg/lib/libogg.a -o build/libogg.js +emcc -O3 -I ogg/include -s WASM=0 -s RESERVED_FUNCTION_POINTERS=50 -s EXPORTED_FUNCTIONS="['_AVOggInit', '_AVOggRead', '_AVOggDestroy']" src/ogg.c ogg/lib/libogg.a -o build/libogg.js --memory-init-file 0 echo "module.exports = Module" >> build/libogg.js From 4719fde4a07cedeb3f778a816ddbb984ce5ece06 Mon Sep 17 00:00:00 2001 From: Sergey Kukunin Date: Mon, 15 Oct 2018 18:20:49 +0300 Subject: [PATCH 4/4] Use the newer emscripten API --- compileOgg.sh | 6 +++++- src/ogg.js | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/compileOgg.sh b/compileOgg.sh index 65f48db..258ad29 100755 --- a/compileOgg.sh +++ b/compileOgg.sh @@ -23,5 +23,9 @@ emmake make -i install # compile wrapper cd .. mkdir -p build -emcc -O3 -I ogg/include -s WASM=0 -s RESERVED_FUNCTION_POINTERS=50 -s EXPORTED_FUNCTIONS="['_AVOggInit', '_AVOggRead', '_AVOggDestroy']" src/ogg.c ogg/lib/libogg.a -o build/libogg.js --memory-init-file 0 +emcc -s WASM=0 \ + -s RESERVED_FUNCTION_POINTERS=2 \ + -s EXTRA_EXPORTED_RUNTIME_METHODS="['addFunction', 'removeFunction']" \ + -s EXPORTED_FUNCTIONS="['_AVOggInit', '_AVOggRead', '_AVOggDestroy']" \ + -O3 -I ogg/include src/ogg.c ogg/lib/libogg.a -o build/libogg.js --memory-init-file 0 echo "module.exports = Module" >> build/libogg.js diff --git a/src/ogg.js b/src/ogg.js index d5a73a4..d6d227f 100644 --- a/src/ogg.js +++ b/src/ogg.js @@ -22,7 +22,7 @@ var OggDemuxer = AV.Demuxer.extend(function() { // copy the stream in case we override it, e.g. flac this._stream = this.stream; - this.callback = Ogg.Runtime.addFunction(function(packet, bytes) { + this.callback = Ogg.addFunction(function(packet, bytes) { var data = new Uint8Array(Ogg.HEAPU8.subarray(packet, packet + bytes)); // find plugin for codec @@ -60,7 +60,7 @@ var OggDemuxer = AV.Demuxer.extend(function() { this.prototype.destroy = function() { this._super(); - Ogg.Runtime.removeFunction(this.callback); + Ogg.removeFunction(this.callback); Ogg._AVOggDestroy(this.ogg); Ogg._free(this.buf);