Module: wine Branch: master Commit: eea01d8e8bd1a73369f64f9cec19eb6900a31ef3 URL: https://source.winehq.org/git/wine.git/?a=commit;h=eea01d8e8bd1a73369f64f9ce...
Author: Zebediah Figura z.figura12@gmail.com Date: Thu Jan 30 19:05:17 2020 -0600
quartz: Introduce a helper to trace reference time.
Signed-off-by: Zebediah Figura z.figura12@gmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/quartz/acmwrapper.c | 4 ++-- dlls/quartz/dsoundrender.c | 7 ++++--- dlls/quartz/filtergraph.c | 12 ++++++++++-- dlls/quartz/memallocator.c | 6 ++++-- dlls/quartz/quartz_private.h | 20 ++++++++++++++++++++ dlls/quartz/systemclock.c | 7 +++---- 6 files changed, 43 insertions(+), 13 deletions(-)
diff --git a/dlls/quartz/acmwrapper.c b/dlls/quartz/acmwrapper.c index 33d9debe5c..aa34f3ae26 100644 --- a/dlls/quartz/acmwrapper.c +++ b/dlls/quartz/acmwrapper.c @@ -163,7 +163,7 @@ static HRESULT WINAPI ACMWrapper_Receive(TransformFilter *tf, IMediaSample *pSam goto error; }
- TRACE("Sample start time: %u.%03u\n", (DWORD)(tStart/10000000), (DWORD)((tStart/10000)%1000)); + TRACE("Sample start time: %s.\n", debugstr_time(tStart)); if (ash.cbSrcLengthUsed == cbSrcStream) { IMediaSample_SetTime(pOutSample, &tStart, &tStop); @@ -196,7 +196,7 @@ static HRESULT WINAPI ACMWrapper_Receive(TransformFilter *tf, IMediaSample *pSam IMediaSample_SetMediaTime(pOutSample, NULL, NULL); }
- TRACE("Sample stop time: %u.%03u\n", (DWORD)(tStart/10000000), (DWORD)((tStart/10000)%1000)); + TRACE("Sample stop time: %s\n", debugstr_time(tStart));
hr = IMemInputPin_Receive(This->tf.source.pMemInputPin, pOutSample); if (hr != S_OK && hr != VFW_E_NOT_CONNECTED) { diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index 6fd49dac9b..4a0f5c4d10 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -171,7 +171,7 @@ static HRESULT DSoundRender_GetWritePos(DSoundRenderImpl *This, DWORD *ret_write *ret_writepos = writepos; } else if (delta_t < 0) { REFERENCE_TIME past, min_writepos_t; - WARN("Delta too big %i/%i, overwriting old data or even skipping\n", (int)delta_t / 10000, (int)max_lag / 10000); + WARN("Delta too big %s/%s, overwriting old data or even skipping\n", debugstr_time(delta_t), debugstr_time(max_lag)); if (min_writepos >= playpos) min_writepos_t = cur + time_from_pos(This, min_writepos - playpos); else @@ -189,7 +189,7 @@ static HRESULT DSoundRender_GetWritePos(DSoundRenderImpl *This, DWORD *ret_write } } else /* delta_t > 0 */ { DWORD aheadbytes; - WARN("Delta too big %i/%i, too far ahead\n", (int)delta_t / 10000, (int)max_lag / 10000); + WARN("Delta too big %s/%s, too far ahead\n", debugstr_time(delta_t), debugstr_time(max_lag)); aheadbytes = pos_from_time(This, delta_t); WARN("Advancing %u bytes\n", aheadbytes); if (delta_t >= DSoundRenderer_Max_Fill) @@ -204,7 +204,8 @@ end: else *pfree = This->buf_size + playpos - *ret_writepos; if (time_from_pos(This, This->buf_size - *pfree) >= DSoundRenderer_Max_Fill) { - TRACE("Blocked: too full %i / %i\n", (int)(time_from_pos(This, This->buf_size - *pfree)/10000), (int)(DSoundRenderer_Max_Fill / 10000)); + TRACE("Blocked: too full %s / %s\n", debugstr_time(time_from_pos(This, This->buf_size - *pfree)), + debugstr_time(DSoundRenderer_Max_Fill)); return S_FALSE; } return S_OK; diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index e30dae0a59..cd4e7f40e0 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -2500,6 +2500,8 @@ static HRESULT WINAPI MediaSeeking_GetStopPosition(IMediaSeeking *iface, LONGLON }
LeaveCriticalSection(&graph->cs); + + TRACE("Returning %s (%s seconds).\n", wine_dbgstr_longlong(*stop), debugstr_time(*stop)); return hr; }
@@ -2525,7 +2527,7 @@ static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface, LONG
LeaveCriticalSection(&graph->cs);
- TRACE("Returning %s.\n", wine_dbgstr_longlong(ret)); + TRACE("Returning %s (%s seconds).\n", wine_dbgstr_longlong(ret), debugstr_time(ret)); *current = ret;
return S_OK; @@ -2565,6 +2567,12 @@ static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface, LONGLONG * TRACE("graph %p, current %s, current_flags %#x, stop %s, stop_flags %#x.\n", graph, current_ptr ? wine_dbgstr_longlong(*current_ptr) : "<null>", current_flags, stop_ptr ? wine_dbgstr_longlong(*stop_ptr): "<null>", stop_flags); + if (current_ptr) + TRACE("Setting current position to %s (%s seconds).\n", + wine_dbgstr_longlong(*current_ptr), debugstr_time(*current_ptr)); + if (stop_ptr) + TRACE("Setting stop position to %s (%s seconds).\n", + wine_dbgstr_longlong(*stop_ptr), debugstr_time(*stop_ptr));
if ((current_flags & 0x7) != AM_SEEKING_AbsolutePositioning && (current_flags & 0x7) != AM_SEEKING_NoPositioning) @@ -5249,7 +5257,7 @@ static HRESULT WINAPI MediaFilter_Run(IMediaFilter *iface, REFERENCE_TIME start) IFilterGraphImpl *graph = impl_from_IMediaFilter(iface); REFERENCE_TIME stream_start = start;
- TRACE("graph %p, start %s.\n", graph, wine_dbgstr_longlong(start)); + TRACE("graph %p, start %s.\n", graph, debugstr_time(start));
EnterCriticalSection(&graph->cs);
diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c index 2f5855e95b..fab0f2d1c4 100644 --- a/dlls/quartz/memallocator.c +++ b/dlls/quartz/memallocator.c @@ -564,7 +564,8 @@ static HRESULT WINAPI StdMediaSample2_SetTime(IMediaSample2 *iface, REFERENCE_TI { StdMediaSample2 *sample = impl_from_IMediaSample2(iface);
- TRACE("iface %p, start %p, end %p.\n", iface, start, end); + TRACE("sample %p, start %s, end %s.\n", sample, start ? debugstr_time(*start) : "(null)", + end ? debugstr_time(*end) : "(null)");
if (start) { @@ -745,7 +746,8 @@ static HRESULT WINAPI StdMediaSample2_SetMediaTime(IMediaSample2 *iface, LONGLON { StdMediaSample2 *sample = impl_from_IMediaSample2(iface);
- TRACE("sample %p, start %p, end %p.\n", iface, start, end); + TRACE("sample %p, start %s, end %s.\n", sample, start ? debugstr_time(*start) : "(null)", + end ? debugstr_time(*end) : "(null)");
if (start) { diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h index 791bec7db6..3431a5836f 100644 --- a/dlls/quartz/quartz_private.h +++ b/dlls/quartz/quartz_private.h @@ -36,6 +36,26 @@ #include "wine/strmbase.h" #include "wine/list.h"
+static inline const char *debugstr_time(REFERENCE_TIME 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); +} + /* see IAsyncReader::Request on MSDN for the explanation of this */ #define MEDIATIME_FROM_BYTES(x) ((LONGLONG)(x) * 10000000) #define BYTES_FROM_MEDIATIME(time) ((time) / 10000000) diff --git a/dlls/quartz/systemclock.c b/dlls/quartz/systemclock.c index 8122cc5b0b..51e96c82e6 100644 --- a/dlls/quartz/systemclock.c +++ b/dlls/quartz/systemclock.c @@ -202,8 +202,6 @@ static HRESULT WINAPI SystemClockImpl_GetTime(IReferenceClock *iface, REFERENCE_ REFERENCE_TIME ret; HRESULT hr;
- TRACE("clock %p, time %p.\n", clock, time); - if (!time) { return E_POINTER; } @@ -217,6 +215,7 @@ static HRESULT WINAPI SystemClockImpl_GetTime(IReferenceClock *iface, REFERENCE_
LeaveCriticalSection(&clock->cs);
+ TRACE("clock %p, time %p, returning %s.\n", clock, time, debugstr_time(ret)); return hr; }
@@ -227,7 +226,7 @@ static HRESULT WINAPI SystemClockImpl_AdviseTime(IReferenceClock *iface, struct advise_sink *sink;
TRACE("clock %p, base %s, offset %s, event %#lx, cookie %p.\n", - clock, wine_dbgstr_longlong(base), wine_dbgstr_longlong(offset), event, cookie); + clock, debugstr_time(base), debugstr_time(offset), event, cookie);
if (!event) return E_INVALIDARG; @@ -263,7 +262,7 @@ static HRESULT WINAPI SystemClockImpl_AdvisePeriodic(IReferenceClock* iface, struct advise_sink *sink;
TRACE("clock %p, start %s, period %s, semaphore %#lx, cookie %p.\n", - clock, wine_dbgstr_longlong(start), wine_dbgstr_longlong(period), semaphore, cookie); + clock, debugstr_time(start), debugstr_time(period), semaphore, cookie);
if (!semaphore) return E_INVALIDARG;