1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-03 17:49:16 +02:00

1.0.6: Return 'vp9' for the video codec in getFullMIMEString(). Also move the annoying warning in deprecated archive.js.

This commit is contained in:
Jeff Schiller 2022-11-25 10:58:12 -08:00
parent d3b8765b42
commit 726feee48f
6 changed files with 16 additions and 14 deletions

View file

@ -102,7 +102,8 @@ ISO RFC6381 MIME type strings, including the codec information. Currently suppor
of MP4 and WEBM. of MP4 and WEBM.
How to use: How to use:
* First, install ffprobe (ffmpeg) on your system.
* Then:
```javascript ```javascript
import { getFullMIMEString } from 'bitjs/codecs/codecs.js'; import { getFullMIMEString } from 'bitjs/codecs/codecs.js';

View file

@ -15,8 +15,6 @@ import { UnarchiveAppendEvent, UnarchiveErrorEvent, UnarchiveEvent, UnarchiveEve
UnrarrerInternal, UntarrerInternal, UnzipperInternal, UnrarrerInternal, UntarrerInternal, UnzipperInternal,
getUnarchiverInternal } from './decompress-internal.js'; getUnarchiverInternal } from './decompress-internal.js';
console.warn(`Stop using archive.js and use decompress.js instead. This module will be removed.`);
export { export {
UnarchiveAppendEvent, UnarchiveAppendEvent,
UnarchiveErrorEvent, UnarchiveErrorEvent,
@ -58,18 +56,22 @@ export {
const createWorkerFn = (scriptFilename) => new Worker(scriptFilename); const createWorkerFn = (scriptFilename) => new Worker(scriptFilename);
function warn() {
console.warn(`Stop using archive.js and use decompress.js instead. This module will be removed.`);
}
// Thin wrappers of unarchivers for clients who want to construct a specific // Thin wrappers of unarchivers for clients who want to construct a specific
// unarchiver themselves rather than use getUnarchiver(). // unarchiver themselves rather than use getUnarchiver().
export class Unzipper extends UnzipperInternal { export class Unzipper extends UnzipperInternal {
constructor(ab, options) { super(ab, createWorkerFn, options); } constructor(ab, options) { warn(); super(ab, createWorkerFn, options); }
} }
export class Unrarrer extends UnrarrerInternal { export class Unrarrer extends UnrarrerInternal {
constructor(ab, options) { super(ab, createWorkerFn, options); } constructor(ab, options) { warn(); super(ab, createWorkerFn, options); }
} }
export class Untarrer extends UntarrerInternal { export class Untarrer extends UntarrerInternal {
constructor(ab, options) { super(ab, createWorkerFn, options); } constructor(ab, options) { warn(); super(ab, createWorkerFn, options); }
} }
/** /**
@ -83,5 +85,6 @@ export class Untarrer extends UntarrerInternal {
* @returns {Unarchiver} * @returns {Unarchiver}
*/ */
export function getUnarchiver(ab, options = {}) { export function getUnarchiver(ab, options = {}) {
warn();
return getUnarchiverInternal(ab, createWorkerFn, options); return getUnarchiverInternal(ab, createWorkerFn, options);
} }

View file

@ -233,8 +233,8 @@ function getVP09CodecString(stream) {
} }
// Add LL hex digits. // Add LL hex digits.
// TODO: ffprobe is spitting out -99 as level... I'm guessing on LL here. // If ffprobe is spitting out -99 as level... Just return 'vp9'.
if (stream.level === -99) { frag += '.FF'; } if (stream.level === -99) { return 'vp9'; }
else { else {
const levelAsHex = Number(stream.level).toString(16).toUpperCase().padStart(2, '0'); const levelAsHex = Number(stream.level).toString(16).toUpperCase().padStart(2, '0');
if (levelAsHex.length !== 2) { if (levelAsHex.length !== 2) {

2
io/README.md Normal file
View file

@ -0,0 +1,2 @@
These generated files exist because Firefox does not support Worker Modules yet.
See https://bugzilla.mozilla.org/show_bug.cgi?id=1247687.

View file

@ -1,6 +1,6 @@
{ {
"name": "@codedread/bitjs", "name": "@codedread/bitjs",
"version": "1.0.5", "version": "1.0.6",
"description": "Binary Tools for JavaScript", "description": "Binary Tools for JavaScript",
"homepage": "https://github.com/codedread/bitjs", "homepage": "https://github.com/codedread/bitjs",
"author": "Jeff Schiller", "author": "Jeff Schiller",

View file

@ -261,11 +261,7 @@ describe('codecs test suite', () => {
info.streams[0].level = -99; // I'm not sure what ffprobe means by this. info.streams[0].level = -99; // I'm not sure what ffprobe means by this.
expect(getFullMIMEString(info)) expect(getFullMIMEString(info))
.to.be.a('string') .to.be.a('string')
.and.satisfy(s => s.startsWith('video/webm; codecs="vp09.')) .and.equals('video/webm; codecs="vp9"');
.and.satisfy(s => {
const matches = s.match(/vp09\.[0-9]{2}\.([0-9A-F]{2})\.[0-9A-F]{2}/);
return matches && matches.length === 2 && matches[1] === 'FF';
});
}); });
}); });