Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOF-1694 Dve Piece now includes metadata needed for inserting Sources to inputs by Actions #222

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 52 additions & 10 deletions src/tv2-common/content/dve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ export interface DVEPieceMetaData extends PieceMetaData {
userData: ActionSelectDVE
mediaPlayerSessions?: string[] // TODO: Should probably move to a ServerPieceMetaData
serverPlaybackTiming?: Array<{ start?: number; end?: number }>
dve?: DvePieceActionMetadata
}

// This is used by the "new" Blueprint in order to put sources into a planned DVE.
export interface DvePieceActionMetadata {
boxes: BoxConfig[]
audioTimelineObjectsForBoxes: { [inputIndex: number]: TSR.TSRTimelineObj[] }
}

export interface DVEOptions {
Expand All @@ -125,7 +132,7 @@ export function MakeContentDVEBase<
parsedCue: CueDefinitionDVE,
dveConfig: DVEConfigInput | undefined,
dveGeneratorOptions: DVEOptions
): { content: WithTimeline<SplitsContent>; valid: boolean } {
): { content: WithTimeline<SplitsContent>; valid: boolean; dvePieceActionMetadata?: DvePieceActionMetadata } {
if (!dveConfig) {
context.core.notifyUserWarning(`DVE ${parsedCue.template} is not configured`)
return {
Expand Down Expand Up @@ -162,7 +169,7 @@ export function MakeContentDVE2<
sources: DVESources | undefined,
dveGeneratorOptions: DVEOptions,
mediaPlayerSessionId?: string
): { content: WithTimeline<SplitsContent>; valid: boolean } {
): { content: WithTimeline<SplitsContent>; valid: boolean; dvePieceActionMetadata?: DvePieceActionMetadata } {
let template: DVEConfig
try {
template = JSON.parse(dveConfig.DVEJSON) as DVEConfig
Expand Down Expand Up @@ -194,13 +201,15 @@ export function MakeContentDVE2<
let valid = true
let hasServer = false

boxAssigments.forEach((mappingFrom, num) => {
const box = boxes[num]
const audioTimelineObjectsForBoxes: { [inputIndex: number]: TSR.TSRTimelineObj[] } = {}

boxAssigments.forEach((mappingFrom, index) => {
const box: BoxConfig = boxes[index]
if (mappingFrom === undefined) {
if (sources) {
// If it is intentional there are no sources, then ignore
// TODO - should this warn?
context.core.notifyUserWarning(`Missing source type for DVE box: ${num + 1}`)
context.core.notifyUserWarning(`Missing source type for DVE box: ${index + 1}`)
setBoxToBlack(box, boxSources)
valid = false
}
Expand All @@ -226,9 +235,12 @@ export function MakeContentDVE2<

setBoxSource(box, boxSources, sourceInfoCam)
cameraSources.push(box.source)
dveTimeline.push(
...GetSisyfosTimelineObjForCamera(context.config, sourceInfoCam, mappingFrom.minusMic, audioEnable)

const audioTimelineObjectsForCamera: TSR.TSRTimelineObj[] = addRandomIdIfMissing(
GetSisyfosTimelineObjForCamera(context.config, sourceInfoCam, mappingFrom.minusMic, audioEnable)
)
audioTimelineObjectsForBoxes[index] = audioTimelineObjectsForCamera
dveTimeline.push(...audioTimelineObjectsForCamera)
break
case SourceType.REMOTE:
const sourceInfoLive = findSourceInfo(context.config.sources, mappingFrom)
Expand All @@ -240,7 +252,12 @@ export function MakeContentDVE2<
}

setBoxSource(box, boxSources, sourceInfoLive)
dveTimeline.push(...GetSisyfosTimelineObjForRemote(context.config, sourceInfoLive, audioEnable))

const audioTimelineObjectsForRemote: TSR.TSRTimelineObj[] = addRandomIdIfMissing(
GetSisyfosTimelineObjForRemote(context.config, sourceInfoLive, audioEnable)
)
audioTimelineObjectsForBoxes[index] = audioTimelineObjectsForRemote
dveTimeline.push(...audioTimelineObjectsForRemote)
break
case SourceType.REPLAY:
const sourceInfoReplay = findSourceInfo(context.config.sources, mappingFrom)
Expand All @@ -252,15 +269,25 @@ export function MakeContentDVE2<
}

setBoxSource(box, boxSources, sourceInfoReplay)
dveTimeline.push(...GetSisyfosTimelineObjForReplay(context.config, sourceInfoReplay, mappingFrom.vo))

const audioTimelineObjectsForReplay: TSR.TSRTimelineObj[] = addRandomIdIfMissing(
GetSisyfosTimelineObjForReplay(context.config, sourceInfoReplay, mappingFrom.vo)
)
audioTimelineObjectsForBoxes[index] = audioTimelineObjectsForReplay
dveTimeline.push(...audioTimelineObjectsForReplay)
break
case SourceType.GRAFIK:
if (mappingFrom.name === 'FULL') {
setBoxSource(box, boxSources, {
sourceLayerType: SourceLayerType.GRAPHICS,
port: findDskFullGfx(context.config).Fill
})
dveTimeline.push(...GetSisyfosTimelineObjForFull(context.config))

const audioTimelineObjectsForFull: TSR.TSRTimelineObj[] = addRandomIdIfMissing(
GetSisyfosTimelineObjForFull(context.config)
)
audioTimelineObjectsForBoxes[index] = audioTimelineObjectsForFull
dveTimeline.push(...audioTimelineObjectsForFull)
} else {
context.core.notifyUserWarning(`Unsupported engine for DVE: ${mappingFrom.name}`)
setBoxToBlack(box, boxSources)
Expand All @@ -277,6 +304,11 @@ export function MakeContentDVE2<
}
})

const dvePieceActionMetadata: DvePieceActionMetadata = {
boxes,
audioTimelineObjectsForBoxes
}

const graphicsTemplate = getDveGraphicsTemplate(dveConfig, context.core.notifyUserWarning)
const graphicsTemplateStyle = getDveGraphicsTemplateStyle(graphicsTemplate)
const locatorType = getDveLocatorType(graphicsTemplate)
Expand All @@ -297,6 +329,7 @@ export function MakeContentDVE2<
}

return {
dvePieceActionMetadata,
valid,
content: literal<WithTimeline<SplitsContent>>({
boxSourceConfiguration: boxSources,
Expand Down Expand Up @@ -375,6 +408,15 @@ export function MakeContentDVE2<
}
}

function addRandomIdIfMissing(timelineObjects: TSR.TSRTimelineObj[]): TSR.TSRTimelineObj[] {
return timelineObjects.map((timelineObject) => {
if (timelineObject.id === '') {
timelineObject.id = `${Math.floor(Math.random() * Date.now())}`
}
return timelineObject
})
}

function getDveGraphicsTemplate(dveConfigInput: DVEConfigInput, notifyUserWarning: (message: string) => void): object {
try {
const dveGraphicsTemplate = JSON.parse(dveConfigInput.DVEGraphicsTemplateJSON)
Expand Down
3 changes: 2 additions & 1 deletion src/tv2_afvd_showstyle/helpers/content/dve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
CueDefinitionDVE,
DVEConfigInput,
DVEOptions,
DvePieceActionMetadata,
MakeContentDVEBase,
PartDefinition,
ShowStyleContext
Expand Down Expand Up @@ -33,6 +34,6 @@ export function MakeContentDVE(
partDefinition: PartDefinition,
parsedCue: CueDefinitionDVE,
dveConfig: DVEConfigInput | undefined
): { content: WithTimeline<SplitsContent>; valid: boolean } {
): { content: WithTimeline<SplitsContent>; valid: boolean; dvePieceActionMetadata?: DvePieceActionMetadata } {
return MakeContentDVEBase(context, partDefinition, parsedCue, dveConfig, AFVD_DVE_GENERATOR_OPTIONS)
}
1 change: 1 addition & 0 deletions src/tv2_afvd_showstyle/helpers/pieces/dve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export function EvaluateDVE(
content: content.content,
prerollDuration: Number(context.config.studio.CasparPrerollDuration) || 0,
metaData: {
dve: content.dvePieceActionMetadata,
type: Tv2PieceType.SPLIT_SCREEN,
outputLayer: Tv2OutputLayer.PROGRAM,
mediaPlayerSessions: [partDefinition.segmentExternalId],
Expand Down
Loading