-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Parse transport info and async transport changes
- Loading branch information
Showing
11 changed files
with
259 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { SynchronousCode } from '../codes' | ||
import { TransportStatus, SlotId, VideoFormat } from '../enums' | ||
import { ResponseMessage, NamedMessage } from '../message' | ||
import { AbstractCommandBase } from './abstractCommand' | ||
import { parseIdOrNone, parseIntIfDefined, parseBool } from './util' | ||
|
||
export interface TransportInfoCommandResponse { | ||
Status: TransportStatus | ||
Speed: number | ||
SlotId: SlotId | null | ||
ClipId: number | null | ||
SingleClip: boolean | ||
DisplayTimecode: string | ||
Timecode: string | ||
VideoFormat: VideoFormat | ||
Loop: boolean | ||
} | ||
|
||
export class TransportInfoCommand extends AbstractCommandBase<TransportInfoCommandResponse> { | ||
expectedResponseCode = SynchronousCode.TransportInfo | ||
|
||
deserialize (msg: ResponseMessage) { | ||
const res: TransportInfoCommandResponse = { | ||
Status: msg.Params['status'] as TransportStatus, | ||
Speed: parseInt(msg.Params['speed']), | ||
SlotId: parseIdOrNone(msg.Params['slot id']) || null, | ||
ClipId: parseIdOrNone(msg.Params['clip id']) || null, | ||
SingleClip: parseBool(msg.Params['single clip']) || false, | ||
DisplayTimecode: msg.Params['display timecode'], | ||
Timecode: msg.Params['timecode'], | ||
VideoFormat: msg.Params['video format'] as VideoFormat, | ||
Loop: parseBool(msg.Params['loop']) || false, | ||
} | ||
return res | ||
} | ||
serialize () { | ||
const res: NamedMessage = { | ||
Name: 'transport info', | ||
Params: {} | ||
} | ||
|
||
return res | ||
} | ||
} | ||
|
||
export interface TransportInfoChangeResponse { | ||
Status: TransportStatus | undefined | ||
Speed: number | undefined | ||
SlotId: SlotId | null | undefined | ||
ClipId: number | null | undefined | ||
SingleClip: boolean | undefined | ||
DisplayTimecode: string | undefined | ||
Timecode: string | undefined | ||
VideoFormat: VideoFormat | undefined | ||
Loop: boolean | undefined | ||
} | ||
|
||
export class TransportInfoChange { | ||
|
||
deserialize (msg: ResponseMessage) { | ||
const res: TransportInfoChangeResponse = { | ||
Status: msg.Params['status'] as TransportStatus, | ||
Speed: parseIntIfDefined(msg.Params['speed']), | ||
SlotId: parseIdOrNone(msg.Params['slot id']), | ||
ClipId: parseIdOrNone(msg.Params['clip id']), | ||
SingleClip: parseBool(msg.Params['single clip']), | ||
DisplayTimecode: msg.Params['display timecode'], | ||
Timecode: msg.Params['timecode'], | ||
VideoFormat: msg.Params['video format'] as VideoFormat, | ||
Loop: parseBool(msg.Params['loop']), | ||
} | ||
return res | ||
} | ||
} |
Oops, something went wrong.