pull/2298/head
Mikael Finstad 10 months ago
parent fe7682590b
commit 59f117af2f
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26

@ -1223,8 +1223,8 @@ function App() {
const loadEdlFile = useCallback(async ({ path, type, append }: { path: string, type: EdlFileType, append?: boolean }) => {
console.log('Loading EDL file', type, path, append);
loadCutSegments(await readEdlFile({ type, path }), append);
}, [loadCutSegments]);
loadCutSegments(await readEdlFile({ type, path, fps: detectedFps }), append);
}, [detectedFps, loadCutSegments]);
const loadSubtitleTrackToSegments = useCallback(async (streamId: number) => {
invariant(filePath != null);

@ -10,10 +10,11 @@ export interface EDLEvent {
}
export default function parseCmx3600(edlContent: string) {
const lines = edlContent.split('\n');
const [firstLine, ...lines] = edlContent.split('\n');
const events: EDLEvent[] = [];
for (const line of lines) {
// trim BOM from first line.
for (const line of [...(firstLine ? [firstLine.trim()] : []), ...lines]) {
if (/^\d+\s+/.test(line)) {
const parts = line.trim().split(/\s+/);
if (parts.length >= 8) {

@ -184,7 +184,8 @@ export async function parseEdlCmx3600(text: string, fps: number) {
}
export async function parseEdl(text: string, fps: number) {
if (text.startsWith('TITLE: ')) return parseEdlCmx3600(text, fps);
// trim because it might have a BOM
if (text.trim().startsWith('TITLE: ')) return parseEdlCmx3600(text, fps);
return parseMplayerEdl(text);
}

@ -105,11 +105,12 @@ export async function loadLlcProject(path: string) {
};
}
export async function readEdlFile({ type, path, fps }: { type: EdlFileType, path: string, fps?: number | undefined }) {
export async function readEdlFile({ type, path, fps }: { type: EdlFileType, path: string, fps: number | undefined }) {
if (type === 'csv') return loadCsvSeconds(path);
if (type === 'csv-frames') {
if (type === 'csv-frames' || type === 'edl') {
invariant(fps != null, 'The loaded media has an unknown framerate');
return loadCsvFrames(path, fps);
if (type === 'csv-frames') return loadCsvFrames(path, fps);
if (type === 'edl') return loadEdl(path, fps);
}
if (type === 'cutlist') return loadCutlistSeconds(path);
if (type === 'xmeml') return loadXmeml(path);
@ -117,10 +118,6 @@ export async function readEdlFile({ type, path, fps }: { type: EdlFileType, path
if (type === 'dv-analyzer-summary-txt') return loadDvAnalyzerSummaryTxt(path);
if (type === 'cue') return loadCue(path);
if (type === 'pbf') return loadPbf(path);
if (type === 'edl') {
invariant(fps != null, 'The loaded media has an unknown framerate');
return loadEdl(path, fps);
}
if (type === 'srt') return loadSrt(path);
if (type === 'llc') {
const project = await loadLlcProject(path);

Loading…
Cancel
Save