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,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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user