In calculating the SMPTE time, we would round incorrectly (0:0:4.30
instead of 0:0:5.0 [the last column only goes to 29]).
This commit is contained in:
parent
f8a4f6b59b
commit
aa2046f643
|
@ -216,7 +216,9 @@ static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position,
|
|||
TRACE("TIME_MS=%lu\n", lpTime->u.ms);
|
||||
break;
|
||||
case TIME_SMPTE:
|
||||
lpTime->u.smpte.fps = 30;
|
||||
position = position / (format->Format.wBitsPerSample / 8 * format->Format.nChannels);
|
||||
position += (format->Format.nSamplesPerSec / lpTime->u.smpte.fps) - 1; /* round up */
|
||||
lpTime->u.smpte.sec = position / format->Format.nSamplesPerSec;
|
||||
position -= lpTime->u.smpte.sec * format->Format.nSamplesPerSec;
|
||||
lpTime->u.smpte.min = lpTime->u.smpte.sec / 60;
|
||||
|
@ -225,12 +227,6 @@ static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position,
|
|||
lpTime->u.smpte.min -= 60 * lpTime->u.smpte.hour;
|
||||
lpTime->u.smpte.fps = 30;
|
||||
lpTime->u.smpte.frame = position * lpTime->u.smpte.fps / format->Format.nSamplesPerSec;
|
||||
position -= lpTime->u.smpte.frame * format->Format.nSamplesPerSec / lpTime->u.smpte.fps;
|
||||
if (position != 0)
|
||||
{
|
||||
/* Round up */
|
||||
lpTime->u.smpte.frame++;
|
||||
}
|
||||
TRACE("TIME_SMPTE=%02u:%02u:%02u:%02u\n",
|
||||
lpTime->u.smpte.hour, lpTime->u.smpte.min,
|
||||
lpTime->u.smpte.sec, lpTime->u.smpte.frame);
|
||||
|
|
Loading…
Reference in New Issue