@slidevideo/cli 0.2.0 → 0.2.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.
- package/CHANGELOG.md +7 -0
- package/README.md +2 -2
- package/addons/slidevideo/geometry.ts +63 -30
- package/addons/slidevideo/global-top.vue +41 -9
- package/addons/slidevideo/playback-entries.ts +16 -5
- package/addons/slidevideo/preview.ts +26 -14
- package/dist/adapters/powerpoint.d.ts +7 -4
- package/dist/adapters/powerpoint.js +116 -26
- package/dist/adapters/slidev-inspection.d.ts +5 -2
- package/dist/adapters/slidev-inspection.js +3 -2
- package/dist/adapters/slidev.d.ts +3 -4
- package/dist/adapters/slidev.js +20 -19
- package/dist/annotation-paint.d.ts +65 -11
- package/dist/annotation-paint.js +290 -10
- package/dist/annotations.d.ts +13 -8
- package/dist/annotations.js +619 -88
- package/dist/assembly.d.ts +4 -2
- package/dist/assembly.js +23 -18
- package/dist/cli.js +102 -16
- package/dist/compositor.d.ts +10 -5
- package/dist/compositor.js +215 -128
- package/dist/contracts.d.ts +91 -30
- package/dist/contracts.js +2 -1
- package/dist/media.d.ts +5 -0
- package/dist/media.js +30 -0
- package/dist/pipeline.d.ts +35 -9
- package/dist/pipeline.js +62 -10
- package/dist/preview/contracts.d.ts +3 -3
- package/dist/preview/player.js +20 -15
- package/dist/preview/server.d.ts +2 -1
- package/dist/preview/server.js +6 -5
- package/dist/setup.d.ts +3 -0
- package/dist/setup.js +16 -1
- package/dist/skill-install.d.ts +35 -0
- package/dist/skill-install.js +132 -0
- package/dist/storyboard.js +9 -0
- package/package.json +4 -1
- package/schemas/annotation-geometry.v1.json +260 -28
- package/schemas/run-manifest.v1.json +31 -0
- package/schemas/schedule.v1.json +448 -182
- package/schemas/storyboard.v1.json +358 -174
- package/skills/slidevideo/SKILL.md +11 -9
- package/skills/slidevideo/references/decks.md +228 -0
- package/skills/slidevideo/references/production.md +14 -10
- package/skills/slidevideo/references/storyboard.md +65 -33
- package/tools/powerpoint/powerpoint.ps1 +52 -41
- package/tools/powerpoint/preview.ps1 +5 -5
|
@@ -302,43 +302,50 @@ function Apply-Operation($operation) {
|
|
|
302
302
|
return $player
|
|
303
303
|
} else { Fail 'POWERPOINT_PROTOCOL' ('Unknown operation ' + $operation.type) }
|
|
304
304
|
}
|
|
305
|
+
function Request-Context($request, [bool]$includeClick = $false) {
|
|
306
|
+
$ids = @($request.annotations)
|
|
307
|
+
$prefix = $(if ($ids.Count -eq 1) { 'Annotation ' + $ids[0] } else { 'Annotations ' + ($ids -join ', ') })
|
|
308
|
+
$suffix = $(if ($includeClick) { ', click ' + $request.click } else { '' })
|
|
309
|
+
return ($prefix + ' (' + $request.key + '), slide ' + $request.slide + ', visit ' + $request.visit + $suffix)
|
|
310
|
+
}
|
|
305
311
|
function Prepare-Annotations($catalog) {
|
|
306
|
-
foreach ($
|
|
307
|
-
$context =
|
|
308
|
-
$visits = @($job.operations | Where-Object { $_.type -eq 'slide' -and $_.id -eq $
|
|
312
|
+
foreach ($request in $job.geometry_requests) {
|
|
313
|
+
$context = Request-Context $request
|
|
314
|
+
$visits = @($job.operations | Where-Object { $_.type -eq 'slide' -and $_.id -eq $request.visit -and $_.native_id -eq $request.native_id -and $_.scene -eq $request.scene })
|
|
309
315
|
if ($visits.Count -ne 1) { Fail 'ANNOTATION_STATE' ($context + ': no unique scheduled slide visit.') }
|
|
310
|
-
if ($
|
|
316
|
+
if ($request.start_ms -lt $visits[0].at_ms + $visits[0].settle_ms -or $request.end_ms -le $request.start_ms -or $request.end_ms -gt $job.duration_ms) { Fail 'ANNOTATION_INTERVAL' ($context + ': interval is outside settled playback.') }
|
|
311
317
|
$click = 0
|
|
312
318
|
foreach ($operation in $job.operations) {
|
|
313
319
|
if ($operation.type -notin @('slide', 'reveal')) { continue }
|
|
314
|
-
if ($operation.at_ms -le $
|
|
320
|
+
if ($operation.at_ms -le $request.start_ms) {
|
|
315
321
|
if ($operation.type -eq 'slide') { $visit = [string]$operation.id; $click = 0 }
|
|
316
322
|
else { $click = [int]$operation.click }
|
|
317
|
-
if ($operation.at_ms + $operation.settle_ms -gt $
|
|
318
|
-
} elseif ($operation.at_ms -lt $
|
|
323
|
+
if ($operation.at_ms + $operation.settle_ms -gt $request.start_ms) { Fail 'ANNOTATION_INTERVAL' ($context + ': interval starts before a native action settles.') }
|
|
324
|
+
} elseif ($operation.at_ms -lt $request.end_ms) { Fail 'ANNOTATION_INTERVAL' ($context + ': interval crosses a native slide or reveal action.') }
|
|
319
325
|
}
|
|
320
|
-
if ($visit -ne $
|
|
321
|
-
if ($
|
|
322
|
-
if ($
|
|
323
|
-
$slides = @($catalog.slides | Where-Object { $_.native_id -eq $
|
|
324
|
-
$matches = @($slides[0].shapes | Where-Object { $_.id -eq $
|
|
325
|
-
if ($matches.Count -ne 1) { Fail 'ANNOTATION_TARGET' ($context + ', shape ' + $
|
|
326
|
-
if ($matches[0].unsupported.Count -gt 0 -or $
|
|
326
|
+
if ($visit -ne $request.visit -or $click -ne $request.click) { Fail 'ANNOTATION_STATE' ($context + ': resolved click or visit does not match native operations.') }
|
|
327
|
+
if ($request.target.type -eq 'element') { Fail 'ANNOTATION_TARGET' ($context + ': use an existing native shape ID or normalized region; selectors are unsupported.') }
|
|
328
|
+
if ($request.target.type -eq 'shape') {
|
|
329
|
+
$slides = @($catalog.slides | Where-Object { $_.native_id -eq $request.native_id })
|
|
330
|
+
$matches = @($slides[0].shapes | Where-Object { $_.id -eq $request.target.id })
|
|
331
|
+
if ($matches.Count -ne 1) { Fail 'ANNOTATION_TARGET' ($context + ', shape ' + $request.target.id + ': identity is missing or ambiguous.') }
|
|
332
|
+
if ($matches[0].unsupported.Count -gt 0 -or $request.click -lt $matches[0].visible_from_click) { Fail 'ANNOTATION_TARGET' ($context + ', shape ' + $request.target.id + ' (' + $matches[0].name + '): unsupported or hidden target. ' + ($matches[0].unsupported -join '; ')) }
|
|
327
333
|
}
|
|
328
|
-
$annotationMonitors.Add(@{
|
|
334
|
+
$annotationMonitors.Add(@{ request = $request; geometry = $null; next_sample_ms = [double]$request.start_ms; complete = $false })
|
|
329
335
|
}
|
|
330
336
|
}
|
|
331
|
-
function Measure-Annotation($
|
|
332
|
-
$context =
|
|
337
|
+
function Measure-Annotation($request, [bool]$allowPaused = $false) {
|
|
338
|
+
$context = Request-Context $request $true
|
|
333
339
|
[SlideVideo.Native]::EnsureGeometry($window, $geometry)
|
|
334
|
-
if ($activeVisit -ne $
|
|
335
|
-
if ($
|
|
336
|
-
|
|
340
|
+
if ($activeVisit -ne $request.visit -or $activeScene -ne $request.scene -or [int]$show.View.Slide.SlideID -ne $request.native_id -or [int]$show.View.GetClickIndex() -ne $request.click -or ([int]$show.View.State -ne 1 -and !($allowPaused -and [int]$show.View.State -eq 2))) { Fail 'ANNOTATION_STATE' ($context + ': actual slideshow state changed.') }
|
|
341
|
+
if ($request.target.type -eq 'slide') { return }
|
|
342
|
+
if ($request.target.type -eq 'region') {
|
|
343
|
+
$bounds = @{ x = [double]$request.target.x; y = [double]$request.target.y; width = [double]$request.target.width; height = [double]$request.target.height }
|
|
337
344
|
} else {
|
|
338
|
-
$matches = @($show.View.Slide.Shapes | Where-Object { $_.Id -eq $
|
|
339
|
-
if ($matches.Count -ne 1) { Fail 'ANNOTATION_TARGET' ($context + ', shape ' + $
|
|
345
|
+
$matches = @($show.View.Slide.Shapes | Where-Object { $_.Id -eq $request.target.id })
|
|
346
|
+
if ($matches.Count -ne 1) { Fail 'ANNOTATION_TARGET' ($context + ', shape ' + $request.target.id + ': actual shape is missing or ambiguous.') }
|
|
340
347
|
$shape = $matches[0]
|
|
341
|
-
if ([int]$shape.Visible -ne -1 -or [int]$shape.Type -eq 6 -or [Math]::Abs([double]$shape.Rotation % 360) -gt 0.001 -or [int]$shape.ThreeD.Visible -ne 0 -or [int]$shape.HorizontalFlip -ne 0 -or [int]$shape.VerticalFlip -ne 0) { Fail 'ANNOTATION_TARGET' ($context + ', shape ' + $
|
|
348
|
+
if ([int]$shape.Visible -ne -1 -or [int]$shape.Type -eq 6 -or [Math]::Abs([double]$shape.Rotation % 360) -gt 0.001 -or [int]$shape.ThreeD.Visible -ne 0 -or [int]$shape.HorizontalFlip -ne 0 -or [int]$shape.VerticalFlip -ne 0) { Fail 'ANNOTATION_TARGET' ($context + ', shape ' + $request.target.id + ': actual target is hidden, grouped or transformed.') }
|
|
342
349
|
$bounds = @{ x = [double]$shape.Left / $presentation.PageSetup.SlideWidth; y = [double]$shape.Top / $presentation.PageSetup.SlideHeight; width = [double]$shape.Width / $presentation.PageSetup.SlideWidth; height = [double]$shape.Height / $presentation.PageSetup.SlideHeight }
|
|
343
350
|
}
|
|
344
351
|
foreach ($value in $bounds.Values) { if ([double]::IsNaN($value) -or [double]::IsInfinity($value)) { Fail 'ANNOTATION_GEOMETRY' ($context + ': nonfinite bounds.') } }
|
|
@@ -348,29 +355,33 @@ function Measure-Annotation($annotation, [bool]$allowPaused = $false) {
|
|
|
348
355
|
function Check-Annotations {
|
|
349
356
|
foreach ($monitor in $annotationMonitors) {
|
|
350
357
|
if ($monitor.complete) { continue }
|
|
351
|
-
$
|
|
352
|
-
|
|
358
|
+
$request = $monitor.request
|
|
359
|
+
$context = Request-Context $request $true
|
|
360
|
+
if ($null -eq $monitor.geometry -and $request.start_ms -ge $annotationStartBeforeMs) { continue }
|
|
353
361
|
$now = $clock.Elapsed.TotalMilliseconds - $origin
|
|
354
|
-
if ($now -lt $monitor.next_sample_ms -and $now -lt $
|
|
355
|
-
if ($null -eq $monitor.geometry -and $now -ge $
|
|
356
|
-
$
|
|
362
|
+
if ($now -lt $monitor.next_sample_ms -and $now -lt $request.end_ms) { continue }
|
|
363
|
+
if ($null -eq $monitor.geometry -and $now -ge $request.end_ms) { Fail 'ANNOTATION_INTERVAL' ($context + ': native playback missed the entire interval.') }
|
|
364
|
+
$fragments = @(Measure-Annotation $request)
|
|
357
365
|
$observed = $clock.Elapsed.TotalMilliseconds - $origin
|
|
358
366
|
if ($null -eq $monitor.geometry) {
|
|
359
|
-
if ($observed -ge $
|
|
360
|
-
if ($observed - $
|
|
361
|
-
$monitor.geometry = @{
|
|
367
|
+
if ($observed -ge $request.end_ms) { Fail 'ANNOTATION_INTERVAL' ($context + ': initial measurement completed after the interval.') }
|
|
368
|
+
if ($observed - $request.start_ms -gt 100) { Fail 'ANNOTATION_INTERVAL' ($context + ': initial native measurement exceeded the interval boundary by 100 ms.') }
|
|
369
|
+
$monitor.geometry = @{ key = [string]$request.key; target = $request.target; scene = [string]$request.scene; slide = [string]$request.slide; visit = [string]$request.visit; click = [int]$request.click; start_ms = $request.start_ms; end_ms = $request.end_ms; observed_start_ms = $observed; observed_end_ms = $observed; viewport = @{ width = [int]$job.output.width; height = [int]$job.output.height }; content = @{ x = $outputContent.x; y = $outputContent.y; width = $outputContent.width; height = $outputContent.height }; fragments = @($fragments); samples = 1 }
|
|
362
370
|
$annotationGeometry.Add($monitor.geometry)
|
|
363
371
|
} else {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
372
|
+
if ($fragments.Count -ne $monitor.geometry.fragments.Count) { Fail 'ANNOTATION_MOVING_TARGET' ($context + ': fragment count changed during its native interval.') }
|
|
373
|
+
for ($fragmentIndex = 0; $fragmentIndex -lt $fragments.Count; $fragmentIndex++) {
|
|
374
|
+
foreach ($coord in @('x', 'y', 'width', 'height')) {
|
|
375
|
+
$pixels = $(if ($coord -in @('x', 'width')) { $outputContent.width } else { $outputContent.height })
|
|
376
|
+
if ([Math]::Abs($fragments[$fragmentIndex][$coord] - $monitor.geometry.fragments[$fragmentIndex][$coord]) * $pixels -gt 0.5) { Fail 'ANNOTATION_MOVING_TARGET' ($context + ': target moved during its native interval.') }
|
|
377
|
+
}
|
|
367
378
|
}
|
|
368
379
|
$monitor.geometry.samples++
|
|
369
380
|
$monitor.geometry.observed_end_ms = $observed
|
|
370
381
|
}
|
|
371
|
-
$monitor.next_sample_ms = [Math]::Min($observed + 50, [double]$
|
|
372
|
-
if ($now -ge $
|
|
373
|
-
if ($observed - $
|
|
382
|
+
$monitor.next_sample_ms = [Math]::Min($observed + 50, [double]$request.end_ms)
|
|
383
|
+
if ($now -ge $request.end_ms) {
|
|
384
|
+
if ($observed - $request.end_ms -gt 100) { Fail 'ANNOTATION_INTERVAL' ($context + ': final native measurement exceeded the interval boundary by 100 ms.') }
|
|
374
385
|
$monitor.complete = $true
|
|
375
386
|
}
|
|
376
387
|
}
|
|
@@ -521,7 +532,7 @@ try {
|
|
|
521
532
|
if ((File-Hash $job.deck) -ne $job.deck_sha256) { Fail 'POWERPOINT_SOURCE_CHANGED' 'The source presentation changed while PowerPoint opened its private copy.' }
|
|
522
533
|
if ($job.mode -eq 'inspect') { $result = Inspect-Native $package }
|
|
523
534
|
else {
|
|
524
|
-
if ($job.
|
|
535
|
+
if ($job.geometry_requests.Count -gt 0) { Prepare-Annotations (Inspect-Native $package) }
|
|
525
536
|
foreach ($media in $job.media) {
|
|
526
537
|
$matches = @($package.media | Where-Object { $_.native_id -eq $media.native_id -and $_.shape -eq $media.shape -and $_.id -eq $media.id -and $_.sha256 -eq $media.sha256 })
|
|
527
538
|
if ($matches.Count -ne 1 -or (File-Hash $media.src) -ne $media.sha256) { Fail 'MEDIA_SOURCE_MISMATCH' ('Native video bytes no longer match ' + $media.id) }
|
|
@@ -574,7 +585,7 @@ try {
|
|
|
574
585
|
} while ($null -eq $geometry)
|
|
575
586
|
$scaleFilter = ('scale=' + $job.output.width + ':' + $job.output.height + ':force_original_aspect_ratio=decrease:flags=bicubic,pad=' + $job.output.width + ':' + $job.output.height + ':(ow-iw)/2:(oh-ih)/2,setsar=1')
|
|
576
587
|
$outputContent = [SlideVideo.Native]::OutputContent($geometry, [int]$job.output.width, [int]$job.output.height)
|
|
577
|
-
if ($job.
|
|
588
|
+
if ($job.geometry_requests.Count -gt 0) { $scaleFilter = ('scale=' + $outputContent.width + ':' + $outputContent.height + ':flags=bicubic,format=rgb24,pad=' + $job.output.width + ':' + $job.output.height + ':' + $outputContent.x + ':' + $outputContent.y + ',setsar=1') }
|
|
578
589
|
$captureFilter = ('crop=' + $geometry.width + ':' + $geometry.height + ':' + $geometry.left + ':' + $geometry.top + ':exact=1,' + $scaleFilter)
|
|
579
590
|
Write-Json 'geometry.json' @{ version = 1; hwnd = $window.ToString(); rectangle = $geometry; deck_aspect = $deckAspect; requested = $job.output; filter = $captureFilter }
|
|
580
591
|
if ($job.verify_timing) { Rehearse }
|
|
@@ -645,7 +656,7 @@ try {
|
|
|
645
656
|
foreach ($marker in $markers) { $marker.observed_ms -= $origin; $marker.rendered_by_ms -= $origin }
|
|
646
657
|
$script:activeVisit = [string]$firstOperation.id
|
|
647
658
|
$script:activeScene = [string]$firstOperation.scene
|
|
648
|
-
$script:collectAnnotations = $job.
|
|
659
|
+
$script:collectAnnotations = $job.geometry_requests.Count -gt 0
|
|
649
660
|
$initial = $true
|
|
650
661
|
for ($operationIndex = 0; $operationIndex -lt $job.operations.Count; $operationIndex++) {
|
|
651
662
|
$operation = $job.operations[$operationIndex]
|
|
@@ -704,7 +715,7 @@ try {
|
|
|
704
715
|
try { [void][Runtime.InteropServices.Marshal]::FinalReleaseComObject($app) } catch { $cleanup.Add('The COM application reference did not release.') }
|
|
705
716
|
}
|
|
706
717
|
try { Write-Json 'events.json' @{ version = 1; events = @($events.ToArray()); markers = @($markers.ToArray()); failure = $failure } } catch {}
|
|
707
|
-
try { Write-Json 'annotation-geometry.json' @{ version = 1; geometry = @($annotationGeometry.ToArray()); intervals = @($annotationMonitors | ForEach-Object { @{
|
|
718
|
+
try { Write-Json 'annotation-geometry.json' @{ version = 1; geometry = @($annotationGeometry.ToArray()); intervals = @($annotationMonitors | ForEach-Object { @{ key = $_.request.key; annotations = @($_.request.annotations); start_ms = $_.request.start_ms; end_ms = $_.request.end_ms; complete = $_.complete } }); failure = $failure } } catch {}
|
|
708
719
|
try { Write-Json 'cleanup.json' @{ version = 1; gaps = @($cleanup.ToArray()); application_created = $createdApplication } } catch {}
|
|
709
720
|
if ($locked) { $mutex.ReleaseMutex() }
|
|
710
721
|
if ($null -ne $mutex) { $mutex.Dispose() }
|
|
@@ -85,14 +85,14 @@ function Run-Preview {
|
|
|
85
85
|
$status = 'ended'
|
|
86
86
|
}
|
|
87
87
|
if ($null -eq $line) { Start-Sleep -Milliseconds 10; continue }
|
|
88
|
-
$
|
|
89
|
-
foreach ($
|
|
90
|
-
if ($position -ge $
|
|
91
|
-
@{
|
|
88
|
+
$targets = @(
|
|
89
|
+
foreach ($request in $job.geometry_requests) {
|
|
90
|
+
if ($position -ge $request.start_ms -and $position -lt $request.end_ms) {
|
|
91
|
+
@{ key = [string]$request.key; fragments = @(Measure-Annotation $request $true) }
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
)
|
|
95
|
-
$state = @{ position_ms = $position; status = $status; duration_ms = $job.duration_ms;
|
|
95
|
+
$state = @{ position_ms = $position; status = $status; duration_ms = $job.duration_ms; targets = @($targets); viewport = @{ width = $previewWidth; height = $previewHeight }; content = @{ x = 0; y = 0; width = $previewWidth; height = $previewHeight } }
|
|
96
96
|
if ($action -eq 'frame') { $state.image = [SlideVideo.Native]::PreviewJpeg($window, $geometry, $previewWidth, $previewHeight) }
|
|
97
97
|
[Console]::WriteLine('SLIDEVIDEO_PREVIEW ' + (ConvertTo-Json -InputObject @{ id = $command.id; state = $state } -Depth 30 -Compress))
|
|
98
98
|
[Console]::Out.Flush()
|