Commit 7105248a authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

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

parent d0ee9f93
...@@ -284,7 +284,9 @@ static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position, ...@@ -284,7 +284,9 @@ static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position,
TRACE("TIME_MS=%lu\n", lpTime->u.ms); TRACE("TIME_MS=%lu\n", lpTime->u.ms);
break; break;
case TIME_SMPTE: case TIME_SMPTE:
lpTime->u.smpte.fps = 30;
position = position / (format->Format.wBitsPerSample / 8 * format->Format.nChannels); 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; lpTime->u.smpte.sec = position / format->Format.nSamplesPerSec;
position -= lpTime->u.smpte.sec * format->Format.nSamplesPerSec; position -= lpTime->u.smpte.sec * format->Format.nSamplesPerSec;
lpTime->u.smpte.min = lpTime->u.smpte.sec / 60; lpTime->u.smpte.min = lpTime->u.smpte.sec / 60;
...@@ -293,12 +295,6 @@ static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position, ...@@ -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.min -= 60 * lpTime->u.smpte.hour;
lpTime->u.smpte.fps = 30; lpTime->u.smpte.fps = 30;
lpTime->u.smpte.frame = position * lpTime->u.smpte.fps / format->Format.nSamplesPerSec; 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", TRACE("TIME_SMPTE=%02u:%02u:%02u:%02u\n",
lpTime->u.smpte.hour, lpTime->u.smpte.min, lpTime->u.smpte.hour, lpTime->u.smpte.min,
lpTime->u.smpte.sec, lpTime->u.smpte.frame); lpTime->u.smpte.sec, lpTime->u.smpte.frame);
......
...@@ -238,7 +238,9 @@ static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position, ...@@ -238,7 +238,9 @@ static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position,
TRACE("TIME_MS=%lu\n", lpTime->u.ms); TRACE("TIME_MS=%lu\n", lpTime->u.ms);
break; break;
case TIME_SMPTE: case TIME_SMPTE:
lpTime->u.smpte.fps = 30;
position = position / (format->wBitsPerSample / 8 * format->wf.nChannels); 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; lpTime->u.smpte.sec = position / format->wf.nSamplesPerSec;
position -= lpTime->u.smpte.sec * format->wf.nSamplesPerSec; position -= lpTime->u.smpte.sec * format->wf.nSamplesPerSec;
lpTime->u.smpte.min = lpTime->u.smpte.sec / 60; lpTime->u.smpte.min = lpTime->u.smpte.sec / 60;
...@@ -247,12 +249,6 @@ static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position, ...@@ -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.min -= 60 * lpTime->u.smpte.hour;
lpTime->u.smpte.fps = 30; lpTime->u.smpte.fps = 30;
lpTime->u.smpte.frame = position * lpTime->u.smpte.fps / format->wf.nSamplesPerSec; 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", TRACE("TIME_SMPTE=%02u:%02u:%02u:%02u\n",
lpTime->u.smpte.hour, lpTime->u.smpte.min, lpTime->u.smpte.hour, lpTime->u.smpte.min,
lpTime->u.smpte.sec, lpTime->u.smpte.frame); lpTime->u.smpte.sec, lpTime->u.smpte.frame);
......
...@@ -197,21 +197,17 @@ static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position, ...@@ -197,21 +197,17 @@ static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position,
TRACE("TIME_MS=%lu\n", lpTime->u.ms); TRACE("TIME_MS=%lu\n", lpTime->u.ms);
break; break;
case TIME_SMPTE: case TIME_SMPTE:
position = position / (format->wBitsPerSample / 8 * format->wf.nChannels); lpTime->u.smpte.fps = 30;
lpTime->u.smpte.sec = position / format->wf.nSamplesPerSec; position = position / (format->Format.wBitsPerSample / 8 * format->Format.nChannels);
position -= lpTime->u.smpte.sec * format->wf.nSamplesPerSec; 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.min = lpTime->u.smpte.sec / 60;
lpTime->u.smpte.sec -= 60 * lpTime->u.smpte.min; lpTime->u.smpte.sec -= 60 * lpTime->u.smpte.min;
lpTime->u.smpte.hour = lpTime->u.smpte.min / 60; lpTime->u.smpte.hour = lpTime->u.smpte.min / 60;
lpTime->u.smpte.min -= 60 * lpTime->u.smpte.hour; lpTime->u.smpte.min -= 60 * lpTime->u.smpte.hour;
lpTime->u.smpte.fps = 30; lpTime->u.smpte.fps = 30;
lpTime->u.smpte.frame = position * lpTime->u.smpte.fps / format->wf.nSamplesPerSec; lpTime->u.smpte.frame = position * lpTime->u.smpte.fps / format->Format.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", TRACE("TIME_SMPTE=%02u:%02u:%02u:%02u\n",
lpTime->u.smpte.hour, lpTime->u.smpte.min, lpTime->u.smpte.hour, lpTime->u.smpte.min,
lpTime->u.smpte.sec, lpTime->u.smpte.frame); lpTime->u.smpte.sec, lpTime->u.smpte.frame);
......
...@@ -233,7 +233,9 @@ static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position, ...@@ -233,7 +233,9 @@ static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position,
TRACE("TIME_MS=%lu\n", lpTime->u.ms); TRACE("TIME_MS=%lu\n", lpTime->u.ms);
break; break;
case TIME_SMPTE: case TIME_SMPTE:
lpTime->u.smpte.fps = 30;
position = position / (format->wBitsPerSample / 8 * format->wf.nChannels); 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; lpTime->u.smpte.sec = position / format->wf.nSamplesPerSec;
position -= lpTime->u.smpte.sec * format->wf.nSamplesPerSec; position -= lpTime->u.smpte.sec * format->wf.nSamplesPerSec;
lpTime->u.smpte.min = lpTime->u.smpte.sec / 60; lpTime->u.smpte.min = lpTime->u.smpte.sec / 60;
...@@ -242,12 +244,6 @@ static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position, ...@@ -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.min -= 60 * lpTime->u.smpte.hour;
lpTime->u.smpte.fps = 30; lpTime->u.smpte.fps = 30;
lpTime->u.smpte.frame = position * lpTime->u.smpte.fps / format->wf.nSamplesPerSec; 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", TRACE("TIME_SMPTE=%02u:%02u:%02u:%02u\n",
lpTime->u.smpte.hour, lpTime->u.smpte.min, lpTime->u.smpte.hour, lpTime->u.smpte.min,
lpTime->u.smpte.sec, lpTime->u.smpte.frame); lpTime->u.smpte.sec, lpTime->u.smpte.frame);
......
...@@ -295,7 +295,9 @@ static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position, ...@@ -295,7 +295,9 @@ static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position,
TRACE("TIME_MS=%lu\n", lpTime->u.ms); TRACE("TIME_MS=%lu\n", lpTime->u.ms);
break; break;
case TIME_SMPTE: case TIME_SMPTE:
lpTime->u.smpte.fps = 30;
position = position / (format->wBitsPerSample / 8 * format->wf.nChannels); 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; lpTime->u.smpte.sec = position / format->wf.nSamplesPerSec;
position -= lpTime->u.smpte.sec * format->wf.nSamplesPerSec; position -= lpTime->u.smpte.sec * format->wf.nSamplesPerSec;
lpTime->u.smpte.min = lpTime->u.smpte.sec / 60; lpTime->u.smpte.min = lpTime->u.smpte.sec / 60;
...@@ -304,12 +306,6 @@ static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position, ...@@ -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.min -= 60 * lpTime->u.smpte.hour;
lpTime->u.smpte.fps = 30; lpTime->u.smpte.fps = 30;
lpTime->u.smpte.frame = position * lpTime->u.smpte.fps / format->wf.nSamplesPerSec; 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", TRACE("TIME_SMPTE=%02u:%02u:%02u:%02u\n",
lpTime->u.smpte.hour, lpTime->u.smpte.min, lpTime->u.smpte.hour, lpTime->u.smpte.min,
lpTime->u.smpte.sec, lpTime->u.smpte.frame); lpTime->u.smpte.sec, lpTime->u.smpte.frame);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment