ReactOS 0.4.17-dev-966-gf06eace
seeking.c File Reference
#include "strmbase_private.h"
Include dependency graph for seeking.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (quartz)
 
static SourceSeeking * impl_from_IMediaSeeking (IMediaSeeking *iface)
 
HRESULT strmbase_seeking_init (SourceSeeking *pSeeking, const IMediaSeekingVtbl *Vtbl, SourceSeeking_ChangeStop fnChangeStop, SourceSeeking_ChangeStart fnChangeStart, SourceSeeking_ChangeRate fnChangeRate)
 
void strmbase_seeking_cleanup (SourceSeeking *seeking)
 
HRESULT WINAPI SourceSeekingImpl_GetCapabilities (IMediaSeeking *iface, DWORD *pCapabilities)
 
HRESULT WINAPI SourceSeekingImpl_CheckCapabilities (IMediaSeeking *iface, DWORD *pCapabilities)
 
HRESULT WINAPI SourceSeekingImpl_IsFormatSupported (IMediaSeeking *iface, const GUID *pFormat)
 
HRESULT WINAPI SourceSeekingImpl_QueryPreferredFormat (IMediaSeeking *iface, GUID *pFormat)
 
HRESULT WINAPI SourceSeekingImpl_GetTimeFormat (IMediaSeeking *iface, GUID *pFormat)
 
HRESULT WINAPI SourceSeekingImpl_IsUsingTimeFormat (IMediaSeeking *iface, const GUID *pFormat)
 
HRESULT WINAPI SourceSeekingImpl_SetTimeFormat (IMediaSeeking *iface, const GUID *pFormat)
 
HRESULT WINAPI SourceSeekingImpl_GetDuration (IMediaSeeking *iface, LONGLONG *pDuration)
 
HRESULT WINAPI SourceSeekingImpl_GetStopPosition (IMediaSeeking *iface, LONGLONG *pStop)
 
HRESULT WINAPI SourceSeekingImpl_GetCurrentPosition (IMediaSeeking *iface, LONGLONG *pCurrent)
 
HRESULT WINAPI SourceSeekingImpl_ConvertTimeFormat (IMediaSeeking *iface, LONGLONG *pTarget, const GUID *pTargetFormat, LONGLONG Source, const GUID *pSourceFormat)
 
static LONGLONG Adjust (LONGLONG value, const LONGLONG *pModifier, DWORD dwFlags)
 
HRESULT WINAPI SourceSeekingImpl_SetPositions (IMediaSeeking *iface, LONGLONG *pCurrent, DWORD dwCurrentFlags, LONGLONG *pStop, DWORD dwStopFlags)
 
HRESULT WINAPI SourceSeekingImpl_GetPositions (IMediaSeeking *iface, LONGLONG *pCurrent, LONGLONG *pStop)
 
HRESULT WINAPI SourceSeekingImpl_GetAvailable (IMediaSeeking *iface, LONGLONG *pEarliest, LONGLONG *pLatest)
 
HRESULT WINAPI SourceSeekingImpl_SetRate (IMediaSeeking *iface, double dRate)
 
HRESULT WINAPI SourceSeekingImpl_GetRate (IMediaSeeking *iface, double *dRate)
 
HRESULT WINAPI SourceSeekingImpl_GetPreroll (IMediaSeeking *iface, LONGLONG *pPreroll)
 

Function Documentation

◆ Adjust()

static LONGLONG Adjust ( LONGLONG  value,
const LONGLONG *  pModifier,
DWORD  dwFlags 
)
inlinestatic

Definition at line 202 of file seeking.c.

203{
205 {
207 return value;
209 return *pModifier;
212 return value + *pModifier;
213 default:
214 assert(FALSE);
215 return 0;
216 }
217}
@ AM_SEEKING_RelativePositioning
Definition: axcore.idl:593
@ AM_SEEKING_IncrementalPositioning
Definition: axcore.idl:594
@ AM_SEEKING_NoPositioning
Definition: axcore.idl:591
@ AM_SEEKING_PositioningBitsMask
Definition: axcore.idl:595
@ AM_SEEKING_AbsolutePositioning
Definition: axcore.idl:592
#define FALSE
Definition: types.h:117
#define assert(_expr)
Definition: assert.h:32
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
Definition: pdh_main.c:64

Referenced by AdjustPacket(), ft_glyphslot_preset_bitmap(), and SourceSeekingImpl_SetPositions().

◆ impl_from_IMediaSeeking()

◆ SourceSeekingImpl_CheckCapabilities()

HRESULT WINAPI SourceSeekingImpl_CheckCapabilities ( IMediaSeeking *  iface,
DWORD *  pCapabilities 
)

Definition at line 75 of file seeking.c.

76{
78 HRESULT hr;
79 DWORD dwCommonCaps;
80
81 TRACE("(%p)\n", pCapabilities);
82
83 if (!pCapabilities)
84 return E_POINTER;
85
86 dwCommonCaps = *pCapabilities & This->dwCapabilities;
87
88 if (!dwCommonCaps)
89 hr = E_FAIL;
90 else
91 hr = (*pCapabilities == dwCommonCaps) ? S_OK : S_FALSE;
92 *pCapabilities = dwCommonCaps;
93 return hr;
94}
#define E_FAIL
Definition: ddrawi.h:102
HRESULT hr
Definition: delayimp.cpp:582
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:52
static SourceSeeking * impl_from_IMediaSeeking(IMediaSeeking *iface)
Definition: seeking.c:26
#define TRACE(s)
Definition: solgame.cpp:4
#define S_FALSE
Definition: winerror.h:3451
#define E_POINTER
Definition: winerror.h:3480

◆ SourceSeekingImpl_ConvertTimeFormat()

HRESULT WINAPI SourceSeekingImpl_ConvertTimeFormat ( IMediaSeeking *  iface,
LONGLONG *  pTarget,
const GUID *  pTargetFormat,
LONGLONG  Source,
const GUID *  pSourceFormat 
)

Definition at line 186 of file seeking.c.

187{
189 if (!pTargetFormat)
190 pTargetFormat = &This->timeformat;
191 if (!pSourceFormat)
192 pSourceFormat = &This->timeformat;
193 if (IsEqualIID(pTargetFormat, &TIME_FORMAT_MEDIA_TIME) && IsEqualIID(pSourceFormat, &TIME_FORMAT_MEDIA_TIME))
194 {
195 *pTarget = Source;
196 return S_OK;
197 }
198 /* FIXME: clear pTarget? */
199 return E_INVALIDARG;
200}
#define E_INVALIDARG
Definition: ddrawi.h:101
FxIoTarget * pTarget
Definition: fxdeviceapi.cpp:97
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ SourceSeekingImpl_GetAvailable()

HRESULT WINAPI SourceSeekingImpl_GetAvailable ( IMediaSeeking *  iface,
LONGLONG *  pEarliest,
LONGLONG *  pLatest 
)

Definition at line 272 of file seeking.c.

273{
275
276 TRACE("(%p, %p)\n", pEarliest, pLatest);
277
279 *pEarliest = 0;
280 *pLatest = This->llDuration;
282
283 return S_OK;
284}
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

◆ SourceSeekingImpl_GetCapabilities()

HRESULT WINAPI SourceSeekingImpl_GetCapabilities ( IMediaSeeking *  iface,
DWORD *  pCapabilities 
)

Definition at line 64 of file seeking.c.

65{
67
68 TRACE("(%p)\n", pCapabilities);
69
70 *pCapabilities = This->dwCapabilities;
71
72 return S_OK;
73}

◆ SourceSeekingImpl_GetCurrentPosition()

HRESULT WINAPI SourceSeekingImpl_GetCurrentPosition ( IMediaSeeking *  iface,
LONGLONG *  pCurrent 
)

Definition at line 173 of file seeking.c.

174{
176
177 TRACE("(%p)\n", pCurrent);
178
180 *pCurrent = This->llCurrent;
182
183 return S_OK;
184}

◆ SourceSeekingImpl_GetDuration()

HRESULT WINAPI SourceSeekingImpl_GetDuration ( IMediaSeeking *  iface,
LONGLONG *  pDuration 
)

Definition at line 146 of file seeking.c.

147{
149
150 TRACE("(%p)\n", pDuration);
151
153 *pDuration = This->llDuration;
155
156 return S_OK;
157}

◆ SourceSeekingImpl_GetPositions()

HRESULT WINAPI SourceSeekingImpl_GetPositions ( IMediaSeeking *  iface,
LONGLONG *  pCurrent,
LONGLONG *  pStop 
)

Definition at line 258 of file seeking.c.

259{
261
262 TRACE("(%p, %p)\n", pCurrent, pStop);
263
265 IMediaSeeking_GetCurrentPosition(iface, pCurrent);
266 IMediaSeeking_GetStopPosition(iface, pStop);
268
269 return S_OK;
270}

◆ SourceSeekingImpl_GetPreroll()

HRESULT WINAPI SourceSeekingImpl_GetPreroll ( IMediaSeeking *  iface,
LONGLONG *  pPreroll 
)

Definition at line 323 of file seeking.c.

324{
325 TRACE("(%p)\n", pPreroll);
326
327 *pPreroll = 0;
328 return S_OK;
329}

◆ SourceSeekingImpl_GetRate()

HRESULT WINAPI SourceSeekingImpl_GetRate ( IMediaSeeking *  iface,
double *  dRate 
)

Definition at line 309 of file seeking.c.

310{
312
313 TRACE("(%p)\n", dRate);
314
316 /* Forward? */
317 *dRate = This->dRate;
319
320 return S_OK;
321}

◆ SourceSeekingImpl_GetStopPosition()

HRESULT WINAPI SourceSeekingImpl_GetStopPosition ( IMediaSeeking *  iface,
LONGLONG *  pStop 
)

Definition at line 159 of file seeking.c.

160{
162
163 TRACE("(%p)\n", pStop);
164
166 *pStop = This->llStop;
168
169 return S_OK;
170}

◆ SourceSeekingImpl_GetTimeFormat()

HRESULT WINAPI SourceSeekingImpl_GetTimeFormat ( IMediaSeeking *  iface,
GUID *  pFormat 
)

Definition at line 111 of file seeking.c.

112{
114 TRACE("(%s)\n", debugstr_guid(pFormat));
115
117 *pFormat = This->timeformat;
119
120 return S_OK;
121}
#define debugstr_guid
Definition: kernel32.h:35

◆ SourceSeekingImpl_IsFormatSupported()

HRESULT WINAPI SourceSeekingImpl_IsFormatSupported ( IMediaSeeking *  iface,
const GUID *  pFormat 
)

Definition at line 96 of file seeking.c.

97{
98 TRACE("(%s)\n", debugstr_guid(pFormat));
99
100 return (IsEqualIID(pFormat, &TIME_FORMAT_MEDIA_TIME) ? S_OK : S_FALSE);
101}

◆ SourceSeekingImpl_IsUsingTimeFormat()

HRESULT WINAPI SourceSeekingImpl_IsUsingTimeFormat ( IMediaSeeking *  iface,
const GUID *  pFormat 
)

Definition at line 123 of file seeking.c.

124{
126 HRESULT hr = S_OK;
127
128 TRACE("(%s)\n", debugstr_guid(pFormat));
129
131 if (!IsEqualIID(pFormat, &This->timeformat))
132 hr = S_FALSE;
134
135 return hr;
136}

◆ SourceSeekingImpl_QueryPreferredFormat()

HRESULT WINAPI SourceSeekingImpl_QueryPreferredFormat ( IMediaSeeking *  iface,
GUID *  pFormat 
)

Definition at line 103 of file seeking.c.

104{
105 TRACE("(%s)\n", debugstr_guid(pFormat));
106
107 *pFormat = TIME_FORMAT_MEDIA_TIME;
108 return S_OK;
109}

◆ SourceSeekingImpl_SetPositions()

HRESULT WINAPI SourceSeekingImpl_SetPositions ( IMediaSeeking *  iface,
LONGLONG *  pCurrent,
DWORD  dwCurrentFlags,
LONGLONG *  pStop,
DWORD  dwStopFlags 
)

Definition at line 219 of file seeking.c.

220{
222 BOOL bChangeCurrent = FALSE, bChangeStop = FALSE;
223 LONGLONG llNewCurrent, llNewStop;
224
225 TRACE("iface %p, current %s, current_flags %#lx, stop %s, stop_flags %#lx.\n", iface,
226 pCurrent ? debugstr_time(*pCurrent) : "<null>", dwCurrentFlags,
227 pStop ? debugstr_time(*pStop): "<null>", dwStopFlags);
228
230
231 llNewCurrent = Adjust(This->llCurrent, pCurrent, dwCurrentFlags);
232 llNewStop = Adjust(This->llStop, pStop, dwStopFlags);
233
234 if (pCurrent)
235 bChangeCurrent = TRUE;
236 if (llNewStop != This->llStop)
237 bChangeStop = TRUE;
238
239 TRACE("Seeking from %s to %s.\n", debugstr_time(This->llCurrent), debugstr_time(llNewCurrent));
240
241 This->llCurrent = llNewCurrent;
242 This->llStop = llNewStop;
243
244 if (pCurrent && (dwCurrentFlags & AM_SEEKING_ReturnTime))
245 *pCurrent = llNewCurrent;
246 if (pStop && (dwStopFlags & AM_SEEKING_ReturnTime))
247 *pStop = llNewStop;
249
250 if (bChangeCurrent)
251 This->fnChangeStart(iface);
252 if (bChangeStop)
253 This->fnChangeStop(iface);
254
255 return S_OK;
256}
@ AM_SEEKING_ReturnTime
Definition: axcore.idl:597
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
static LONGLONG Adjust(LONGLONG value, const LONGLONG *pModifier, DWORD dwFlags)
Definition: seeking.c:202
static const char * debugstr_time(REFERENCE_TIME time)
Definition: strmbase.h:32
int64_t LONGLONG
Definition: typedefs.h:68

◆ SourceSeekingImpl_SetRate()

HRESULT WINAPI SourceSeekingImpl_SetRate ( IMediaSeeking *  iface,
double  dRate 
)

Definition at line 286 of file seeking.c.

287{
289 BOOL bChangeRate = (dRate != This->dRate);
290 HRESULT hr = S_OK;
291
292 TRACE("(%e)\n", dRate);
293
294 if (dRate > 100 || dRate < .001)
295 {
296 FIXME("Excessive rate %e, ignoring\n", dRate);
298 }
299
301 This->dRate = dRate;
302 if (bChangeRate)
303 hr = This->fnChangeRate(iface);
305
306 return hr;
307}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define VFW_E_UNSUPPORTED_AUDIO
Definition: vfwmsgs.h:112

◆ SourceSeekingImpl_SetTimeFormat()

HRESULT WINAPI SourceSeekingImpl_SetTimeFormat ( IMediaSeeking *  iface,
const GUID *  pFormat 
)

Definition at line 138 of file seeking.c.

139{
141 TRACE("%p %s\n", This, debugstr_guid(pFormat));
142 return (IsEqualIID(pFormat, &TIME_FORMAT_MEDIA_TIME) ? S_OK : E_INVALIDARG);
143}

◆ strmbase_seeking_cleanup()

void strmbase_seeking_cleanup ( SourceSeeking *  seeking)

Definition at line 58 of file seeking.c.

59{
60 seeking->cs.DebugInfo->Spare[0] = 0;
61 DeleteCriticalSection(&seeking->cs);
62}
CRITICAL_SECTION cs
Definition: strmbase.h:197
PRTL_CRITICAL_SECTION_DEBUG DebugInfo
Definition: rtltypes.h:1478
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

◆ strmbase_seeking_init()

HRESULT strmbase_seeking_init ( SourceSeeking *  pSeeking,
const IMediaSeekingVtbl *  Vtbl,
SourceSeeking_ChangeStop  fnChangeStop,
SourceSeeking_ChangeStart  fnChangeStart,
SourceSeeking_ChangeRate  fnChangeRate 
)

Definition at line 31 of file seeking.c.

34{
35 assert(fnChangeStop && fnChangeStart && fnChangeRate);
36
37 pSeeking->IMediaSeeking_iface.lpVtbl = Vtbl;
38 pSeeking->refCount = 1;
39 pSeeking->fnChangeRate = fnChangeRate;
40 pSeeking->fnChangeStop = fnChangeStop;
41 pSeeking->fnChangeStart = fnChangeStart;
47 pSeeking->llCurrent = 0;
48 pSeeking->llStop = ((ULONGLONG)0x80000000) << 32;
49 pSeeking->llDuration = pSeeking->llStop;
50 pSeeking->dRate = 1.0;
51 pSeeking->timeformat = TIME_FORMAT_MEDIA_TIME;
53 InitializeCriticalSection(&pSeeking->cs);
54 pSeeking->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SourceSeeking.cs");
55 return S_OK;
56}
@ AM_SEEKING_CanGetDuration
Definition: axcore.idl:609
@ AM_SEEKING_CanSeekBackwards
Definition: axcore.idl:606
@ AM_SEEKING_CanSeekForwards
Definition: axcore.idl:605
@ AM_SEEKING_CanSeekAbsolute
Definition: axcore.idl:604
@ AM_SEEKING_CanGetStopPos
Definition: axcore.idl:608
BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection, IN DWORD dwSpinCount, IN DWORD flags)
Definition: sync.c:107
LONGLONG llCurrent
Definition: strmbase.h:195
LONGLONG llStop
Definition: strmbase.h:195
double dRate
Definition: strmbase.h:194
SourceSeeking_ChangeRate fnChangeRate
Definition: strmbase.h:192
LONGLONG llDuration
Definition: strmbase.h:195
DWORD dwCapabilities
Definition: strmbase.h:193
SourceSeeking_ChangeStart fnChangeStart
Definition: strmbase.h:191
ULONG refCount
Definition: strmbase.h:189
GUID timeformat
Definition: strmbase.h:196
SourceSeeking_ChangeStop fnChangeStop
Definition: strmbase.h:190
IMediaSeeking IMediaSeeking_iface
Definition: strmbase.h:187
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:687
#define DWORD_PTR
Definition: treelist.c:76
uint64_t ULONGLONG
Definition: typedefs.h:67
#define RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO
Definition: winnt_old.h:1156

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( quartz  )