feat: initial Cutdex application

Add the Flutter video editing application with project management, media
import, timeline editing, preview, AI assistance, diagnostics and settings.

Include shared UI and native host packages, platform runners, application
tests and release tooling.

Provide usage and contribution guides, the MIT license and third-party
notices. Exclude local credentials, build outputs and validation data.
This commit is contained in:
lingjhf committed 2026-10-05 23:36:23 +08:00
commit 27e77fff39
718 files changed
+183958

No files matched your search

@@ -0,0 +1,67 @@
import 'package:cutdex_sdk/project.dart';
import 'package:cutdex_sdk/runtime.dart';
import 'package:cutdex_sdk/timeline_ui.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import '../../workspace/media_binding.dart';
import '../../workspace/projects.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'
show ProviderListenableSelect;
part 'media_waveforms.g.dart';
@Riverpod(keepAlive: true)
MediaWaveforms mediaWaveforms(Ref ref) {
final projectId = ref.watch(
projectsProvider.select((s) => s.asData?.value.activeProject?.id),
);
return MediaWaveforms(
loadMedia: <T>(asset, action) => ref
.read(projectsProvider.notifier)
.withAssetMedia(projectId, asset, action),
);
}
/// Browser envelopes use the same native request/cache as timeline waveforms.
class MediaWaveforms {
MediaWaveforms({required this.loadMedia});
final AssetMediaLoader loadMedia;
final _runtime = CutdexRuntime();
final _cache = <(String, int?), Future<TimelineWaveform?>>{};
Future<void> _tail = Future.value();
Future<TimelineWaveform?> load(AssetDocument asset) {
final key = (asset.location, asset.byteLength);
final cached = _cache.remove(key);
if (cached != null) {
_cache[key] = cached;
return cached;
}
if (_cache.length >= 16) _cache.remove(_cache.keys.first);
final future = _tail.then((_) async {
try {
final waveform = await loadMedia(
asset,
(media) => _runtime.waveform(WaveformRequest(media: media)),
);
return TimelineWaveform(
sampleRate: waveform.sampleRate,
sourceStartSeconds: waveform.sourceStartSeconds,
frameCount: waveform.frameCount,
levels: List.unmodifiable([
for (final level in waveform.levels)
TimelineWaveformLevel(
samplesPerBucket: level.samplesPerBucket,
channels: level.channels,
),
]),
);
} catch (_) {
return null;
}
});
_cache[key] = future;
_tail = future.then((_) {});
return future;
}
}