mfplat: Add a helper to trace timestamp arguments.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-03-25 15:01:21 +03:00 committed by Alexandre Julliard
parent 3ac77317b8
commit 9ea8edc0b9
3 changed files with 28 additions and 8 deletions

View file

@ -663,7 +663,7 @@ HRESULT WINAPI MFCreateMediaBufferFromMediaType(IMFMediaType *media_type, LONGLO
HRESULT hr;
GUID major;
TRACE("%p, %s, %u, %u, %p.\n", media_type, wine_dbgstr_longlong(duration), min_length, alignment, buffer);
TRACE("%p, %s, %u, %u, %p.\n", media_type, debugstr_time(duration), min_length, alignment, buffer);
if (!media_type)
return E_INVALIDARG;
@ -1075,7 +1075,7 @@ static HRESULT WINAPI sample_SetSampleTime(IMFSample *iface, LONGLONG timestamp)
{
struct sample *sample = impl_from_IMFSample(iface);
TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(timestamp));
TRACE("%p, %s.\n", iface, debugstr_time(timestamp));
EnterCriticalSection(&sample->attributes.cs);
sample->timestamp = timestamp;
@ -1106,7 +1106,7 @@ static HRESULT WINAPI sample_SetSampleDuration(IMFSample *iface, LONGLONG durati
{
struct sample *sample = impl_from_IMFSample(iface);
TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(duration));
TRACE("%p, %s.\n", iface, debugstr_time(duration));
EnterCriticalSection(&sample->attributes.cs);
sample->duration = duration;

View file

@ -8015,7 +8015,7 @@ static HRESULT WINAPI system_time_source_sink_OnClockStart(IMFClockStateSink *if
struct system_time_source *source = impl_from_IMFClockStateSink(iface);
HRESULT hr;
TRACE("%p, %s, %s.\n", iface, wine_dbgstr_longlong(system_time), wine_dbgstr_longlong(start_offset));
TRACE("%p, %s, %s.\n", iface, debugstr_time(system_time), debugstr_time(start_offset));
EnterCriticalSection(&source->cs);
if (SUCCEEDED(hr = system_time_source_change_state(source, CLOCK_CMD_START)))
@ -8033,7 +8033,7 @@ static HRESULT WINAPI system_time_source_sink_OnClockStop(IMFClockStateSink *ifa
struct system_time_source *source = impl_from_IMFClockStateSink(iface);
HRESULT hr;
TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(system_time));
TRACE("%p, %s.\n", iface, debugstr_time(system_time));
EnterCriticalSection(&source->cs);
if (SUCCEEDED(hr = system_time_source_change_state(source, CLOCK_CMD_STOP)))
@ -8048,7 +8048,7 @@ static HRESULT WINAPI system_time_source_sink_OnClockPause(IMFClockStateSink *if
struct system_time_source *source = impl_from_IMFClockStateSink(iface);
HRESULT hr;
TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(system_time));
TRACE("%p, %s.\n", iface, debugstr_time(system_time));
EnterCriticalSection(&source->cs);
if (SUCCEEDED(hr = system_time_source_change_state(source, CLOCK_CMD_PAUSE)))
@ -8066,7 +8066,7 @@ static HRESULT WINAPI system_time_source_sink_OnClockRestart(IMFClockStateSink *
struct system_time_source *source = impl_from_IMFClockStateSink(iface);
HRESULT hr;
TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(system_time));
TRACE("%p, %s.\n", iface, debugstr_time(system_time));
EnterCriticalSection(&source->cs);
if (SUCCEEDED(hr = system_time_source_change_state(source, CLOCK_CMD_RESTART)))
@ -8084,7 +8084,7 @@ static HRESULT WINAPI system_time_source_sink_OnClockSetRate(IMFClockStateSink *
struct system_time_source *source = impl_from_IMFClockStateSink(iface);
double intpart;
TRACE("%p, %s, %f.\n", iface, wine_dbgstr_longlong(system_time), rate);
TRACE("%p, %s, %f.\n", iface, debugstr_time(system_time), rate);
if (rate == 0.0f)
return MF_E_UNSUPPORTED_RATE;

View file

@ -182,3 +182,23 @@ static inline const char *debugstr_fourcc(DWORD format)
return wine_dbgstr_an((char *)&format, 4);
}
static inline const char *debugstr_time(LONGLONG time)
{
ULONGLONG abstime = time >= 0 ? time : -time;
unsigned int i = 0, j = 0;
char buffer[23], rev[23];
while (abstime || i <= 8)
{
buffer[i++] = '0' + (abstime % 10);
abstime /= 10;
if (i == 7) buffer[i++] = '.';
}
if (time < 0) buffer[i++] = '-';
while (i--) rev[j++] = buffer[i];
rev[j] = 0;
return wine_dbg_sprintf("%s", rev);
}