Apply Jeremy White's SMPTE calculation fix to each audio driver.

This commit is contained in:
Francois Gouget 2005-03-02 13:39:23 +00:00 committed by Alexandre Julliard
parent d0ee9f9309
commit 7105248ae6
5 changed files with 14 additions and 34 deletions

View File

@ -284,7 +284,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;
@ -293,12 +295,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);

View File

@ -238,7 +238,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->wBitsPerSample / 8 * format->wf.nChannels);
position += (format->wf.nSamplesPerSec / lpTime->u.smpte.fps) - 1; /* round up */
lpTime->u.smpte.sec = position / format->wf.nSamplesPerSec;
position -= lpTime->u.smpte.sec * format->wf.nSamplesPerSec;
lpTime->u.smpte.min = lpTime->u.smpte.sec / 60;
@ -247,12 +249,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->wf.nSamplesPerSec;
position -= lpTime->u.smpte.frame * format->wf.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);

View File

@ -197,21 +197,17 @@ static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position,
TRACE("TIME_MS=%lu\n", lpTime->u.ms);
break;
case TIME_SMPTE:
position = position / (format->wBitsPerSample / 8 * format->wf.nChannels);
lpTime->u.smpte.sec = position / format->wf.nSamplesPerSec;
position -= lpTime->u.smpte.sec * format->wf.nSamplesPerSec;
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;
lpTime->u.smpte.sec -= 60 * lpTime->u.smpte.min;
lpTime->u.smpte.hour = lpTime->u.smpte.min / 60;
lpTime->u.smpte.min -= 60 * lpTime->u.smpte.hour;
lpTime->u.smpte.fps = 30;
lpTime->u.smpte.frame = position * lpTime->u.smpte.fps / format->wf.nSamplesPerSec;
position -= lpTime->u.smpte.frame * format->wf.nSamplesPerSec / lpTime->u.smpte.fps;
if (position != 0)
{
/* Round up */
lpTime->u.smpte.frame++;
}
lpTime->u.smpte.frame = position * lpTime->u.smpte.fps / format->Format.nSamplesPerSec;
TRACE("TIME_SMPTE=%02u:%02u:%02u:%02u\n",
lpTime->u.smpte.hour, lpTime->u.smpte.min,
lpTime->u.smpte.sec, lpTime->u.smpte.frame);

View File

@ -233,7 +233,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->wBitsPerSample / 8 * format->wf.nChannels);
position += (format->wf.nSamplesPerSec / lpTime->u.smpte.fps) - 1; /* round up */
lpTime->u.smpte.sec = position / format->wf.nSamplesPerSec;
position -= lpTime->u.smpte.sec * format->wf.nSamplesPerSec;
lpTime->u.smpte.min = lpTime->u.smpte.sec / 60;
@ -242,12 +244,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->wf.nSamplesPerSec;
position -= lpTime->u.smpte.frame * format->wf.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);

View File

@ -295,7 +295,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->wBitsPerSample / 8 * format->wf.nChannels);
position += (format->wf.nSamplesPerSec / lpTime->u.smpte.fps) - 1; /* round up */
lpTime->u.smpte.sec = position / format->wf.nSamplesPerSec;
position -= lpTime->u.smpte.sec * format->wf.nSamplesPerSec;
lpTime->u.smpte.min = lpTime->u.smpte.sec / 60;
@ -304,12 +306,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->wf.nSamplesPerSec;
position -= lpTime->u.smpte.frame * format->wf.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);