From 726feee48f5e7c02e72684dea584b5a103560524 Mon Sep 17 00:00:00 2001 From: Jeff Schiller Date: Fri, 25 Nov 2022 10:58:12 -0800 Subject: [PATCH] 1.0.6: Return 'vp9' for the video codec in getFullMIMEString(). Also move the annoying warning in deprecated archive.js. --- README.md | 3 ++- archive/archive.js | 13 ++++++++----- codecs/codecs.js | 4 ++-- io/README.md | 2 ++ package.json | 2 +- tests/codecs.spec.js | 6 +----- 6 files changed, 16 insertions(+), 14 deletions(-) create mode 100644 io/README.md diff --git a/README.md b/README.md index 128409c..166c7b2 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,8 @@ ISO RFC6381 MIME type strings, including the codec information. Currently suppor of MP4 and WEBM. How to use: - + * First, install ffprobe (ffmpeg) on your system. + * Then: ```javascript import { getFullMIMEString } from 'bitjs/codecs/codecs.js'; diff --git a/archive/archive.js b/archive/archive.js index e4b961d..b6552bc 100644 --- a/archive/archive.js +++ b/archive/archive.js @@ -15,8 +15,6 @@ import { UnarchiveAppendEvent, UnarchiveErrorEvent, UnarchiveEvent, UnarchiveEve UnrarrerInternal, UntarrerInternal, UnzipperInternal, getUnarchiverInternal } from './decompress-internal.js'; -console.warn(`Stop using archive.js and use decompress.js instead. This module will be removed.`); - export { UnarchiveAppendEvent, UnarchiveErrorEvent, @@ -58,18 +56,22 @@ export { 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 // unarchiver themselves rather than use getUnarchiver(). 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 { - constructor(ab, options) { super(ab, createWorkerFn, options); } + constructor(ab, options) { warn(); super(ab, createWorkerFn, options); } } 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} */ export function getUnarchiver(ab, options = {}) { + warn(); return getUnarchiverInternal(ab, createWorkerFn, options); } diff --git a/codecs/codecs.js b/codecs/codecs.js index 0a96caa..4696348 100644 --- a/codecs/codecs.js +++ b/codecs/codecs.js @@ -233,8 +233,8 @@ function getVP09CodecString(stream) { } // Add LL hex digits. - // TODO: ffprobe is spitting out -99 as level... I'm guessing on LL here. - if (stream.level === -99) { frag += '.FF'; } + // If ffprobe is spitting out -99 as level... Just return 'vp9'. + if (stream.level === -99) { return 'vp9'; } else { const levelAsHex = Number(stream.level).toString(16).toUpperCase().padStart(2, '0'); if (levelAsHex.length !== 2) { diff --git a/io/README.md b/io/README.md new file mode 100644 index 0000000..3aab370 --- /dev/null +++ b/io/README.md @@ -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. diff --git a/package.json b/package.json index ddd7e14..b074c12 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@codedread/bitjs", - "version": "1.0.5", + "version": "1.0.6", "description": "Binary Tools for JavaScript", "homepage": "https://github.com/codedread/bitjs", "author": "Jeff Schiller", diff --git a/tests/codecs.spec.js b/tests/codecs.spec.js index 12592f7..3547524 100644 --- a/tests/codecs.spec.js +++ b/tests/codecs.spec.js @@ -261,11 +261,7 @@ describe('codecs test suite', () => { info.streams[0].level = -99; // I'm not sure what ffprobe means by this. expect(getFullMIMEString(info)) .to.be.a('string') - .and.satisfy(s => s.startsWith('video/webm; codecs="vp09.')) - .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'; - }); + .and.equals('video/webm; codecs="vp9"'); }); });