add timecode field to encoding

This commit is contained in:
2024-12-26 12:30:57 -06:00
parent 245e092e3d
commit cf5c5f5429
2 changed files with 39 additions and 0 deletions
+9
View File
@@ -174,6 +174,15 @@ export function encode(packet: DDPPacket): Uint8Array {
view.setUint32(4, packet.header.dataOffset);
view.setUint16(8, packet.header.dataLength);
if(packet.header.flags.timecode){
if(packet.header.timecode !== undefined){
view.setUint16(10, packet.header.timecode?.seconds)
view.setUint16(12, packet.header.timecode?.fractionalSeconds)
}else{
throw new Error("DDP packet had timecode flag set but no timecode value supplied")
}
}
// const bytes = new Uint8Array([flagByte, sequenceNumberByte, dataTypeByte, packet.header.sourceOrDestinationID])
const headerBytes = new Uint8Array(view.buffer, view.byteOffset, view.byteLength);