@hyperframes/parsers 0.9.92 → 0.9.93

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.
@@ -61,8 +61,10 @@ declare const SELF_CONTAINED_FORMATS = "mov,matroska,mxf,avi,mpeg,mpegts,mpegvid
61
61
  declare function _setDemuxerListingForTests(listing?: string): void;
62
62
  declare function localContainerInputArgs(container: "mov" | "matroska" | undefined): string[];
63
63
 
64
- /** 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. */
65
- declare function mediaInputFormatArgs(listingBinary: string, input: string): string[];
64
+ /** 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. Playlists only with `playlists: true`; anything but an http(s) URL reads as a local file. */
65
+ declare function mediaInputFormatArgs(listingBinary: string, input: string, { playlists }?: {
66
+ playlists?: boolean;
67
+ }): string[];
66
68
  /** Hears the furthest output time, in seconds, that ffmpeg's `-progress pipe:1` lines on `stream` report. */
67
69
  declare function followFfmpegProgress(stream: Readable, onSeconds: (seconds: number) => void): void;
68
70
 
@@ -362,8 +362,11 @@ function _setDemuxerListingForTests(listing) {
362
362
  function localContainerInputArgs(container) {
363
363
  return container ? ["-protocol_whitelist", "file", "-format_whitelist", container] : [];
364
364
  }
365
- function mediaInputFormatArgs(listingBinary, input) {
365
+ var PLAYLIST_DEMUXERS = /* @__PURE__ */ new Set(["hls", "applehttp", "concat"]);
366
+ function mediaInputFormatArgs(listingBinary, input, { playlists = false } = {}) {
366
367
  assertLiteralMediaInput(input);
368
+ const local = /^https?:\/\//i.test(input) ? [] : ["-protocol_whitelist", "file"];
369
+ const allowed = (formats2) => playlists ? formats2 : formats2.split(",").filter((name) => !PLAYLIST_DEMUXERS.has(name)).join(",");
367
370
  let formats = demuxerLists.get(listingBinary);
368
371
  if (formats === void 0) {
369
372
  try {
@@ -378,10 +381,10 @@ function mediaInputFormatArgs(listingBinary, input) {
378
381
  } catch {
379
382
  formats = void 0;
380
383
  }
381
- if (formats === void 0) return ["-format_whitelist", SELF_CONTAINED_FORMATS];
384
+ if (formats === void 0) return [...local, "-format_whitelist", SELF_CONTAINED_FORMATS];
382
385
  demuxerLists.set(listingBinary, formats);
383
386
  }
384
- return ["-format_whitelist", formats];
387
+ return [...local, "-format_whitelist", allowed(formats)];
385
388
  }
386
389
  var OUT_TIME = /^out_time_(?:us|ms)=(\d+)$/;
387
390
  function followFfmpegProgress(stream, onSeconds) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/parsers",
3
- "version": "0.9.92",
3
+ "version": "0.9.93",
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.92"
154
+ "@hyperframes/core": "0.9.93"
155
155
  },
156
156
  "scripts": {
157
157
  "build": "tsup",