dsound/tests: Skip tests if there is no default device.
[wine.git] / dlls / amstream / mediastream.c
blobf619cbd23e023e01697ea80787539c21da3510ff
1 /*
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"
23 #define COBJMACROS
25 #include "winbase.h"
26 #include "wingdi.h"
28 #include "amstream_private.h"
29 #include "amstream.h"
31 #include "ddstream.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);
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;
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);
65 *ret_iface = iface;
66 return S_OK;
68 else if (IsEqualGUID(riid, &IID_IDirectDrawMediaStream))
70 IAMMediaStream_AddRef(iface);
71 *ret_iface = &This->IDirectDrawMediaStream_iface;
72 return S_OK;
75 ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface);
76 return E_NOINTERFACE;
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);
86 return 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);
96 if (!ref)
97 HeapFree(GetProcessHeap(), 0, This);
99 return ref;
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);
110 return S_FALSE;
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);
120 if (purpose_id)
121 *purpose_id = This->purpose_id;
122 if (type)
123 *type = This->stream_type;
125 return S_OK;
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);
135 return S_FALSE;
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);
145 return S_FALSE;
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);
155 return S_FALSE;
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);
164 return S_FALSE;
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);
175 return S_FALSE;
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);
184 return S_FALSE;
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);
193 return S_FALSE;
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);
202 return S_FALSE;
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);
211 return S_FALSE;
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);
253 *ret_iface = iface;
254 return S_OK;
256 else if (IsEqualGUID(riid, &IID_IAMMediaStream))
258 IDirectDrawMediaStream_AddRef(iface);
259 *ret_iface = &This->IAMMediaStream_iface;
260 return S_OK;
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);
283 if (!ref)
284 HeapFree(GetProcessHeap(), 0, This);
286 return ref;
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);
297 return S_FALSE;
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);
307 if (purpose_id)
308 *purpose_id = This->purpose_id;
309 if (type)
310 *type = This->stream_type;
312 return S_OK;
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);
322 return S_FALSE;
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);
332 return S_FALSE;
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);
342 return S_FALSE;
345 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SendEndOfStream(IDirectDrawMediaStream *iface,
346 DWORD dwFlags)
348 DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
350 FIXME("(%p/%p)->(%x) stub!\n", This, iface, dwFlags);
352 return S_FALSE;
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,
361 flags);
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);
372 return E_NOTIMPL;
375 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetDirectDraw(IDirectDrawMediaStream *iface,
376 IDirectDraw **ppDirectDraw)
378 FIXME("(%p)->(%p) stub!\n", iface, ppDirectDraw);
380 return E_NOTIMPL;
383 static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetDirectDraw(IDirectDrawMediaStream *iface,
384 IDirectDraw *pDirectDraw)
386 FIXME("(%p)->(%p) stub!\n", iface, pDirectDraw);
388 return E_NOTIMPL;
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);
405 return E_NOTIMPL;
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));
438 if (!object)
439 return E_OUTOFMEMORY;
441 object->IAMMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IAMMediaStream_Vtbl;
442 object->IDirectDrawMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Vtbl;
443 object->ref = 1;
445 object->parent = parent;
446 object->purpose_id = *purpose_id;
447 object->stream_type = stream_type;
449 *media_stream = (IMediaStream*)&object->IAMMediaStream_iface;
451 return S_OK;
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;
463 static inline AudioMediaStreamImpl *impl_from_AudioMediaStream_IAMMediaStream(IAMMediaStream *iface)
465 return CONTAINING_RECORD(iface, AudioMediaStreamImpl, IAMMediaStream_iface);
468 /*** IUnknown methods ***/
469 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_QueryInterface(IAMMediaStream *iface,
470 REFIID riid, void **ret_iface)
472 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
474 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ret_iface);
476 if (IsEqualGUID(riid, &IID_IUnknown) ||
477 IsEqualGUID(riid, &IID_IMediaStream) ||
478 IsEqualGUID(riid, &IID_IAMMediaStream))
480 IAMMediaStream_AddRef(iface);
481 *ret_iface = iface;
482 return S_OK;
484 else if (IsEqualGUID(riid, &IID_IAudioMediaStream))
486 IAMMediaStream_AddRef(iface);
487 *ret_iface = &This->IAudioMediaStream_iface;
488 return S_OK;
491 ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface);
492 return E_NOINTERFACE;
495 static ULONG WINAPI AudioMediaStreamImpl_IAMMediaStream_AddRef(IAMMediaStream *iface)
497 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
498 ULONG ref = InterlockedIncrement(&This->ref);
500 TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
502 return ref;
505 static ULONG WINAPI AudioMediaStreamImpl_IAMMediaStream_Release(IAMMediaStream *iface)
507 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
508 ULONG ref = InterlockedDecrement(&This->ref);
510 TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
512 if (!ref)
513 HeapFree(GetProcessHeap(), 0, This);
515 return ref;
518 /*** IMediaStream methods ***/
519 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_GetMultiMediaStream(IAMMediaStream *iface,
520 IMultiMediaStream** multi_media_stream)
522 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
524 FIXME("(%p/%p)->(%p) stub!\n", This, iface, multi_media_stream);
526 return S_FALSE;
529 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_GetInformation(IAMMediaStream *iface,
530 MSPID *purpose_id, STREAM_TYPE *type)
532 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
534 TRACE("(%p/%p)->(%p,%p)\n", This, iface, purpose_id, type);
536 if (purpose_id)
537 *purpose_id = This->purpose_id;
538 if (type)
539 *type = This->stream_type;
541 return S_OK;
544 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_SetSameFormat(IAMMediaStream *iface,
545 IMediaStream *pStreamThatHasDesiredFormat, DWORD flags)
547 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
549 FIXME("(%p/%p)->(%p,%x) stub!\n", This, iface, pStreamThatHasDesiredFormat, flags);
551 return S_FALSE;
554 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_AllocateSample(IAMMediaStream *iface,
555 DWORD flags, IStreamSample **sample)
557 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
559 FIXME("(%p/%p)->(%x,%p) stub!\n", This, iface, flags, sample);
561 return S_FALSE;
564 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_CreateSharedSample(IAMMediaStream *iface,
565 IStreamSample *existing_sample, DWORD flags, IStreamSample **sample)
567 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
569 FIXME("(%p/%p)->(%p,%x,%p) stub!\n", This, iface, existing_sample, flags, sample);
571 return S_FALSE;
574 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_SendEndOfStream(IAMMediaStream *iface, DWORD flags)
576 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
578 FIXME("(%p/%p)->(%x) stub!\n", This, iface, flags);
580 return S_FALSE;
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)
587 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
589 FIXME("(%p/%p)->(%p,%x,%p,%u) stub!\n", This, iface, source_object, flags, purpose_id, stream_type);
591 return S_FALSE;
594 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_SetState(IAMMediaStream *iface, FILTER_STATE state)
596 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
598 FIXME("(%p/%p)->(%u) stub!\n", This, iface, state);
600 return S_FALSE;
603 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaStream(IAMMediaStream *iface, IAMMultiMediaStream *am_multi_media_stream)
605 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
607 FIXME("(%p/%p)->(%p) stub!\n", This, iface, am_multi_media_stream);
609 return S_FALSE;
612 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMediaStreamFilter *media_stream_filter)
614 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
616 FIXME("(%p/%p)->(%p) stub!\n", This, iface, media_stream_filter);
618 return S_FALSE;
621 static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph)
623 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
625 FIXME("(%p/%p)->(%p) stub!\n", This, iface, filtergraph);
627 return S_FALSE;
630 static const struct IAMMediaStreamVtbl AudioMediaStreamImpl_IAMMediaStream_Vtbl =
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
651 static inline AudioMediaStreamImpl *impl_from_IAudioMediaStream(IAudioMediaStream *iface)
653 return CONTAINING_RECORD(iface, AudioMediaStreamImpl, IAudioMediaStream_iface);
656 /*** IUnknown methods ***/
657 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_QueryInterface(IAudioMediaStream *iface,
658 REFIID riid, void **ret_iface)
660 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
662 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ret_iface);
664 if (IsEqualGUID(riid, &IID_IUnknown) ||
665 IsEqualGUID(riid, &IID_IMediaStream) ||
666 IsEqualGUID(riid, &IID_IAudioMediaStream))
668 IAudioMediaStream_AddRef(iface);
669 *ret_iface = iface;
670 return S_OK;
672 else if (IsEqualGUID(riid, &IID_IAMMediaStream))
674 IAudioMediaStream_AddRef(iface);
675 *ret_iface = &This->IAMMediaStream_iface;
676 return S_OK;
680 *ret_iface = NULL;
682 ERR("(%p/%p)->(%s,%p),not found\n", iface, This, debugstr_guid(riid), ret_iface);
683 return E_NOINTERFACE;
686 static ULONG WINAPI AudioMediaStreamImpl_IAudioMediaStream_AddRef(IAudioMediaStream *iface)
688 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
689 ULONG ref = InterlockedIncrement(&This->ref);
691 TRACE("(%p/%p): new ref = %u\n", iface, This, ref);
693 return ref;
696 static ULONG WINAPI AudioMediaStreamImpl_IAudioMediaStream_Release(IAudioMediaStream *iface)
698 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
699 ULONG ref = InterlockedDecrement(&This->ref);
701 TRACE("(%p/%p): new ref = %u\n", iface, This, ref);
703 if (!ref)
704 HeapFree(GetProcessHeap(), 0, This);
706 return ref;
709 /*** IMediaStream methods ***/
710 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_GetMultiMediaStream(IAudioMediaStream *iface,
711 IMultiMediaStream** multimedia_stream)
713 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
715 FIXME("(%p/%p)->(%p) stub!\n", iface, This, multimedia_stream);
717 return S_FALSE;
720 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_GetInformation(IAudioMediaStream *iface,
721 MSPID *purpose_id, STREAM_TYPE *type)
723 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
725 TRACE("(%p/%p)->(%p,%p)\n", iface, This, purpose_id, type);
727 if (purpose_id)
728 *purpose_id = This->purpose_id;
729 if (type)
730 *type = This->stream_type;
732 return S_OK;
735 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_SetSameFormat(IAudioMediaStream *iface,
736 IMediaStream *stream_format, DWORD flags)
738 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
740 FIXME("(%p/%p)->(%p,%x) stub!\n", iface, This, stream_format, flags);
742 return S_FALSE;
745 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_AllocateSample(IAudioMediaStream *iface,
746 DWORD flags, IStreamSample **sample)
748 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
750 FIXME("(%p/%p)->(%x,%p) stub!\n", iface, This, flags, sample);
752 return S_FALSE;
755 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_CreateSharedSample(IAudioMediaStream *iface,
756 IStreamSample *existing_sample, DWORD flags, IStreamSample **sample)
758 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
760 FIXME("(%p/%p)->(%p,%x,%p) stub!\n", iface, This, existing_sample, flags, sample);
762 return S_FALSE;
765 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_SendEndOfStream(IAudioMediaStream *iface,
766 DWORD flags)
768 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
770 FIXME("(%p/%p)->(%x) stub!\n", iface, This, flags);
772 return S_FALSE;
775 /*** IAudioMediaStream methods ***/
776 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_GetFormat(IAudioMediaStream *iface, WAVEFORMATEX *wave_format_current)
778 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
780 FIXME("(%p/%p)->(%p) stub!\n", iface, This, wave_format_current);
782 if (!wave_format_current)
783 return E_POINTER;
785 return MS_E_NOSTREAM;
789 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_SetFormat(IAudioMediaStream *iface, const WAVEFORMATEX *wave_format)
791 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
793 FIXME("(%p/%p)->(%p) stub!\n", iface, This, wave_format);
795 return E_NOTIMPL;
798 static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_CreateSample(IAudioMediaStream *iface, IAudioData *audio_data,
799 DWORD flags, IAudioStreamSample **sample)
801 AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
803 TRACE("(%p/%p)->(%p,%u,%p)\n", iface, This, audio_data, flags, sample);
805 if (!audio_data)
806 return E_POINTER;
808 return audiostreamsample_create(iface, audio_data, sample);
811 static const struct IAudioMediaStreamVtbl AudioMediaStreamImpl_IAudioMediaStream_Vtbl =
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
830 HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
831 STREAM_TYPE stream_type, IMediaStream **media_stream)
833 AudioMediaStreamImpl *object;
835 TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream);
837 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(AudioMediaStreamImpl));
838 if (!object)
839 return E_OUTOFMEMORY;
841 object->IAMMediaStream_iface.lpVtbl = &AudioMediaStreamImpl_IAMMediaStream_Vtbl;
842 object->IAudioMediaStream_iface.lpVtbl = &AudioMediaStreamImpl_IAudioMediaStream_Vtbl;
843 object->ref = 1;
845 object->parent = parent;
846 object->purpose_id = *purpose_id;
847 object->stream_type = stream_type;
849 *media_stream = (IMediaStream*)&object->IAMMediaStream_iface;
851 return S_OK;
854 typedef struct {
855 IDirectDrawStreamSample IDirectDrawStreamSample_iface;
856 LONG ref;
857 IMediaStream *parent;
858 } IDirectDrawStreamSampleImpl;
860 static inline IDirectDrawStreamSampleImpl *impl_from_IDirectDrawStreamSample(IDirectDrawStreamSample *iface)
862 return CONTAINING_RECORD(iface, IDirectDrawStreamSampleImpl, IDirectDrawStreamSample_iface);
865 /*** IUnknown methods ***/
866 static HRESULT WINAPI IDirectDrawStreamSampleImpl_QueryInterface(IDirectDrawStreamSample *iface,
867 REFIID riid, void **ret_iface)
869 TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), ret_iface);
871 if (IsEqualGUID(riid, &IID_IUnknown) ||
872 IsEqualGUID(riid, &IID_IStreamSample) ||
873 IsEqualGUID(riid, &IID_IDirectDrawStreamSample))
875 IDirectDrawStreamSample_AddRef(iface);
876 *ret_iface = iface;
877 return S_OK;
880 *ret_iface = NULL;
882 ERR("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ret_iface);
883 return E_NOINTERFACE;
886 static ULONG WINAPI IDirectDrawStreamSampleImpl_AddRef(IDirectDrawStreamSample *iface)
888 IDirectDrawStreamSampleImpl *This = impl_from_IDirectDrawStreamSample(iface);
889 ULONG ref = InterlockedIncrement(&This->ref);
891 TRACE("(%p)->(): new ref = %u\n", iface, ref);
893 return ref;
896 static ULONG WINAPI IDirectDrawStreamSampleImpl_Release(IDirectDrawStreamSample *iface)
898 IDirectDrawStreamSampleImpl *This = impl_from_IDirectDrawStreamSample(iface);
899 ULONG ref = InterlockedDecrement(&This->ref);
901 TRACE("(%p)->(): new ref = %u\n", iface, ref);
903 if (!ref)
904 HeapFree(GetProcessHeap(), 0, This);
906 return ref;
909 /*** IStreamSample methods ***/
910 static HRESULT WINAPI IDirectDrawStreamSampleImpl_GetMediaStream(IDirectDrawStreamSample *iface, IMediaStream **media_stream)
912 FIXME("(%p)->(%p): stub\n", iface, media_stream);
914 return E_NOTIMPL;
917 static HRESULT WINAPI IDirectDrawStreamSampleImpl_GetSampleTimes(IDirectDrawStreamSample *iface, STREAM_TIME *start_time,
918 STREAM_TIME *end_time, STREAM_TIME *current_time)
920 FIXME("(%p)->(%p,%p,%p): stub\n", iface, start_time, end_time, current_time);
922 return E_NOTIMPL;
925 static HRESULT WINAPI IDirectDrawStreamSampleImpl_SetSampleTimes(IDirectDrawStreamSample *iface, const STREAM_TIME *start_time,
926 const STREAM_TIME *end_time)
928 FIXME("(%p)->(%p,%p): stub\n", iface, start_time, end_time);
930 return E_NOTIMPL;
933 static HRESULT WINAPI IDirectDrawStreamSampleImpl_Update(IDirectDrawStreamSample *iface, DWORD flags, HANDLE event,
934 PAPCFUNC func_APC, DWORD APC_data)
936 FIXME("(%p)->(%x,%p,%p,%u): stub\n", iface, flags, event, func_APC, APC_data);
938 return E_NOTIMPL;
941 static HRESULT WINAPI IDirectDrawStreamSampleImpl_CompletionStatus(IDirectDrawStreamSample *iface, DWORD flags, DWORD milliseconds)
943 FIXME("(%p)->(%x,%u): stub\n", iface, flags, milliseconds);
945 return E_NOTIMPL;
948 /*** IDirectDrawStreamSample methods ***/
949 static HRESULT WINAPI IDirectDrawStreamSampleImpl_GetSurface(IDirectDrawStreamSample *iface, IDirectDrawSurface **ddraw_surface,
950 RECT *rect)
952 FIXME("(%p)->(%p,%p): stub\n", iface, ddraw_surface, rect);
954 return E_NOTIMPL;
957 static HRESULT WINAPI IDirectDrawStreamSampleImpl_SetRect(IDirectDrawStreamSample *iface, const RECT *rect)
959 FIXME("(%p)->(%p): stub\n", iface, rect);
961 return E_NOTIMPL;
964 static const struct IDirectDrawStreamSampleVtbl DirectDrawStreamSample_Vtbl =
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
981 static HRESULT ddrawstreamsample_create(IDirectDrawMediaStream *parent, IDirectDrawStreamSample **ddraw_stream_sample)
983 IDirectDrawStreamSampleImpl *object;
985 TRACE("(%p)\n", ddraw_stream_sample);
987 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawStreamSampleImpl));
988 if (!object)
989 return E_OUTOFMEMORY;
991 object->IDirectDrawStreamSample_iface.lpVtbl = &DirectDrawStreamSample_Vtbl;
992 object->ref = 1;
993 object->parent = (IMediaStream*)parent;
995 *ddraw_stream_sample = (IDirectDrawStreamSample*)&object->IDirectDrawStreamSample_iface;
997 return S_OK;
1000 typedef struct {
1001 IAudioStreamSample IAudioStreamSample_iface;
1002 LONG ref;
1003 IMediaStream *parent;
1004 IAudioData *audio_data;
1005 } IAudioStreamSampleImpl;
1007 static inline IAudioStreamSampleImpl *impl_from_IAudioStreamSample(IAudioStreamSample *iface)
1009 return CONTAINING_RECORD(iface, IAudioStreamSampleImpl, IAudioStreamSample_iface);
1012 /*** IUnknown methods ***/
1013 static HRESULT WINAPI IAudioStreamSampleImpl_QueryInterface(IAudioStreamSample *iface,
1014 REFIID riid, void **ret_iface)
1016 TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), ret_iface);
1018 if (IsEqualGUID(riid, &IID_IUnknown) ||
1019 IsEqualGUID(riid, &IID_IStreamSample) ||
1020 IsEqualGUID(riid, &IID_IAudioStreamSample))
1022 IAudioStreamSample_AddRef(iface);
1023 *ret_iface = iface;
1024 return S_OK;
1027 *ret_iface = NULL;
1029 ERR("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ret_iface);
1030 return E_NOINTERFACE;
1033 static ULONG WINAPI IAudioStreamSampleImpl_AddRef(IAudioStreamSample *iface)
1035 IAudioStreamSampleImpl *This = impl_from_IAudioStreamSample(iface);
1036 ULONG ref = InterlockedIncrement(&This->ref);
1038 TRACE("(%p)->(): new ref = %u\n", iface, ref);
1040 return ref;
1043 static ULONG WINAPI IAudioStreamSampleImpl_Release(IAudioStreamSample *iface)
1045 IAudioStreamSampleImpl *This = impl_from_IAudioStreamSample(iface);
1046 ULONG ref = InterlockedDecrement(&This->ref);
1048 TRACE("(%p)->(): new ref = %u\n", iface, ref);
1050 if (!ref)
1051 HeapFree(GetProcessHeap(), 0, This);
1053 return ref;
1056 /*** IStreamSample methods ***/
1057 static HRESULT WINAPI IAudioStreamSampleImpl_GetMediaStream(IAudioStreamSample *iface, IMediaStream **media_stream)
1059 FIXME("(%p)->(%p): stub\n", iface, media_stream);
1061 return E_NOTIMPL;
1064 static HRESULT WINAPI IAudioStreamSampleImpl_GetSampleTimes(IAudioStreamSample *iface, STREAM_TIME *start_time,
1065 STREAM_TIME *end_time, STREAM_TIME *current_time)
1067 FIXME("(%p)->(%p,%p,%p): stub\n", iface, start_time, end_time, current_time);
1069 return E_NOTIMPL;
1072 static HRESULT WINAPI IAudioStreamSampleImpl_SetSampleTimes(IAudioStreamSample *iface, const STREAM_TIME *start_time,
1073 const STREAM_TIME *end_time)
1075 FIXME("(%p)->(%p,%p): stub\n", iface, start_time, end_time);
1077 return E_NOTIMPL;
1080 static HRESULT WINAPI IAudioStreamSampleImpl_Update(IAudioStreamSample *iface, DWORD flags, HANDLE event,
1081 PAPCFUNC func_APC, DWORD APC_data)
1083 FIXME("(%p)->(%x,%p,%p,%u): stub\n", iface, flags, event, func_APC, APC_data);
1085 return E_NOTIMPL;
1088 static HRESULT WINAPI IAudioStreamSampleImpl_CompletionStatus(IAudioStreamSample *iface, DWORD flags, DWORD milliseconds)
1090 FIXME("(%p)->(%x,%u): stub\n", iface, flags, milliseconds);
1092 return E_NOTIMPL;
1095 /*** IAudioStreamSample methods ***/
1096 static HRESULT WINAPI IAudioStreamSampleImpl_GetAudioData(IAudioStreamSample *iface, IAudioData **audio_data)
1098 FIXME("(%p)->(%p): stub\n", iface, audio_data);
1100 return E_NOTIMPL;
1103 static const struct IAudioStreamSampleVtbl AudioStreamSample_Vtbl =
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
1119 static HRESULT audiostreamsample_create(IAudioMediaStream *parent, IAudioData *audio_data, IAudioStreamSample **audio_stream_sample)
1121 IAudioStreamSampleImpl *object;
1123 TRACE("(%p)\n", audio_stream_sample);
1125 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAudioStreamSampleImpl));
1126 if (!object)
1127 return E_OUTOFMEMORY;
1129 object->IAudioStreamSample_iface.lpVtbl = &AudioStreamSample_Vtbl;
1130 object->ref = 1;
1131 object->parent = (IMediaStream*)parent;
1132 object->audio_data = audio_data;
1134 *audio_stream_sample = (IAudioStreamSample*)&object->IAudioStreamSample_iface;
1136 return S_OK;