Skip to content

Commit 78f9969

Browse files
authored
Merge pull request #8 from JumpCutter/dk949/fcpxml-fix
Fixed FCPXML generation
2 parents 1d9c5d8 + 8a19996 commit 78f9969

5 files changed

Lines changed: 2010 additions & 29 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"@typescript-eslint/parser": "^5.2.0",
3939
"eslint": "^8.1.0",
4040
"mocha": "^9.1.2",
41+
"node-libxml": "^4.1.2",
4142
"ts-node": "^10.2.1",
4243
"typescript": "^4.3.4"
4344
}

src/FCPXML/helpersFCPXML.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class fcpxmlBuilder extends baseXMLBUilder {
2222
}
2323
public projectBuildContext(name: string, duration: number, l: () => void): fcpxmlBuilder {
2424
this.putTag("project", {name, uid: ""}, () => {
25-
this.putTag("sequence", {duration: this.putSeconds(duration)}, () => {
25+
this.putTag("sequence", {duration: this.putSeconds(duration), format: this.getLastFormat()}, () => {
2626
this.putTag("spine", {}, () => {
2727
l();
2828
});
@@ -34,14 +34,15 @@ export class fcpxmlBuilder extends baseXMLBUilder {
3434
public putAsset(name: string, duration: number): fcpxmlBuilder {
3535
this.putTag("asset", {
3636
name,
37-
src: name,
38-
format: this.IDs.format[this.IDs.format.length - 1].toString(),
37+
format: this.getLastFormat(),
3938
id: this.genID("asset"),
4039
duration: this.putSeconds(duration),
4140
start: this.putSeconds(0),
4241
hasAudio: this.putBool(this.conf.hasAudio),
4342
hasVideo: this.putBool(this.conf.hasVideo),
44-
});
43+
}, () => this.putTag("media-rep", {
44+
src: name,
45+
}));
4546
return this;
4647
}
4748

@@ -65,9 +66,10 @@ export class fcpxmlBuilder extends baseXMLBUilder {
6566
this.IDs[type].push(id);
6667
return id;
6768
}
69+
private getLastFormat(): string {return this.IDs.format[this.IDs.format.length - 1].toString();}
6870

6971
private readonly conf = {
70-
"version": "1.9",
72+
"version": "1.10",
7173
"hasAudio": true,
7274
"hasVideo": true
7375
} as const;

0 commit comments

Comments
 (0)