From 90858fff7118ea3968a58f65904f239efc1336f6 Mon Sep 17 00:00:00 2001 From: Alex Van Camp Date: Fri, 17 Mar 2023 11:40:43 -0500 Subject: [PATCH] fix: account for how drop-frame content is expressed in the timecode --- src/commands/diskList.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/commands/diskList.ts b/src/commands/diskList.ts index 7ae8aff..8637120 100644 --- a/src/commands/diskList.ts +++ b/src/commands/diskList.ts @@ -45,9 +45,11 @@ export class DiskListCommand extends AbstractCommand { const frameRateMatch = match?.groups?.format.match(framerateRegex) const timecodeMatch = match?.groups?.timecode.match(timecodeRegex) if (match?.groups && frameRateMatch?.groups && timecodeMatch?.groups) { + // according to the manual, timecodes are expressed as non-drop-frame const interlaced = frameRateMatch.groups.scan.toLowerCase() === 'i' - const fieldRate = parseInt(frameRateMatch.groups.frameRate, 10) - const msPerFrame = 1000 / (interlaced ? fieldRate / 2 : fieldRate) + const rawFrameRate = parseInt(frameRateMatch.groups.frameRate, 10) + const frameRate = Math.round(interlaced ? rawFrameRate / 2 : rawFrameRate) + const msPerFrame = 1000 / (interlaced ? frameRate / 2 : frameRate) const hoursMs = parseInt(timecodeMatch.groups.hours, 10) * 60 * 60 * 1000 const minutesMs = parseInt(timecodeMatch.groups.minutes, 10) * 60 * 1000 const secondsMs = parseInt(timecodeMatch.groups.seconds, 10) * 1000