Skip to content

Commit

Permalink
feat: support enabling/disabling iso recording
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Feb 7, 2024
1 parent 038a28c commit d1fdfdb
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/atem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,11 @@ export class Atem extends BasicAtem {
return this.sendCommand(command)
}

public async setEnableISORecording(enabled: boolean): Promise<void> {
const command = new Commands.RecordingISOCommand(enabled)
return this.sendCommand(command)
}

public async saveStartupState(): Promise<void> {
const command = new Commands.StartupStateSaveCommand()
return this.sendCommand(command)
Expand Down
34 changes: 34 additions & 0 deletions src/commands/Recording/RecordingISOCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { SymmetricalCommand } from '../CommandBase'
import { AtemState, InvalidIdError } from '../../state'
import { ProtocolVersion } from '../../enums'

export class RecordingISOCommand extends SymmetricalCommand<{ recordAllInputs: boolean }> {
public static readonly rawName = 'ISOi'
public static readonly minimumVersion = ProtocolVersion.V8_1_1

constructor(recordAllInputs: boolean) {
super({ recordAllInputs })
}

public serialize(): Buffer {
const buffer = Buffer.alloc(4)
buffer.writeUInt8(this.properties.recordAllInputs ? 1 : 0, 0)
return buffer
}

public static deserialize(rawCommand: Buffer): RecordingISOCommand {
const recordAllInputs = rawCommand.readUInt8(0) > 0

return new RecordingISOCommand(recordAllInputs)
}

public applyToState(state: AtemState): string {
if (!state.recording) {
throw new InvalidIdError('Recording')
}

state.recording.recordAllInputs = this.properties.recordAllInputs

return `recording.recordAllInputs`
}
}
1 change: 1 addition & 0 deletions src/commands/Recording/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './RecordingDiskCommand'
export * from './RecordingDurationCommand'
export * from './RecordingISOCommand'
export * from './RecordingSettingsCommand'
export * from './RecordingStatusCommand'
2 changes: 2 additions & 0 deletions src/state/recording.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export interface RecordingState {
status?: RecordingStateStatus
properties: RecordingStateProperties

recordAllInputs?: boolean

duration?: Timecode

disks: { [id: number]: RecordingDiskProperties | undefined }
Expand Down

0 comments on commit d1fdfdb

Please sign in to comment.