Skip to content

Commit 0872b5a

Browse files
committed
wip: adlib clear layer
1 parent 9f6afb7 commit 0872b5a

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

packages/corelib/src/playout/processAndPrune.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,8 @@ export interface PieceInstanceWithTimings extends ReadonlyDeep<PieceInstance> {
8888
* This is a maximum end point of the pieceInstance.
8989
* If the pieceInstance also has a enable.duration or userDuration set then the shortest one will need to be used
9090
* This can be:
91-
* - 'now', if it was stopped by something that does not need a preroll (or is virtual)
92-
* - '#something.start + 100', if it was stopped by something that needs a preroll
93-
* - '100', if not relative to now at all
91+
* - '100', if relative to the start of the part
92+
* - { offsetFromNow: 100 }, if stopped by an absolute time
9493
*/
9594
resolvedEndCap?: number | RelativeResolvedEndCap
9695
priority: number

packages/job-worker/src/playout/timeline/pieceGroup.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export function createPieceGroupAndCap(
137137
// If the start has been adjusted, the end needs to be updated to compensate
138138
if (typeof pieceInstance.resolvedEndCap === 'number') {
139139
resolvedEndCap = pieceInstance.resolvedEndCap - (pieceStartOffset ?? 0)
140-
} else if (pieceInstance.resolvedEndCap) {
140+
} else if (pieceInstance.resolvedEndCap || controlObj.enable.end === 'now') {
141141
// TODO - there could already be a piece with a cap of 'now' that we could use as our end time
142142
// As the cap is for 'now', rather than try to get tsr to understand `end: 'now'`, we can create a 'now' object to tranlate it
143143
const nowObj = literal<TimelineObjRundown & OnGenerateTimelineObjExt<PieceTimelineMetadata>>({
@@ -157,7 +157,13 @@ export function createPieceGroupAndCap(
157157
priority: 0,
158158
})
159159
capObjs.push(nowObj)
160-
resolvedEndCap = `#${nowObj.id}.start + ${pieceInstance.resolvedEndCap.offsetFromNow}`
160+
161+
resolvedEndCap = `#${nowObj.id}.start + ${pieceInstance.resolvedEndCap?.offsetFromNow ?? 0}`
162+
163+
// If the object has an end of now, we can remove it as it will be replaced by the `resolvedEndCap`
164+
if (controlObj.enable.end === 'now') {
165+
delete controlObj.enable.end
166+
}
161167
}
162168

163169
if (controlObj.enable.duration !== undefined || controlObj.enable.end !== undefined) {

packages/job-worker/src/playout/timeline/rundown.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,16 @@ function calculateInfinitePieceEnable(
385385

386386
// nocommit prerollDuration?
387387

388-
// Ingore userDuration, it gets handled later
388+
// // If an end time has been set by a hotkey, then update the duration to be correct
389+
// if (pieceInstance.userDuration && pieceInstance.piece.enable.start !== 'now') {
390+
// if ('endRelativeToNow' in pieceInstance.userDuration) {
391+
// infiniteGroupEnable.duration =
392+
// pieceInstance.userDuration.endRelativeToNow - pieceInstance.piece.enable.start
393+
// } else {
394+
// // This should never be hit
395+
// infiniteGroupEnable.end = 'now'
396+
// }
397+
// }
389398
}
390399

391400
return {

0 commit comments

Comments
 (0)