@flow-player/test-streams 0.14.2 → 0.15.1

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.
@@ -0,0 +1,110 @@
1
+ import type { CodecId } from "../config.js";
2
+ /** drawtext 不可用时的兜底字体占位(仅用于离线单测断言子串,真实生成时按需替换)。 */
3
+ export declare const DEFAULT_DRAWTEXT_FONT = "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf";
4
+ /** 生成期按序探测的本机字体候选(macOS 优先,Linux 次之)。 */
5
+ export declare const DRAWTEXT_FONT_CANDIDATES: ReadonlyArray<string>;
6
+ /** GOP 形态:short(1s)/ long(≥4s)/ single(整段单个 GOP)。 */
7
+ export type GopMode = "short" | "long" | "single";
8
+ /** 双段关系:gap(两段之间留空洞)/ overlap(两段时间重叠)/ sizeSwitch(同起点不同尺寸)。 */
9
+ export type WindowPairKind = "gap" | "overlap" | "sizeSwitch";
10
+ /** 单条烧录窗 fixture 的静态规格(纯数据,可序列化进文档与 manifest)。 */
11
+ export type WindowFixtureSpec = {
12
+ /** 短横线 id,同时是输出文件名(window/<id>.mp4)与 manifest 主键。 */
13
+ id: string;
14
+ /** 视频编码。 */
15
+ codec: CodecId;
16
+ /** 画面宽高。 */
17
+ width: number;
18
+ /** 画面宽高。 */
19
+ height: number;
20
+ /** 输入源帧率;sparse 为 true 时输出侧再经 fps=1 抽稀。 */
21
+ fps: number;
22
+ /** 单段时长(秒)。 */
23
+ durationSeconds: number;
24
+ /** GOP 长度(帧数),single 模式下等于 durationSeconds × fps。 */
25
+ gopFrames: number;
26
+ /** GOP 形态。 */
27
+ gopMode: GopMode;
28
+ /** B 帧数;0 表示无 B 帧(-bf 0)。 */
29
+ bframes: number;
30
+ /** 首 PTS 偏移(秒),经 -output_ts_offset 实现;非零值覆盖窗口偏移场景。 */
31
+ startPtsSeconds: number;
32
+ /** 是否 1fps 稀疏输出。 */
33
+ sparse: boolean;
34
+ /** 恒为 true:关闭 faststart,moov 落尾部。 */
35
+ moovTrailing: true;
36
+ /** 是否考察尾部 delayed 帧(B 帧编码器回吐延迟)。 */
37
+ delayedTail: boolean;
38
+ /** 所属双段组;单段 fixture 为 undefined。 */
39
+ pairKind?: WindowPairKind;
40
+ /** 双段组内角色:a(首段)/ b(次段)。 */
41
+ pairRole?: "a" | "b";
42
+ /** P3 窗口测试中的用途(中文)。 */
43
+ usageP3: string;
44
+ /** P5 容量测试中的用途(中文)。 */
45
+ usageP5: string;
46
+ };
47
+ /** manifest.windowFixtures 条目携带的编码参数(随 size/sha256 一起落盘)。 */
48
+ export type WindowEncodeParams = {
49
+ /** 视频编码。 */
50
+ codec: CodecId;
51
+ /** GOP 长度(帧数)。 */
52
+ gopFrames: number;
53
+ /** GOP 形态。 */
54
+ gopMode: GopMode;
55
+ /** B 帧数;0 表示无 B 帧。 */
56
+ bframes: number;
57
+ /** 首 PTS 偏移(秒)。 */
58
+ startPtsSeconds: number;
59
+ /** 是否 1fps 稀疏。 */
60
+ sparse: boolean;
61
+ /** moov 位置;恒为 trailing(关闭 faststart)。 */
62
+ moov: "trailing";
63
+ /** 是否考察尾部 delayed 帧。 */
64
+ delayedTail: boolean;
65
+ /** 画面宽度。 */
66
+ width: number;
67
+ /** 画面高度。 */
68
+ height: number;
69
+ /** 输出帧率(稀疏段为 1)。 */
70
+ fps: number;
71
+ };
72
+ /** 单条烧录窗的生成计划:目标路径 + 一次 ffmpeg 调用的全部输出侧参数。 */
73
+ export type WindowFixturePlan = {
74
+ /** 与 spec.id 一致。 */
75
+ id: string;
76
+ /** 源规格。 */
77
+ spec: WindowFixtureSpec;
78
+ /** 相对 fixtureDir 的主文件路径(window/<id>.mp4)。 */
79
+ mainFile: string;
80
+ /** 预期输出文件(单文件,仅主文件)。 */
81
+ files: ReadonlyArray<string>;
82
+ /** 传给 ffmpeg 的输出侧参数(不含最后的输出文件名)。 */
83
+ ffmpegOutputArgs: ReadonlyArray<string>;
84
+ /** 写入 manifest 的编码参数。 */
85
+ encode: WindowEncodeParams;
86
+ };
87
+ /** 烧录窗输出目录(相对 fixtureDir)。 */
88
+ export declare const WINDOW_CONTAINER_DIR = "window";
89
+ /** P3-H 烧录窗全量规格(16 段,全部 MP4 单文件)。 */
90
+ export declare const WINDOW_SPECS: ReadonlyArray<WindowFixtureSpec>;
91
+ /**
92
+ * 拼 drawtext 烧录滤镜:画面左上烧录帧号与媒体时间
93
+ *(`n=<frame_num> t=<hms>`,白字黑底),供视觉核对。
94
+ */
95
+ export declare function drawtextFilter(fontfile: string): string;
96
+ /**
97
+ * 为单条烧录窗规格构建 ffmpeg 生成计划。视频源为 testsrc2(自带运动测试图),
98
+ * 音频源为正弦波;输出 MP4 关闭 faststart(moov 落尾)。
99
+ * @param useDrawtext 是否追加 drawtext 烧录(本机 ffmpeg 缺滤镜时传 false 降级)。
100
+ * @param fontfile drawtext 字体路径;useDrawtext 为 false 时忽略。
101
+ */
102
+ export declare function buildWindowPlan(spec: WindowFixtureSpec, opts?: {
103
+ useDrawtext?: boolean;
104
+ fontfile?: string;
105
+ }): WindowFixturePlan;
106
+ /** 展开烧录窗全量计划(WINDOW_SPECS 顺序,供 generateFixtures 顺序执行)。 */
107
+ export declare function expandWindowMatrix(opts?: {
108
+ useDrawtext?: boolean;
109
+ fontfile?: string;
110
+ }): ReadonlyArray<WindowFixturePlan>;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { buildPlan, expandMatrix, VOD_SAMPLE_RELATIVE, type FixturePlan, } from "./fixtures/matrix.js";
2
- export { loadManifest, lookupFixture, summarizeCatalog, verifyEntryOnDisk, type CatalogSummary, type FixtureLookup, type Manifest, type ManifestEntry, type ManifestItem, } from "./fixtures/catalog.js";
2
+ export { loadManifest, lookupFixture, summarizeCatalog, verifyEntryOnDisk, type CatalogSummary, type FixtureLookup, type Manifest, type ManifestEntry, type ManifestItem, type WindowManifestItem, } from "./fixtures/catalog.js";
3
+ export { buildWindowPlan, drawtextFilter, expandWindowMatrix, DRAWTEXT_FONT_CANDIDATES, DEFAULT_DRAWTEXT_FONT, WINDOW_CONTAINER_DIR, WINDOW_SPECS, type GopMode, type WindowEncodeParams, type WindowFixturePlan, type WindowFixtureSpec, type WindowPairKind, } from "./fixtures/window.js";
3
4
  export { CODEC_SPEC, type CodecSpec } from "./fixtures/codec.js";
4
5
  export { layoutFor, containerRelativeDir, containerRelativePath, type FormatLayout, } from "./fixtures/format.js";
5
6
  export { ALL_CODECS, ALL_FORMATS, DEFAULT_DURATION_SECONDS, DEFAULT_FIXTURE_DIR, DEFAULT_HLS_SEGMENT_SECONDS, DEFAULT_HOST, DEFAULT_PORT, type CodecId, type FormatId, type GenerateOptions, type ServeOptions, } from "./config.js";