This replaces Wine's 10 copies of the function.
-- v2: strmbase: Use debugstr_reftime instead of reimplementing it. wmvcore: Use debugstr_reftime instead of reimplementing it. winegstreamer: Use debugstr_reftime instead of reimplementing it. quartz: Use debugstr_reftime instead of reimplementing it. qasf: Use debugstr_reftime instead of reimplementing it. mfsrcsnk: Use debugstr_reftime instead of reimplementing it. mfplat: Use debugstr_reftime instead of reimplementing it. mf: Use debugstr_reftime instead of reimplementing it. evr: Use debugstr_reftime instead of reimplementing it. include: Introduce debugstr_reftime and wine_dbgstr_reftime.
From: Alex Henrie alexhenrie24@gmail.com
--- include/wine/debug.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/include/wine/debug.h b/include/wine/debug.h index 86e008a1408..fe3013af1bf 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -334,6 +334,27 @@ static inline const char *wine_dbgstr_fourcc( unsigned int fourcc ) return wine_dbg_sprintf( "0x%08x", fourcc ); }
+static inline const char *wine_dbgstr_reftime( 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]; + while (rev[j-1] == '0' && rev[j-2] != '.') --j; + rev[j] = 0; + + return wine_dbg_sprintf( "%s", rev ); +} + static inline const char *wine_dbgstr_point( const POINT *pt ) { if (!pt) return "(null)"; @@ -515,6 +536,7 @@ static inline const char *debugstr_an( const char * s, int n ) { return wine_dbg static inline const char *debugstr_wn( const WCHAR *s, int n ) { return wine_dbgstr_wn( s, n ); } static inline const char *debugstr_guid( const struct _GUID *id ) { return wine_dbgstr_guid(id); } static inline const char *debugstr_fourcc( unsigned int cc ) { return wine_dbgstr_fourcc( cc ); } +static inline const char *debugstr_reftime( LONGLONG time ) { return wine_dbgstr_reftime( time ); } static inline const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, -1 ); } static inline const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); }
From: Alex Henrie alexhenrie24@gmail.com
--- dlls/evr/evr_private.h | 21 --------------------- dlls/evr/presenter.c | 10 +++++----- dlls/evr/sample.c | 27 +++------------------------ 3 files changed, 8 insertions(+), 50 deletions(-)
diff --git a/dlls/evr/evr_private.h b/dlls/evr/evr_private.h index 225e60348b4..c24dd01a745 100644 --- a/dlls/evr/evr_private.h +++ b/dlls/evr/evr_private.h @@ -24,27 +24,6 @@ #include "wine/strmbase.h" #include "wine/debug.h"
-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]; - while (rev[j-1] == '0' && rev[j-2] != '.') --j; - rev[j] = 0; - - return wine_dbg_sprintf("%s", rev); -} - static inline const char *debugstr_normalized_rect(const MFVideoNormalizedRect *rect) { if (!rect) return "(null)"; diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c index 552e24b4b97..f4c7fe1178d 100644 --- a/dlls/evr/presenter.c +++ b/dlls/evr/presenter.c @@ -918,7 +918,7 @@ static HRESULT WINAPI video_presenter_OnClockStart(IMFVideoPresenter *iface, MFT { struct video_presenter *presenter = impl_from_IMFVideoPresenter(iface);
- TRACE("%p, %s, %s.\n", iface, debugstr_time(systime), wine_dbgstr_longlong(offset)); + TRACE("%p, %s, %s.\n", iface, debugstr_reftime(systime), wine_dbgstr_longlong(offset));
EnterCriticalSection(&presenter->cs); presenter->state = PRESENTER_STATE_STARTED; @@ -931,7 +931,7 @@ static HRESULT WINAPI video_presenter_OnClockStop(IMFVideoPresenter *iface, MFTI { struct video_presenter *presenter = impl_from_IMFVideoPresenter(iface);
- TRACE("%p, %s.\n", iface, debugstr_time(systime)); + TRACE("%p, %s.\n", iface, debugstr_reftime(systime));
EnterCriticalSection(&presenter->cs); presenter->state = PRESENTER_STATE_STOPPED; @@ -945,7 +945,7 @@ static HRESULT WINAPI video_presenter_OnClockPause(IMFVideoPresenter *iface, MFT { struct video_presenter *presenter = impl_from_IMFVideoPresenter(iface);
- TRACE("%p, %s.\n", iface, debugstr_time(systime)); + TRACE("%p, %s.\n", iface, debugstr_reftime(systime));
EnterCriticalSection(&presenter->cs); presenter->state = PRESENTER_STATE_PAUSED; @@ -958,7 +958,7 @@ static HRESULT WINAPI video_presenter_OnClockRestart(IMFVideoPresenter *iface, M { struct video_presenter *presenter = impl_from_IMFVideoPresenter(iface);
- TRACE("%p, %s.\n", iface, debugstr_time(systime)); + TRACE("%p, %s.\n", iface, debugstr_reftime(systime));
EnterCriticalSection(&presenter->cs); presenter->state = PRESENTER_STATE_STARTED; @@ -969,7 +969,7 @@ static HRESULT WINAPI video_presenter_OnClockRestart(IMFVideoPresenter *iface, M
static HRESULT WINAPI video_presenter_OnClockSetRate(IMFVideoPresenter *iface, MFTIME systime, float rate) { - FIXME("%p, %s, %f.\n", iface, debugstr_time(systime), rate); + FIXME("%p, %s, %f.\n", iface, debugstr_reftime(systime), rate);
return E_NOTIMPL; } diff --git a/dlls/evr/sample.c b/dlls/evr/sample.c index aa3f120b115..3f168538c62 100644 --- a/dlls/evr/sample.c +++ b/dlls/evr/sample.c @@ -29,27 +29,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(evr);
-static 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]; - while (rev[j-1] == '0' && rev[j-2] != '.') --j; - rev[j] = 0; - - return wine_dbg_sprintf("%s", rev); -} - struct surface_buffer { IMFMediaBuffer IMFMediaBuffer_iface; @@ -1282,7 +1261,7 @@ static HRESULT WINAPI video_sample_SetSampleTime(IMFSample *iface, LONGLONG time { struct video_sample *sample = impl_from_IMFSample(iface);
- TRACE("%p, %s.\n", iface, debugstr_time(timestamp)); + TRACE("%p, %s.\n", iface, debugstr_reftime(timestamp));
EnterCriticalSection(&sample->cs); sample->timestamp = timestamp; @@ -1313,7 +1292,7 @@ static HRESULT WINAPI video_sample_SetSampleDuration(IMFSample *iface, LONGLONG { struct video_sample *sample = impl_from_IMFSample(iface);
- TRACE("%p, %s.\n", iface, debugstr_time(duration)); + TRACE("%p, %s.\n", iface, debugstr_reftime(duration));
EnterCriticalSection(&sample->cs); sample->duration = duration; @@ -1545,7 +1524,7 @@ static void WINAPI desired_video_sample_SetDesiredSampleTimeAndDuration(IMFDesir { struct video_sample *sample = impl_from_IMFDesiredSample(iface);
- TRACE("%p, %s, %s.\n", iface, debugstr_time(sample_time), debugstr_time(sample_duration)); + TRACE("%p, %s, %s.\n", iface, debugstr_reftime(sample_time), debugstr_reftime(sample_duration));
EnterCriticalSection(&sample->cs); sample->flags |= SAMPLE_PROP_HAS_DESIRED_PROPS;
From: Alex Henrie alexhenrie24@gmail.com
--- dlls/mf/clock.c | 4 ++-- dlls/mf/copier.c | 2 +- dlls/mf/evr.c | 12 ++++++------ dlls/mf/mf_private.h | 21 --------------------- dlls/mf/samplegrabber.c | 10 +++++----- dlls/mf/sar.c | 12 ++++++------ dlls/mf/topology.c | 2 +- 7 files changed, 21 insertions(+), 42 deletions(-)
diff --git a/dlls/mf/clock.c b/dlls/mf/clock.c index e6be05d2794..fd889655cf8 100644 --- a/dlls/mf/clock.c +++ b/dlls/mf/clock.c @@ -660,7 +660,7 @@ static HRESULT WINAPI present_clock_Start(IMFPresentationClock *iface, LONGLONG struct clock_state_change_param param = {{0}}; HRESULT hr;
- TRACE("%p, %s.\n", iface, debugstr_time(start_offset)); + TRACE("%p, %s.\n", iface, debugstr_reftime(start_offset));
EnterCriticalSection(&clock->cs); clock->start_offset = param.u.offset = start_offset; @@ -888,7 +888,7 @@ static HRESULT WINAPI present_clock_timer_SetTimer(IMFTimer *iface, DWORD flags, struct clock_timer *clock_timer; HRESULT hr;
- TRACE("%p, %#lx, %s, %p, %p, %p.\n", iface, flags, debugstr_time(time), callback, state, cancel_key); + TRACE("%p, %#lx, %s, %p, %p, %p.\n", iface, flags, debugstr_reftime(time), callback, state, cancel_key);
if (!(clock_timer = calloc(1, sizeof(*clock_timer)))) return E_OUTOFMEMORY; diff --git a/dlls/mf/copier.c b/dlls/mf/copier.c index ab995fb98db..29638a2dd98 100644 --- a/dlls/mf/copier.c +++ b/dlls/mf/copier.c @@ -424,7 +424,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, debugstr_time(lower), debugstr_time(upper)); + TRACE("%p, %s, %s.\n", iface, debugstr_reftime(lower), debugstr_reftime(upper));
return E_NOTIMPL; } diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index db7053a1405..12c0a47af14 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -1511,7 +1511,7 @@ static HRESULT WINAPI video_renderer_preroll_NotifyPreroll(IMFMediaSinkPreroll * HRESULT hr = S_OK; size_t i;
- TRACE("%p, %s.\n", iface, debugstr_time(start_time)); + TRACE("%p, %s.\n", iface, debugstr_reftime(start_time));
EnterCriticalSection(&renderer->cs); if (renderer->flags & EVR_SHUT_DOWN) @@ -1909,7 +1909,7 @@ static HRESULT WINAPI video_renderer_clock_sink_OnClockStart(IMFClockStateSink * unsigned int state, request_sample; size_t i;
- TRACE("%p, %s, %s.\n", iface, debugstr_time(systime), debugstr_time(offset)); + TRACE("%p, %s, %s.\n", iface, debugstr_reftime(systime), debugstr_reftime(offset));
EnterCriticalSection(&renderer->cs);
@@ -1952,7 +1952,7 @@ static HRESULT WINAPI video_renderer_clock_sink_OnClockStop(IMFClockStateSink *i struct video_renderer *renderer = impl_from_IMFClockStateSink(iface); size_t i;
- TRACE("%p, %s.\n", iface, debugstr_time(systime)); + TRACE("%p, %s.\n", iface, debugstr_reftime(systime));
EnterCriticalSection(&renderer->cs);
@@ -1989,7 +1989,7 @@ static HRESULT WINAPI video_renderer_clock_sink_OnClockPause(IMFClockStateSink * struct video_renderer *renderer = impl_from_IMFClockStateSink(iface); size_t i;
- TRACE("%p, %s.\n", iface, debugstr_time(systime)); + TRACE("%p, %s.\n", iface, debugstr_reftime(systime));
EnterCriticalSection(&renderer->cs);
@@ -2016,7 +2016,7 @@ static HRESULT WINAPI video_renderer_clock_sink_OnClockRestart(IMFClockStateSink struct video_renderer *renderer = impl_from_IMFClockStateSink(iface); size_t i;
- TRACE("%p, %s.\n", iface, debugstr_time(systime)); + TRACE("%p, %s.\n", iface, debugstr_reftime(systime));
EnterCriticalSection(&renderer->cs);
@@ -2039,7 +2039,7 @@ static HRESULT WINAPI video_renderer_clock_sink_OnClockSetRate(IMFClockStateSink struct video_renderer *renderer = impl_from_IMFClockStateSink(iface); IMFClockStateSink *sink;
- TRACE("%p, %s, %f.\n", iface, debugstr_time(systime), rate); + TRACE("%p, %s, %f.\n", iface, debugstr_reftime(systime), rate);
EnterCriticalSection(&renderer->cs);
diff --git a/dlls/mf/mf_private.h b/dlls/mf/mf_private.h index bbfadaee5d8..c4e2214c993 100644 --- a/dlls/mf/mf_private.h +++ b/dlls/mf/mf_private.h @@ -58,27 +58,6 @@ struct activate_funcs
HRESULT create_activation_object(void *context, const struct activate_funcs *funcs, IMFActivate **ret);
-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]; - while (rev[j-1] == '0' && rev[j-2] != '.') --j; - rev[j] = 0; - - return wine_dbg_sprintf("%s", rev); -} - static inline const char *debugstr_propvar(const PROPVARIANT *v) { if (!v) diff --git a/dlls/mf/samplegrabber.c b/dlls/mf/samplegrabber.c index de599139736..80fded31895 100644 --- a/dlls/mf/samplegrabber.c +++ b/dlls/mf/samplegrabber.c @@ -1250,7 +1250,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockStart(IMFClockStateSink * { struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface);
- TRACE("%p, %s, %s.\n", iface, debugstr_time(systime), debugstr_time(offset)); + TRACE("%p, %s, %s.\n", iface, debugstr_reftime(systime), debugstr_reftime(offset));
return sample_grabber_set_state(grabber, SINK_STATE_RUNNING, systime, offset); } @@ -1259,7 +1259,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockStop(IMFClockStateSink *i { struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface);
- TRACE("%p, %s.\n", iface, debugstr_time(systime)); + TRACE("%p, %s.\n", iface, debugstr_reftime(systime));
return sample_grabber_set_state(grabber, SINK_STATE_STOPPED, systime, 0); } @@ -1268,7 +1268,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockPause(IMFClockStateSink * { struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface);
- TRACE("%p, %s.\n", iface, debugstr_time(systime)); + TRACE("%p, %s.\n", iface, debugstr_reftime(systime));
return sample_grabber_set_state(grabber, SINK_STATE_PAUSED, systime, 0); } @@ -1277,7 +1277,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockRestart(IMFClockStateSink { struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface);
- TRACE("%p, %s.\n", iface, debugstr_time(systime)); + TRACE("%p, %s.\n", iface, debugstr_reftime(systime));
return sample_grabber_set_state(grabber, SINK_STATE_RUNNING, systime, PRESENTATION_CURRENT_POSITION); } @@ -1287,7 +1287,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockSetRate(IMFClockStateSink struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface); HRESULT hr = S_OK;
- TRACE("%p, %s, %f.\n", iface, debugstr_time(systime), rate); + TRACE("%p, %s, %f.\n", iface, debugstr_reftime(systime), rate);
EnterCriticalSection(&grabber->cs);
diff --git a/dlls/mf/sar.c b/dlls/mf/sar.c index 84824f954dd..0a38bca0c33 100644 --- a/dlls/mf/sar.c +++ b/dlls/mf/sar.c @@ -523,7 +523,7 @@ static HRESULT WINAPI audio_renderer_preroll_NotifyPreroll(IMFMediaSinkPreroll * { struct audio_renderer *renderer = impl_from_IMFMediaSinkPreroll(iface);
- TRACE("%p, %s.\n", iface, debugstr_time(start_time)); + TRACE("%p, %s.\n", iface, debugstr_reftime(start_time));
if (renderer->flags & SAR_SHUT_DOWN) return MF_E_SHUTDOWN; @@ -631,7 +631,7 @@ static HRESULT WINAPI audio_renderer_clock_sink_OnClockStart(IMFClockStateSink * struct audio_renderer *renderer = impl_from_IMFClockStateSink(iface); HRESULT hr = S_OK;
- TRACE("%p, %s, %s.\n", iface, debugstr_time(systime), debugstr_time(offset)); + TRACE("%p, %s, %s.\n", iface, debugstr_reftime(systime), debugstr_reftime(offset));
EnterCriticalSection(&renderer->cs); if (renderer->audio_client) @@ -659,7 +659,7 @@ static HRESULT WINAPI audio_renderer_clock_sink_OnClockStop(IMFClockStateSink *i struct audio_renderer *renderer = impl_from_IMFClockStateSink(iface); HRESULT hr = S_OK;
- TRACE("%p, %s.\n", iface, debugstr_time(systime)); + TRACE("%p, %s.\n", iface, debugstr_reftime(systime));
EnterCriticalSection(&renderer->cs); if (renderer->audio_client) @@ -691,7 +691,7 @@ static HRESULT WINAPI audio_renderer_clock_sink_OnClockPause(IMFClockStateSink * struct audio_renderer *renderer = impl_from_IMFClockStateSink(iface); HRESULT hr;
- TRACE("%p, %s.\n", iface, debugstr_time(systime)); + TRACE("%p, %s.\n", iface, debugstr_reftime(systime));
EnterCriticalSection(&renderer->cs); if (renderer->state == STREAM_STATE_RUNNING) @@ -720,7 +720,7 @@ static HRESULT WINAPI audio_renderer_clock_sink_OnClockRestart(IMFClockStateSink BOOL preroll = FALSE; HRESULT hr = S_OK;
- TRACE("%p, %s.\n", iface, debugstr_time(systime)); + TRACE("%p, %s.\n", iface, debugstr_reftime(systime));
EnterCriticalSection(&renderer->cs); if (renderer->audio_client) @@ -746,7 +746,7 @@ static HRESULT WINAPI audio_renderer_clock_sink_OnClockRestart(IMFClockStateSink
static HRESULT WINAPI audio_renderer_clock_sink_OnClockSetRate(IMFClockStateSink *iface, MFTIME systime, float rate) { - FIXME("%p, %s, %f.\n", iface, debugstr_time(systime), rate); + FIXME("%p, %s, %f.\n", iface, debugstr_reftime(systime), rate);
return E_NOTIMPL; } diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c index f09a9c87a46..4f894f2f8f4 100644 --- a/dlls/mf/topology.c +++ b/dlls/mf/topology.c @@ -2288,7 +2288,7 @@ HRESULT WINAPI MFCreateSequencerSegmentOffset(MFSequencerElementId id, MFTIME ti { struct segment_offset *offset;
- TRACE("%#lx, %s, %p.\n", id, debugstr_time(timeoffset), ret); + TRACE("%#lx, %s, %p.\n", id, debugstr_reftime(timeoffset), ret);
if (!ret) return E_POINTER;
From: Alex Henrie alexhenrie24@gmail.com
--- dlls/mfplat/buffer.c | 2 +- dlls/mfplat/main.c | 10 +++++----- dlls/mfplat/mfplat_private.h | 21 --------------------- dlls/mfplat/sample.c | 4 ++-- 4 files changed, 8 insertions(+), 29 deletions(-)
diff --git a/dlls/mfplat/buffer.c b/dlls/mfplat/buffer.c index b7f32f12cdc..3770dd0eff4 100644 --- a/dlls/mfplat/buffer.c +++ b/dlls/mfplat/buffer.c @@ -1691,7 +1691,7 @@ HRESULT WINAPI MFCreateMediaBufferFromMediaType(IMFMediaType *media_type, LONGLO HRESULT hr; GUID major;
- TRACE("%p, %s, %lu, %lu, %p.\n", media_type, debugstr_time(duration), min_length, alignment, buffer); + TRACE("%p, %s, %lu, %lu, %p.\n", media_type, debugstr_reftime(duration), min_length, alignment, buffer);
if (!media_type) return E_INVALIDARG; diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index aa987ff0496..4262c9f7670 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -8193,7 +8193,7 @@ static HRESULT WINAPI system_time_source_sink_OnClockStart(IMFClockStateSink *if MFCLOCK_STATE state; HRESULT hr;
- TRACE("%p, %s, %s.\n", iface, debugstr_time(system_time), debugstr_time(start_offset)); + TRACE("%p, %s, %s.\n", iface, debugstr_reftime(system_time), debugstr_reftime(start_offset));
EnterCriticalSection(&source->cs); state = source->state; @@ -8224,7 +8224,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, debugstr_time(system_time)); + TRACE("%p, %s.\n", iface, debugstr_reftime(system_time));
EnterCriticalSection(&source->cs); if (SUCCEEDED(hr = system_time_source_change_state(source, CLOCK_CMD_STOP))) @@ -8241,7 +8241,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, debugstr_time(system_time)); + TRACE("%p, %s.\n", iface, debugstr_reftime(system_time));
EnterCriticalSection(&source->cs); if (SUCCEEDED(hr = system_time_source_change_state(source, CLOCK_CMD_PAUSE))) @@ -8258,7 +8258,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, debugstr_time(system_time)); + TRACE("%p, %s.\n", iface, debugstr_reftime(system_time));
EnterCriticalSection(&source->cs); if (SUCCEEDED(hr = system_time_source_change_state(source, CLOCK_CMD_RESTART))) @@ -8275,7 +8275,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, debugstr_time(system_time), rate); + TRACE("%p, %s, %f.\n", iface, debugstr_reftime(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 c9af96d88f9..703e0ce196f 100644 --- a/dlls/mfplat/mfplat_private.h +++ b/dlls/mfplat/mfplat_private.h @@ -183,24 +183,3 @@ static inline const char *mf_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]; - while (rev[j-1] == '0' && rev[j-2] != '.') --j; - rev[j] = 0; - - return wine_dbg_sprintf("%s", rev); -} diff --git a/dlls/mfplat/sample.c b/dlls/mfplat/sample.c index a50f81c93d4..afa40970029 100644 --- a/dlls/mfplat/sample.c +++ b/dlls/mfplat/sample.c @@ -528,7 +528,7 @@ static HRESULT WINAPI sample_SetSampleTime(IMFSample *iface, LONGLONG timestamp) { struct sample *sample = impl_from_IMFSample(iface);
- TRACE("%p, %s.\n", iface, debugstr_time(timestamp)); + TRACE("%p, %s.\n", iface, debugstr_reftime(timestamp));
EnterCriticalSection(&sample->attributes.cs); sample->timestamp = timestamp; @@ -559,7 +559,7 @@ static HRESULT WINAPI sample_SetSampleDuration(IMFSample *iface, LONGLONG durati { struct sample *sample = impl_from_IMFSample(iface);
- TRACE("%p, %s.\n", iface, debugstr_time(duration)); + TRACE("%p, %s.\n", iface, debugstr_reftime(duration));
EnterCriticalSection(&sample->attributes.cs); sample->duration = duration;
From: Alex Henrie alexhenrie24@gmail.com
--- dlls/mfsrcsnk/wave.c | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-)
diff --git a/dlls/mfsrcsnk/wave.c b/dlls/mfsrcsnk/wave.c index 736bbb5aa3c..be3872b1fcb 100644 --- a/dlls/mfsrcsnk/wave.c +++ b/dlls/mfsrcsnk/wave.c @@ -28,27 +28,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
-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]; - while (rev[j-1] == '0' && rev[j-2] != '.') --j; - rev[j] = 0; - - return wine_dbg_sprintf("%s", rev); -} - enum wave_sink_flags { SINK_SHUT_DOWN = 0x1, @@ -800,7 +779,7 @@ static HRESULT WINAPI wave_sink_clock_sink_OnClockStart(IMFClockStateSink *iface { struct wave_sink *sink = impl_from_IMFClockStateSink(iface);
- TRACE("%p, %s, %s.\n", iface, debugstr_time(systime), debugstr_time(offset)); + TRACE("%p, %s, %s.\n", iface, debugstr_reftime(systime), debugstr_reftime(offset));
return IMFMediaEventQueue_QueueEventParamVar(sink->stream_event_queue, MEStreamSinkStarted, &GUID_NULL, S_OK, NULL); } @@ -809,7 +788,7 @@ static HRESULT WINAPI wave_sink_clock_sink_OnClockStop(IMFClockStateSink *iface, { struct wave_sink *sink = impl_from_IMFClockStateSink(iface);
- TRACE("%p, %s.\n", iface, debugstr_time(systime)); + TRACE("%p, %s.\n", iface, debugstr_reftime(systime));
return IMFMediaEventQueue_QueueEventParamVar(sink->stream_event_queue, MEStreamSinkStopped, &GUID_NULL, S_OK, NULL); } @@ -818,7 +797,7 @@ static HRESULT WINAPI wave_sink_clock_sink_OnClockPause(IMFClockStateSink *iface { struct wave_sink *sink = impl_from_IMFClockStateSink(iface);
- TRACE("%p, %s.\n", iface, debugstr_time(systime)); + TRACE("%p, %s.\n", iface, debugstr_reftime(systime));
return IMFMediaEventQueue_QueueEventParamVar(sink->stream_event_queue, MEStreamSinkPaused, &GUID_NULL, S_OK, NULL); } @@ -827,14 +806,14 @@ static HRESULT WINAPI wave_sink_clock_sink_OnClockRestart(IMFClockStateSink *ifa { struct wave_sink *sink = impl_from_IMFClockStateSink(iface);
- TRACE("%p, %s.\n", iface, debugstr_time(systime)); + TRACE("%p, %s.\n", iface, debugstr_reftime(systime));
return IMFMediaEventQueue_QueueEventParamVar(sink->stream_event_queue, MEStreamSinkStarted, &GUID_NULL, S_OK, NULL); }
static HRESULT WINAPI wave_sink_clock_sink_OnClockSetRate(IMFClockStateSink *iface, MFTIME systime, float rate) { - FIXME("%p, %s, %f.\n", iface, debugstr_time(systime), rate); + FIXME("%p, %s, %f.\n", iface, debugstr_reftime(systime), rate);
return E_NOTIMPL; }
From: Alex Henrie alexhenrie24@gmail.com
--- dlls/qasf/asfreader.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-)
diff --git a/dlls/qasf/asfreader.c b/dlls/qasf/asfreader.c index 4cf077e9dd3..5c4ddbcfe80 100644 --- a/dlls/qasf/asfreader.c +++ b/dlls/qasf/asfreader.c @@ -27,27 +27,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
-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]; - while (rev[j-1] == '0' && rev[j-2] != '.') --j; - rev[j] = 0; - - return wine_dbg_sprintf("%s", rev); -} - struct buffer { INSSBuffer INSSBuffer_iface; @@ -345,8 +324,8 @@ static HRESULT WINAPI media_seeking_SetPositions(IMediaSeeking *iface, LONGLONG *current, DWORD current_flags, LONGLONG *stop, DWORD stop_flags) { FIXME("iface %p, current %s, current_flags %#lx, stop %s, stop_flags %#lx stub!\n", - iface, current ? debugstr_time(*current) : "<null>", current_flags, - stop ? debugstr_time(*stop) : "<null>", stop_flags); + iface, current ? debugstr_reftime(*current) : "<null>", current_flags, + stop ? debugstr_reftime(*stop) : "<null>", stop_flags); return SourceSeekingImpl_SetPositions(iface, current, current_flags, stop, stop_flags); }
From: Alex Henrie alexhenrie24@gmail.com
--- dlls/quartz/acmwrapper.c | 6 +++--- dlls/quartz/avidec.c | 2 +- dlls/quartz/dsoundrender.c | 10 +++++----- dlls/quartz/filtergraph.c | 12 ++++++------ dlls/quartz/memallocator.c | 8 ++++---- dlls/quartz/quartz_private.h | 21 --------------------- dlls/quartz/systemclock.c | 6 +++--- 7 files changed, 22 insertions(+), 43 deletions(-)
diff --git a/dlls/quartz/acmwrapper.c b/dlls/quartz/acmwrapper.c index 8e1b5e6b773..424a4b1cafa 100644 --- a/dlls/quartz/acmwrapper.c +++ b/dlls/quartz/acmwrapper.c @@ -202,7 +202,7 @@ static HRESULT WINAPI acm_wrapper_sink_Receive(struct strmbase_sink *iface, IMed goto error; }
- TRACE("Sample start time: %s.\n", debugstr_time(tStart)); + TRACE("Sample start time: %s.\n", debugstr_reftime(tStart)); if (ash.cbSrcLengthUsed == cbSrcStream) { IMediaSample_SetTime(pOutSample, &tStart, &tStop); @@ -235,7 +235,7 @@ static HRESULT WINAPI acm_wrapper_sink_Receive(struct strmbase_sink *iface, IMed IMediaSample_SetMediaTime(pOutSample, NULL, NULL); }
- TRACE("Sample stop time: %s\n", debugstr_time(tStart)); + TRACE("Sample stop time: %s\n", debugstr_reftime(tStart));
hr = IMemInputPin_Receive(This->source.pMemInputPin, pOutSample); if (hr != S_OK && hr != VFW_E_NOT_CONNECTED) { @@ -417,7 +417,7 @@ static HRESULT WINAPI acm_wrapper_source_qc_Notify(IQualityControl *iface, HRESULT hr = S_OK;
TRACE("filter %p, sender %p, type %#x, proportion %ld, late %s, timestamp %s.\n", - filter, sender, q.Type, q.Proportion, debugstr_time(q.Late), debugstr_time(q.TimeStamp)); + filter, sender, q.Type, q.Proportion, debugstr_reftime(q.Late), debugstr_reftime(q.TimeStamp));
if (filter->source_qc_sink) return IQualityControl_Notify(filter->source_qc_sink, &filter->filter.IBaseFilter_iface, q); diff --git a/dlls/quartz/avidec.c b/dlls/quartz/avidec.c index 8cc729748c1..9b0e8392c39 100644 --- a/dlls/quartz/avidec.c +++ b/dlls/quartz/avidec.c @@ -480,7 +480,7 @@ static HRESULT WINAPI avi_decompressor_source_qc_Notify(IQualityControl *iface, struct avi_decompressor *filter = impl_from_source_IQualityControl(iface);
TRACE("filter %p, sender %p, type %#x, proportion %ld, late %s, timestamp %s.\n", - filter, sender, q.Type, q.Proportion, debugstr_time(q.Late), debugstr_time(q.TimeStamp)); + filter, sender, q.Type, q.Proportion, debugstr_reftime(q.Late), debugstr_reftime(q.TimeStamp));
EnterCriticalSection(&filter->filter.stream_cs); if (q.Late > 0) diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index 10eed43422e..84d48f51b5b 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -182,7 +182,7 @@ static HRESULT DSoundRender_GetWritePos(struct dsound_render *This, *ret_writepos = writepos; } else if (delta_t < 0) { REFERENCE_TIME past, min_writepos_t; - WARN("Delta too big %s/%s, overwriting old data or even skipping\n", debugstr_time(delta_t), debugstr_time(max_lag)); + WARN("Delta too big %s/%s, overwriting old data or even skipping\n", debugstr_reftime(delta_t), debugstr_reftime(max_lag)); if (min_writepos >= playpos) min_writepos_t = cur + time_from_pos(This, min_writepos - playpos); else @@ -200,7 +200,7 @@ static HRESULT DSoundRender_GetWritePos(struct dsound_render *This, } } else /* delta_t > 0 */ { DWORD aheadbytes; - WARN("Delta too big %s/%s, too far ahead\n", debugstr_time(delta_t), debugstr_time(max_lag)); + WARN("Delta too big %s/%s, too far ahead\n", debugstr_reftime(delta_t), debugstr_reftime(max_lag)); aheadbytes = pos_from_time(This, delta_t); WARN("Advancing %lu bytes.\n", aheadbytes); if (delta_t >= DSoundRenderer_Max_Fill) @@ -213,8 +213,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 %s / %s\n", debugstr_time(time_from_pos(This, This->buf_size - *pfree)), - debugstr_time(DSoundRenderer_Max_Fill)); + TRACE("Blocked: too full %s / %s\n", debugstr_reftime(time_from_pos(This, This->buf_size - *pfree)), + debugstr_reftime(DSoundRenderer_Max_Fill)); return S_FALSE; } return S_OK; @@ -964,7 +964,7 @@ static HRESULT WINAPI dsound_render_qc_Notify(IQualityControl *iface, struct dsound_render *filter = impl_from_IQualityControl(iface);
FIXME("filter %p, sender %p, type %#x, proportion %ld, late %s, timestamp %s, stub!\n", - filter, sender, q.Type, q.Proportion, debugstr_time(q.Late), debugstr_time(q.TimeStamp)); + filter, sender, q.Type, q.Proportion, debugstr_reftime(q.Late), debugstr_reftime(q.TimeStamp));
return E_NOTIMPL; } diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 4100e71be3a..f4e89d0ce7d 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -2315,7 +2315,7 @@ static HRESULT WINAPI MediaSeeking_GetDuration(IMediaSeeking *iface, LONGLONG *d LeaveCriticalSection(&graph->cs);
TRACE("Returning hr %#lx, duration %s (%s seconds).\n", hr, - wine_dbgstr_longlong(*duration), debugstr_time(*duration)); + wine_dbgstr_longlong(*duration), debugstr_reftime(*duration)); return hr; }
@@ -2356,7 +2356,7 @@ static HRESULT WINAPI MediaSeeking_GetStopPosition(IMediaSeeking *iface, LONGLON
LeaveCriticalSection(&graph->cs);
- TRACE("Returning %s (%s seconds).\n", wine_dbgstr_longlong(*stop), debugstr_time(*stop)); + TRACE("Returning %s (%s seconds).\n", wine_dbgstr_longlong(*stop), debugstr_reftime(*stop)); return hr; }
@@ -2386,7 +2386,7 @@ static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface, LONG
LeaveCriticalSection(&graph->cs);
- TRACE("Returning %s (%s seconds).\n", wine_dbgstr_longlong(ret), debugstr_time(ret)); + TRACE("Returning %s (%s seconds).\n", wine_dbgstr_longlong(ret), debugstr_reftime(ret)); *current = ret;
return S_OK; @@ -2427,10 +2427,10 @@ static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface, LONGLONG * 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)); + wine_dbgstr_longlong(*current_ptr), debugstr_reftime(*current_ptr)); if (stop_ptr) TRACE("Setting stop position to %s (%s seconds).\n", - wine_dbgstr_longlong(*stop_ptr), debugstr_time(*stop_ptr)); + wine_dbgstr_longlong(*stop_ptr), debugstr_reftime(*stop_ptr));
if ((current_flags & 0x7) != AM_SEEKING_AbsolutePositioning && (current_flags & 0x7) != AM_SEEKING_NoPositioning) @@ -5159,7 +5159,7 @@ static HRESULT WINAPI MediaFilter_Run(IMediaFilter *iface, REFERENCE_TIME start) struct filter_graph *graph = impl_from_IMediaFilter(iface); HRESULT hr;
- TRACE("graph %p, start %s.\n", graph, debugstr_time(start)); + TRACE("graph %p, start %s.\n", graph, debugstr_reftime(start));
EnterCriticalSection(&graph->cs);
diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c index 87869b4d6b2..bd6e3ea936a 100644 --- a/dlls/quartz/memallocator.c +++ b/dlls/quartz/memallocator.c @@ -560,8 +560,8 @@ static HRESULT WINAPI StdMediaSample2_SetTime(IMediaSample2 *iface, REFERENCE_TI { StdMediaSample2 *sample = impl_from_IMediaSample2(iface);
- TRACE("sample %p, start %s, end %s.\n", sample, start ? debugstr_time(*start) : "(null)", - end ? debugstr_time(*end) : "(null)"); + TRACE("sample %p, start %s, end %s.\n", sample, start ? debugstr_reftime(*start) : "(null)", + end ? debugstr_reftime(*end) : "(null)");
if (start) { @@ -742,8 +742,8 @@ static HRESULT WINAPI StdMediaSample2_SetMediaTime(IMediaSample2 *iface, LONGLON { StdMediaSample2 *sample = impl_from_IMediaSample2(iface);
- TRACE("sample %p, start %s, end %s.\n", sample, start ? debugstr_time(*start) : "(null)", - end ? debugstr_time(*end) : "(null)"); + TRACE("sample %p, start %s, end %s.\n", sample, start ? debugstr_reftime(*start) : "(null)", + end ? debugstr_reftime(*end) : "(null)");
if (start) { diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h index 849795d9c1b..af31afc1d74 100644 --- a/dlls/quartz/quartz_private.h +++ b/dlls/quartz/quartz_private.h @@ -44,27 +44,6 @@ 0, 0, { (DWORD_PTR)(__FILE__ ": " # cs) }}; \ static CRITICAL_SECTION cs = { &cs##_debug, -1, 0, 0, 0, 0 };
-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]; - while (rev[j-1] == '0' && rev[j-2] != '.') --j; - 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 01a8e9fa1ee..51fcc99db75 100644 --- a/dlls/quartz/systemclock.c +++ b/dlls/quartz/systemclock.c @@ -255,7 +255,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)); + TRACE("clock %p, time %p, returning %s.\n", clock, time, debugstr_reftime(ret)); return hr; }
@@ -265,7 +265,7 @@ static HRESULT WINAPI SystemClockImpl_AdviseTime(IReferenceClock *iface, struct system_clock *clock = impl_from_IReferenceClock(iface);
TRACE("clock %p, base %s, offset %s, event %#Ix, cookie %p.\n", - clock, debugstr_time(base), debugstr_time(offset), event, cookie); + clock, debugstr_reftime(base), debugstr_reftime(offset), event, cookie);
if (base + offset <= 0) return E_INVALIDARG; @@ -279,7 +279,7 @@ static HRESULT WINAPI SystemClockImpl_AdvisePeriodic(IReferenceClock* iface, struct system_clock *clock = impl_from_IReferenceClock(iface);
TRACE("clock %p, start %s, period %s, semaphore %#Ix, cookie %p.\n", - clock, debugstr_time(start), debugstr_time(period), semaphore, cookie); + clock, debugstr_reftime(start), debugstr_reftime(period), semaphore, cookie);
if (start <= 0 || period <= 0) return E_INVALIDARG;
From: Alex Henrie alexhenrie24@gmail.com
--- dlls/winegstreamer/gst_private.h | 21 --------------------- dlls/winegstreamer/media_sink.c | 10 +++++----- dlls/winegstreamer/quartz_parser.c | 6 +++--- dlls/winegstreamer/quartz_transform.c | 4 ++-- dlls/winegstreamer/wm_reader.c | 8 ++++---- 5 files changed, 14 insertions(+), 35 deletions(-)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 26873edb74b..7d5abfd5937 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -41,27 +41,6 @@
bool array_reserve(void **elements, size_t *capacity, size_t count, size_t size);
-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]; - while (rev[j-1] == '0' && rev[j-2] != '.') --j; - rev[j] = 0; - - return wine_dbg_sprintf("%s", rev); -} - #define MEDIATIME_FROM_BYTES(x) ((LONGLONG)(x) * 10000000)
struct wg_sample_queue; diff --git a/dlls/winegstreamer/media_sink.c b/dlls/winegstreamer/media_sink.c index 6996d689e83..c1d6cfb3ede 100644 --- a/dlls/winegstreamer/media_sink.c +++ b/dlls/winegstreamer/media_sink.c @@ -987,7 +987,7 @@ static HRESULT WINAPI media_sink_clock_sink_OnClockStart(IMFClockStateSink *ifac struct media_sink *media_sink = impl_from_IMFClockStateSink(iface); HRESULT hr;
- TRACE("iface %p, systime %s, offset %s.\n", iface, debugstr_time(systime), debugstr_time(offset)); + TRACE("iface %p, systime %s, offset %s.\n", iface, debugstr_reftime(systime), debugstr_reftime(offset));
EnterCriticalSection(&media_sink->cs);
@@ -1002,7 +1002,7 @@ static HRESULT WINAPI media_sink_clock_sink_OnClockStop(IMFClockStateSink *iface struct media_sink *media_sink = impl_from_IMFClockStateSink(iface); HRESULT hr;
- TRACE("iface %p, systime %s.\n", iface, debugstr_time(systime)); + TRACE("iface %p, systime %s.\n", iface, debugstr_reftime(systime));
EnterCriticalSection(&media_sink->cs);
@@ -1017,7 +1017,7 @@ static HRESULT WINAPI media_sink_clock_sink_OnClockPause(IMFClockStateSink *ifac struct media_sink *media_sink = impl_from_IMFClockStateSink(iface); HRESULT hr;
- TRACE("iface %p, systime %s.\n", iface, debugstr_time(systime)); + TRACE("iface %p, systime %s.\n", iface, debugstr_reftime(systime));
EnterCriticalSection(&media_sink->cs);
@@ -1032,7 +1032,7 @@ static HRESULT WINAPI media_sink_clock_sink_OnClockRestart(IMFClockStateSink *if struct media_sink *media_sink = impl_from_IMFClockStateSink(iface); HRESULT hr;
- TRACE("iface %p, systime %s.\n", iface, debugstr_time(systime)); + TRACE("iface %p, systime %s.\n", iface, debugstr_reftime(systime));
EnterCriticalSection(&media_sink->cs);
@@ -1044,7 +1044,7 @@ static HRESULT WINAPI media_sink_clock_sink_OnClockRestart(IMFClockStateSink *if
static HRESULT WINAPI media_sink_clock_sink_OnClockSetRate(IMFClockStateSink *iface, MFTIME systime, float rate) { - FIXME("iface %p, systime %s, rate %f stub!\n", iface, debugstr_time(systime), rate); + FIXME("iface %p, systime %s, rate %f stub!\n", iface, debugstr_reftime(systime), rate);
return E_NOTIMPL; } diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c index 0670fbd5181..c85192381fb 100644 --- a/dlls/winegstreamer/quartz_parser.c +++ b/dlls/winegstreamer/quartz_parser.c @@ -1698,8 +1698,8 @@ static HRESULT WINAPI GST_Seeking_SetPositions(IMediaSeeking *iface, int i;
TRACE("pin %p, current %s, current_flags %#lx, stop %s, stop_flags %#lx.\n", - pin, current ? debugstr_time(*current) : "<null>", current_flags, - stop ? debugstr_time(*stop) : "<null>", stop_flags); + pin, current ? debugstr_reftime(*current) : "<null>", current_flags, + stop ? debugstr_reftime(*stop) : "<null>", stop_flags);
if (pin->pin.pin.filter->state == State_Stopped) { @@ -1832,7 +1832,7 @@ static HRESULT WINAPI GST_QualityControl_Notify(IQualityControl *iface, IBaseFil
TRACE("pin %p, sender %p, type %s, proportion %ld, late %s, timestamp %s.\n", pin, sender, q.Type == Famine ? "Famine" : "Flood", q.Proportion, - debugstr_time(q.Late), debugstr_time(q.TimeStamp)); + debugstr_reftime(q.Late), debugstr_reftime(q.TimeStamp));
/* DirectShow filters sometimes pass negative timestamps (Audiosurf uses the * current time instead of the time of the last buffer). GstClockTime is diff --git a/dlls/winegstreamer/quartz_transform.c b/dlls/winegstreamer/quartz_transform.c index fee275bb1ee..0df50e0e25e 100644 --- a/dlls/winegstreamer/quartz_transform.c +++ b/dlls/winegstreamer/quartz_transform.c @@ -454,7 +454,7 @@ static HRESULT WINAPI sink_quality_control_Notify(IQualityControl *iface, IBaseF struct transform *filter = impl_from_sink_IQualityControl(iface);
TRACE("filter %p, sender %p, type %#x, proportion %ld, late %s, timestamp %s.\n", - filter, sender, q.Type, q.Proportion, debugstr_time(q.Late), debugstr_time(q.TimeStamp)); + filter, sender, q.Type, q.Proportion, debugstr_reftime(q.Late), debugstr_reftime(q.TimeStamp));
return S_OK; } @@ -509,7 +509,7 @@ static HRESULT WINAPI source_quality_control_Notify(IQualityControl *iface, IBas HRESULT hr = VFW_E_NOT_FOUND;
TRACE("filter %p, sender %p, type %#x, proportion %ld, late %s, timestamp %s.\n", - filter, sender, q.Type, q.Proportion, debugstr_time(q.Late), debugstr_time(q.TimeStamp)); + filter, sender, q.Type, q.Proportion, debugstr_reftime(q.Late), debugstr_reftime(q.TimeStamp));
if (filter->qc_sink) return IQualityControl_Notify(filter->qc_sink, &filter->filter.IBaseFilter_iface, q); diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index 882b6df1bbb..faac6e17a8c 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -931,7 +931,7 @@ static HRESULT WINAPI profile_CreateNewStreamPrioritization(IWMProfile3 *iface,
static HRESULT WINAPI profile_GetExpectedPacketCount(IWMProfile3 *iface, QWORD duration, QWORD *count) { - FIXME("iface %p, duration %s, count %p, stub!\n", iface, debugstr_time(duration), count); + FIXME("iface %p, duration %s, count %p, stub!\n", iface, debugstr_reftime(duration), count); return E_NOTIMPL; }
@@ -1045,7 +1045,7 @@ static HRESULT WINAPI header_info_GetAttributeByName(IWMHeaderInfo3 *iface, WORD EnterCriticalSection(&reader->cs); duration = wg_parser_stream_get_duration(wg_parser_get_stream(reader->wg_parser, 0)); LeaveCriticalSection(&reader->cs); - TRACE("Returning duration %s.\n", debugstr_time(duration)); + TRACE("Returning duration %s.\n", debugstr_reftime(duration)); memcpy(value, &duration, sizeof(QWORD)); return S_OK; } @@ -1100,7 +1100,7 @@ static HRESULT WINAPI header_info_GetMarker(IWMHeaderInfo3 *iface,
static HRESULT WINAPI header_info_AddMarker(IWMHeaderInfo3 *iface, const WCHAR *name, QWORD time) { - FIXME("iface %p, name %s, time %s, stub!\n", iface, debugstr_w(name), debugstr_time(time)); + FIXME("iface %p, name %s, time %s, stub!\n", iface, debugstr_w(name), debugstr_reftime(time)); return E_NOTIMPL; }
@@ -1128,7 +1128,7 @@ static HRESULT WINAPI header_info_AddScript(IWMHeaderInfo3 *iface, const WCHAR *type, const WCHAR *command, QWORD time) { FIXME("iface %p, type %s, command %s, time %s, stub!\n", - iface, debugstr_w(type), debugstr_w(command), debugstr_time(time)); + iface, debugstr_w(type), debugstr_w(command), debugstr_reftime(time)); return E_NOTIMPL; }
From: Alex Henrie alexhenrie24@gmail.com
--- dlls/wmvcore/async_reader.c | 12 ++++++------ dlls/wmvcore/wmvcore_private.h | 21 --------------------- 2 files changed, 6 insertions(+), 27 deletions(-)
diff --git a/dlls/wmvcore/async_reader.c b/dlls/wmvcore/async_reader.c index 3a8556a5f0a..ec4b1c999d4 100644 --- a/dlls/wmvcore/async_reader.c +++ b/dlls/wmvcore/async_reader.c @@ -275,8 +275,8 @@ static void async_reader_deliver_sample(struct async_reader *reader, struct samp HRESULT hr;
TRACE("reader %p, output %lu, stream %u, pts %s, duration %s, flags %#lx, buffer %p.\n", - reader, sample->output, sample->stream, debugstr_time(sample->pts), - debugstr_time(sample->duration), sample->flags, sample->buffer); + reader, sample->output, sample->stream, debugstr_reftime(sample->pts), + debugstr_reftime(sample->duration), sample->flags, sample->buffer);
if (FAILED(hr = IWMSyncReader2_GetReadStreamSamples(reader->reader, sample->stream, &read_compressed))) @@ -685,7 +685,7 @@ static HRESULT WINAPI WMReader_Start(IWMReader *iface, HRESULT hr;
TRACE("reader %p, start %s, duration %s, rate %.8e, context %p.\n", - reader, debugstr_time(start), debugstr_time(duration), rate, context); + reader, debugstr_reftime(start), debugstr_reftime(duration), rate, context);
if (rate != 1.0f) FIXME("Ignoring rate %.8e.\n", rate); @@ -799,7 +799,7 @@ static HRESULT WINAPI WMReaderAdvanced_DeliverTime(IWMReaderAdvanced6 *iface, QW { struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
- TRACE("reader %p, time %s.\n", reader, debugstr_time(time)); + TRACE("reader %p, time %s.\n", reader, debugstr_reftime(time));
EnterCriticalSection(&reader->callback_cs);
@@ -1860,7 +1860,7 @@ static HRESULT WINAPI refclock_AdviseTime(IReferenceClock *iface, REFERENCE_TIME struct async_reader *reader = impl_from_IReferenceClock(iface);
FIXME("reader %p, basetime %s, streamtime %s, event %#Ix, cookie %p, stub!\n", - reader, debugstr_time(basetime), debugstr_time(streamtime), event, cookie); + reader, debugstr_reftime(basetime), debugstr_reftime(streamtime), event, cookie);
return E_NOTIMPL; } @@ -1871,7 +1871,7 @@ static HRESULT WINAPI refclock_AdvisePeriodic(IReferenceClock *iface, REFERENCE_ struct async_reader *reader = impl_from_IReferenceClock(iface);
FIXME("reader %p, starttime %s, period %s, semaphore %#Ix, cookie %p, stub!\n", - reader, debugstr_time(starttime), debugstr_time(period), semaphore, cookie); + reader, debugstr_reftime(starttime), debugstr_reftime(period), semaphore, cookie);
return E_NOTIMPL; } diff --git a/dlls/wmvcore/wmvcore_private.h b/dlls/wmvcore/wmvcore_private.h index a5225d79da9..81ecdf953a2 100644 --- a/dlls/wmvcore/wmvcore_private.h +++ b/dlls/wmvcore/wmvcore_private.h @@ -27,24 +27,3 @@ #include "wine/debug.h"
HRESULT WINAPI winegstreamer_create_wm_sync_reader(IUnknown *outer, void **out); - -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]; - while (rev[j-1] == '0' && rev[j-2] != '.') --j; - rev[j] = 0; - - return wine_dbg_sprintf("%s", rev); -}
From: Alex Henrie alexhenrie24@gmail.com
--- libs/strmbase/filter.c | 2 +- libs/strmbase/mediatype.c | 4 ++-- libs/strmbase/pin.c | 4 ++-- libs/strmbase/renderer.c | 8 ++++---- libs/strmbase/seeking.c | 6 +++--- libs/strmbase/strmbase_private.h | 21 --------------------- 6 files changed, 12 insertions(+), 33 deletions(-)
diff --git a/libs/strmbase/filter.c b/libs/strmbase/filter.c index ee41611a198..8beff98623d 100644 --- a/libs/strmbase/filter.c +++ b/libs/strmbase/filter.c @@ -347,7 +347,7 @@ static HRESULT WINAPI filter_Run(IBaseFilter *iface, REFERENCE_TIME start) struct strmbase_filter *filter = impl_from_IBaseFilter(iface); HRESULT hr = S_OK;
- TRACE("filter %p %s, start %s.\n", filter, debugstr_w(filter->name), debugstr_time(start)); + TRACE("filter %p %s, start %s.\n", filter, debugstr_w(filter->name), debugstr_reftime(start));
EnterCriticalSection(&filter->filter_cs);
diff --git a/libs/strmbase/mediatype.c b/libs/strmbase/mediatype.c index af813e2ffee..a4b05be6282 100644 --- a/libs/strmbase/mediatype.c +++ b/libs/strmbase/mediatype.c @@ -101,7 +101,7 @@ void strmbase_dump_media_type(const AM_MEDIA_TYPE *mt) if (!IsRectEmpty(&vih->rcTarget)) TRACE("target %s, ", wine_dbgstr_rect(&vih->rcTarget)); if (vih->dwBitRate) TRACE("bitrate %lu, ", vih->dwBitRate); if (vih->dwBitErrorRate) TRACE("error rate %lu, ", vih->dwBitErrorRate); - TRACE("%s sec/frame, ", debugstr_time(vih->AvgTimePerFrame)); + TRACE("%s sec/frame, ", debugstr_reftime(vih->AvgTimePerFrame)); TRACE("size %ldx%ld, %u planes, %u bpp, compression %s, image size %lu", vih->bmiHeader.biWidth, vih->bmiHeader.biHeight, vih->bmiHeader.biPlanes, vih->bmiHeader.biBitCount, debugstr_fourcc(vih->bmiHeader.biCompression), @@ -120,7 +120,7 @@ void strmbase_dump_media_type(const AM_MEDIA_TYPE *mt) if (!IsRectEmpty(&vih->rcTarget)) TRACE("target %s, ", wine_dbgstr_rect(&vih->rcTarget)); if (vih->dwBitRate) TRACE("bitrate %lu, ", vih->dwBitRate); if (vih->dwBitErrorRate) TRACE("error rate %lu, ", vih->dwBitErrorRate); - TRACE("%s sec/frame, ", debugstr_time(vih->AvgTimePerFrame)); + TRACE("%s sec/frame, ", debugstr_reftime(vih->AvgTimePerFrame)); if (vih->dwInterlaceFlags) TRACE("interlace flags %#lx, ", vih->dwInterlaceFlags); if (vih->dwCopyProtectFlags) TRACE("copy-protection flags %#lx, ", vih->dwCopyProtectFlags); TRACE("aspect ratio %lu/%lu, ", vih->dwPictAspectRatioX, vih->dwPictAspectRatioY); diff --git a/libs/strmbase/pin.c b/libs/strmbase/pin.c index 03330837477..8a4e86b73e4 100644 --- a/libs/strmbase/pin.c +++ b/libs/strmbase/pin.c @@ -650,7 +650,7 @@ static HRESULT WINAPI source_NewSegment(IPin * iface, REFERENCE_TIME start, REFE struct strmbase_source *pin = impl_source_from_IPin(iface);
TRACE("pin %p %s:%s, start %s, stop %s, rate %.16e.\n", pin, debugstr_w(pin->pin.filter->name), - debugstr_w(pin->pin.name), debugstr_time(start), debugstr_time(stop), rate); + debugstr_w(pin->pin.name), debugstr_reftime(start), debugstr_reftime(stop), rate);
return S_OK; } @@ -995,7 +995,7 @@ static HRESULT WINAPI sink_NewSegment(IPin *iface, REFERENCE_TIME start, REFEREN newsegmentargs args;
TRACE("pin %p %s:%s, start %s, stop %s, rate %.16e.\n", pin, debugstr_w(pin->pin.filter->name), - debugstr_w(pin->pin.name), debugstr_time(start), debugstr_time(stop), rate); + debugstr_w(pin->pin.name), debugstr_reftime(start), debugstr_reftime(stop), rate);
if (pin->pFuncsTable->sink_new_segment) return pin->pFuncsTable->sink_new_segment(pin, start, stop, rate); diff --git a/libs/strmbase/renderer.c b/libs/strmbase/renderer.c index dc421f499ed..ec3909a2089 100644 --- a/libs/strmbase/renderer.c +++ b/libs/strmbase/renderer.c @@ -107,11 +107,11 @@ static void perform_qos(struct strmbase_renderer *filter, }
TRACE("start %s, entered %s, left %s, pt %s, duration %s, jitter %s.\n", - debugstr_time(start), debugstr_time(entered), debugstr_time(left), - debugstr_time(pt), debugstr_time(duration), debugstr_time(jitter)); + debugstr_reftime(start), debugstr_reftime(entered), debugstr_reftime(left), + debugstr_reftime(pt), debugstr_reftime(duration), debugstr_reftime(jitter));
TRACE("average duration %s, average pt %s, average rate %.16e.\n", - debugstr_time(filter->avg_duration), debugstr_time(filter->avg_pt), filter->avg_rate); + debugstr_reftime(filter->avg_duration), debugstr_reftime(filter->avg_pt), filter->avg_rate);
/* Collect running averages. For first observations, we copy the values. */ if (filter->avg_duration < 0) @@ -527,7 +527,7 @@ static HRESULT WINAPI quality_control_Notify(IQualityControl *iface, IBaseFilter HRESULT hr = S_FALSE;
TRACE("filter %p, sender %p, type %#x, proportion %ld, late %s, timestamp %s.\n", - filter, sender, q.Type, q.Proportion, debugstr_time(q.Late), debugstr_time(q.TimeStamp)); + filter, sender, q.Type, q.Proportion, debugstr_reftime(q.Late), debugstr_reftime(q.TimeStamp));
if (filter->qc_sink) return IQualityControl_Notify(filter->qc_sink, &filter->filter.IBaseFilter_iface, q); diff --git a/libs/strmbase/seeking.c b/libs/strmbase/seeking.c index 91e9ccedfb4..23e3af4f9e1 100644 --- a/libs/strmbase/seeking.c +++ b/libs/strmbase/seeking.c @@ -222,8 +222,8 @@ HRESULT WINAPI SourceSeekingImpl_SetPositions(IMediaSeeking * iface, LONGLONG * LONGLONG llNewCurrent, llNewStop;
TRACE("iface %p, current %s, current_flags %#lx, stop %s, stop_flags %#lx.\n", iface, - pCurrent ? debugstr_time(*pCurrent) : "<null>", dwCurrentFlags, - pStop ? debugstr_time(*pStop): "<null>", dwStopFlags); + pCurrent ? debugstr_reftime(*pCurrent) : "<null>", dwCurrentFlags, + pStop ? debugstr_reftime(*pStop): "<null>", dwStopFlags);
EnterCriticalSection(&This->cs);
@@ -235,7 +235,7 @@ HRESULT WINAPI SourceSeekingImpl_SetPositions(IMediaSeeking * iface, LONGLONG * if (llNewStop != This->llStop) bChangeStop = TRUE;
- TRACE("Seeking from %s to %s.\n", debugstr_time(This->llCurrent), debugstr_time(llNewCurrent)); + TRACE("Seeking from %s to %s.\n", debugstr_reftime(This->llCurrent), debugstr_reftime(llNewCurrent));
This->llCurrent = llNewCurrent; This->llStop = llNewStop; diff --git a/libs/strmbase/strmbase_private.h b/libs/strmbase/strmbase_private.h index cf702a279c2..374b10e7d51 100644 --- a/libs/strmbase/strmbase_private.h +++ b/libs/strmbase/strmbase_private.h @@ -30,25 +30,4 @@ #include "wine/list.h" #include "wine/strmbase.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]; - while (rev[j-1] == '0' && rev[j-2] != '.') --j; - rev[j] = 0; - - return wine_dbg_sprintf("%s", rev); -} - #endif /* __WINE_STRMBASE_PRIVATE_H */
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=141503
Your paranoid android.
=== debian11 (build log) ===
error: patch failed: dlls/winegstreamer/quartz_transform.c:509 Task: Patch failed to apply
=== debian11b (build log) ===
error: patch failed: dlls/winegstreamer/quartz_transform.c:509 Task: Patch failed to apply
On Mon Nov 27 19:45:25 2023 +0000, Rémi Bernon wrote:
Thanks for the feedback Rémi. I'm hesitant to have debug functions with the same name and different implementations. I did just push a new version that calls the function `debugstr_reftime` because that seems to be the most common name for this time format.
The slightly unfortunate thing about shortening it to "reftime" is that DirectShow (specifically the Automation-focused interfaces) have REFTIME, which expresses the same quantities but is typedef'd to double.
On Fri Dec 29 19:48:43 2023 +0000, Zebediah Figura wrote:
In the future we could make a separate ds_debugstr_reftime function, like how there is a global debugstr_fourcc function and a specific mf_debugstr_fourcc for Media Foundation. Do you see a better way to do it?
On Fri Dec 29 19:48:43 2023 +0000, Alex Henrie wrote:
Is it bad to have it in strmbase.h for now?
On Fri Dec 29 19:56:58 2023 +0000, Nikolay Sivov wrote:
Is it bad to have it in strmbase.h for now?
That would be fine. We'd just have to add `#include "wine/strmbase.h"` to mf, mfplat, mfsrcsnk, and wmvcore.
In the future we could make a separate ds_debugstr_reftime function, like how there is a global debugstr_fourcc function and a specific mf_debugstr_fourcc for Media Foundation. Do you see a better way to do it?
The problem isn't that we'll need a separate function for dumping REFTIME; float printf is perfectly fine for that. The problem is that calling this function debugstr_reftime() is potentially misleading.
On Fri Dec 29 20:56:14 2023 +0000, Alex Henrie wrote:
That would be fine. We'd just have to add `#include "wine/strmbase.h"` to mf, mfplat, mfsrcsnk, and wmvcore.
Not necessarily, we don't need to fix everything at once.
On Sun Jan 7 21:57:25 2024 +0000, Zebediah Figura wrote:
Okay. I really just want to eliminate the code duplication and I don't have strong feelings about exactly how to accomplish that. What would you two like the function to be called, and where would you like it to be defined?