feat(chroma): offer to remove a green or blue screen, and key it in the decode
TASK 64 slices D and E: the feature is usable end to end. - Add a video file → one frame is probed (new `IChromaProbe`/`FfmpegChromaProbe`, one ffmpeg pass at 160x90, off the UI thread) and the layer gets an offer: "Looks like a green screen — Remove it", with the measured colour as a swatch. - Accepting it turns the offer into settings (Amount / Softness / Fringe) that reach ffmpeg as `colorkey` + `despill` + `format=bgra`, so the key is computed in the pipe and both consumers (the shared preview bitmap and the compositor's frame) carry the same alpha. - Media sessions are now keyed by **path + look** (`MainViewModel.MediaSessionKey`), so two layers with the same settings still share one decoder, and changing the look releases the old session and starts the new one. Removal, load reconciliation, loop and audio settings all move to the same key. - Settings persist on the `Source` row (six ALTER TABLE guards + SELECT/INSERT), so a keyed layer comes back keyed. - Panel section is plain creator words: Green/Blue Screen, Amount, Softness, Fringe. Test: `ChromaKeyApplyTests` — the pipe asks ffmpeg to key (and does not when off); a green-screen clip is offered, accepting it starts a keyed session, the layer's resolver then reads that session rather than the old one; the setting survives a save. Docs: TASK 64 D/E ticked with slice F (auto-apply setting + alert clips) left open; frame-pipeline records the decode-option design; HANDOFF rewritten. verify.sh: 544 passed, 0 failed, 0 warnings.
This commit is contained in:
@@ -106,7 +106,7 @@ public class MediaVideoSourceManagerTests
|
||||
{
|
||||
var started = new List<string>();
|
||||
var stopped = new List<string>();
|
||||
var manager = new MediaVideoSourceManager(key => new FakeMediaSource(key, started, stopped));
|
||||
var manager = new MediaVideoSourceManager((key, _) => new FakeMediaSource(key, started, stopped));
|
||||
|
||||
Assert.True(await manager.AcquireAsync(@"C:\videos\clip.mp4"));
|
||||
Assert.True(await manager.AcquireAsync(@"C:\videos\clip.mp4"));
|
||||
@@ -124,7 +124,7 @@ public class MediaVideoSourceManagerTests
|
||||
{
|
||||
var started = new List<string>();
|
||||
var stopped = new List<string>();
|
||||
var manager = new MediaVideoSourceManager(key => new FakeMediaSource(key, started, stopped));
|
||||
var manager = new MediaVideoSourceManager((key, _) => new FakeMediaSource(key, started, stopped));
|
||||
|
||||
await manager.AcquireAsync(@"C:\videos\clip.mp4");
|
||||
await manager.AcquireAsync(@"C:\videos\clip.mp4");
|
||||
@@ -136,7 +136,7 @@ public class MediaVideoSourceManagerTests
|
||||
[Fact]
|
||||
public async Task Acquire_FailingSource_ReturnsFalseAndRaisesMediaFailed()
|
||||
{
|
||||
var manager = new MediaVideoSourceManager(key => new FailingMediaSource(key));
|
||||
var manager = new MediaVideoSourceManager((key, _) => new FailingMediaSource(key));
|
||||
string? failedKey = null;
|
||||
manager.MediaFailed += (key, _) => failedKey = key;
|
||||
|
||||
@@ -147,7 +147,7 @@ public class MediaVideoSourceManagerTests
|
||||
[Fact]
|
||||
public async Task Acquire_EmptyKey_ReturnsFalse()
|
||||
{
|
||||
var manager = new MediaVideoSourceManager(key => new FakeMediaSource(key));
|
||||
var manager = new MediaVideoSourceManager((key, _) => new FakeMediaSource(key));
|
||||
Assert.False(await manager.AcquireAsync(" "));
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class MediaVideoSourceManagerTests
|
||||
public async Task GetLatestFrame_ReturnsLatestPump_UntilReleased()
|
||||
{
|
||||
FakeMediaSource? captured = null;
|
||||
var manager = new MediaVideoSourceManager(key => captured = new FakeMediaSource(key));
|
||||
var manager = new MediaVideoSourceManager((key, _) => captured = new FakeMediaSource(key));
|
||||
|
||||
Assert.Null(manager.GetLatestFrame(@"C:\videos\clip.mp4"));
|
||||
|
||||
@@ -181,7 +181,7 @@ public class MediaVideoSourceManagerTests
|
||||
{
|
||||
using var pump = new DispatcherPump();
|
||||
FakeMediaSource? captured = null;
|
||||
var manager = new MediaVideoSourceManager(key => captured = new FakeMediaSource(key), pump.Dispatcher);
|
||||
var manager = new MediaVideoSourceManager((key, _) => captured = new FakeMediaSource(key), pump.Dispatcher);
|
||||
|
||||
WriteableBitmap? published = null;
|
||||
var publishedCount = 0;
|
||||
|
||||
Reference in New Issue
Block a user