From e121a552930739c46fb64bb9a6822ba7c4c26099 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 25 Mar 2020 15:01:23 +0300 Subject: [PATCH] mf: Add a helper to trace timestamp arguments. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mf/main.c | 2 +- dlls/mf/mf_private.h | 21 +++++++++++++++++++++ dlls/mf/samplegrabber.c | 10 +++++----- dlls/mf/session.c | 6 ++++-- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/dlls/mf/main.c b/dlls/mf/main.c index 20b587e413d..8e42837b464 100644 --- a/dlls/mf/main.c +++ b/dlls/mf/main.c @@ -1894,7 +1894,7 @@ static HRESULT WINAPI sample_copier_transform_GetOutputStatus(IMFTransform *ifac static HRESULT WINAPI sample_copier_transform_SetOutputBounds(IMFTransform *iface, LONGLONG lower, LONGLONG upper) { - TRACE("%p, %s, %s.\n", iface, wine_dbgstr_longlong(lower), wine_dbgstr_longlong(upper)); + TRACE("%p, %s, %s.\n", iface, debugstr_time(lower), debugstr_time(upper)); return E_NOTIMPL; } diff --git a/dlls/mf/mf_private.h b/dlls/mf/mf_private.h index f68c7d8d4cb..dd8f49e1bc5 100644 --- a/dlls/mf/mf_private.h +++ b/dlls/mf/mf_private.h @@ -19,6 +19,7 @@ #include "mfidl.h" #include "wine/heap.h" +#include "wine/debug.h" static inline BOOL mf_array_reserve(void **elements, size_t *capacity, size_t count, size_t size) { @@ -55,3 +56,23 @@ struct activate_funcs }; HRESULT create_activation_object(void *context, const struct activate_funcs *funcs, IMFActivate **ret) DECLSPEC_HIDDEN; + +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); +} diff --git a/dlls/mf/samplegrabber.c b/dlls/mf/samplegrabber.c index ea0d596f7eb..205298501d9 100644 --- a/dlls/mf/samplegrabber.c +++ b/dlls/mf/samplegrabber.c @@ -1151,7 +1151,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockStart(IMFClockStateSink * { struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface); - TRACE("%p, %s, %s.\n", iface, wine_dbgstr_longlong(systime), wine_dbgstr_longlong(offset)); + TRACE("%p, %s, %s.\n", iface, debugstr_time(systime), debugstr_time(offset)); sample_grabber_set_state(grabber, SINK_STATE_RUNNING); @@ -1162,7 +1162,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockStop(IMFClockStateSink *i { struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface); - TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(systime)); + TRACE("%p, %s.\n", iface, debugstr_time(systime)); sample_grabber_set_state(grabber, SINK_STATE_STOPPED); @@ -1173,7 +1173,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockPause(IMFClockStateSink * { struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface); - TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(systime)); + TRACE("%p, %s.\n", iface, debugstr_time(systime)); return IMFSampleGrabberSinkCallback_OnClockPause(sample_grabber_get_callback(grabber), systime); } @@ -1182,7 +1182,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockRestart(IMFClockStateSink { struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface); - TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(systime)); + TRACE("%p, %s.\n", iface, debugstr_time(systime)); sample_grabber_set_state(grabber, SINK_STATE_RUNNING); @@ -1193,7 +1193,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockSetRate(IMFClockStateSink { struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface); - TRACE("%p, %s, %f.\n", iface, wine_dbgstr_longlong(systime), rate); + TRACE("%p, %s, %f.\n", iface, debugstr_time(systime), rate); return IMFSampleGrabberSinkCallback_OnClockSetRate(sample_grabber_get_callback(grabber), systime, rate); } diff --git a/dlls/mf/session.c b/dlls/mf/session.c index db1e5e4fe50..50f011dc52d 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -31,6 +31,8 @@ #include "wine/heap.h" #include "wine/list.h" +#include "mf_private.h" + WINE_DEFAULT_DEBUG_CHANNEL(mfplat); enum session_command @@ -3547,7 +3549,7 @@ static HRESULT WINAPI present_clock_Start(IMFPresentationClock *iface, LONGLONG struct clock_state_change_param param = {{0}}; HRESULT hr; - TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(start_offset)); + TRACE("%p, %s.\n", iface, debugstr_time(start_offset)); EnterCriticalSection(&clock->cs); clock->start_offset = param.u.offset = start_offset; @@ -3772,7 +3774,7 @@ static HRESULT WINAPI present_clock_timer_SetTimer(IMFTimer *iface, DWORD flags, struct clock_timer *clock_timer; HRESULT hr; - TRACE("%p, %#x, %s, %p, %p, %p.\n", iface, flags, wine_dbgstr_longlong(time), callback, state, cancel_key); + TRACE("%p, %#x, %s, %p, %p, %p.\n", iface, flags, debugstr_time(time), callback, state, cancel_key); if (!(clock_timer = heap_alloc_zero(sizeof(*clock_timer)))) return E_OUTOFMEMORY;