Nikolay Sivov : mfplat: Add a helper to trace timestamp arguments.
Alexandre Julliard
julliard at winehq.org
Wed Mar 25 17:07:27 CDT 2020
Module: wine
Branch: master
Commit: 9ea8edc0b95b6c9e53b9f68aa02ae929908e501e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9ea8edc0b95b6c9e53b9f68aa02ae929908e501e
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Wed Mar 25 15:01:21 2020 +0300
mfplat: Add a helper to trace timestamp arguments.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mfplat/buffer.c | 6 +++---
dlls/mfplat/main.c | 10 +++++-----
dlls/mfplat/mfplat_private.h | 20 ++++++++++++++++++++
3 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/dlls/mfplat/buffer.c b/dlls/mfplat/buffer.c
index ea89bcb1f5..4bbb36b683 100644
--- a/dlls/mfplat/buffer.c
+++ b/dlls/mfplat/buffer.c
@@ -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;
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index 3368ab0969..66bdc505f0 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -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;
diff --git a/dlls/mfplat/mfplat_private.h b/dlls/mfplat/mfplat_private.h
index ad4958465a..0f1c5479e6 100644
--- a/dlls/mfplat/mfplat_private.h
+++ b/dlls/mfplat/mfplat_private.h
@@ -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);
+}
More information about the wine-cvs
mailing list