drone-path 0.9.0 → 0.11.0

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +16 -14
  3. package/THIRD-PARTY-NOTICES.md +7 -7
  4. package/app/ipc.d.mts +43 -0
  5. package/app/ipc.mjs +216 -0
  6. package/app/main.mjs +10 -204
  7. package/dist/appsession.js +34 -75
  8. package/dist/appstate.js +24 -21
  9. package/dist/buildinfo.js +9 -16
  10. package/dist/cammeta-decode.js +237 -0
  11. package/dist/cammeta.js +8 -247
  12. package/dist/cli.js +40 -32
  13. package/dist/config.js +333 -173
  14. package/dist/configfile.js +20 -7
  15. package/dist/errors.js +30 -0
  16. package/dist/exec-tool.js +13 -0
  17. package/dist/exportjob.js +7 -7
  18. package/dist/{fftools.js → ffmpeg-tools.js} +5 -4
  19. package/dist/{ff.js → ffmpeg.js} +14 -29
  20. package/dist/frametime.js +32 -0
  21. package/dist/geo.js +1 -1
  22. package/dist/manual/build.js +5 -10
  23. package/dist/manual/cliref.js +4 -1
  24. package/dist/manual/reference.js +6 -11
  25. package/dist/{run.js → pipeline.js} +100 -143
  26. package/dist/png.js +1 -18
  27. package/dist/{proto.js → protobuf-wire.js} +5 -5
  28. package/dist/range.js +3 -3
  29. package/dist/{page.js → render-page.js} +2 -2
  30. package/dist/render.js +25 -115
  31. package/dist/renderer/boot.js +2 -2
  32. package/dist/renderer/dom.js +32 -10
  33. package/dist/renderer/scene.js +14 -6
  34. package/dist/restyle.js +1 -1
  35. package/dist/serve.js +1 -31
  36. package/dist/srt.js +2 -2
  37. package/dist/telemetry-json-schema.js +6 -11
  38. package/dist/telemetry-json.js +46 -27
  39. package/dist/telemetry-math.js +3 -2
  40. package/dist/{summary.js → telemetry-summary.js} +4 -4
  41. package/dist/telemetry.js +32 -18
  42. package/dist/tiles.js +30 -86
  43. package/dist/track-format.js +13 -0
  44. package/dist/track-geojson.js +44 -0
  45. package/dist/track-gpx.js +34 -0
  46. package/dist/track-kml.js +47 -0
  47. package/dist/track-kmz.js +68 -0
  48. package/dist/track-write.js +41 -0
  49. package/dist/track.js +79 -0
  50. package/package.json +13 -14
  51. package/dist/tracing.js +0 -184
  52. /package/dist/{renderer/leaflet.js → logging.js} +0 -0
  53. /package/dist/{inputs.js → recordings.js} +0 -0
@@ -1,19 +1,18 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
- import { errorMessage } from './errors.js';
4
- import { outputMatchesSource, probeVideo, verifyOutput } from './ff.js';
5
- import { resolveFfTools } from './fftools.js';
6
- import { videoBaseName } from './inputs.js';
3
+ import { ERR_OUTPUT_VERIFICATION, ERR_RENDER_CANCELED, errorMessage } from './errors.js';
4
+ import { outputMatchesSource, probeVideo, verifyOutput } from './ffmpeg.js';
5
+ import { resolveFfmpegTools } from './ffmpeg-tools.js';
6
+ import { videoBaseName } from './recordings.js';
7
7
  import { pathKey, uniquePath } from './paths.js';
8
8
  import { loadTelemetry } from './telemetry.js';
9
- import { buildTelemetryDocument, serializeTelemetryDocument, } from './telemetry-json.js';
9
+ import { writeTrackFile } from './track-write.js';
10
10
  import { prefetchTiles } from './tiles.js';
11
11
  import { planIntroOutroFrames, planView } from './plan.js';
12
- import { buildPageHtml, planPageOpts } from './page.js';
12
+ import { buildPageHtml, planPageOpts } from './render-page.js';
13
13
  import { renderVideo } from './render.js';
14
- import { assertValidFrameRange, effectiveZoomOut, hasAltitude, resolveHudSpec, } from './config.js';
15
- import { fixesLabel, noLockCuesLabel, telemetrySummary, trackDistanceLabel, } from './summary.js';
16
- import { NOOP_TRACER, stage } from './tracing.js';
14
+ import { effectiveZoomOut, hasAltitude, resolveHudLayout, resolveFrameRange, } from './config.js';
15
+ import { fixCountLabel, noLockCountLabel, telemetrySummary, trackDistanceLabel, } from './telemetry-summary.js';
17
16
  const PREPARE_STAGE_ORDER = ['probe', 'telemetry', 'plan'];
18
17
  export function outputPathFor(videoPath, config) {
19
18
  const base = videoBaseName(videoPath);
@@ -39,13 +38,13 @@ export function planOutputs(videos, config) {
39
38
  });
40
39
  }
41
40
  function resolveHud(config, tel, log) {
42
- const hud = resolveHudSpec(config.hud, hasAltitude(tel.frames.map((f) => f.alt)));
41
+ const hud = resolveHudLayout(config.hud, hasAltitude(tel.frames.map((f) => f.alt)));
43
42
  if (config.hud.alt && !hud.alt) {
44
43
  log('hud: altitude unavailable in this telemetry source (chip disabled)');
45
44
  }
46
45
  return hud;
47
46
  }
48
- export function frameArrays(tel) {
47
+ export function frameChannelsOf(tel) {
49
48
  const lat = [];
50
49
  const lon = [];
51
50
  tel.frames.forEach((frame, i) => {
@@ -110,15 +109,6 @@ function resolveDeps(overrides, tileCache) {
110
109
  outputMatchesSource: overrides?.outputMatchesSource ?? realDeps.outputMatchesSource,
111
110
  };
112
111
  }
113
- export function resolveRange(range, frames) {
114
- if (!range)
115
- return null;
116
- assertValidFrameRange(range);
117
- if (range.end >= frames) {
118
- throw new Error(`frame range ${range.start}-${range.end} is beyond the recording (${frames} frames)`);
119
- }
120
- return range;
121
- }
122
112
  function createPrepareReporter(onProgress = () => { }) {
123
113
  return (stage) => onProgress({
124
114
  stage,
@@ -127,9 +117,9 @@ function createPrepareReporter(onProgress = () => { }) {
127
117
  });
128
118
  }
129
119
  async function probeStage(env) {
130
- const { videoPath, config, log, tracer, parent, deps, tools, report } = env;
120
+ const { videoPath, config, log, deps, tools, report } = env;
131
121
  report('probe');
132
- const probe = await stage(tracer, 'probe', parent, {}, () => deps.probeVideo(tools, videoPath, log));
122
+ const probe = await deps.probeVideo(tools, videoPath, log);
133
123
  log(`source: ${path.basename(videoPath)} ${probe.width}x${probe.height} @ ${probe.fps.str} fps, ${probe.frames} frames`);
134
124
  const introOutro = planIntroOutroFrames(config, {
135
125
  fps: probe.fps.value,
@@ -141,66 +131,41 @@ async function probeStage(env) {
141
131
  return { probe, introOutro };
142
132
  }
143
133
  async function telemetryStage(env, probe) {
144
- const { videoPath, config, log, tracer, parent, deps, tools, report } = env;
134
+ const { videoPath, config, log, deps, tools, report } = env;
145
135
  report('telemetry');
146
- const loaded = await stage(tracer, 'telemetry.load', parent, {}, async (span) => {
147
- const result = await deps.loadTelemetry(videoPath, {
148
- frames: probe.frames,
149
- fpsValue: probe.fps.value,
150
- durationSec: probe.durationSec,
151
- tools,
152
- });
153
- span.setAttributes({
154
- 'telemetry.source': result.telemetry.source,
155
- 'telemetry.method': result.telemetry.method,
156
- 'telemetry.fix.count': result.telemetry.fixCount,
157
- 'telemetry.noLock.count': result.telemetry.noLock,
158
- });
159
- return result;
136
+ const loaded = await deps.loadTelemetry(videoPath, {
137
+ frames: probe.frames,
138
+ fpsValue: probe.fps.value,
139
+ durationSec: probe.durationSec,
140
+ tools,
160
141
  });
161
142
  const tel = loaded.telemetry;
162
143
  const summary = telemetrySummary(tel);
163
- log(`telemetry: ${summary.source} (${summary.method}), ${fixesLabel(summary.fixes)}, ` +
144
+ log(`telemetry: ${summary.source} (${summary.method}), ${fixCountLabel(summary.fixCount)}, ` +
164
145
  `heading=${summary.headingMode}, track ${trackDistanceLabel(summary.trackDistanceM)}` +
165
- (summary.noLock ? `, ${noLockCuesLabel(summary.noLock)}` : ''));
146
+ (summary.noLock ? `, ${noLockCountLabel(summary.noLock)}` : ''));
166
147
  const hud = resolveHud(config, tel, log);
167
148
  return {
168
149
  tel,
169
150
  frameValues: loaded.frameValues,
151
+ trackValues: loaded.trackValues,
170
152
  protoFile: loaded.protoFile,
171
153
  gimbalDevice: loaded.gimbalDevice,
172
154
  hud,
173
155
  };
174
156
  }
175
157
  async function viewPlanStage(env, tel) {
176
- const { config, log, tracer, parent, report } = env;
158
+ const { config, log, report } = env;
177
159
  report('plan');
178
- const overview = await stage(tracer, 'plan', parent, { 'plan.view': config.view }, async (span) => {
179
- const computed = planView(tel.bbox, config.width, config.height, config);
180
- span.setAttributes({
181
- 'plan.zoom': computed.zoom,
182
- 'plan.zoomOut': effectiveZoomOut(config),
183
- 'plan.tile.count': computed.tiles.length,
184
- });
185
- return computed;
186
- });
160
+ const overview = planView(tel.bbox, config.width, config.height, config);
187
161
  log(describeView(config, overview, config.style));
188
162
  return overview;
189
163
  }
190
- async function tileWarmStage(deps, config, overview, log, tracer, parent) {
191
- const tileStats = await stage(tracer, 'tiles.prefetch', parent, {}, async (span) => {
192
- const stats = await deps.prefetchTiles({
193
- style: config.style,
194
- tiles: overview.tiles,
195
- log,
196
- });
197
- span.setAttributes({
198
- 'tiles.total': stats.total,
199
- 'tiles.downloaded': stats.downloaded,
200
- 'tiles.cached': stats.total - stats.downloaded - stats.failed,
201
- 'tiles.failed': stats.failed,
202
- });
203
- return stats;
164
+ async function tileWarmStage(deps, config, overview, log) {
165
+ const tileStats = await deps.prefetchTiles({
166
+ style: config.style,
167
+ tiles: overview.tiles,
168
+ log,
204
169
  });
205
170
  if (tileStats.downloaded) {
206
171
  log(`tiles: ${tileStats.downloaded} downloaded, ${tileStats.failed} placeholders`);
@@ -212,23 +177,22 @@ export async function prepareSession(videoPath, config, log, options = {}) {
212
177
  videoPath,
213
178
  config,
214
179
  log,
215
- tracer: options.trace?.tracer ?? NOOP_TRACER,
216
- parent: options.trace?.parent,
217
180
  deps: resolveDeps(options.deps, config.tileCache),
218
- tools: options.tools ?? resolveFfTools(config),
181
+ tools: options.tools ?? resolveFfmpegTools(config),
219
182
  report: createPrepareReporter(options.onProgress),
220
183
  };
221
184
  const { width, height } = config;
222
185
  const { probe, introOutro } = await probeStage(env);
223
- const { tel, frameValues, protoFile, gimbalDevice, hud } = await telemetryStage(env, probe);
186
+ const { tel, frameValues, trackValues, protoFile, gimbalDevice, hud } = await telemetryStage(env, probe);
224
187
  const overview = await viewPlanStage(env, tel);
225
- const frames = frameArrays(tel);
188
+ const frames = frameChannelsOf(tel);
226
189
  return {
227
190
  width,
228
191
  height,
229
192
  probe,
230
193
  tel,
231
194
  frameValues,
195
+ trackValues,
232
196
  protoFile,
233
197
  gimbalDevice,
234
198
  hud,
@@ -270,7 +234,7 @@ function buildOkSummary(ctx, elapsedSec) {
270
234
  source: telemetry.source,
271
235
  method: telemetry.method,
272
236
  headingMode: telemetry.headingMode,
273
- fixes: telemetry.fixes,
237
+ fixes: telemetry.fixCount,
274
238
  noLock: telemetry.noLock,
275
239
  trackDistanceM: telemetry.trackDistanceM,
276
240
  frames: ctx.outFrames,
@@ -286,27 +250,18 @@ function buildOkSummary(ctx, elapsedSec) {
286
250
  };
287
251
  }
288
252
  async function verifyRenderedOutput(env) {
289
- const { ctx, deps, tools, tracer, root } = env;
290
- await stage(tracer, 'output.verify', root, {}, async (span) => {
291
- const verify = await deps.verifyOutput(tools, ctx.outPath, ctx.outFrames, ctx.probe.fps.value);
292
- span.setAttributes({
293
- 'verify.frames.expected': ctx.outFrames,
294
- 'verify.frames.actual': verify.frames,
295
- 'verify.fps.expected': ctx.probe.fps.str,
296
- 'verify.fps.actual': verify.fps ?? 'unknown',
297
- 'verify.ok': verify.ok,
298
- });
299
- if (!verify.ok) {
300
- throw new Error(`output verification failed: got ${verify.frames} frames @ ${verify.fps ?? 'unknown'}, ` +
301
- `expected ${ctx.outFrames} @ ${ctx.probe.fps.str}`);
302
- }
303
- });
253
+ const { ctx, deps, tools } = env;
254
+ const verify = await deps.verifyOutput(tools, ctx.outPath, ctx.outFrames, ctx.probe.fps.value);
255
+ if (!verify.ok) {
256
+ throw new Error(`${ERR_OUTPUT_VERIFICATION}got ${verify.frames} frames @ ${verify.fps ?? 'unknown'}, ` +
257
+ `expected ${ctx.outFrames} @ ${ctx.probe.fps.str}`);
258
+ }
304
259
  ctx.log(ctx.frameRange
305
260
  ? 'verified: frame count and frame rate are 1:1 within the exported range'
306
261
  : 'verified: frame count and frame rate match the source');
307
262
  }
308
263
  async function renderToOutput(env) {
309
- const { ctx, deps, tools, options, tracer, root } = env;
264
+ const { ctx, deps, tools, options } = env;
310
265
  const html = buildPageHtml(recordingPageOpts(ctx, ctx.config));
311
266
  fs.mkdirSync(path.dirname(ctx.outPath), { recursive: true });
312
267
  await renderWithOutputCleanup(ctx.outPath, ctx.log, async () => {
@@ -329,7 +284,6 @@ async function renderToOutput(env) {
329
284
  browserPath: ctx.config.browser,
330
285
  signal: options.signal,
331
286
  log: ctx.log,
332
- trace: { tracer, parent: root },
333
287
  onCapture: options.onCapture,
334
288
  });
335
289
  await verifyRenderedOutput(env);
@@ -346,84 +300,87 @@ export function telemetryExportInput(prep) {
346
300
  headingDeg: prep.tel.frames.map((frame) => frame.headingDeg),
347
301
  };
348
302
  }
349
- function writeTelemetryExport(file, prep, log) {
350
- const doc = buildTelemetryDocument(telemetryExportInput(prep));
351
- fs.mkdirSync(path.dirname(file), { recursive: true });
352
- fs.writeFileSync(file, serializeTelemetryDocument(doc));
353
- log(`telemetry JSON: wrote ${file}`);
303
+ // The track formats read the fix-faithful records (which carry positions and
304
+ // source times for every telemetry source); the .json document keeps its own
305
+ // record stream.
306
+ export function trackExportStream(prep) {
307
+ return {
308
+ records: prep.trackValues,
309
+ fpsValue: prep.probe.fps.value,
310
+ frameCount: prep.probe.frames,
311
+ };
312
+ }
313
+ function writeTrackExport(file, prep, log) {
314
+ // The export intentionally covers the whole recording: a frame range
315
+ // limits the render, never this export.
316
+ writeTrackFile(file, { document: telemetryExportInput(prep), track: trackExportStream(prep) }, null);
317
+ log(`track: wrote ${file}`);
354
318
  }
355
319
  export async function processRecording(videoPath, config, log, outPath = outputPathFor(videoPath, config), options = {}) {
356
320
  const t0 = Date.now();
357
- const tracer = options.trace?.tracer ?? NOOP_TRACER;
358
321
  const deps = resolveDeps(options.deps, config.tileCache);
359
- const tools = options.tools ?? resolveFfTools(config);
322
+ const tools = options.tools ?? resolveFfmpegTools(config);
360
323
  if (options.signal?.aborted)
361
- throw new Error('render canceled');
362
- return stage(tracer, 'recording.process', options.trace?.parent, {
363
- 'source.file.name': path.basename(videoPath),
364
- }, async (root) => {
365
- const prep = await prepareSession(videoPath, config, log, {
366
- ...options,
367
- deps,
368
- tools,
369
- trace: { tracer, parent: root },
370
- });
371
- root.setAttributes({
372
- 'canvas.width': prep.width,
373
- 'canvas.height': prep.height,
374
- 'map.style': config.style,
375
- 'map.view': config.view,
376
- 'source.frames': prep.probe.frames,
377
- 'source.fps': prep.probe.fps.value,
378
- 'telemetry.source': prep.tel.source,
379
- });
380
- if (config.telemetryJson) {
381
- writeTelemetryExport(config.telemetryJson, prep, log);
382
- }
383
- const tileStats = await tileWarmStage(deps, config, prep.overview, log, tracer, root);
384
- const range = resolveRange(options.range, prep.probe.frames);
385
- const outFrames = range ? range.end - range.start + 1 : prep.probe.frames;
386
- const ctx = {
387
- ...prep,
388
- videoPath,
389
- outPath,
390
- config,
391
- log,
392
- outFrames,
393
- frameRange: range,
394
- tileStats,
395
- };
396
- await renderToOutput({ ctx, deps, tools, options, tracer, root });
397
- return buildOkSummary(ctx, Math.round((Date.now() - t0) / 1000));
324
+ throw new Error(ERR_RENDER_CANCELED);
325
+ const prep = await prepareSession(videoPath, config, log, {
326
+ ...options,
327
+ deps,
328
+ tools,
398
329
  });
330
+ if (config.trackOut) {
331
+ writeTrackExport(config.trackOut, prep, log);
332
+ }
333
+ const tileStats = await tileWarmStage(deps, config, prep.overview, log);
334
+ const range = resolveFrameRange(options.range, prep.probe.frames);
335
+ const outFrames = range ? range.end - range.start + 1 : prep.probe.frames;
336
+ const ctx = {
337
+ ...prep,
338
+ videoPath,
339
+ outPath,
340
+ config,
341
+ log,
342
+ outFrames,
343
+ frameRange: range,
344
+ tileStats,
345
+ };
346
+ await renderToOutput({ ctx, deps, tools, options });
347
+ return buildOkSummary(ctx, Math.round((Date.now() - t0) / 1000));
399
348
  }
400
349
  export async function runBatch(videos, config, log, emit, options = {}) {
401
350
  const result = { ok: 0, skipped: 0, failed: 0 };
402
351
  const deps = resolveDeps(options.deps, config.tileCache);
403
- const tools = options.tools ?? resolveFfTools(config);
404
- if (config.telemetryJson && videos.length > 1) {
405
- throw new Error('--telemetry-json writes one document per run: give a single recording');
352
+ const tools = options.tools ?? resolveFfmpegTools(config);
353
+ if (config.trackOut && videos.length > 1) {
354
+ throw new Error('--track-out writes one file per run: give a single recording');
406
355
  }
407
356
  const plans = planOutputs(videos, config);
357
+ function collisionWarning(base, plan) {
358
+ if (plan.out !== plan.plain) {
359
+ log(`warning: output name collision for ${base} - writing ${path.basename(plan.out)} instead`);
360
+ }
361
+ }
362
+ async function maybeSkip(video, plan) {
363
+ if (!(config.skipExisting && (await deps.outputMatchesSource(tools, video, plan.out)))) {
364
+ return null;
365
+ }
366
+ log(`SKIP ${plan.out} (exists and matches the source)`);
367
+ return 'skipped';
368
+ }
369
+ async function runOne(video, plan) {
370
+ return processRecording(video, config, log, plan.out, { ...options, deps, tools });
371
+ }
408
372
  for (const [idx, video] of videos.entries()) {
409
373
  const base = path.basename(video);
410
374
  log(`=== ${base} ===`);
411
375
  const plan = plans[idx];
412
- if (plan.out !== plan.plain) {
413
- log(`warning: output name collision for ${base} - writing ${path.basename(plan.out)} instead`);
414
- }
415
- if (config.skipExisting && (await deps.outputMatchesSource(tools, video, plan.out))) {
416
- log(`SKIP ${plan.out} (exists and matches the source)`);
376
+ collisionWarning(base, plan);
377
+ if ((await maybeSkip(video, plan)) !== null) {
417
378
  emit({ video, out: plan.out, status: 'skipped', elapsedSec: 0 });
418
379
  result.skipped++;
419
380
  continue;
420
381
  }
421
382
  try {
422
- const summary = await processRecording(video, config, log, plan.out, {
423
- ...options,
424
- deps,
425
- tools,
426
- });
383
+ const summary = await runOne(video, plan);
427
384
  emit(summary);
428
385
  log(`OK ${plan.out} (${summary.frames} frames @ ${summary.fps}, ${summary.elapsedSec} s)`);
429
386
  result.ok++;
package/dist/png.js CHANGED
@@ -1,27 +1,10 @@
1
1
  import zlib from 'node:zlib';
2
- const CRC_TABLE = (() => {
3
- const table = new Int32Array(256);
4
- for (let n = 0; n < 256; n++) {
5
- let c = n;
6
- for (let k = 0; k < 8; k++)
7
- c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
8
- table[n] = c;
9
- }
10
- return table;
11
- })();
12
- function crc32(buf) {
13
- let crc = 0xffffffff;
14
- for (let i = 0; i < buf.length; i++) {
15
- crc = CRC_TABLE[(crc ^ buf[i]) & 0xff] ^ (crc >>> 8);
16
- }
17
- return (crc ^ 0xffffffff) >>> 0;
18
- }
19
2
  function pngChunk(type, data) {
20
3
  const len = Buffer.alloc(4);
21
4
  len.writeUInt32BE(data.length);
22
5
  const body = Buffer.concat([Buffer.from(type, 'ascii'), data]);
23
6
  const crc = Buffer.alloc(4);
24
- crc.writeUInt32BE(crc32(body));
7
+ crc.writeUInt32BE(zlib.crc32(body));
25
8
  return Buffer.concat([len, body, crc]);
26
9
  }
27
10
  export function solidPng(hexColor, size = 256) {
@@ -77,26 +77,26 @@ function pushField(fields, fieldNumber, field) {
77
77
  else
78
78
  fields.set(fieldNumber, [field]);
79
79
  }
80
- export function subMessage(buf, fields, fieldNumber) {
80
+ export function firstSubMessage(buf, fields, fieldNumber) {
81
81
  const field = fields.get(fieldNumber)?.[0];
82
82
  if (!field?.bytesSpan)
83
83
  return null;
84
84
  const [start, end] = field.bytesSpan;
85
85
  return parseProtoFields(buf, start, end);
86
86
  }
87
- export function firstVarint(fields, fieldNumber) {
87
+ export function firstVarintField(fields, fieldNumber) {
88
88
  const value = fields.get(fieldNumber)?.[0]?.varintValue;
89
89
  return value !== undefined ? signedVarint(value) : null;
90
90
  }
91
- export function firstFloat(fields, fieldNumber) {
91
+ export function firstFloatField(fields, fieldNumber) {
92
92
  const value = fields.get(fieldNumber)?.[0]?.floatValue;
93
93
  return value ?? null;
94
94
  }
95
- export function firstDouble(fields, fieldNumber) {
95
+ export function firstDoubleField(fields, fieldNumber) {
96
96
  const value = fields.get(fieldNumber)?.[0]?.doubleValue;
97
97
  return value ?? null;
98
98
  }
99
- export function firstString(buf, fields, fieldNumber) {
99
+ export function firstStringField(buf, fields, fieldNumber) {
100
100
  const span = fields.get(fieldNumber)?.[0]?.bytesSpan;
101
101
  return span ? buf.toString('utf8', span[0], span[1]) : null;
102
102
  }
package/dist/range.js CHANGED
@@ -1,4 +1,4 @@
1
- export function parseRange(header, size) {
1
+ export function parseByteRange(header, size) {
2
2
  if (header === undefined)
3
3
  return null;
4
4
  const text = Array.isArray(header) ? header[0] : header;
@@ -28,8 +28,8 @@ export function parseRange(header, size) {
28
28
  return 'unsatisfiable';
29
29
  return { start, end: Math.min(end, size - 1) };
30
30
  }
31
- export function rangePlan(header, size, mime) {
32
- const range = parseRange(header, size);
31
+ export function planByteRange(header, size, mime) {
32
+ const range = parseByteRange(header, size);
33
33
  if (range === 'unsatisfiable') {
34
34
  return {
35
35
  status: 416,
@@ -1,4 +1,4 @@
1
- import { hasAltitude, resolveHudSpec } from './config.js';
1
+ import { hasAltitude, resolveHudLayout } from './config.js';
2
2
  import { decimateTrack } from './decimate.js';
3
3
  import { unproject } from './geo.js';
4
4
  import { planIntroOutroFrames, planView } from './plan.js';
@@ -7,7 +7,7 @@ export function planPageOpts(opts) {
7
7
  const { bbox, width, height, config, source, frames, planned, previous } = opts;
8
8
  const overview = planned?.overview ?? planView(bbox, width, height, config);
9
9
  const introOutro = planned?.introOutro ?? planIntroOutroFrames(config, source);
10
- const hud = planned?.hud ?? resolveHudSpec(config.hud, hasAltitude(frames.alt));
10
+ const hud = planned?.hud ?? resolveHudLayout(config.hud, hasAltitude(frames.alt));
11
11
  const decimated = previous && previous.zoom === overview.zoom
12
12
  ? previous.decimated
13
13
  : decimateTrack(frames.lat, frames.lon, overview.zoom);