@hyperframes/parsers 0.9.39 → 0.9.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mediaStreams.d.ts +9 -1
- package/dist/mediaStreams.js +11 -1
- package/package.json +2 -2
package/dist/mediaStreams.d.ts
CHANGED
|
@@ -2,7 +2,15 @@ interface FfprobeStreamCodec {
|
|
|
2
2
|
codec_type?: string;
|
|
3
3
|
codec_name?: string;
|
|
4
4
|
}
|
|
5
|
+
interface FfprobePcmFields extends FfprobeStreamCodec {
|
|
6
|
+
sample_rate?: string;
|
|
7
|
+
channels?: number;
|
|
8
|
+
bit_rate?: string;
|
|
9
|
+
bits_per_sample?: number;
|
|
10
|
+
}
|
|
11
|
+
/** PCM whose header byte rate is not sample rate x channels x sample size: a seek by it lands wrong. */
|
|
12
|
+
declare function misstatesPcmByteRate(stream: FfprobePcmFields): boolean;
|
|
5
13
|
/** The audio track ffmpeg can decode, as N in `-map 0:a:N`; ffprobe names no codec for one it cannot. */
|
|
6
14
|
declare function decodableAudioStream(streams: readonly FfprobeStreamCodec[]): number | null;
|
|
7
15
|
|
|
8
|
-
export { type FfprobeStreamCodec, decodableAudioStream };
|
|
16
|
+
export { type FfprobePcmFields, type FfprobeStreamCodec, decodableAudioStream, misstatesPcmByteRate };
|
package/dist/mediaStreams.js
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
// src/mediaStreams.ts
|
|
2
|
+
function misstatesPcmByteRate(stream) {
|
|
3
|
+
const declared = Number(stream.bit_rate);
|
|
4
|
+
const { channels, bits_per_sample: bits } = stream;
|
|
5
|
+
const rate = Number(stream.sample_rate);
|
|
6
|
+
if (!stream.codec_name?.startsWith("pcm_") || !declared || !channels || !bits || !rate) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
return declared !== rate * channels * bits;
|
|
10
|
+
}
|
|
2
11
|
function decodableAudioStream(streams) {
|
|
3
12
|
const index = streams.filter((stream) => stream.codec_type === "audio").findIndex((stream) => stream.codec_name !== void 0);
|
|
4
13
|
return index < 0 ? null : index;
|
|
5
14
|
}
|
|
6
15
|
export {
|
|
7
|
-
decodableAudioStream
|
|
16
|
+
decodableAudioStream,
|
|
17
|
+
misstatesPcmByteRate
|
|
8
18
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/parsers",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.41",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/heygen-com/hyperframes",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"tsx": "^4.21.0",
|
|
140
140
|
"typescript": "^5.0.0",
|
|
141
141
|
"vitest": "^4.1.11",
|
|
142
|
-
"@hyperframes/core": "0.9.
|
|
142
|
+
"@hyperframes/core": "0.9.41"
|
|
143
143
|
},
|
|
144
144
|
"scripts": {
|
|
145
145
|
"build": "tsup",
|