[AMSTREAM]
[reactos.git] / reactos / dll / directx / wine / amstream / mediastream.c
1 /*
2 * Implementation of IMediaStream Interfaces
3 *
4 * Copyright 2005, 2008, 2012 Christian Costa
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #include "amstream_private.h"
22
23 static HRESULT ddrawstreamsample_create(IDirectDrawMediaStream *parent, IDirectDrawStreamSample **ddraw_stream_sample);
24 static HRESULT audiostreamsample_create(IAudioMediaStream *parent, IAudioData *audio_data, IAudioStreamSample **audio_stream_sample);
25
26 typedef struct {
27 IAMMediaStream IAMMediaStream_iface;
28 IDirectDrawMediaStream IDirectDrawMediaStream_iface;
29 LONG ref;
30 IMultiMediaStream* parent;
31 MSPID purpose_id;
32 STREAM_TYPE stream_type;
33 } DirectDrawMediaStreamImpl;
34
35 static inline DirectDrawMediaStreamImpl *impl_from_DirectDrawMediaStream_IAMMediaStream(IAMMediaStream *iface)
36 {
37 return CONTAINING_RECORD(iface, DirectDrawMediaStreamImpl, IAMMediaStream_iface);
38 }
39
40 /*** IUnknown methods ***/
41 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_QueryInterface(IAMMediaStream *iface,
42 REFIID riid, void **ret_iface)
43 {
44 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
45
46 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ret_iface);
47
48 if (IsEqualGUID(riid, &IID_IUnknown) ||
49 IsEqualGUID(riid, &IID_IMediaStream) ||
50 IsEqualGUID(riid, &IID_IAMMediaStream))
51 {
52 IAMMediaStream_AddRef(iface);
53 *ret_iface = iface;
54 return S_OK;
55 }
56 else if (IsEqualGUID(riid, &IID_IDirectDrawMediaStream))
57 {
58 IAMMediaStream_AddRef(iface);
59 *ret_iface = &This->IDirectDrawMediaStream_iface;
60 return S_OK;
61 }
62
63 ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface);
64 return E_NOINTERFACE;
65 }
66
67 static ULONG WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_AddRef(IAMMediaStream *iface)
68 {
69 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
70 ULONG ref = InterlockedIncrement(&This->ref);
71
72 TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
73
74 return ref;
75 }
76
77 static ULONG WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_Release(IAMMediaStream *iface)
78 {
79 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
80 ULONG ref = InterlockedDecrement(&This->ref);
81
82 TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
83
84 if (!ref)
85 HeapFree(GetProcessHeap(), 0, This);
86
87 return ref;
88 }
89
90 /*** IMediaStream methods ***/
91 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_GetMultiMediaStream(IAMMediaStream *iface,
92 IMultiMediaStream** multi_media_stream)
93 {
94 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
95
96 FIXME("(%p/%p)->(%p) stub!\n", This, iface, multi_media_stream);
97
98 return S_FALSE;
99 }
100
101 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_GetInformation(IAMMediaStream *iface,
102 MSPID *purpose_id, STREAM_TYPE *type)
103 {
104 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
105
106 TRACE("(%p/%p)->(%p,%p)\n", This, iface, purpose_id, type);
107
108 if (purpose_id)
109 *purpose_id = This->purpose_id;
110 if (type)
111 *type = This->stream_type;
112
113 return S_OK;
114 }
115
116 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_SetSameFormat(IAMMediaStream *iface,
117 IMediaStream *pStreamThatHasDesiredFormat, DWORD flags)
118 {
119 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
120
121 FIXME("(%p/%p)->(%p,%x) stub!\n", This, iface, pStreamThatHasDesiredFormat, flags);
122
123 return S_FALSE;
124 }
125
126 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_AllocateSample(IAMMediaStream *iface,
127 DWORD flags, IStreamSample **sample)
128 {
129 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
130
131 FIXME("(%p/%p)->(%x,%p) stub!\n", This, iface, flags, sample);
132
133 return S_FALSE;
134 }
135
136 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_CreateSharedSample(IAMMediaStream *iface,
137 IStreamSample *existing_sample, DWORD flags, IStreamSample **sample)
138 {
139 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
140
141 FIXME("(%p/%p)->(%p,%x,%p) stub!\n", This, iface, existing_sample, flags, sample);
142
143 return S_FALSE;
144 }
145
146 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_SendEndOfStream(IAMMediaStream *iface, DWORD flags)
147 {
148 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
149
150 FIXME("(%p/%p)->(%x) stub!\n", This, iface, flags);
151
152 return S_FALSE;
153 }
154
155 /*** IAMMediaStream methods ***/
156 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_Initialize(IAMMediaStream *iface, IUnknown *source_object, DWORD flags,
157 REFMSPID purpose_id, const STREAM_TYPE stream_type)
158 {
159 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
160
161 FIXME("(%p/%p)->(%p,%x,%p,%u) stub!\n", This, iface, source_object, flags, purpose_id, stream_type);
162
163 return S_FALSE;
164 }
165
166 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_SetState(IAMMediaStream *iface, FILTER_STATE state)
167 {
168 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
169
170 FIXME("(%p/%p)->(%u) stub!\n", This, iface, state);
171
172 return S_FALSE;
173 }
174
175 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaStream(IAMMediaStream *iface, IAMMultiMediaStream *am_multi_media_stream)
176 {
177 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
178
179 FIXME("(%p/%p)->(%p) stub!\n", This, iface, am_multi_media_stream);
180
181 return S_FALSE;
182 }
183
184 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMediaStreamFilter *media_stream_filter)
185 {
186 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
187
188 FIXME("(%p/%p)->(%p) stub!\n", This, iface, media_stream_filter);
189
190 return S_FALSE;
191 }
192
193 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph)
194 {
195 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
196
197 FIXME("(%p/%p)->(%p) stub!\n", This, iface, filtergraph);
198
199 return S_FALSE;
200 }
201
202 static const struct IAMMediaStreamVtbl DirectDrawMediaStreamImpl_IAMMediaStream_Vtbl =
203 {
204 /*** IUnknown methods ***/
205 DirectDrawMediaStreamImpl_IAMMediaStream_QueryInterface,
206 DirectDrawMediaStreamImpl_IAMMediaStream_AddRef,
207 DirectDrawMediaStreamImpl_IAMMediaStream_Release,
208 /*** IMediaStream methods ***/
209 DirectDrawMediaStreamImpl_IAMMediaStream_GetMultiMediaStream,
210 DirectDrawMediaStreamImpl_IAMMediaStream_GetInformation,
211 DirectDrawMediaStreamImpl_IAMMediaStream_SetSameFormat,
212 DirectDrawMediaStreamImpl_IAMMediaStream_AllocateSample,
213 DirectDrawMediaStreamImpl_IAMMediaStream_CreateSharedSample,
214 DirectDrawMediaStreamImpl_IAMMediaStream_SendEndOfStream,
215 /*** IAMMediaStream methods ***/
216 DirectDrawMediaStreamImpl_IAMMediaStream_Initialize,
217 DirectDrawMediaStreamImpl_IAMMediaStream_SetState,
218 DirectDrawMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaStream,
219 DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilter,
220 DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilterGraph
221 };
222
223 static inline DirectDrawMediaStreamImpl *impl_from_IDirectDrawMediaStream(IDirectDrawMediaStream *iface)
224 {
225 return CONTAINING_RECORD(iface, DirectDrawMediaStreamImpl, IDirectDrawMediaStream_iface);
226 }
227
228 /*** IUnknown methods ***/
229 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_QueryInterface(IDirectDrawMediaStream *iface,
230 REFIID riid, void **ret_iface)
231 {
232 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
233
234 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ret_iface);
235
236 if (IsEqualGUID(riid, &IID_IUnknown) ||
237 IsEqualGUID(riid, &IID_IMediaStream) ||
238 IsEqualGUID(riid, &IID_IDirectDrawMediaStream))
239 {
240 IDirectDrawMediaStream_AddRef(iface);
241 *ret_iface = iface;
242 return S_OK;
243 }
244 else if (IsEqualGUID(riid, &IID_IAMMediaStream))
245 {
246 IDirectDrawMediaStream_AddRef(iface);
247 *ret_iface = &This->IAMMediaStream_iface;
248 return S_OK;
249 }
250
251 ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface);
252 return E_NOINTERFACE;
253 }
254
255 static ULONG WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AddRef(IDirectDrawMediaStream *iface)
256 {
257 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
258
259 TRACE("(%p/%p)\n", iface, This);
260
261 return InterlockedIncrement(&This->ref);
262 }
263
264 static ULONG WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Release(IDirectDrawMediaStream *iface)
265 {
266 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
267 ULONG ref = InterlockedDecrement(&This->ref);
268
269 TRACE("(%p/%p)\n", iface, This);
270
271 if (!ref)
272 HeapFree(GetProcessHeap(), 0, This);
273
274 return ref;
275 }
276
277 /*** IMediaStream methods ***/
278 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetMultiMediaStream(IDirectDrawMediaStream *iface,
279 IMultiMediaStream** ppMultiMediaStream)
280 {
281 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
282
283 FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppMultiMediaStream);
284
285 return S_FALSE;
286 }
287
288 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetInformation(IDirectDrawMediaStream *iface,
289 MSPID *purpose_id, STREAM_TYPE *type)
290 {
291 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
292
293 TRACE("(%p/%p)->(%p,%p)\n", This, iface, purpose_id, type);
294
295 if (purpose_id)
296 *purpose_id = This->purpose_id;
297 if (type)
298 *type = This->stream_type;
299
300 return S_OK;
301 }
302
303 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetSameFormat(IDirectDrawMediaStream *iface,
304 IMediaStream *pStreamThatHasDesiredFormat, DWORD dwFlags)
305 {
306 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
307
308 FIXME("(%p/%p)->(%p,%x) stub!\n", This, iface, pStreamThatHasDesiredFormat, dwFlags);
309
310 return S_FALSE;
311 }
312
313 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AllocateSample(IDirectDrawMediaStream *iface,
314 DWORD dwFlags, IStreamSample **ppSample)
315 {
316 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
317
318 FIXME("(%p/%p)->(%x,%p) stub!\n", This, iface, dwFlags, ppSample);
319
320 return S_FALSE;
321 }
322
323 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSharedSample(IDirectDrawMediaStream *iface,
324 IStreamSample *pExistingSample, DWORD dwFlags, IStreamSample **ppSample)
325 {
326 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
327
328 FIXME("(%p/%p)->(%p,%x,%p) stub!\n", This, iface, pExistingSample, dwFlags, ppSample);
329
330 return S_FALSE;
331 }
332
333 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SendEndOfStream(IDirectDrawMediaStream *iface,
334 DWORD dwFlags)
335 {
336 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
337
338 FIXME("(%p/%p)->(%x) stub!\n", This, iface, dwFlags);
339
340 return S_FALSE;
341 }
342
343 /*** IDirectDrawMediaStream methods ***/
344 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetFormat(IDirectDrawMediaStream *iface,
345 DDSURFACEDESC *current_format, IDirectDrawPalette **palette,
346 DDSURFACEDESC *desired_format, DWORD *flags)
347 {
348 FIXME("(%p)->(%p,%p,%p,%p) stub!\n", iface, current_format, palette, desired_format,
349 flags);
350
351 return MS_E_NOSTREAM;
352
353 }
354
355 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetFormat(IDirectDrawMediaStream *iface,
356 const DDSURFACEDESC *pDDSurfaceDesc, IDirectDrawPalette *pDirectDrawPalette)
357 {
358 FIXME("(%p)->(%p,%p) stub!\n", iface, pDDSurfaceDesc, pDirectDrawPalette);
359
360 return E_NOTIMPL;
361 }
362
363 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetDirectDraw(IDirectDrawMediaStream *iface,
364 IDirectDraw **ppDirectDraw)
365 {
366 FIXME("(%p)->(%p) stub!\n", iface, ppDirectDraw);
367
368 return E_NOTIMPL;
369 }
370
371 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetDirectDraw(IDirectDrawMediaStream *iface,
372 IDirectDraw *pDirectDraw)
373 {
374 FIXME("(%p)->(%p) stub!\n", iface, pDirectDraw);
375
376 return E_NOTIMPL;
377 }
378
379 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSample(IDirectDrawMediaStream *iface,
380 IDirectDrawSurface *pSurface, const RECT *pRect, DWORD dwFlags,
381 IDirectDrawStreamSample **ppSample)
382 {
383 TRACE("(%p)->(%p,%p,%x,%p)\n", iface, pSurface, pRect, dwFlags, ppSample);
384
385 return ddrawstreamsample_create(iface, ppSample);
386 }
387
388 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetTimePerFrame(IDirectDrawMediaStream *iface,
389 STREAM_TIME *pFrameTime)
390 {
391 FIXME("(%p)->(%p) stub!\n", iface, pFrameTime);
392
393 return E_NOTIMPL;
394 }
395
396 static const struct IDirectDrawMediaStreamVtbl DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Vtbl =
397 {
398 /*** IUnknown methods ***/
399 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_QueryInterface,
400 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AddRef,
401 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Release,
402 /*** IMediaStream methods ***/
403 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetMultiMediaStream,
404 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetInformation,
405 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetSameFormat,
406 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AllocateSample,
407 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSharedSample,
408 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SendEndOfStream,
409 /*** IDirectDrawMediaStream methods ***/
410 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetFormat,
411 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetFormat,
412 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetDirectDraw,
413 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetDirectDraw,
414 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSample,
415 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetTimePerFrame
416 };
417
418 HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
419 STREAM_TYPE stream_type, IMediaStream **media_stream)
420 {
421 DirectDrawMediaStreamImpl *object;
422
423 TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream);
424
425 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DirectDrawMediaStreamImpl));
426 if (!object)
427 return E_OUTOFMEMORY;
428
429 object->IAMMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IAMMediaStream_Vtbl;
430 object->IDirectDrawMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Vtbl;
431 object->ref = 1;
432
433 object->parent = parent;
434 object->purpose_id = *purpose_id;
435 object->stream_type = stream_type;
436
437 *media_stream = (IMediaStream*)&object->IAMMediaStream_iface;
438
439 return S_OK;
440 }
441
442 typedef struct {
443 IAMMediaStream IAMMediaStream_iface;
444 IAudioMediaStream IAudioMediaStream_iface;
445 LONG ref;
446 IMultiMediaStream* parent;
447 MSPID purpose_id;
448 STREAM_TYPE stream_type;
449 } AudioMediaStreamImpl;
450
451 static inline AudioMediaStreamImpl *impl_from_AudioMediaStream_IAMMediaStream(IAMMediaStream *iface)
452 {
453 return CONTAINING_RECORD(iface, AudioMediaStreamImpl, IAMMediaStream_iface);
454 }
455
456 /*** IUnknown methods ***/
457 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_QueryInterface(IAMMediaStream *iface,
458 REFIID riid, void **ret_iface)
459 {
460 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
461
462 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ret_iface);
463
464 if (IsEqualGUID(riid, &IID_IUnknown) ||
465 IsEqualGUID(riid, &IID_IMediaStream) ||
466 IsEqualGUID(riid, &IID_IAMMediaStream))
467 {
468 IAMMediaStream_AddRef(iface);
469 *ret_iface = iface;
470 return S_OK;
471 }
472 else if (IsEqualGUID(riid, &IID_IAudioMediaStream))
473 {
474 IAMMediaStream_AddRef(iface);
475 *ret_iface = &This->IAudioMediaStream_iface;
476 return S_OK;
477 }
478
479 ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface);
480 return E_NOINTERFACE;
481 }
482
483 static ULONG WINAPI AudioMediaStreamImpl_IAMMediaStream_AddRef(IAMMediaStream *iface)
484 {
485 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
486 ULONG ref = InterlockedIncrement(&This->ref);
487
488 TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
489
490 return ref;
491 }
492
493 static ULONG WINAPI AudioMediaStreamImpl_IAMMediaStream_Release(IAMMediaStream *iface)
494 {
495 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
496 ULONG ref = InterlockedDecrement(&This->ref);
497
498 TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
499
500 if (!ref)
501 HeapFree(GetProcessHeap(), 0, This);
502
503 return ref;
504 }
505
506 /*** IMediaStream methods ***/
507 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_GetMultiMediaStream(IAMMediaStream *iface,
508 IMultiMediaStream** multi_media_stream)
509 {
510 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
511
512 FIXME("(%p/%p)->(%p) stub!\n", This, iface, multi_media_stream);
513
514 return S_FALSE;
515 }
516
517 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_GetInformation(IAMMediaStream *iface,
518 MSPID *purpose_id, STREAM_TYPE *type)
519 {
520 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
521
522 TRACE("(%p/%p)->(%p,%p)\n", This, iface, purpose_id, type);
523
524 if (purpose_id)
525 *purpose_id = This->purpose_id;
526 if (type)
527 *type = This->stream_type;
528
529 return S_OK;
530 }
531
532 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_SetSameFormat(IAMMediaStream *iface,
533 IMediaStream *pStreamThatHasDesiredFormat, DWORD flags)
534 {
535 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
536
537 FIXME("(%p/%p)->(%p,%x) stub!\n", This, iface, pStreamThatHasDesiredFormat, flags);
538
539 return S_FALSE;
540 }
541
542 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_AllocateSample(IAMMediaStream *iface,
543 DWORD flags, IStreamSample **sample)
544 {
545 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
546
547 FIXME("(%p/%p)->(%x,%p) stub!\n", This, iface, flags, sample);
548
549 return S_FALSE;
550 }
551
552 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_CreateSharedSample(IAMMediaStream *iface,
553 IStreamSample *existing_sample, DWORD flags, IStreamSample **sample)
554 {
555 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
556
557 FIXME("(%p/%p)->(%p,%x,%p) stub!\n", This, iface, existing_sample, flags, sample);
558
559 return S_FALSE;
560 }
561
562 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_SendEndOfStream(IAMMediaStream *iface, DWORD flags)
563 {
564 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
565
566 FIXME("(%p/%p)->(%x) stub!\n", This, iface, flags);
567
568 return S_FALSE;
569 }
570
571 /*** IAMMediaStream methods ***/
572 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_Initialize(IAMMediaStream *iface, IUnknown *source_object, DWORD flags,
573 REFMSPID purpose_id, const STREAM_TYPE stream_type)
574 {
575 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
576
577 FIXME("(%p/%p)->(%p,%x,%p,%u) stub!\n", This, iface, source_object, flags, purpose_id, stream_type);
578
579 return S_FALSE;
580 }
581
582 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_SetState(IAMMediaStream *iface, FILTER_STATE state)
583 {
584 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
585
586 FIXME("(%p/%p)->(%u) stub!\n", This, iface, state);
587
588 return S_FALSE;
589 }
590
591 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaStream(IAMMediaStream *iface, IAMMultiMediaStream *am_multi_media_stream)
592 {
593 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
594
595 FIXME("(%p/%p)->(%p) stub!\n", This, iface, am_multi_media_stream);
596
597 return S_FALSE;
598 }
599
600 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMediaStreamFilter *media_stream_filter)
601 {
602 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
603
604 FIXME("(%p/%p)->(%p) stub!\n", This, iface, media_stream_filter);
605
606 return S_FALSE;
607 }
608
609 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph)
610 {
611 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
612
613 FIXME("(%p/%p)->(%p) stub!\n", This, iface, filtergraph);
614
615 return S_FALSE;
616 }
617
618 static const struct IAMMediaStreamVtbl AudioMediaStreamImpl_IAMMediaStream_Vtbl =
619 {
620 /*** IUnknown methods ***/
621 AudioMediaStreamImpl_IAMMediaStream_QueryInterface,
622 AudioMediaStreamImpl_IAMMediaStream_AddRef,
623 AudioMediaStreamImpl_IAMMediaStream_Release,
624 /*** IMediaStream methods ***/
625 AudioMediaStreamImpl_IAMMediaStream_GetMultiMediaStream,
626 AudioMediaStreamImpl_IAMMediaStream_GetInformation,
627 AudioMediaStreamImpl_IAMMediaStream_SetSameFormat,
628 AudioMediaStreamImpl_IAMMediaStream_AllocateSample,
629 AudioMediaStreamImpl_IAMMediaStream_CreateSharedSample,
630 AudioMediaStreamImpl_IAMMediaStream_SendEndOfStream,
631 /*** IAMMediaStream methods ***/
632 AudioMediaStreamImpl_IAMMediaStream_Initialize,
633 AudioMediaStreamImpl_IAMMediaStream_SetState,
634 AudioMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaStream,
635 AudioMediaStreamImpl_IAMMediaStream_JoinFilter,
636 AudioMediaStreamImpl_IAMMediaStream_JoinFilterGraph
637 };
638
639 static inline AudioMediaStreamImpl *impl_from_IAudioMediaStream(IAudioMediaStream *iface)
640 {
641 return CONTAINING_RECORD(iface, AudioMediaStreamImpl, IAudioMediaStream_iface);
642 }
643
644 /*** IUnknown methods ***/
645 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_QueryInterface(IAudioMediaStream *iface,
646 REFIID riid, void **ret_iface)
647 {
648 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
649
650 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ret_iface);
651
652 if (IsEqualGUID(riid, &IID_IUnknown) ||
653 IsEqualGUID(riid, &IID_IMediaStream) ||
654 IsEqualGUID(riid, &IID_IAudioMediaStream))
655 {
656 IAudioMediaStream_AddRef(iface);
657 *ret_iface = iface;
658 return S_OK;
659 }
660 else if (IsEqualGUID(riid, &IID_IAMMediaStream))
661 {
662 IAudioMediaStream_AddRef(iface);
663 *ret_iface = &This->IAMMediaStream_iface;
664 return S_OK;
665 }
666
667
668 *ret_iface = NULL;
669
670 ERR("(%p/%p)->(%s,%p),not found\n", iface, This, debugstr_guid(riid), ret_iface);
671 return E_NOINTERFACE;
672 }
673
674 static ULONG WINAPI AudioMediaStreamImpl_IAudioMediaStream_AddRef(IAudioMediaStream *iface)
675 {
676 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
677 ULONG ref = InterlockedIncrement(&This->ref);
678
679 TRACE("(%p/%p): new ref = %u\n", iface, This, ref);
680
681 return ref;
682 }
683
684 static ULONG WINAPI AudioMediaStreamImpl_IAudioMediaStream_Release(IAudioMediaStream *iface)
685 {
686 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
687 ULONG ref = InterlockedDecrement(&This->ref);
688
689 TRACE("(%p/%p): new ref = %u\n", iface, This, ref);
690
691 if (!ref)
692 HeapFree(GetProcessHeap(), 0, This);
693
694 return ref;
695 }
696
697 /*** IMediaStream methods ***/
698 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_GetMultiMediaStream(IAudioMediaStream *iface,
699 IMultiMediaStream** multimedia_stream)
700 {
701 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
702
703 FIXME("(%p/%p)->(%p) stub!\n", iface, This, multimedia_stream);
704
705 return S_FALSE;
706 }
707
708 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_GetInformation(IAudioMediaStream *iface,
709 MSPID *purpose_id, STREAM_TYPE *type)
710 {
711 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
712
713 TRACE("(%p/%p)->(%p,%p)\n", iface, This, purpose_id, type);
714
715 if (purpose_id)
716 *purpose_id = This->purpose_id;
717 if (type)
718 *type = This->stream_type;
719
720 return S_OK;
721 }
722
723 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_SetSameFormat(IAudioMediaStream *iface,
724 IMediaStream *stream_format, DWORD flags)
725 {
726 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
727
728 FIXME("(%p/%p)->(%p,%x) stub!\n", iface, This, stream_format, flags);
729
730 return S_FALSE;
731 }
732
733 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_AllocateSample(IAudioMediaStream *iface,
734 DWORD flags, IStreamSample **sample)
735 {
736 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
737
738 FIXME("(%p/%p)->(%x,%p) stub!\n", iface, This, flags, sample);
739
740 return S_FALSE;
741 }
742
743 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_CreateSharedSample(IAudioMediaStream *iface,
744 IStreamSample *existing_sample, DWORD flags, IStreamSample **sample)
745 {
746 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
747
748 FIXME("(%p/%p)->(%p,%x,%p) stub!\n", iface, This, existing_sample, flags, sample);
749
750 return S_FALSE;
751 }
752
753 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_SendEndOfStream(IAudioMediaStream *iface,
754 DWORD flags)
755 {
756 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
757
758 FIXME("(%p/%p)->(%x) stub!\n", iface, This, flags);
759
760 return S_FALSE;
761 }
762
763 /*** IAudioMediaStream methods ***/
764 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_GetFormat(IAudioMediaStream *iface, WAVEFORMATEX *wave_format_current)
765 {
766 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
767
768 FIXME("(%p/%p)->(%p) stub!\n", iface, This, wave_format_current);
769
770 if (!wave_format_current)
771 return E_POINTER;
772
773 return MS_E_NOSTREAM;
774
775 }
776
777 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_SetFormat(IAudioMediaStream *iface, const WAVEFORMATEX *wave_format)
778 {
779 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
780
781 FIXME("(%p/%p)->(%p) stub!\n", iface, This, wave_format);
782
783 return E_NOTIMPL;
784 }
785
786 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_CreateSample(IAudioMediaStream *iface, IAudioData *audio_data,
787 DWORD flags, IAudioStreamSample **sample)
788 {
789 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
790
791 TRACE("(%p/%p)->(%p,%u,%p)\n", iface, This, audio_data, flags, sample);
792
793 if (!audio_data)
794 return E_POINTER;
795
796 return audiostreamsample_create(iface, audio_data, sample);
797 }
798
799 static const struct IAudioMediaStreamVtbl AudioMediaStreamImpl_IAudioMediaStream_Vtbl =
800 {
801 /*** IUnknown methods ***/
802 AudioMediaStreamImpl_IAudioMediaStream_QueryInterface,
803 AudioMediaStreamImpl_IAudioMediaStream_AddRef,
804 AudioMediaStreamImpl_IAudioMediaStream_Release,
805 /*** IMediaStream methods ***/
806 AudioMediaStreamImpl_IAudioMediaStream_GetMultiMediaStream,
807 AudioMediaStreamImpl_IAudioMediaStream_GetInformation,
808 AudioMediaStreamImpl_IAudioMediaStream_SetSameFormat,
809 AudioMediaStreamImpl_IAudioMediaStream_AllocateSample,
810 AudioMediaStreamImpl_IAudioMediaStream_CreateSharedSample,
811 AudioMediaStreamImpl_IAudioMediaStream_SendEndOfStream,
812 /*** IAudioMediaStream methods ***/
813 AudioMediaStreamImpl_IAudioMediaStream_GetFormat,
814 AudioMediaStreamImpl_IAudioMediaStream_SetFormat,
815 AudioMediaStreamImpl_IAudioMediaStream_CreateSample
816 };
817
818 HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
819 STREAM_TYPE stream_type, IMediaStream **media_stream)
820 {
821 AudioMediaStreamImpl *object;
822
823 TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream);
824
825 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(AudioMediaStreamImpl));
826 if (!object)
827 return E_OUTOFMEMORY;
828
829 object->IAMMediaStream_iface.lpVtbl = &AudioMediaStreamImpl_IAMMediaStream_Vtbl;
830 object->IAudioMediaStream_iface.lpVtbl = &AudioMediaStreamImpl_IAudioMediaStream_Vtbl;
831 object->ref = 1;
832
833 object->parent = parent;
834 object->purpose_id = *purpose_id;
835 object->stream_type = stream_type;
836
837 *media_stream = (IMediaStream*)&object->IAMMediaStream_iface;
838
839 return S_OK;
840 }
841
842 typedef struct {
843 IDirectDrawStreamSample IDirectDrawStreamSample_iface;
844 LONG ref;
845 IMediaStream *parent;
846 } IDirectDrawStreamSampleImpl;
847
848 static inline IDirectDrawStreamSampleImpl *impl_from_IDirectDrawStreamSample(IDirectDrawStreamSample *iface)
849 {
850 return CONTAINING_RECORD(iface, IDirectDrawStreamSampleImpl, IDirectDrawStreamSample_iface);
851 }
852
853 /*** IUnknown methods ***/
854 static HRESULT WINAPI IDirectDrawStreamSampleImpl_QueryInterface(IDirectDrawStreamSample *iface,
855 REFIID riid, void **ret_iface)
856 {
857 TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), ret_iface);
858
859 if (IsEqualGUID(riid, &IID_IUnknown) ||
860 IsEqualGUID(riid, &IID_IStreamSample) ||
861 IsEqualGUID(riid, &IID_IDirectDrawStreamSample))
862 {
863 IDirectDrawStreamSample_AddRef(iface);
864 *ret_iface = iface;
865 return S_OK;
866 }
867
868 *ret_iface = NULL;
869
870 ERR("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ret_iface);
871 return E_NOINTERFACE;
872 }
873
874 static ULONG WINAPI IDirectDrawStreamSampleImpl_AddRef(IDirectDrawStreamSample *iface)
875 {
876 IDirectDrawStreamSampleImpl *This = impl_from_IDirectDrawStreamSample(iface);
877 ULONG ref = InterlockedIncrement(&This->ref);
878
879 TRACE("(%p)->(): new ref = %u\n", iface, ref);
880
881 return ref;
882 }
883
884 static ULONG WINAPI IDirectDrawStreamSampleImpl_Release(IDirectDrawStreamSample *iface)
885 {
886 IDirectDrawStreamSampleImpl *This = impl_from_IDirectDrawStreamSample(iface);
887 ULONG ref = InterlockedDecrement(&This->ref);
888
889 TRACE("(%p)->(): new ref = %u\n", iface, ref);
890
891 if (!ref)
892 HeapFree(GetProcessHeap(), 0, This);
893
894 return ref;
895 }
896
897 /*** IStreamSample methods ***/
898 static HRESULT WINAPI IDirectDrawStreamSampleImpl_GetMediaStream(IDirectDrawStreamSample *iface, IMediaStream **media_stream)
899 {
900 FIXME("(%p)->(%p): stub\n", iface, media_stream);
901
902 return E_NOTIMPL;
903 }
904
905 static HRESULT WINAPI IDirectDrawStreamSampleImpl_GetSampleTimes(IDirectDrawStreamSample *iface, STREAM_TIME *start_time,
906 STREAM_TIME *end_time, STREAM_TIME *current_time)
907 {
908 FIXME("(%p)->(%p,%p,%p): stub\n", iface, start_time, end_time, current_time);
909
910 return E_NOTIMPL;
911 }
912
913 static HRESULT WINAPI IDirectDrawStreamSampleImpl_SetSampleTimes(IDirectDrawStreamSample *iface, const STREAM_TIME *start_time,
914 const STREAM_TIME *end_time)
915 {
916 FIXME("(%p)->(%p,%p): stub\n", iface, start_time, end_time);
917
918 return E_NOTIMPL;
919 }
920
921 static HRESULT WINAPI IDirectDrawStreamSampleImpl_Update(IDirectDrawStreamSample *iface, DWORD flags, HANDLE event,
922 PAPCFUNC func_APC, DWORD APC_data)
923 {
924 FIXME("(%p)->(%x,%p,%p,%u): stub\n", iface, flags, event, func_APC, APC_data);
925
926 return E_NOTIMPL;
927 }
928
929 static HRESULT WINAPI IDirectDrawStreamSampleImpl_CompletionStatus(IDirectDrawStreamSample *iface, DWORD flags, DWORD milliseconds)
930 {
931 FIXME("(%p)->(%x,%u): stub\n", iface, flags, milliseconds);
932
933 return E_NOTIMPL;
934 }
935
936 /*** IDirectDrawStreamSample methods ***/
937 static HRESULT WINAPI IDirectDrawStreamSampleImpl_GetSurface(IDirectDrawStreamSample *iface, IDirectDrawSurface **ddraw_surface,
938 RECT *rect)
939 {
940 FIXME("(%p)->(%p,%p): stub\n", iface, ddraw_surface, rect);
941
942 return E_NOTIMPL;
943 }
944
945 static HRESULT WINAPI IDirectDrawStreamSampleImpl_SetRect(IDirectDrawStreamSample *iface, const RECT *rect)
946 {
947 FIXME("(%p)->(%p): stub\n", iface, rect);
948
949 return E_NOTIMPL;
950 }
951
952 static const struct IDirectDrawStreamSampleVtbl DirectDrawStreamSample_Vtbl =
953 {
954 /*** IUnknown methods ***/
955 IDirectDrawStreamSampleImpl_QueryInterface,
956 IDirectDrawStreamSampleImpl_AddRef,
957 IDirectDrawStreamSampleImpl_Release,
958 /*** IStreamSample methods ***/
959 IDirectDrawStreamSampleImpl_GetMediaStream,
960 IDirectDrawStreamSampleImpl_GetSampleTimes,
961 IDirectDrawStreamSampleImpl_SetSampleTimes,
962 IDirectDrawStreamSampleImpl_Update,
963 IDirectDrawStreamSampleImpl_CompletionStatus,
964 /*** IDirectDrawStreamSample methods ***/
965 IDirectDrawStreamSampleImpl_GetSurface,
966 IDirectDrawStreamSampleImpl_SetRect
967 };
968
969 static HRESULT ddrawstreamsample_create(IDirectDrawMediaStream *parent, IDirectDrawStreamSample **ddraw_stream_sample)
970 {
971 IDirectDrawStreamSampleImpl *object;
972
973 TRACE("(%p)\n", ddraw_stream_sample);
974
975 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawStreamSampleImpl));
976 if (!object)
977 return E_OUTOFMEMORY;
978
979 object->IDirectDrawStreamSample_iface.lpVtbl = &DirectDrawStreamSample_Vtbl;
980 object->ref = 1;
981 object->parent = (IMediaStream*)parent;
982
983 *ddraw_stream_sample = (IDirectDrawStreamSample*)&object->IDirectDrawStreamSample_iface;
984
985 return S_OK;
986 }
987
988 typedef struct {
989 IAudioStreamSample IAudioStreamSample_iface;
990 LONG ref;
991 IMediaStream *parent;
992 IAudioData *audio_data;
993 } IAudioStreamSampleImpl;
994
995 static inline IAudioStreamSampleImpl *impl_from_IAudioStreamSample(IAudioStreamSample *iface)
996 {
997 return CONTAINING_RECORD(iface, IAudioStreamSampleImpl, IAudioStreamSample_iface);
998 }
999
1000 /*** IUnknown methods ***/
1001 static HRESULT WINAPI IAudioStreamSampleImpl_QueryInterface(IAudioStreamSample *iface,
1002 REFIID riid, void **ret_iface)
1003 {
1004 TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), ret_iface);
1005
1006 if (IsEqualGUID(riid, &IID_IUnknown) ||
1007 IsEqualGUID(riid, &IID_IStreamSample) ||
1008 IsEqualGUID(riid, &IID_IAudioStreamSample))
1009 {
1010 IAudioStreamSample_AddRef(iface);
1011 *ret_iface = iface;
1012 return S_OK;
1013 }
1014
1015 *ret_iface = NULL;
1016
1017 ERR("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ret_iface);
1018 return E_NOINTERFACE;
1019 }
1020
1021 static ULONG WINAPI IAudioStreamSampleImpl_AddRef(IAudioStreamSample *iface)
1022 {
1023 IAudioStreamSampleImpl *This = impl_from_IAudioStreamSample(iface);
1024 ULONG ref = InterlockedIncrement(&This->ref);
1025
1026 TRACE("(%p)->(): new ref = %u\n", iface, ref);
1027
1028 return ref;
1029 }
1030
1031 static ULONG WINAPI IAudioStreamSampleImpl_Release(IAudioStreamSample *iface)
1032 {
1033 IAudioStreamSampleImpl *This = impl_from_IAudioStreamSample(iface);
1034 ULONG ref = InterlockedDecrement(&This->ref);
1035
1036 TRACE("(%p)->(): new ref = %u\n", iface, ref);
1037
1038 if (!ref)
1039 HeapFree(GetProcessHeap(), 0, This);
1040
1041 return ref;
1042 }
1043
1044 /*** IStreamSample methods ***/
1045 static HRESULT WINAPI IAudioStreamSampleImpl_GetMediaStream(IAudioStreamSample *iface, IMediaStream **media_stream)
1046 {
1047 FIXME("(%p)->(%p): stub\n", iface, media_stream);
1048
1049 return E_NOTIMPL;
1050 }
1051
1052 static HRESULT WINAPI IAudioStreamSampleImpl_GetSampleTimes(IAudioStreamSample *iface, STREAM_TIME *start_time,
1053 STREAM_TIME *end_time, STREAM_TIME *current_time)
1054 {
1055 FIXME("(%p)->(%p,%p,%p): stub\n", iface, start_time, end_time, current_time);
1056
1057 return E_NOTIMPL;
1058 }
1059
1060 static HRESULT WINAPI IAudioStreamSampleImpl_SetSampleTimes(IAudioStreamSample *iface, const STREAM_TIME *start_time,
1061 const STREAM_TIME *end_time)
1062 {
1063 FIXME("(%p)->(%p,%p): stub\n", iface, start_time, end_time);
1064
1065 return E_NOTIMPL;
1066 }
1067
1068 static HRESULT WINAPI IAudioStreamSampleImpl_Update(IAudioStreamSample *iface, DWORD flags, HANDLE event,
1069 PAPCFUNC func_APC, DWORD APC_data)
1070 {
1071 FIXME("(%p)->(%x,%p,%p,%u): stub\n", iface, flags, event, func_APC, APC_data);
1072
1073 return E_NOTIMPL;
1074 }
1075
1076 static HRESULT WINAPI IAudioStreamSampleImpl_CompletionStatus(IAudioStreamSample *iface, DWORD flags, DWORD milliseconds)
1077 {
1078 FIXME("(%p)->(%x,%u): stub\n", iface, flags, milliseconds);
1079
1080 return E_NOTIMPL;
1081 }
1082
1083 /*** IAudioStreamSample methods ***/
1084 static HRESULT WINAPI IAudioStreamSampleImpl_GetAudioData(IAudioStreamSample *iface, IAudioData **audio_data)
1085 {
1086 FIXME("(%p)->(%p): stub\n", iface, audio_data);
1087
1088 return E_NOTIMPL;
1089 }
1090
1091 static const struct IAudioStreamSampleVtbl AudioStreamSample_Vtbl =
1092 {
1093 /*** IUnknown methods ***/
1094 IAudioStreamSampleImpl_QueryInterface,
1095 IAudioStreamSampleImpl_AddRef,
1096 IAudioStreamSampleImpl_Release,
1097 /*** IStreamSample methods ***/
1098 IAudioStreamSampleImpl_GetMediaStream,
1099 IAudioStreamSampleImpl_GetSampleTimes,
1100 IAudioStreamSampleImpl_SetSampleTimes,
1101 IAudioStreamSampleImpl_Update,
1102 IAudioStreamSampleImpl_CompletionStatus,
1103 /*** IAudioStreamSample methods ***/
1104 IAudioStreamSampleImpl_GetAudioData
1105 };
1106
1107 static HRESULT audiostreamsample_create(IAudioMediaStream *parent, IAudioData *audio_data, IAudioStreamSample **audio_stream_sample)
1108 {
1109 IAudioStreamSampleImpl *object;
1110
1111 TRACE("(%p)\n", audio_stream_sample);
1112
1113 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAudioStreamSampleImpl));
1114 if (!object)
1115 return E_OUTOFMEMORY;
1116
1117 object->IAudioStreamSample_iface.lpVtbl = &AudioStreamSample_Vtbl;
1118 object->ref = 1;
1119 object->parent = (IMediaStream*)parent;
1120 object->audio_data = audio_data;
1121
1122 *audio_stream_sample = (IAudioStreamSample*)&object->IAudioStreamSample_iface;
1123
1124 return S_OK;
1125 }