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