2 * Implementation of IMediaStream Interfaces
4 * Copyright 2005, 2008, 2012 Christian Costa
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.
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.
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
21 #include "wine/debug.h"
28 #include "amstream_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(amstream);
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);
39 IAMMediaStream IAMMediaStream_iface;
40 IDirectDrawMediaStream IDirectDrawMediaStream_iface;
42 IMultiMediaStream* parent;
44 STREAM_TYPE stream_type;
45 } DirectDrawMediaStreamImpl;
47 static inline DirectDrawMediaStreamImpl *impl_from_DirectDrawMediaStream_IAMMediaStream(IAMMediaStream *iface)
49 return CONTAINING_RECORD(iface, DirectDrawMediaStreamImpl, IAMMediaStream_iface);
52 /*** IUnknown methods ***/
53 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_QueryInterface(IAMMediaStream *iface,
54 REFIID riid, void **ret_iface)
56 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
58 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ret_iface);
60 if (IsEqualGUID(riid, &IID_IUnknown) ||
61 IsEqualGUID(riid, &IID_IMediaStream) ||
62 IsEqualGUID(riid, &IID_IAMMediaStream))
64 IAMMediaStream_AddRef(iface);
68 else if (IsEqualGUID(riid, &IID_IDirectDrawMediaStream))
70 IAMMediaStream_AddRef(iface);
71 *ret_iface = &This->IDirectDrawMediaStream_iface;
75 ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface);
79 static ULONG WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_AddRef(IAMMediaStream *iface)
81 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
82 ULONG ref = InterlockedIncrement(&This->ref);
84 TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
89 static ULONG WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_Release(IAMMediaStream *iface)
91 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
92 ULONG ref = InterlockedDecrement(&This->ref);
94 TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
97 HeapFree(GetProcessHeap(), 0, This);
102 /*** IMediaStream methods ***/
103 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_GetMultiMediaStream(IAMMediaStream *iface,
104 IMultiMediaStream** multi_media_stream)
106 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
108 FIXME("(%p/%p)->(%p) stub!\n", This, iface, multi_media_stream);
113 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_GetInformation(IAMMediaStream *iface,
114 MSPID *purpose_id, STREAM_TYPE *type)
116 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
118 TRACE("(%p/%p)->(%p,%p)\n", This, iface, purpose_id, type);
121 *purpose_id = This->purpose_id;
123 *type = This->stream_type;
128 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_SetSameFormat(IAMMediaStream *iface,
129 IMediaStream *pStreamThatHasDesiredFormat, DWORD flags)
131 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
133 FIXME("(%p/%p)->(%p,%x) stub!\n", This, iface, pStreamThatHasDesiredFormat, flags);
138 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_AllocateSample(IAMMediaStream *iface,
139 DWORD flags, IStreamSample **sample)
141 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
143 FIXME("(%p/%p)->(%x,%p) stub!\n", This, iface, flags, sample);
148 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_CreateSharedSample(IAMMediaStream *iface,
149 IStreamSample *existing_sample, DWORD flags, IStreamSample **sample)
151 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
153 FIXME("(%p/%p)->(%p,%x,%p) stub!\n", This, iface, existing_sample, flags, sample);
158 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_SendEndOfStream(IAMMediaStream *iface, DWORD flags)
160 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
162 FIXME("(%p/%p)->(%x) stub!\n", This, iface, flags);
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)
171 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
173 FIXME("(%p/%p)->(%p,%x,%p,%u) stub!\n", This, iface, source_object, flags, purpose_id, stream_type);
178 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_SetState(IAMMediaStream *iface, FILTER_STATE state)
180 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
182 FIXME("(%p/%p)->(%u) stub!\n", This, iface, state);
187 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaStream(IAMMediaStream *iface, IAMMultiMediaStream *am_multi_media_stream)
189 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
191 FIXME("(%p/%p)->(%p) stub!\n", This, iface, am_multi_media_stream);
196 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMediaStreamFilter *media_stream_filter)
198 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
200 FIXME("(%p/%p)->(%p) stub!\n", This, iface, media_stream_filter);
205 static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph)
207 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
209 FIXME("(%p/%p)->(%p) stub!\n", This, iface, filtergraph);
214 static const struct IAMMediaStreamVtbl DirectDrawMediaStreamImpl_IAMMediaStream_Vtbl =
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
235 static inline DirectDrawMediaStreamImpl *impl_from_IDirectDrawMediaStream(IDirectDrawMediaStream *iface)
237 return CONTAINING_RECORD(iface, DirectDrawMediaStreamImpl, IDirectDrawMediaStream_iface);
240 /*** IUnknown methods ***/
241 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_QueryInterface(IDirectDrawMediaStream *iface,
242 REFIID riid, void **ret_iface)
244 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
246 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ret_iface);
248 if (IsEqualGUID(riid, &IID_IUnknown) ||
249 IsEqualGUID(riid, &IID_IMediaStream) ||
250 IsEqualGUID(riid, &IID_IDirectDrawMediaStream))
252 IDirectDrawMediaStream_AddRef(iface);
256 else if (IsEqualGUID(riid, &IID_IAMMediaStream))
258 IDirectDrawMediaStream_AddRef(iface);
259 *ret_iface = &This->IAMMediaStream_iface;
263 ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface);
264 return E_NOINTERFACE;
267 static ULONG WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AddRef(IDirectDrawMediaStream *iface)
269 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
271 TRACE("(%p/%p)\n", iface, This);
273 return InterlockedIncrement(&This->ref);
276 static ULONG WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Release(IDirectDrawMediaStream *iface)
278 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
279 ULONG ref = InterlockedDecrement(&This->ref);
281 TRACE("(%p/%p)\n", iface, This);
284 HeapFree(GetProcessHeap(), 0, This);
289 /*** IMediaStream methods ***/
290 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetMultiMediaStream(IDirectDrawMediaStream *iface,
291 IMultiMediaStream** ppMultiMediaStream)
293 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
295 FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppMultiMediaStream);
300 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetInformation(IDirectDrawMediaStream *iface,
301 MSPID *purpose_id, STREAM_TYPE *type)
303 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
305 TRACE("(%p/%p)->(%p,%p)\n", This, iface, purpose_id, type);
308 *purpose_id = This->purpose_id;
310 *type = This->stream_type;
315 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetSameFormat(IDirectDrawMediaStream *iface,
316 IMediaStream *pStreamThatHasDesiredFormat, DWORD dwFlags)
318 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
320 FIXME("(%p/%p)->(%p,%x) stub!\n", This, iface, pStreamThatHasDesiredFormat, dwFlags);
325 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AllocateSample(IDirectDrawMediaStream *iface,
326 DWORD dwFlags, IStreamSample **ppSample)
328 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
330 FIXME("(%p/%p)->(%x,%p) stub!\n", This, iface, dwFlags, ppSample);
335 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSharedSample(IDirectDrawMediaStream *iface,
336 IStreamSample *pExistingSample, DWORD dwFlags, IStreamSample **ppSample)
338 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
340 FIXME("(%p/%p)->(%p,%x,%p) stub!\n", This, iface, pExistingSample, dwFlags, ppSample);
345 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SendEndOfStream(IDirectDrawMediaStream *iface,
348 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
350 FIXME("(%p/%p)->(%x) stub!\n", This, iface, dwFlags);
355 /*** IDirectDrawMediaStream methods ***/
356 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetFormat(IDirectDrawMediaStream *iface,
357 DDSURFACEDESC *current_format, IDirectDrawPalette **palette,
358 DDSURFACEDESC *desired_format, DWORD *flags)
360 FIXME("(%p)->(%p,%p,%p,%p) stub!\n", iface, current_format, palette, desired_format,
363 return MS_E_NOSTREAM;
367 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetFormat(IDirectDrawMediaStream *iface,
368 const DDSURFACEDESC *pDDSurfaceDesc, IDirectDrawPalette *pDirectDrawPalette)
370 FIXME("(%p)->(%p,%p) stub!\n", iface, pDDSurfaceDesc, pDirectDrawPalette);
375 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetDirectDraw(IDirectDrawMediaStream *iface,
376 IDirectDraw **ppDirectDraw)
378 FIXME("(%p)->(%p) stub!\n", iface, ppDirectDraw);
383 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetDirectDraw(IDirectDrawMediaStream *iface,
384 IDirectDraw *pDirectDraw)
386 FIXME("(%p)->(%p) stub!\n", iface, pDirectDraw);
391 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSample(IDirectDrawMediaStream *iface,
392 IDirectDrawSurface *pSurface, const RECT *pRect, DWORD dwFlags,
393 IDirectDrawStreamSample **ppSample)
395 TRACE("(%p)->(%p,%p,%x,%p)\n", iface, pSurface, pRect, dwFlags, ppSample);
397 return ddrawstreamsample_create(iface, ppSample);
400 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetTimePerFrame(IDirectDrawMediaStream *iface,
401 STREAM_TIME *pFrameTime)
403 FIXME("(%p)->(%p) stub!\n", iface, pFrameTime);
408 static const struct IDirectDrawMediaStreamVtbl DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Vtbl =
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
430 HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
431 STREAM_TYPE stream_type, IMediaStream **media_stream)
433 DirectDrawMediaStreamImpl *object;
435 TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream);
437 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DirectDrawMediaStreamImpl));
440 ERR("Out of memory\n");
441 return E_OUTOFMEMORY;
444 object->IAMMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IAMMediaStream_Vtbl;
445 object->IDirectDrawMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Vtbl;
448 object->parent = parent;
449 object->purpose_id = *purpose_id;
450 object->stream_type = stream_type;
452 *media_stream = (IMediaStream*)&object->IAMMediaStream_iface;
458 IAMMediaStream IAMMediaStream_iface;
459 IAudioMediaStream IAudioMediaStream_iface;
461 IMultiMediaStream* parent;
463 STREAM_TYPE stream_type;
464 } AudioMediaStreamImpl;
466 static inline AudioMediaStreamImpl *impl_from_AudioMediaStream_IAMMediaStream(IAMMediaStream *iface)
468 return CONTAINING_RECORD(iface, AudioMediaStreamImpl, IAMMediaStream_iface);
471 /*** IUnknown methods ***/
472 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_QueryInterface(IAMMediaStream *iface,
473 REFIID riid, void **ret_iface)
475 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
477 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ret_iface);
479 if (IsEqualGUID(riid, &IID_IUnknown) ||
480 IsEqualGUID(riid, &IID_IMediaStream) ||
481 IsEqualGUID(riid, &IID_IAMMediaStream))
483 IAMMediaStream_AddRef(iface);
487 else if (IsEqualGUID(riid, &IID_IAudioMediaStream))
489 IAMMediaStream_AddRef(iface);
490 *ret_iface = &This->IAudioMediaStream_iface;
494 ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface);
495 return E_NOINTERFACE;
498 static ULONG WINAPI AudioMediaStreamImpl_IAMMediaStream_AddRef(IAMMediaStream *iface)
500 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
501 ULONG ref = InterlockedIncrement(&This->ref);
503 TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
508 static ULONG WINAPI AudioMediaStreamImpl_IAMMediaStream_Release(IAMMediaStream *iface)
510 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
511 ULONG ref = InterlockedDecrement(&This->ref);
513 TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
516 HeapFree(GetProcessHeap(), 0, This);
521 /*** IMediaStream methods ***/
522 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_GetMultiMediaStream(IAMMediaStream *iface,
523 IMultiMediaStream** multi_media_stream)
525 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
527 FIXME("(%p/%p)->(%p) stub!\n", This, iface, multi_media_stream);
532 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_GetInformation(IAMMediaStream *iface,
533 MSPID *purpose_id, STREAM_TYPE *type)
535 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
537 TRACE("(%p/%p)->(%p,%p)\n", This, iface, purpose_id, type);
540 *purpose_id = This->purpose_id;
542 *type = This->stream_type;
547 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_SetSameFormat(IAMMediaStream *iface,
548 IMediaStream *pStreamThatHasDesiredFormat, DWORD flags)
550 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
552 FIXME("(%p/%p)->(%p,%x) stub!\n", This, iface, pStreamThatHasDesiredFormat, flags);
557 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_AllocateSample(IAMMediaStream *iface,
558 DWORD flags, IStreamSample **sample)
560 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
562 FIXME("(%p/%p)->(%x,%p) stub!\n", This, iface, flags, sample);
567 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_CreateSharedSample(IAMMediaStream *iface,
568 IStreamSample *existing_sample, DWORD flags, IStreamSample **sample)
570 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
572 FIXME("(%p/%p)->(%p,%x,%p) stub!\n", This, iface, existing_sample, flags, sample);
577 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_SendEndOfStream(IAMMediaStream *iface, DWORD flags)
579 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
581 FIXME("(%p/%p)->(%x) stub!\n", This, iface, flags);
586 /*** IAMMediaStream methods ***/
587 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_Initialize(IAMMediaStream *iface, IUnknown *source_object, DWORD flags,
588 REFMSPID purpose_id, const STREAM_TYPE stream_type)
590 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
592 FIXME("(%p/%p)->(%p,%x,%p,%u) stub!\n", This, iface, source_object, flags, purpose_id, stream_type);
597 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_SetState(IAMMediaStream *iface, FILTER_STATE state)
599 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
601 FIXME("(%p/%p)->(%u) stub!\n", This, iface, state);
606 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaStream(IAMMediaStream *iface, IAMMultiMediaStream *am_multi_media_stream)
608 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
610 FIXME("(%p/%p)->(%p) stub!\n", This, iface, am_multi_media_stream);
615 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMediaStreamFilter *media_stream_filter)
617 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
619 FIXME("(%p/%p)->(%p) stub!\n", This, iface, media_stream_filter);
624 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph)
626 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
628 FIXME("(%p/%p)->(%p) stub!\n", This, iface, filtergraph);
633 static const struct IAMMediaStreamVtbl AudioMediaStreamImpl_IAMMediaStream_Vtbl =
635 /*** IUnknown methods ***/
636 AudioMediaStreamImpl_IAMMediaStream_QueryInterface,
637 AudioMediaStreamImpl_IAMMediaStream_AddRef,
638 AudioMediaStreamImpl_IAMMediaStream_Release,
639 /*** IMediaStream methods ***/
640 AudioMediaStreamImpl_IAMMediaStream_GetMultiMediaStream,
641 AudioMediaStreamImpl_IAMMediaStream_GetInformation,
642 AudioMediaStreamImpl_IAMMediaStream_SetSameFormat,
643 AudioMediaStreamImpl_IAMMediaStream_AllocateSample,
644 AudioMediaStreamImpl_IAMMediaStream_CreateSharedSample,
645 AudioMediaStreamImpl_IAMMediaStream_SendEndOfStream,
646 /*** IAMMediaStream methods ***/
647 AudioMediaStreamImpl_IAMMediaStream_Initialize,
648 AudioMediaStreamImpl_IAMMediaStream_SetState,
649 AudioMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaStream,
650 AudioMediaStreamImpl_IAMMediaStream_JoinFilter,
651 AudioMediaStreamImpl_IAMMediaStream_JoinFilterGraph
654 static inline AudioMediaStreamImpl *impl_from_IAudioMediaStream(IAudioMediaStream *iface)
656 return CONTAINING_RECORD(iface, AudioMediaStreamImpl, IAudioMediaStream_iface);
659 /*** IUnknown methods ***/
660 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_QueryInterface(IAudioMediaStream *iface,
661 REFIID riid, void **ret_iface)
663 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
665 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ret_iface);
667 if (IsEqualGUID(riid, &IID_IUnknown) ||
668 IsEqualGUID(riid, &IID_IMediaStream) ||
669 IsEqualGUID(riid, &IID_IAudioMediaStream))
671 IAudioMediaStream_AddRef(iface);
675 else if (IsEqualGUID(riid, &IID_IAMMediaStream))
677 IAudioMediaStream_AddRef(iface);
678 *ret_iface = &This->IAMMediaStream_iface;
685 ERR("(%p/%p)->(%s,%p),not found\n", iface, This, debugstr_guid(riid), ret_iface);
686 return E_NOINTERFACE;
689 static ULONG WINAPI AudioMediaStreamImpl_IAudioMediaStream_AddRef(IAudioMediaStream *iface)
691 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
692 ULONG ref = InterlockedIncrement(&This->ref);
694 TRACE("(%p/%p): new ref = %u\n", iface, This, ref);
699 static ULONG WINAPI AudioMediaStreamImpl_IAudioMediaStream_Release(IAudioMediaStream *iface)
701 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
702 ULONG ref = InterlockedDecrement(&This->ref);
704 TRACE("(%p/%p): new ref = %u\n", iface, This, ref);
707 HeapFree(GetProcessHeap(), 0, This);
712 /*** IMediaStream methods ***/
713 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_GetMultiMediaStream(IAudioMediaStream *iface,
714 IMultiMediaStream** multimedia_stream)
716 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
718 FIXME("(%p/%p)->(%p) stub!\n", iface, This, multimedia_stream);
723 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_GetInformation(IAudioMediaStream *iface,
724 MSPID *purpose_id, STREAM_TYPE *type)
726 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
728 TRACE("(%p/%p)->(%p,%p)\n", iface, This, purpose_id, type);
731 *purpose_id = This->purpose_id;
733 *type = This->stream_type;
738 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_SetSameFormat(IAudioMediaStream *iface,
739 IMediaStream *stream_format, DWORD flags)
741 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
743 FIXME("(%p/%p)->(%p,%x) stub!\n", iface, This, stream_format, flags);
748 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_AllocateSample(IAudioMediaStream *iface,
749 DWORD flags, IStreamSample **sample)
751 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
753 FIXME("(%p/%p)->(%x,%p) stub!\n", iface, This, flags, sample);
758 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_CreateSharedSample(IAudioMediaStream *iface,
759 IStreamSample *existing_sample, DWORD flags, IStreamSample **sample)
761 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
763 FIXME("(%p/%p)->(%p,%x,%p) stub!\n", iface, This, existing_sample, flags, sample);
768 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_SendEndOfStream(IAudioMediaStream *iface,
771 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
773 FIXME("(%p/%p)->(%x) stub!\n", iface, This, flags);
778 /*** IAudioMediaStream methods ***/
779 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_GetFormat(IAudioMediaStream *iface, WAVEFORMATEX *wave_format_current)
781 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
783 FIXME("(%p/%p)->(%p) stub!\n", iface, This, wave_format_current);
785 if (!wave_format_current)
788 return MS_E_NOSTREAM;
792 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_SetFormat(IAudioMediaStream *iface, const WAVEFORMATEX *wave_format)
794 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
796 FIXME("(%p/%p)->(%p) stub!\n", iface, This, wave_format);
801 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_CreateSample(IAudioMediaStream *iface, IAudioData *audio_data,
802 DWORD flags, IAudioStreamSample **sample)
804 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
806 TRACE("(%p/%p)->(%p,%u,%p)\n", iface, This, audio_data, flags, sample);
811 return audiostreamsample_create(iface, audio_data, sample);
814 static const struct IAudioMediaStreamVtbl AudioMediaStreamImpl_IAudioMediaStream_Vtbl =
816 /*** IUnknown methods ***/
817 AudioMediaStreamImpl_IAudioMediaStream_QueryInterface,
818 AudioMediaStreamImpl_IAudioMediaStream_AddRef,
819 AudioMediaStreamImpl_IAudioMediaStream_Release,
820 /*** IMediaStream methods ***/
821 AudioMediaStreamImpl_IAudioMediaStream_GetMultiMediaStream,
822 AudioMediaStreamImpl_IAudioMediaStream_GetInformation,
823 AudioMediaStreamImpl_IAudioMediaStream_SetSameFormat,
824 AudioMediaStreamImpl_IAudioMediaStream_AllocateSample,
825 AudioMediaStreamImpl_IAudioMediaStream_CreateSharedSample,
826 AudioMediaStreamImpl_IAudioMediaStream_SendEndOfStream,
827 /*** IAudioMediaStream methods ***/
828 AudioMediaStreamImpl_IAudioMediaStream_GetFormat,
829 AudioMediaStreamImpl_IAudioMediaStream_SetFormat,
830 AudioMediaStreamImpl_IAudioMediaStream_CreateSample
833 HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
834 STREAM_TYPE stream_type, IMediaStream **media_stream)
836 AudioMediaStreamImpl *object;
838 TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream);
840 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(AudioMediaStreamImpl));
843 ERR("Out of memory\n");
844 return E_OUTOFMEMORY;
847 object->IAMMediaStream_iface.lpVtbl = &AudioMediaStreamImpl_IAMMediaStream_Vtbl;
848 object->IAudioMediaStream_iface.lpVtbl = &AudioMediaStreamImpl_IAudioMediaStream_Vtbl;
851 object->parent = parent;
852 object->purpose_id = *purpose_id;
853 object->stream_type = stream_type;
855 *media_stream = (IMediaStream*)&object->IAMMediaStream_iface;
861 IDirectDrawStreamSample IDirectDrawStreamSample_iface;
863 IMediaStream *parent;
864 } IDirectDrawStreamSampleImpl;
866 static inline IDirectDrawStreamSampleImpl *impl_from_IDirectDrawStreamSample(IDirectDrawStreamSample *iface)
868 return CONTAINING_RECORD(iface, IDirectDrawStreamSampleImpl, IDirectDrawStreamSample_iface);
871 /*** IUnknown methods ***/
872 static HRESULT WINAPI IDirectDrawStreamSampleImpl_QueryInterface(IDirectDrawStreamSample *iface,
873 REFIID riid, void **ret_iface)
875 TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), ret_iface);
877 if (IsEqualGUID(riid, &IID_IUnknown) ||
878 IsEqualGUID(riid, &IID_IStreamSample) ||
879 IsEqualGUID(riid, &IID_IDirectDrawStreamSample))
881 IDirectDrawStreamSample_AddRef(iface);
888 ERR("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ret_iface);
889 return E_NOINTERFACE;
892 static ULONG WINAPI IDirectDrawStreamSampleImpl_AddRef(IDirectDrawStreamSample *iface)
894 IDirectDrawStreamSampleImpl *This = impl_from_IDirectDrawStreamSample(iface);
895 ULONG ref = InterlockedIncrement(&This->ref);
897 TRACE("(%p)->(): new ref = %u\n", iface, ref);
902 static ULONG WINAPI IDirectDrawStreamSampleImpl_Release(IDirectDrawStreamSample *iface)
904 IDirectDrawStreamSampleImpl *This = impl_from_IDirectDrawStreamSample(iface);
905 ULONG ref = InterlockedDecrement(&This->ref);
907 TRACE("(%p)->(): new ref = %u\n", iface, ref);
910 HeapFree(GetProcessHeap(), 0, This);
915 /*** IStreamSample methods ***/
916 static HRESULT WINAPI IDirectDrawStreamSampleImpl_GetMediaStream(IDirectDrawStreamSample *iface, IMediaStream **media_stream)
918 FIXME("(%p)->(%p): stub\n", iface, media_stream);
923 static HRESULT WINAPI IDirectDrawStreamSampleImpl_GetSampleTimes(IDirectDrawStreamSample *iface, STREAM_TIME *start_time,
924 STREAM_TIME *end_time, STREAM_TIME *current_time)
926 FIXME("(%p)->(%p,%p,%p): stub\n", iface, start_time, end_time, current_time);
931 static HRESULT WINAPI IDirectDrawStreamSampleImpl_SetSampleTimes(IDirectDrawStreamSample *iface, const STREAM_TIME *start_time,
932 const STREAM_TIME *end_time)
934 FIXME("(%p)->(%p,%p): stub\n", iface, start_time, end_time);
939 static HRESULT WINAPI IDirectDrawStreamSampleImpl_Update(IDirectDrawStreamSample *iface, DWORD flags, HANDLE event,
940 PAPCFUNC func_APC, DWORD APC_data)
942 FIXME("(%p)->(%x,%p,%p,%u): stub\n", iface, flags, event, func_APC, APC_data);
947 static HRESULT WINAPI IDirectDrawStreamSampleImpl_CompletionStatus(IDirectDrawStreamSample *iface, DWORD flags, DWORD milliseconds)
949 FIXME("(%p)->(%x,%u): stub\n", iface, flags, milliseconds);
954 /*** IDirectDrawStreamSample methods ***/
955 static HRESULT WINAPI IDirectDrawStreamSampleImpl_GetSurface(IDirectDrawStreamSample *iface, IDirectDrawSurface **ddraw_surface,
958 FIXME("(%p)->(%p,%p): stub\n", iface, ddraw_surface, rect);
963 static HRESULT WINAPI IDirectDrawStreamSampleImpl_SetRect(IDirectDrawStreamSample *iface, const RECT *rect)
965 FIXME("(%p)->(%p): stub\n", iface, rect);
970 static const struct IDirectDrawStreamSampleVtbl DirectDrawStreamSample_Vtbl =
972 /*** IUnknown methods ***/
973 IDirectDrawStreamSampleImpl_QueryInterface,
974 IDirectDrawStreamSampleImpl_AddRef,
975 IDirectDrawStreamSampleImpl_Release,
976 /*** IStreamSample methods ***/
977 IDirectDrawStreamSampleImpl_GetMediaStream,
978 IDirectDrawStreamSampleImpl_GetSampleTimes,
979 IDirectDrawStreamSampleImpl_SetSampleTimes,
980 IDirectDrawStreamSampleImpl_Update,
981 IDirectDrawStreamSampleImpl_CompletionStatus,
982 /*** IDirectDrawStreamSample methods ***/
983 IDirectDrawStreamSampleImpl_GetSurface,
984 IDirectDrawStreamSampleImpl_SetRect
987 static HRESULT ddrawstreamsample_create(IDirectDrawMediaStream *parent, IDirectDrawStreamSample **ddraw_stream_sample)
989 IDirectDrawStreamSampleImpl *object;
991 TRACE("(%p)\n", ddraw_stream_sample);
993 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawStreamSampleImpl));
996 ERR("Out of memory\n");
997 return E_OUTOFMEMORY;
1000 object->IDirectDrawStreamSample_iface.lpVtbl = &DirectDrawStreamSample_Vtbl;
1002 object->parent = (IMediaStream*)parent;
1004 *ddraw_stream_sample = (IDirectDrawStreamSample*)&object->IDirectDrawStreamSample_iface;
1010 IAudioStreamSample IAudioStreamSample_iface;
1012 IMediaStream *parent;
1013 IAudioData *audio_data;
1014 } IAudioStreamSampleImpl;
1016 static inline IAudioStreamSampleImpl *impl_from_IAudioStreamSample(IAudioStreamSample *iface)
1018 return CONTAINING_RECORD(iface, IAudioStreamSampleImpl, IAudioStreamSample_iface);
1021 /*** IUnknown methods ***/
1022 static HRESULT WINAPI IAudioStreamSampleImpl_QueryInterface(IAudioStreamSample *iface,
1023 REFIID riid, void **ret_iface)
1025 TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), ret_iface);
1027 if (IsEqualGUID(riid, &IID_IUnknown) ||
1028 IsEqualGUID(riid, &IID_IStreamSample) ||
1029 IsEqualGUID(riid, &IID_IAudioStreamSample))
1031 IAudioStreamSample_AddRef(iface);
1038 ERR("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ret_iface);
1039 return E_NOINTERFACE;
1042 static ULONG WINAPI IAudioStreamSampleImpl_AddRef(IAudioStreamSample *iface)
1044 IAudioStreamSampleImpl *This = impl_from_IAudioStreamSample(iface);
1045 ULONG ref = InterlockedIncrement(&This->ref);
1047 TRACE("(%p)->(): new ref = %u\n", iface, ref);
1052 static ULONG WINAPI IAudioStreamSampleImpl_Release(IAudioStreamSample *iface)
1054 IAudioStreamSampleImpl *This = impl_from_IAudioStreamSample(iface);
1055 ULONG ref = InterlockedDecrement(&This->ref);
1057 TRACE("(%p)->(): new ref = %u\n", iface, ref);
1060 HeapFree(GetProcessHeap(), 0, This);
1065 /*** IStreamSample methods ***/
1066 static HRESULT WINAPI IAudioStreamSampleImpl_GetMediaStream(IAudioStreamSample *iface, IMediaStream **media_stream)
1068 FIXME("(%p)->(%p): stub\n", iface, media_stream);
1073 static HRESULT WINAPI IAudioStreamSampleImpl_GetSampleTimes(IAudioStreamSample *iface, STREAM_TIME *start_time,
1074 STREAM_TIME *end_time, STREAM_TIME *current_time)
1076 FIXME("(%p)->(%p,%p,%p): stub\n", iface, start_time, end_time, current_time);
1081 static HRESULT WINAPI IAudioStreamSampleImpl_SetSampleTimes(IAudioStreamSample *iface, const STREAM_TIME *start_time,
1082 const STREAM_TIME *end_time)
1084 FIXME("(%p)->(%p,%p): stub\n", iface, start_time, end_time);
1089 static HRESULT WINAPI IAudioStreamSampleImpl_Update(IAudioStreamSample *iface, DWORD flags, HANDLE event,
1090 PAPCFUNC func_APC, DWORD APC_data)
1092 FIXME("(%p)->(%x,%p,%p,%u): stub\n", iface, flags, event, func_APC, APC_data);
1097 static HRESULT WINAPI IAudioStreamSampleImpl_CompletionStatus(IAudioStreamSample *iface, DWORD flags, DWORD milliseconds)
1099 FIXME("(%p)->(%x,%u): stub\n", iface, flags, milliseconds);
1104 /*** IAudioStreamSample methods ***/
1105 static HRESULT WINAPI IAudioStreamSampleImpl_GetAudioData(IAudioStreamSample *iface, IAudioData **audio_data)
1107 FIXME("(%p)->(%p): stub\n", iface, audio_data);
1112 static const struct IAudioStreamSampleVtbl AudioStreamSample_Vtbl =
1114 /*** IUnknown methods ***/
1115 IAudioStreamSampleImpl_QueryInterface,
1116 IAudioStreamSampleImpl_AddRef,
1117 IAudioStreamSampleImpl_Release,
1118 /*** IStreamSample methods ***/
1119 IAudioStreamSampleImpl_GetMediaStream,
1120 IAudioStreamSampleImpl_GetSampleTimes,
1121 IAudioStreamSampleImpl_SetSampleTimes,
1122 IAudioStreamSampleImpl_Update,
1123 IAudioStreamSampleImpl_CompletionStatus,
1124 /*** IAudioStreamSample methods ***/
1125 IAudioStreamSampleImpl_GetAudioData
1128 static HRESULT audiostreamsample_create(IAudioMediaStream *parent, IAudioData *audio_data, IAudioStreamSample **audio_stream_sample)
1130 IAudioStreamSampleImpl *object;
1132 TRACE("(%p)\n", audio_stream_sample);
1134 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAudioStreamSampleImpl));
1137 ERR("Out of memory\n");
1138 return E_OUTOFMEMORY;
1141 object->IAudioStreamSample_iface.lpVtbl = &AudioStreamSample_Vtbl;
1143 object->parent = (IMediaStream*)parent;
1144 object->audio_data = audio_data;
1146 *audio_stream_sample = (IAudioStreamSample*)&object->IAudioStreamSample_iface;