@hyperframes/parsers 0.9.68 → 0.9.70

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.
@@ -43,6 +43,10 @@ declare function findFfBinary(name: FfBinaryName, options?: FindFfBinaryOptions)
43
43
  declare function requireFfBinary(name: FfBinaryName): string;
44
44
  /** Test hook: drop cached system lookups so resolution can be re-exercised. */
45
45
  declare function clearFfBinaryLookupCache(): void;
46
+ /** One `file` entry per path; a path holding what ends a list line (LF, CR, NUL) is refused. */
47
+ declare function concatListText(paths: readonly string[], options?: {
48
+ videoContainersOnly?: boolean;
49
+ }): string;
46
50
  /**
47
51
  * Concat input for a list HyperFrames wrote: entries open only as local mov, matroska or concat
48
52
  * files (an ffconcat entry is followed in safe mode), and `-xerror` fails at a refused entry.
@@ -52,10 +56,11 @@ declare function concatListInputArgs(concatListPath: string): string[];
52
56
  declare const SELF_CONTAINED_FORMATS = "mov,matroska,mxf,avi,mpeg,mpegts,mpegvideo,flv,asf,ogg,wav,mp3,aac,flac,aiff,gif,image2,png_pipe,jpeg_pipe,webp_pipe,bmp_pipe,tiff_pipe";
53
57
  /** Tests feed a `-demuxers` listing so none spawns a binary; no argument forgets it. */
54
58
  declare function _setDemuxerListingForTests(listing?: string): void;
59
+ declare function localContainerInputArgs(container: "mov" | "matroska" | undefined): string[];
55
60
 
56
61
  /** Every demuxer `listingBinary` reports that opens nothing by itself and is not text art, for reading `input`; one that cannot be asked gets the self-contained list, and is asked again. */
57
62
  declare function mediaInputFormatArgs(listingBinary: string, input: string): string[];
58
63
  /** Hears the furthest output time, in seconds, that ffmpeg's `-progress pipe:1` lines on `stream` report. */
59
64
  declare function followFfmpegProgress(stream: Readable, onSeconds: (seconds: number) => void): void;
60
65
 
61
- export { FFMPEG_PATH_ENV, FFPROBE_PATH_ENV, type FfBinaryName, type FindFfBinaryOptions, SELF_CONTAINED_FORMATS, _setDemuxerListingForTests, clearFfBinaryLookupCache, concatListInputArgs, executableIn, findFfBinary, findTrustedExecutable, followFfmpegProgress, getSkippedX86Binary, isTrustedDirectory, isTrustedExecutablePath, isX86OnlyMachO, mediaInputFormatArgs, pathEntries, requireFfBinary, trustedPathDirs };
66
+ export { FFMPEG_PATH_ENV, FFPROBE_PATH_ENV, type FfBinaryName, type FindFfBinaryOptions, SELF_CONTAINED_FORMATS, _setDemuxerListingForTests, clearFfBinaryLookupCache, concatListInputArgs, concatListText, executableIn, findFfBinary, findTrustedExecutable, followFfmpegProgress, getSkippedX86Binary, isTrustedDirectory, isTrustedExecutablePath, isX86OnlyMachO, localContainerInputArgs, mediaInputFormatArgs, pathEntries, requireFfBinary, trustedPathDirs };
@@ -287,6 +287,19 @@ function clearFfBinaryLookupCache() {
287
287
  lastMissAt.clear();
288
288
  skippedX86Binaries.clear();
289
289
  }
290
+ var endsAListLine = (text) => ["\n", "\r", "\0"].some((char) => text.includes(char));
291
+ function concatListText(paths, options = {}) {
292
+ const entryOptions = options.videoContainersOnly ? "option format_whitelist mov,matroska\n" : "";
293
+ return paths.map((path) => {
294
+ if (endsAListLine(path)) {
295
+ throw new Error(
296
+ `A file to join holds a line break or NUL in its path: ${JSON.stringify(path)}`
297
+ );
298
+ }
299
+ return `file '${path.replace(/'/g, "'\\''")}'
300
+ ${entryOptions}`;
301
+ }).join("");
302
+ }
290
303
  function concatListInputArgs(concatListPath) {
291
304
  return [
292
305
  "-xerror",
@@ -337,6 +350,9 @@ function _setDemuxerListingForTests(listing) {
337
350
  listingOverride = listing;
338
351
  demuxerLists.clear();
339
352
  }
353
+ function localContainerInputArgs(container) {
354
+ return container ? ["-protocol_whitelist", "file", "-format_whitelist", container] : [];
355
+ }
340
356
  function mediaInputFormatArgs(listingBinary, input) {
341
357
  assertLiteralMediaInput(input);
342
358
  let formats = demuxerLists.get(listingBinary);
@@ -383,6 +399,7 @@ export {
383
399
  assertLiteralMediaInput,
384
400
  clearFfBinaryLookupCache,
385
401
  concatListInputArgs,
402
+ concatListText,
386
403
  executableIn,
387
404
  findFfBinary,
388
405
  findTrustedExecutable,
@@ -391,6 +408,7 @@ export {
391
408
  isTrustedDirectory,
392
409
  isTrustedExecutablePath,
393
410
  isX86OnlyMachO,
411
+ localContainerInputArgs,
394
412
  mediaInputFormatArgs,
395
413
  pathEntries,
396
414
  requireFfBinary,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/parsers",
3
- "version": "0.9.68",
3
+ "version": "0.9.70",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/heygen-com/hyperframes",
@@ -151,7 +151,7 @@
151
151
  "tsx": "^4.21.0",
152
152
  "typescript": "^5.0.0",
153
153
  "vitest": "^4.1.12",
154
- "@hyperframes/core": "0.9.68"
154
+ "@hyperframes/core": "0.9.70"
155
155
  },
156
156
  "scripts": {
157
157
  "build": "tsup",