Skip to content

Commit

Permalink
v1.3.2 Update from origin jsmpeg
Browse files Browse the repository at this point in the history
Don't attempt to get/set index when no buffer was written yet;
Fix stretched WebGL viewport when video with is not a multiple of 16;
  • Loading branch information
cycjimmy committed Nov 5, 2018
1 parent ab4405e commit 98d9014
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 9 deletions.
29 changes: 27 additions & 2 deletions build/JSMpeg.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* jsmpeg-player v1.3.1
* jsmpeg-player v1.3.2
* Homepage: https://github.com/cycdpo/jsmpeg-player#readme
* Released under the MIT License.
*/
Expand Down Expand Up @@ -4064,14 +4064,26 @@ MPEG1WASM.prototype.initializeWasmDecoder = function () {
};

MPEG1WASM.prototype.destroy = function () {
if (!this.decoder) {
return;
}

this.functions._mpeg1_decoder_destroy(this.decoder);
};

MPEG1WASM.prototype.bufferGetIndex = function () {
if (!this.decoder) {
return;
}

return this.functions._mpeg1_decoder_get_index(this.decoder);
};

MPEG1WASM.prototype.bufferSetIndex = function (index) {
if (!this.decoder) {
return;
}

this.functions._mpeg1_decoder_set_index(this.decoder, index);
};

Expand Down Expand Up @@ -4955,14 +4967,26 @@ MP2WASM.prototype.initializeWasmDecoder = function () {
};

MP2WASM.prototype.destroy = function () {
if (!this.decoder) {
return;
}

this.functions._mp2_decoder_destroy(this.decoder);
};

MP2WASM.prototype.bufferGetIndex = function () {
if (!this.decoder) {
return;
}

return this.functions._mp2_decoder_get_index(this.decoder);
};

MP2WASM.prototype.bufferSetIndex = function (index) {
if (!this.decoder) {
return;
}

this.functions._mp2_decoder_set_index(this.decoder, index);
};

Expand Down Expand Up @@ -5102,7 +5126,8 @@ WebGLRenderer.prototype.resize = function (width, height) {
this.canvas.width = this.width;
this.canvas.height = this.height;
this.gl.useProgram(this.program);
this.gl.viewport(0, 0, this.width, this.height);
var codedWidth = this.width + 15 >> 4 << 4;
this.gl.viewport(0, 0, codedWidth, this.height);
};

WebGLRenderer.prototype.createTexture = function (index, name) {
Expand Down
4 changes: 2 additions & 2 deletions build/JSMpeg.min.js

Large diffs are not rendered by default.

29 changes: 27 additions & 2 deletions dist/JSMpeg.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/JSMpeg.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsmpeg-player",
"version": "1.3.1",
"version": "1.3.2",
"description": "MPEG1 Video Player Based On JSMpeg",
"main": "build/JSMpeg.js",
"scripts": {
Expand Down
9 changes: 9 additions & 0 deletions src/lib/mp2-wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,23 @@ MP2WASM.prototype.initializeWasmDecoder = function () {
};

MP2WASM.prototype.destroy = function () {
if (!this.decoder) {
return;
}
this.functions._mp2_decoder_destroy(this.decoder);
};

MP2WASM.prototype.bufferGetIndex = function () {
if (!this.decoder) {
return;
}
return this.functions._mp2_decoder_get_index(this.decoder);
};

MP2WASM.prototype.bufferSetIndex = function (index) {
if (!this.decoder) {
return;
}
this.functions._mp2_decoder_set_index(this.decoder, index);
};

Expand Down
9 changes: 9 additions & 0 deletions src/lib/mpeg1-wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,23 @@ MPEG1WASM.prototype.initializeWasmDecoder = function () {
};

MPEG1WASM.prototype.destroy = function () {
if (!this.decoder) {
return;
}
this.functions._mpeg1_decoder_destroy(this.decoder);
};

MPEG1WASM.prototype.bufferGetIndex = function () {
if (!this.decoder) {
return;
}
return this.functions._mpeg1_decoder_get_index(this.decoder);
};

MPEG1WASM.prototype.bufferSetIndex = function (index) {
if (!this.decoder) {
return;
}
this.functions._mpeg1_decoder_set_index(this.decoder, index);
};

Expand Down
3 changes: 2 additions & 1 deletion src/lib/webgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ WebGLRenderer.prototype.resize = function (width, height) {
this.canvas.height = this.height;

this.gl.useProgram(this.program);
this.gl.viewport(0, 0, this.width, this.height);
const codedWidth = ((this.width + 15) >> 4) << 4;
this.gl.viewport(0, 0, codedWidth, this.height);
};

WebGLRenderer.prototype.createTexture = function (index, name) {
Expand Down

0 comments on commit 98d9014

Please sign in to comment.