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:
commit
27e77fff39
718 files changed
+183958
No files matched your search
@@ -0,0 +1,7 @@
|
||||
import 'package:cutdex/workspace/persistence/timeline_creation_names.dart';
|
||||
|
||||
const testCreationNames = TimelineCreationNames(
|
||||
timeline: 'Timeline 1',
|
||||
sequence: 'Main sequence',
|
||||
storyline: 'Main storyline',
|
||||
);
|
||||
@@ -0,0 +1,16 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cutdex/integrations/agent/conversation_repository.dart';
|
||||
|
||||
class EmptyConversationRepository extends ConversationRepository {
|
||||
EmptyConversationRepository() : super(Directory('/unused'));
|
||||
|
||||
@override
|
||||
Future<List<ConversationMetadata>> list(
|
||||
String projectId, {
|
||||
bool trash = false,
|
||||
}) async => [];
|
||||
|
||||
@override
|
||||
Future<String?> selected(String projectId) async => null;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import 'package:cutdex/persistence/app_settings_repositories.dart';
|
||||
import 'package:cutdex/workspace/project_state.dart';
|
||||
import 'package:cutdex/workspace/persistence/recent_projects.dart';
|
||||
|
||||
class MemoryProjectLocationSettingsRepository
|
||||
implements ProjectLocationSettingsRepository {
|
||||
MemoryProjectLocationSettingsRepository([this.value]);
|
||||
|
||||
String? value;
|
||||
|
||||
@override
|
||||
Future<String?> load() async => value;
|
||||
|
||||
@override
|
||||
Future<void> save(String directory) async => value = directory;
|
||||
}
|
||||
|
||||
class MemoryResourceLocationSettingsRepository
|
||||
implements ResourceLocationSettingsRepository {
|
||||
MemoryResourceLocationSettingsRepository(this.value);
|
||||
|
||||
String? value;
|
||||
|
||||
@override
|
||||
Future<String?> load() async => value;
|
||||
|
||||
@override
|
||||
Future<void> save(String directory) async => value = directory;
|
||||
}
|
||||
|
||||
class MemoryMcpSettingsRepository implements McpSettingsRepository {
|
||||
McpSettingsValue? value;
|
||||
bool failWrites = false;
|
||||
|
||||
@override
|
||||
Future<McpSettingsValue?> load() async => value;
|
||||
|
||||
@override
|
||||
Future<void> save(McpSettingsValue configuration) async {
|
||||
if (failWrites) throw StateError('write failed');
|
||||
value = configuration;
|
||||
}
|
||||
}
|
||||
|
||||
class MemoryAppearanceSettingsRepository
|
||||
implements AppearanceSettingsRepository {
|
||||
AppAppearance value = AppAppearance.system;
|
||||
bool failWrites = false;
|
||||
|
||||
@override
|
||||
Future<AppAppearance> load() async => value;
|
||||
|
||||
@override
|
||||
Future<void> save(AppAppearance mode) async {
|
||||
if (failWrites) throw StateError('write failed');
|
||||
value = mode;
|
||||
}
|
||||
}
|
||||
|
||||
class MemoryRecentProjectsRepository implements RecentProjectsRepository {
|
||||
List<RecentProject> recent = [];
|
||||
final projects = <String, String>{};
|
||||
|
||||
@override
|
||||
Future<List<RecentProject>> load() async => List.of(recent);
|
||||
|
||||
@override
|
||||
Future<void> save(List<RecentProject> projects) async {
|
||||
recent = List.of(projects);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<String?> lastTimeline(String projectId) async => projects[projectId];
|
||||
|
||||
@override
|
||||
Future<void> rememberTimeline(String projectId, String timelineId) async {
|
||||
projects[projectId] = timelineId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
import 'creation_names.dart';
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cutdex/workspace/persistence/project_workspace.dart';
|
||||
import 'package:cutdex/workspace/timeline_session.dart';
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
|
||||
Future<
|
||||
({
|
||||
Directory directory,
|
||||
ProjectWorkspace workspace,
|
||||
EditorTimelineSession timeline,
|
||||
})
|
||||
>
|
||||
createPreviewFixture(
|
||||
Uri source, {
|
||||
Map<String, Object?>? toneMapping,
|
||||
bool hasAudio = false,
|
||||
String mediaType = 'video',
|
||||
RationalTime? clipDuration,
|
||||
TimelineDto? timelineOverride,
|
||||
Map<String, Object>? renderSize,
|
||||
List<PayloadDocument>? payloads,
|
||||
}) async {
|
||||
final duration = clipDuration ?? RationalTime.seconds(2);
|
||||
final directory = await Directory.systemTemp.createTemp(
|
||||
'cutdex-preview-test-',
|
||||
);
|
||||
final workspace = ProjectWorkspace(creationNames: testCreationNames);
|
||||
try {
|
||||
await workspace.open(
|
||||
'${directory.path}/Preview.cutdex',
|
||||
name: 'Preview test',
|
||||
);
|
||||
await workspace.project!.saveAsset(
|
||||
AssetDocument(
|
||||
id: 'media',
|
||||
name: 'Test media',
|
||||
storage: AssetStorage.external,
|
||||
location: source.toString(),
|
||||
),
|
||||
);
|
||||
TimelineDto sequence(String id, {bool empty = false}) => TimelineDto(
|
||||
id: SequenceId(id),
|
||||
name: id,
|
||||
format: TimelineFormat.fps30,
|
||||
primaryStorylineId: StorylineId('primary'),
|
||||
storylines: [
|
||||
StorylineDto(
|
||||
id: StorylineId('primary'),
|
||||
elementIds: [if (!empty) ElementId('clip')],
|
||||
),
|
||||
],
|
||||
elements: [
|
||||
if (!empty)
|
||||
ElementDto(
|
||||
id: ElementId('clip'),
|
||||
name: 'Preview clip',
|
||||
structure: ElementStructure.content,
|
||||
payloadRef: PayloadRef('source'),
|
||||
duration: duration,
|
||||
sourceRange: TimeRange(
|
||||
start: RationalTime.zero,
|
||||
duration: duration,
|
||||
),
|
||||
mediaRange: TimeRange(start: RationalTime.zero, duration: duration),
|
||||
),
|
||||
],
|
||||
);
|
||||
await workspace.project!.saveTimeline(
|
||||
TimelineDocument(
|
||||
id: 'project',
|
||||
name: 'Preview test',
|
||||
sequences: [
|
||||
timelineOverride ?? sequence('one'),
|
||||
sequence('empty', empty: true),
|
||||
],
|
||||
defaultSequenceId: SequenceId('one'),
|
||||
payloads:
|
||||
payloads ??
|
||||
[
|
||||
PayloadDocument(
|
||||
id: 'source',
|
||||
type: mediaType,
|
||||
assetIds: ['media'],
|
||||
data: {
|
||||
'videoTrackIndex': 0,
|
||||
if (hasAudio) 'audioTrackIndex': 0,
|
||||
},
|
||||
),
|
||||
],
|
||||
settings: {
|
||||
'renderSize': renderSize ?? {'width': 1080, 'height': 1920},
|
||||
'toneMapping': ?toneMapping,
|
||||
},
|
||||
),
|
||||
);
|
||||
final document = await workspace.loadTimeline(
|
||||
workspace.project!.info.id,
|
||||
'project',
|
||||
);
|
||||
final timeline = await workspace.openTimelineSession(
|
||||
workspace.project!.info.id,
|
||||
document,
|
||||
);
|
||||
return (directory: directory, workspace: workspace, timeline: timeline);
|
||||
} catch (_) {
|
||||
await workspace.close();
|
||||
await directory.delete(recursive: true);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cutdex/integrations/runtime/processing_configuration.dart';
|
||||
|
||||
/// File-presence fixture only: no worker is run and no model is downloaded.
|
||||
Future<ProcessingConfiguration> processingFixture(
|
||||
Directory root,
|
||||
int capabilities, {
|
||||
bool stale = false,
|
||||
}) async {
|
||||
final suffix = Platform.isWindows ? '.exe' : '';
|
||||
final paths = [
|
||||
'runtime/bin/cutdex-processing-worker$suffix',
|
||||
if (capabilities & 13 != 0) 'runtime/bin/ffmpeg$suffix',
|
||||
if (capabilities & 1 != 0) ...[
|
||||
'runtime/workers/asr/cutdex-asr-worker$suffix',
|
||||
'asr/ggml-model.bin',
|
||||
'asr/silero_vad.onnx',
|
||||
],
|
||||
if (capabilities & 2 != 0) ...[
|
||||
'runtime/workers/translation/cutdex-m2m100-worker$suffix',
|
||||
'translation/model.bin',
|
||||
'translation/config.json',
|
||||
'translation/shared_vocabulary.json',
|
||||
'translation/sentencepiece.bpe.model',
|
||||
],
|
||||
if (capabilities & 4 != 0) ...[
|
||||
'runtime/workers/audio/cutdex-audio-worker$suffix',
|
||||
'audio/melband.pt',
|
||||
],
|
||||
if (capabilities & 8 != 0) 'background/model.onnx',
|
||||
];
|
||||
for (final path in paths) {
|
||||
final file = File('${root.path}/$path');
|
||||
await file.parent.create(recursive: true);
|
||||
await file.writeAsString('fixture');
|
||||
}
|
||||
final base = stale ? '${root.path}/missing' : root.path;
|
||||
return ProcessingConfiguration.fromPaths(
|
||||
root: '${root.path}/runtime',
|
||||
transcriptionPath: '$base/asr',
|
||||
translationPath: '$base/translation',
|
||||
vocalPath: '$base/audio/melband.pt',
|
||||
backgroundRemovalPath: '$base/background/model.onnx',
|
||||
)!;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:sqlite3/sqlite3.dart';
|
||||
|
||||
/// Holds a competing writer without depending on the SDK's table layout.
|
||||
void Function() blockProjectWrites(String projectPath) {
|
||||
final database = sqlite3.open(p.join(projectPath, 'project.sqlite'));
|
||||
try {
|
||||
database.execute('BEGIN IMMEDIATE');
|
||||
} catch (_) {
|
||||
database.close();
|
||||
rethrow;
|
||||
}
|
||||
var released = false;
|
||||
return () {
|
||||
if (released) return;
|
||||
released = true;
|
||||
try {
|
||||
database.execute('ROLLBACK');
|
||||
} finally {
|
||||
database.close();
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user