2021-10-21 18:40:49 +02:00
|
|
|
import {
|
|
|
|
getStream,
|
|
|
|
indexOf,
|
|
|
|
renderAllProps,
|
|
|
|
getStreamIndex,
|
|
|
|
formatDuration,
|
|
|
|
} from "./util.mjs";
|
|
|
|
import { makeIDGen } from "./util.mjs";
|
|
|
|
|
|
|
|
const makeId = makeIDGen(1);
|
|
|
|
const producerIndexGen = makeIDGen(0);
|
|
|
|
|
|
|
|
export default class Producer {
|
2021-10-23 20:37:41 +02:00
|
|
|
constructor(path) {
|
|
|
|
this.path = path;
|
2021-10-21 18:40:49 +02:00
|
|
|
this.index = producerIndexGen.next().value;
|
|
|
|
}
|
|
|
|
|
2021-10-23 20:37:41 +02:00
|
|
|
async toXML(fps) {
|
|
|
|
const xml = (
|
|
|
|
await $`melt ${
|
|
|
|
this.path
|
|
|
|
} -consumer xml ${`frame_rate_num=${fps}`} | htmlq producer`
|
|
|
|
).stdout;
|
2021-10-21 18:40:49 +02:00
|
|
|
|
2021-10-23 20:37:41 +02:00
|
|
|
return xml.replace("producer0", `producer${this.index}`);
|
2021-10-21 18:40:49 +02:00
|
|
|
}
|
|
|
|
}
|