2 * Copyright (C) 2015 Austin English
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #include "mf_private.h"
31 #include "wine/debug.h"
32 #include "wine/list.h"
33 #include "wine/mfinternal.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(mfplat
);
37 extern const GUID CLSID_FileSchemePlugin
;
39 struct activate_object
41 IMFActivate IMFActivate_iface
;
43 IMFAttributes
*attributes
;
45 const struct activate_funcs
*funcs
;
49 static struct activate_object
*impl_from_IMFActivate(IMFActivate
*iface
)
51 return CONTAINING_RECORD(iface
, struct activate_object
, IMFActivate_iface
);
54 static HRESULT WINAPI
activate_object_QueryInterface(IMFActivate
*iface
, REFIID riid
, void **obj
)
56 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(riid
), obj
);
58 if (IsEqualIID(riid
, &IID_IMFActivate
) ||
59 IsEqualIID(riid
, &IID_IMFAttributes
) ||
60 IsEqualIID(riid
, &IID_IUnknown
))
63 IMFActivate_AddRef(iface
);
67 WARN("Unsupported %s.\n", debugstr_guid(riid
));
72 static ULONG WINAPI
activate_object_AddRef(IMFActivate
*iface
)
74 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
75 ULONG refcount
= InterlockedIncrement(&activate
->refcount
);
77 TRACE("%p, refcount %lu.\n", iface
, refcount
);
82 static ULONG WINAPI
activate_object_Release(IMFActivate
*iface
)
84 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
85 ULONG refcount
= InterlockedDecrement(&activate
->refcount
);
87 TRACE("%p, refcount %lu.\n", iface
, refcount
);
91 if (activate
->funcs
->free_private
)
92 activate
->funcs
->free_private(activate
->context
);
94 IUnknown_Release(activate
->object
);
95 IMFAttributes_Release(activate
->attributes
);
102 static HRESULT WINAPI
activate_object_GetItem(IMFActivate
*iface
, REFGUID key
, PROPVARIANT
*value
)
104 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
106 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), value
);
108 return IMFAttributes_GetItem(activate
->attributes
, key
, value
);
111 static HRESULT WINAPI
activate_object_GetItemType(IMFActivate
*iface
, REFGUID key
, MF_ATTRIBUTE_TYPE
*type
)
113 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
115 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), type
);
117 return IMFAttributes_GetItemType(activate
->attributes
, key
, type
);
120 static HRESULT WINAPI
activate_object_CompareItem(IMFActivate
*iface
, REFGUID key
, REFPROPVARIANT value
, BOOL
*result
)
122 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
124 TRACE("%p, %s, %p, %p.\n", iface
, debugstr_guid(key
), value
, result
);
126 return IMFAttributes_CompareItem(activate
->attributes
, key
, value
, result
);
129 static HRESULT WINAPI
activate_object_Compare(IMFActivate
*iface
, IMFAttributes
*theirs
, MF_ATTRIBUTES_MATCH_TYPE type
,
132 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
134 TRACE("%p, %p, %d, %p.\n", iface
, theirs
, type
, result
);
136 return IMFAttributes_Compare(activate
->attributes
, theirs
, type
, result
);
139 static HRESULT WINAPI
activate_object_GetUINT32(IMFActivate
*iface
, REFGUID key
, UINT32
*value
)
141 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
143 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), value
);
145 return IMFAttributes_GetUINT32(activate
->attributes
, key
, value
);
148 static HRESULT WINAPI
activate_object_GetUINT64(IMFActivate
*iface
, REFGUID key
, UINT64
*value
)
150 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
152 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), value
);
154 return IMFAttributes_GetUINT64(activate
->attributes
, key
, value
);
157 static HRESULT WINAPI
activate_object_GetDouble(IMFActivate
*iface
, REFGUID key
, double *value
)
159 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
161 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), value
);
163 return IMFAttributes_GetDouble(activate
->attributes
, key
, value
);
166 static HRESULT WINAPI
activate_object_GetGUID(IMFActivate
*iface
, REFGUID key
, GUID
*value
)
168 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
170 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), value
);
172 return IMFAttributes_GetGUID(activate
->attributes
, key
, value
);
175 static HRESULT WINAPI
activate_object_GetStringLength(IMFActivate
*iface
, REFGUID key
, UINT32
*length
)
177 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
179 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), length
);
181 return IMFAttributes_GetStringLength(activate
->attributes
, key
, length
);
184 static HRESULT WINAPI
activate_object_GetString(IMFActivate
*iface
, REFGUID key
, WCHAR
*value
,
185 UINT32 size
, UINT32
*length
)
187 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
189 TRACE("%p, %s, %p, %d, %p.\n", iface
, debugstr_guid(key
), value
, size
, length
);
191 return IMFAttributes_GetString(activate
->attributes
, key
, value
, size
, length
);
194 static HRESULT WINAPI
activate_object_GetAllocatedString(IMFActivate
*iface
, REFGUID key
,
195 WCHAR
**value
, UINT32
*length
)
197 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
199 TRACE("%p, %s, %p, %p.\n", iface
, debugstr_guid(key
), value
, length
);
201 return IMFAttributes_GetAllocatedString(activate
->attributes
, key
, value
, length
);
204 static HRESULT WINAPI
activate_object_GetBlobSize(IMFActivate
*iface
, REFGUID key
, UINT32
*size
)
206 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
208 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), size
);
210 return IMFAttributes_GetBlobSize(activate
->attributes
, key
, size
);
213 static HRESULT WINAPI
activate_object_GetBlob(IMFActivate
*iface
, REFGUID key
, UINT8
*buf
,
214 UINT32 bufsize
, UINT32
*blobsize
)
216 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
218 TRACE("%p, %s, %p, %d, %p.\n", iface
, debugstr_guid(key
), buf
, bufsize
, blobsize
);
220 return IMFAttributes_GetBlob(activate
->attributes
, key
, buf
, bufsize
, blobsize
);
223 static HRESULT WINAPI
activate_object_GetAllocatedBlob(IMFActivate
*iface
, REFGUID key
, UINT8
**buf
, UINT32
*size
)
225 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
227 TRACE("%p, %s, %p, %p.\n", iface
, debugstr_guid(key
), buf
, size
);
229 return IMFAttributes_GetAllocatedBlob(activate
->attributes
, key
, buf
, size
);
232 static HRESULT WINAPI
activate_object_GetUnknown(IMFActivate
*iface
, REFGUID key
, REFIID riid
, void **ppv
)
234 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
236 TRACE("%p, %s, %s, %p.\n", iface
, debugstr_guid(key
), debugstr_guid(riid
), ppv
);
238 return IMFAttributes_GetUnknown(activate
->attributes
, key
, riid
, ppv
);
241 static HRESULT WINAPI
activate_object_SetItem(IMFActivate
*iface
, REFGUID key
, REFPROPVARIANT value
)
243 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
245 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(key
), value
);
247 return IMFAttributes_SetItem(activate
->attributes
, key
, value
);
250 static HRESULT WINAPI
activate_object_DeleteItem(IMFActivate
*iface
, REFGUID key
)
252 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
254 TRACE("%p, %s.\n", iface
, debugstr_guid(key
));
256 return IMFAttributes_DeleteItem(activate
->attributes
, key
);
259 static HRESULT WINAPI
activate_object_DeleteAllItems(IMFActivate
*iface
)
261 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
263 TRACE("%p.\n", iface
);
265 return IMFAttributes_DeleteAllItems(activate
->attributes
);
268 static HRESULT WINAPI
activate_object_SetUINT32(IMFActivate
*iface
, REFGUID key
, UINT32 value
)
270 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
272 TRACE("%p, %s, %d.\n", iface
, debugstr_guid(key
), value
);
274 return IMFAttributes_SetUINT32(activate
->attributes
, key
, value
);
277 static HRESULT WINAPI
activate_object_SetUINT64(IMFActivate
*iface
, REFGUID key
, UINT64 value
)
279 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
281 TRACE("%p, %s, %s.\n", iface
, debugstr_guid(key
), wine_dbgstr_longlong(value
));
283 return IMFAttributes_SetUINT64(activate
->attributes
, key
, value
);
286 static HRESULT WINAPI
activate_object_SetDouble(IMFActivate
*iface
, REFGUID key
, double value
)
288 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
290 TRACE("%p, %s, %f.\n", iface
, debugstr_guid(key
), value
);
292 return IMFAttributes_SetDouble(activate
->attributes
, key
, value
);
295 static HRESULT WINAPI
activate_object_SetGUID(IMFActivate
*iface
, REFGUID key
, REFGUID value
)
297 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
299 TRACE("%p, %s, %s.\n", iface
, debugstr_guid(key
), debugstr_guid(value
));
301 return IMFAttributes_SetGUID(activate
->attributes
, key
, value
);
304 static HRESULT WINAPI
activate_object_SetString(IMFActivate
*iface
, REFGUID key
, const WCHAR
*value
)
306 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
308 TRACE("%p, %s, %s.\n", iface
, debugstr_guid(key
), debugstr_w(value
));
310 return IMFAttributes_SetString(activate
->attributes
, key
, value
);
313 static HRESULT WINAPI
activate_object_SetBlob(IMFActivate
*iface
, REFGUID key
, const UINT8
*buf
, UINT32 size
)
315 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
317 TRACE("%p, %s, %p, %d.\n", iface
, debugstr_guid(key
), buf
, size
);
319 return IMFAttributes_SetBlob(activate
->attributes
, key
, buf
, size
);
322 static HRESULT WINAPI
activate_object_SetUnknown(IMFActivate
*iface
, REFGUID key
, IUnknown
*unknown
)
324 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
326 TRACE("(%p)->(%s, %p)\n", iface
, debugstr_guid(key
), unknown
);
328 return IMFAttributes_SetUnknown(activate
->attributes
, key
, unknown
);
331 static HRESULT WINAPI
activate_object_LockStore(IMFActivate
*iface
)
333 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
335 TRACE("%p.\n", iface
);
337 return IMFAttributes_LockStore(activate
->attributes
);
340 static HRESULT WINAPI
activate_object_UnlockStore(IMFActivate
*iface
)
342 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
344 TRACE("%p.\n", iface
);
346 return IMFAttributes_UnlockStore(activate
->attributes
);
349 static HRESULT WINAPI
activate_object_GetCount(IMFActivate
*iface
, UINT32
*count
)
351 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
353 TRACE("%p, %p.\n", iface
, count
);
355 return IMFAttributes_GetCount(activate
->attributes
, count
);
358 static HRESULT WINAPI
activate_object_GetItemByIndex(IMFActivate
*iface
, UINT32 index
, GUID
*key
, PROPVARIANT
*value
)
360 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
362 TRACE("%p, %u, %p, %p.\n", iface
, index
, key
, value
);
364 return IMFAttributes_GetItemByIndex(activate
->attributes
, index
, key
, value
);
367 static HRESULT WINAPI
activate_object_CopyAllItems(IMFActivate
*iface
, IMFAttributes
*dest
)
369 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
371 TRACE("%p, %p.\n", iface
, dest
);
373 return IMFAttributes_CopyAllItems(activate
->attributes
, dest
);
376 static HRESULT WINAPI
activate_object_ActivateObject(IMFActivate
*iface
, REFIID riid
, void **obj
)
378 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
382 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(riid
), obj
);
384 if (!activate
->object
)
386 if (FAILED(hr
= activate
->funcs
->create_object((IMFAttributes
*)iface
, activate
->context
, &object
)))
389 if (InterlockedCompareExchangePointer((void **)&activate
->object
, object
, NULL
))
390 IUnknown_Release(object
);
393 return IUnknown_QueryInterface(activate
->object
, riid
, obj
);
396 static HRESULT WINAPI
activate_object_ShutdownObject(IMFActivate
*iface
)
398 struct activate_object
*activate
= impl_from_IMFActivate(iface
);
401 TRACE("%p.\n", iface
);
403 if ((object
= InterlockedCompareExchangePointer((void **)&activate
->object
, NULL
, activate
->object
)))
405 activate
->funcs
->shutdown_object(activate
->context
, object
);
406 IUnknown_Release(object
);
412 static HRESULT WINAPI
activate_object_DetachObject(IMFActivate
*iface
)
414 TRACE("%p.\n", iface
);
419 static const IMFActivateVtbl activate_object_vtbl
=
421 activate_object_QueryInterface
,
422 activate_object_AddRef
,
423 activate_object_Release
,
424 activate_object_GetItem
,
425 activate_object_GetItemType
,
426 activate_object_CompareItem
,
427 activate_object_Compare
,
428 activate_object_GetUINT32
,
429 activate_object_GetUINT64
,
430 activate_object_GetDouble
,
431 activate_object_GetGUID
,
432 activate_object_GetStringLength
,
433 activate_object_GetString
,
434 activate_object_GetAllocatedString
,
435 activate_object_GetBlobSize
,
436 activate_object_GetBlob
,
437 activate_object_GetAllocatedBlob
,
438 activate_object_GetUnknown
,
439 activate_object_SetItem
,
440 activate_object_DeleteItem
,
441 activate_object_DeleteAllItems
,
442 activate_object_SetUINT32
,
443 activate_object_SetUINT64
,
444 activate_object_SetDouble
,
445 activate_object_SetGUID
,
446 activate_object_SetString
,
447 activate_object_SetBlob
,
448 activate_object_SetUnknown
,
449 activate_object_LockStore
,
450 activate_object_UnlockStore
,
451 activate_object_GetCount
,
452 activate_object_GetItemByIndex
,
453 activate_object_CopyAllItems
,
454 activate_object_ActivateObject
,
455 activate_object_ShutdownObject
,
456 activate_object_DetachObject
,
459 HRESULT
create_activation_object(void *context
, const struct activate_funcs
*funcs
, IMFActivate
**ret
)
461 struct activate_object
*object
;
464 if (!(object
= calloc(1, sizeof(*object
))))
465 return E_OUTOFMEMORY
;
467 object
->IMFActivate_iface
.lpVtbl
= &activate_object_vtbl
;
468 object
->refcount
= 1;
469 if (FAILED(hr
= MFCreateAttributes(&object
->attributes
, 0)))
474 object
->funcs
= funcs
;
475 object
->context
= context
;
477 *ret
= &object
->IMFActivate_iface
;
484 IClassFactory IClassFactory_iface
;
485 HRESULT (*create_instance
)(REFIID riid
, void **obj
);
488 static inline struct class_factory
*impl_from_IClassFactory(IClassFactory
*iface
)
490 return CONTAINING_RECORD(iface
, struct class_factory
, IClassFactory_iface
);
493 static HRESULT WINAPI
class_factory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **obj
)
495 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(riid
), obj
);
497 if (IsEqualGUID(riid
, &IID_IClassFactory
) ||
498 IsEqualGUID(riid
, &IID_IUnknown
))
501 IClassFactory_AddRef(iface
);
505 WARN("%s is not supported.\n", debugstr_guid(riid
));
507 return E_NOINTERFACE
;
510 static ULONG WINAPI
class_factory_AddRef(IClassFactory
*iface
)
515 static ULONG WINAPI
class_factory_Release(IClassFactory
*iface
)
520 static HRESULT WINAPI
class_factory_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
, REFIID riid
, void **obj
)
522 struct class_factory
*factory
= impl_from_IClassFactory(iface
);
524 TRACE("%p, %p, %s, %p.\n", iface
, outer
, debugstr_guid(riid
), obj
);
529 return CLASS_E_NOAGGREGATION
;
532 return factory
->create_instance(riid
, obj
);
535 static HRESULT WINAPI
class_factory_LockServer(IClassFactory
*iface
, BOOL dolock
)
537 FIXME("%d.\n", dolock
);
542 static const IClassFactoryVtbl class_factory_vtbl
=
544 class_factory_QueryInterface
,
545 class_factory_AddRef
,
546 class_factory_Release
,
547 class_factory_CreateInstance
,
548 class_factory_LockServer
,
551 struct file_scheme_handler_result
554 IMFAsyncResult
*result
;
555 MF_OBJECT_TYPE obj_type
;
559 struct file_scheme_handler
561 IMFSchemeHandler IMFSchemeHandler_iface
;
562 IMFAsyncCallback IMFAsyncCallback_iface
;
564 IMFSourceResolver
*resolver
;
569 static struct file_scheme_handler
*impl_from_IMFSchemeHandler(IMFSchemeHandler
*iface
)
571 return CONTAINING_RECORD(iface
, struct file_scheme_handler
, IMFSchemeHandler_iface
);
574 static struct file_scheme_handler
*impl_from_IMFAsyncCallback(IMFAsyncCallback
*iface
)
576 return CONTAINING_RECORD(iface
, struct file_scheme_handler
, IMFAsyncCallback_iface
);
579 static HRESULT WINAPI
file_scheme_handler_QueryInterface(IMFSchemeHandler
*iface
, REFIID riid
, void **obj
)
581 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(riid
), obj
);
583 if (IsEqualIID(riid
, &IID_IMFSchemeHandler
) ||
584 IsEqualIID(riid
, &IID_IUnknown
))
587 IMFSchemeHandler_AddRef(iface
);
591 WARN("Unsupported %s.\n", debugstr_guid(riid
));
593 return E_NOINTERFACE
;
596 static ULONG WINAPI
file_scheme_handler_AddRef(IMFSchemeHandler
*iface
)
598 struct file_scheme_handler
*handler
= impl_from_IMFSchemeHandler(iface
);
599 ULONG refcount
= InterlockedIncrement(&handler
->refcount
);
601 TRACE("%p, refcount %lu.\n", handler
, refcount
);
606 static ULONG WINAPI
file_scheme_handler_Release(IMFSchemeHandler
*iface
)
608 struct file_scheme_handler
*handler
= impl_from_IMFSchemeHandler(iface
);
609 ULONG refcount
= InterlockedDecrement(&handler
->refcount
);
610 struct file_scheme_handler_result
*result
, *next
;
612 TRACE("%p, refcount %lu.\n", iface
, refcount
);
616 LIST_FOR_EACH_ENTRY_SAFE(result
, next
, &handler
->results
, struct file_scheme_handler_result
, entry
)
618 list_remove(&result
->entry
);
619 IMFAsyncResult_Release(result
->result
);
621 IUnknown_Release(result
->object
);
624 DeleteCriticalSection(&handler
->cs
);
625 if (handler
->resolver
)
626 IMFSourceResolver_Release(handler
->resolver
);
633 struct create_object_context
635 IUnknown IUnknown_iface
;
638 IPropertyStore
*props
;
643 static struct create_object_context
*impl_from_IUnknown(IUnknown
*iface
)
645 return CONTAINING_RECORD(iface
, struct create_object_context
, IUnknown_iface
);
648 static HRESULT WINAPI
create_object_context_QueryInterface(IUnknown
*iface
, REFIID riid
, void **obj
)
650 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(riid
), obj
);
652 if (IsEqualIID(riid
, &IID_IUnknown
))
655 IUnknown_AddRef(iface
);
659 WARN("Unsupported %s.\n", debugstr_guid(riid
));
661 return E_NOINTERFACE
;
664 static ULONG WINAPI
create_object_context_AddRef(IUnknown
*iface
)
666 struct create_object_context
*context
= impl_from_IUnknown(iface
);
667 ULONG refcount
= InterlockedIncrement(&context
->refcount
);
669 TRACE("%p, refcount %lu.\n", iface
, refcount
);
674 static ULONG WINAPI
create_object_context_Release(IUnknown
*iface
)
676 struct create_object_context
*context
= impl_from_IUnknown(iface
);
677 ULONG refcount
= InterlockedDecrement(&context
->refcount
);
679 TRACE("%p, refcount %lu.\n", iface
, refcount
);
684 IPropertyStore_Release(context
->props
);
692 static const IUnknownVtbl create_object_context_vtbl
=
694 create_object_context_QueryInterface
,
695 create_object_context_AddRef
,
696 create_object_context_Release
,
699 static HRESULT WINAPI
file_scheme_handler_BeginCreateObject(IMFSchemeHandler
*iface
, const WCHAR
*url
, DWORD flags
,
700 IPropertyStore
*props
, IUnknown
**cancel_cookie
, IMFAsyncCallback
*callback
, IUnknown
*state
)
702 struct file_scheme_handler
*handler
= impl_from_IMFSchemeHandler(iface
);
703 struct create_object_context
*context
;
704 IMFAsyncResult
*caller
, *item
;
707 TRACE("%p, %s, %#lx, %p, %p, %p, %p.\n", iface
, debugstr_w(url
), flags
, props
, cancel_cookie
, callback
, state
);
710 *cancel_cookie
= NULL
;
712 if (FAILED(hr
= MFCreateAsyncResult(NULL
, callback
, state
, &caller
)))
715 if (!(context
= malloc(sizeof(*context
))))
717 IMFAsyncResult_Release(caller
);
718 return E_OUTOFMEMORY
;
721 context
->IUnknown_iface
.lpVtbl
= &create_object_context_vtbl
;
722 context
->refcount
= 1;
723 context
->props
= props
;
725 IPropertyStore_AddRef(context
->props
);
726 context
->flags
= flags
;
727 context
->url
= wcsdup(url
);
730 IMFAsyncResult_Release(caller
);
731 IUnknown_Release(&context
->IUnknown_iface
);
732 return E_OUTOFMEMORY
;
735 hr
= MFCreateAsyncResult(&context
->IUnknown_iface
, &handler
->IMFAsyncCallback_iface
, (IUnknown
*)caller
, &item
);
736 IUnknown_Release(&context
->IUnknown_iface
);
739 if (SUCCEEDED(hr
= MFPutWorkItemEx(MFASYNC_CALLBACK_QUEUE_IO
, item
)))
743 *cancel_cookie
= (IUnknown
*)caller
;
744 IUnknown_AddRef(*cancel_cookie
);
748 IMFAsyncResult_Release(item
);
750 IMFAsyncResult_Release(caller
);
755 static HRESULT WINAPI
file_scheme_handler_EndCreateObject(IMFSchemeHandler
*iface
, IMFAsyncResult
*result
,
756 MF_OBJECT_TYPE
*obj_type
, IUnknown
**object
)
758 struct file_scheme_handler
*handler
= impl_from_IMFSchemeHandler(iface
);
759 struct file_scheme_handler_result
*found
= NULL
, *cur
;
762 TRACE("%p, %p, %p, %p.\n", iface
, result
, obj_type
, object
);
764 EnterCriticalSection(&handler
->cs
);
766 LIST_FOR_EACH_ENTRY(cur
, &handler
->results
, struct file_scheme_handler_result
, entry
)
768 if (result
== cur
->result
)
770 list_remove(&cur
->entry
);
776 LeaveCriticalSection(&handler
->cs
);
780 *obj_type
= found
->obj_type
;
781 *object
= found
->object
;
782 hr
= IMFAsyncResult_GetStatus(found
->result
);
783 IMFAsyncResult_Release(found
->result
);
788 *obj_type
= MF_OBJECT_INVALID
;
790 hr
= MF_E_UNEXPECTED
;
796 static HRESULT WINAPI
file_scheme_handler_CancelObjectCreation(IMFSchemeHandler
*iface
, IUnknown
*cancel_cookie
)
798 struct file_scheme_handler
*handler
= impl_from_IMFSchemeHandler(iface
);
799 struct file_scheme_handler_result
*found
= NULL
, *cur
;
801 TRACE("%p, %p.\n", iface
, cancel_cookie
);
803 EnterCriticalSection(&handler
->cs
);
805 LIST_FOR_EACH_ENTRY(cur
, &handler
->results
, struct file_scheme_handler_result
, entry
)
807 if (cancel_cookie
== (IUnknown
*)cur
->result
)
809 list_remove(&cur
->entry
);
815 LeaveCriticalSection(&handler
->cs
);
819 IMFAsyncResult_Release(found
->result
);
821 IUnknown_Release(found
->object
);
825 return found
? S_OK
: MF_E_UNEXPECTED
;
828 static const IMFSchemeHandlerVtbl file_scheme_handler_vtbl
=
830 file_scheme_handler_QueryInterface
,
831 file_scheme_handler_AddRef
,
832 file_scheme_handler_Release
,
833 file_scheme_handler_BeginCreateObject
,
834 file_scheme_handler_EndCreateObject
,
835 file_scheme_handler_CancelObjectCreation
,
838 static HRESULT WINAPI
file_scheme_handler_callback_QueryInterface(IMFAsyncCallback
*iface
, REFIID riid
, void **obj
)
840 if (IsEqualIID(riid
, &IID_IMFAsyncCallback
) ||
841 IsEqualIID(riid
, &IID_IUnknown
))
844 IMFAsyncCallback_AddRef(iface
);
848 WARN("Unsupported %s.\n", debugstr_guid(riid
));
850 return E_NOINTERFACE
;
853 static ULONG WINAPI
file_scheme_handler_callback_AddRef(IMFAsyncCallback
*iface
)
855 struct file_scheme_handler
*handler
= impl_from_IMFAsyncCallback(iface
);
856 return IMFSchemeHandler_AddRef(&handler
->IMFSchemeHandler_iface
);
859 static ULONG WINAPI
file_scheme_handler_callback_Release(IMFAsyncCallback
*iface
)
861 struct file_scheme_handler
*handler
= impl_from_IMFAsyncCallback(iface
);
862 return IMFSchemeHandler_Release(&handler
->IMFSchemeHandler_iface
);
865 static HRESULT WINAPI
file_scheme_handler_callback_GetParameters(IMFAsyncCallback
*iface
, DWORD
*flags
, DWORD
*queue
)
870 static HRESULT
file_scheme_handler_get_resolver(struct file_scheme_handler
*handler
, IMFSourceResolver
**resolver
)
874 if (!handler
->resolver
)
876 IMFSourceResolver
*resolver
;
878 if (FAILED(hr
= MFCreateSourceResolver(&resolver
)))
881 if (InterlockedCompareExchangePointer((void **)&handler
->resolver
, resolver
, NULL
))
882 IMFSourceResolver_Release(resolver
);
885 *resolver
= handler
->resolver
;
886 IMFSourceResolver_AddRef(*resolver
);
891 static HRESULT WINAPI
file_scheme_handler_callback_Invoke(IMFAsyncCallback
*iface
, IMFAsyncResult
*result
)
893 static const WCHAR schemeW
[] = {'f','i','l','e',':','/','/'};
894 struct file_scheme_handler
*handler
= impl_from_IMFAsyncCallback(iface
);
895 struct file_scheme_handler_result
*handler_result
;
896 MF_OBJECT_TYPE obj_type
= MF_OBJECT_INVALID
;
897 IUnknown
*object
= NULL
, *context_object
;
898 struct create_object_context
*context
;
899 IMFSourceResolver
*resolver
;
900 IMFAsyncResult
*caller
;
901 IMFByteStream
*stream
;
905 caller
= (IMFAsyncResult
*)IMFAsyncResult_GetStateNoAddRef(result
);
907 if (FAILED(hr
= IMFAsyncResult_GetObject(result
, &context_object
)))
909 WARN("Expected context set for callee result.\n");
913 context
= impl_from_IUnknown(context_object
);
915 /* Strip from scheme, MFCreateFile() won't be expecting it. */
917 if (!wcsnicmp(context
->url
, schemeW
, ARRAY_SIZE(schemeW
)))
918 url
+= ARRAY_SIZE(schemeW
);
920 hr
= MFCreateFile(context
->flags
& MF_RESOLUTION_WRITE
? MF_ACCESSMODE_READWRITE
: MF_ACCESSMODE_READ
,
921 MF_OPENMODE_FAIL_IF_NOT_EXIST
, MF_FILEFLAGS_NONE
, url
, &stream
);
924 if (context
->flags
& MF_RESOLUTION_MEDIASOURCE
)
926 if (SUCCEEDED(hr
= file_scheme_handler_get_resolver(handler
, &resolver
)))
928 hr
= IMFSourceResolver_CreateObjectFromByteStream(resolver
, stream
, context
->url
, context
->flags
,
929 context
->props
, &obj_type
, &object
);
930 IMFSourceResolver_Release(resolver
);
931 IMFByteStream_Release(stream
);
936 object
= (IUnknown
*)stream
;
937 obj_type
= MF_OBJECT_BYTESTREAM
;
941 handler_result
= malloc(sizeof(*handler_result
));
944 handler_result
->result
= caller
;
945 IMFAsyncResult_AddRef(handler_result
->result
);
946 handler_result
->obj_type
= obj_type
;
947 handler_result
->object
= object
;
949 EnterCriticalSection(&handler
->cs
);
950 list_add_tail(&handler
->results
, &handler_result
->entry
);
951 LeaveCriticalSection(&handler
->cs
);
956 IUnknown_Release(object
);
960 IUnknown_Release(&context
->IUnknown_iface
);
962 IMFAsyncResult_SetStatus(caller
, hr
);
963 MFInvokeCallback(caller
);
968 static const IMFAsyncCallbackVtbl file_scheme_handler_callback_vtbl
=
970 file_scheme_handler_callback_QueryInterface
,
971 file_scheme_handler_callback_AddRef
,
972 file_scheme_handler_callback_Release
,
973 file_scheme_handler_callback_GetParameters
,
974 file_scheme_handler_callback_Invoke
,
977 static HRESULT
file_scheme_handler_construct(REFIID riid
, void **obj
)
979 struct file_scheme_handler
*handler
;
982 TRACE("%s, %p.\n", debugstr_guid(riid
), obj
);
984 if (!(handler
= calloc(1, sizeof(*handler
))))
985 return E_OUTOFMEMORY
;
987 handler
->IMFSchemeHandler_iface
.lpVtbl
= &file_scheme_handler_vtbl
;
988 handler
->IMFAsyncCallback_iface
.lpVtbl
= &file_scheme_handler_callback_vtbl
;
989 handler
->refcount
= 1;
990 list_init(&handler
->results
);
991 InitializeCriticalSection(&handler
->cs
);
993 hr
= IMFSchemeHandler_QueryInterface(&handler
->IMFSchemeHandler_iface
, riid
, obj
);
994 IMFSchemeHandler_Release(&handler
->IMFSchemeHandler_iface
);
999 static struct class_factory file_scheme_handler_factory
= { { &class_factory_vtbl
}, file_scheme_handler_construct
};
1001 static const struct class_object
1004 IClassFactory
*factory
;
1008 { &CLSID_FileSchemePlugin
, &file_scheme_handler_factory
.IClassFactory_iface
},
1011 /*******************************************************************************
1012 * DllGetClassObject (mf.@)
1014 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, void **obj
)
1018 TRACE("%s, %s, %p.\n", debugstr_guid(rclsid
), debugstr_guid(riid
), obj
);
1020 for (i
= 0; i
< ARRAY_SIZE(class_objects
); ++i
)
1022 if (IsEqualGUID(class_objects
[i
].clsid
, rclsid
))
1023 return IClassFactory_QueryInterface(class_objects
[i
].factory
, riid
, obj
);
1026 WARN("%s: class not found.\n", debugstr_guid(rclsid
));
1027 return CLASS_E_CLASSNOTAVAILABLE
;
1030 static HRESULT
prop_string_vector_append(PROPVARIANT
*vector
, unsigned int *capacity
, BOOL unique
, const WCHAR
*str
)
1037 for (i
= 0; i
< vector
->calpwstr
.cElems
; ++i
)
1039 if (!lstrcmpW(vector
->calpwstr
.pElems
[i
], str
))
1044 if (!*capacity
|| *capacity
- 1 < vector
->calpwstr
.cElems
)
1046 unsigned int new_count
;
1049 new_count
= *capacity
? *capacity
* 2 : 10;
1050 ptr
= CoTaskMemRealloc(vector
->calpwstr
.pElems
, new_count
* sizeof(*vector
->calpwstr
.pElems
));
1052 return E_OUTOFMEMORY
;
1053 vector
->calpwstr
.pElems
= ptr
;
1054 *capacity
= new_count
;
1057 len
= lstrlenW(str
);
1058 if (!(vector
->calpwstr
.pElems
[vector
->calpwstr
.cElems
] = ptrW
= CoTaskMemAlloc((len
+ 1) * sizeof(WCHAR
))))
1059 return E_OUTOFMEMORY
;
1061 lstrcpyW(ptrW
, str
);
1062 vector
->calpwstr
.cElems
++;
1067 static int __cdecl
qsort_string_compare(const void *a
, const void *b
)
1069 const WCHAR
*left
= *(const WCHAR
**)a
, *right
= *(const WCHAR
**)b
;
1070 return lstrcmpW(left
, right
);
1073 static HRESULT
mf_get_handler_strings(const WCHAR
*path
, WCHAR filter
, unsigned int maxlen
, PROPVARIANT
*dst
)
1075 static const HKEY hkey_roots
[2] = { HKEY_CURRENT_USER
, HKEY_LOCAL_MACHINE
};
1076 unsigned int capacity
= 0, count
;
1082 if (!(buffW
= calloc(maxlen
, sizeof(*buffW
))))
1083 return E_OUTOFMEMORY
;
1085 memset(dst
, 0, sizeof(*dst
));
1086 dst
->vt
= VT_VECTOR
| VT_LPWSTR
;
1088 for (i
= 0; i
< ARRAY_SIZE(hkey_roots
); ++i
)
1092 if (RegOpenKeyW(hkey_roots
[i
], path
, &hkey
))
1097 count
= dst
->calpwstr
.cElems
;
1098 while (!RegEnumKeyExW(hkey
, index
++, buffW
, &size
, NULL
, NULL
, NULL
, NULL
))
1100 if (filter
&& !wcschr(buffW
, filter
))
1103 if (FAILED(hr
= prop_string_vector_append(dst
, &capacity
, i
> 0, buffW
)))
1108 /* Sort last pass results. */
1109 qsort(&dst
->calpwstr
.pElems
[count
], dst
->calpwstr
.cElems
- count
, sizeof(*dst
->calpwstr
.pElems
),
1110 qsort_string_compare
);
1116 PropVariantClear(dst
);
1123 /***********************************************************************
1124 * MFGetSupportedMimeTypes (mf.@)
1126 HRESULT WINAPI
MFGetSupportedMimeTypes(PROPVARIANT
*dst
)
1128 unsigned int maxlen
;
1130 TRACE("%p.\n", dst
);
1135 /* According to RFC4288 it's 127/127 characters. */
1136 maxlen
= 127 /* type */ + 1 /* / */ + 127 /* subtype */ + 1;
1137 return mf_get_handler_strings(L
"Software\\Microsoft\\Windows Media Foundation\\ByteStreamHandlers", '/',
1141 /***********************************************************************
1142 * MFGetSupportedSchemes (mf.@)
1144 HRESULT WINAPI
MFGetSupportedSchemes(PROPVARIANT
*dst
)
1146 TRACE("%p.\n", dst
);
1151 return mf_get_handler_strings(L
"Software\\Microsoft\\Windows Media Foundation\\SchemeHandlers", 0, 64, dst
);
1154 /***********************************************************************
1155 * MFGetService (mf.@)
1157 HRESULT WINAPI
MFGetService(IUnknown
*object
, REFGUID service
, REFIID riid
, void **obj
)
1162 TRACE("(%p, %s, %s, %p)\n", object
, debugstr_guid(service
), debugstr_guid(riid
), obj
);
1167 if (FAILED(hr
= IUnknown_QueryInterface(object
, &IID_IMFGetService
, (void **)&gs
)))
1170 hr
= IMFGetService_GetService(gs
, service
, riid
, obj
);
1171 IMFGetService_Release(gs
);
1175 /***********************************************************************
1176 * MFShutdownObject (mf.@)
1178 HRESULT WINAPI
MFShutdownObject(IUnknown
*object
)
1180 IMFShutdown
*shutdown
;
1182 TRACE("%p.\n", object
);
1184 if (object
&& SUCCEEDED(IUnknown_QueryInterface(object
, &IID_IMFShutdown
, (void **)&shutdown
)))
1186 IMFShutdown_Shutdown(shutdown
);
1187 IMFShutdown_Release(shutdown
);
1193 /***********************************************************************
1194 * MFEnumDeviceSources (mf.@)
1196 HRESULT WINAPI
MFEnumDeviceSources(IMFAttributes
*attributes
, IMFActivate
***sources
, UINT32
*count
)
1198 FIXME("%p, %p, %p.\n", attributes
, sources
, count
);
1200 if (!attributes
|| !sources
|| !count
)
1201 return E_INVALIDARG
;
1208 struct simple_type_handler
1210 IMFMediaTypeHandler IMFMediaTypeHandler_iface
;
1212 IMFMediaType
*media_type
;
1213 CRITICAL_SECTION cs
;
1216 static struct simple_type_handler
*impl_from_IMFMediaTypeHandler(IMFMediaTypeHandler
*iface
)
1218 return CONTAINING_RECORD(iface
, struct simple_type_handler
, IMFMediaTypeHandler_iface
);
1221 static HRESULT WINAPI
simple_type_handler_QueryInterface(IMFMediaTypeHandler
*iface
, REFIID riid
, void **obj
)
1223 TRACE("%p, %s, %p.\n", iface
, debugstr_guid(riid
), obj
);
1225 if (IsEqualIID(riid
, &IID_IMFMediaTypeHandler
) ||
1226 IsEqualIID(riid
, &IID_IUnknown
))
1229 IMFMediaTypeHandler_AddRef(iface
);
1234 return E_NOINTERFACE
;
1237 static ULONG WINAPI
simple_type_handler_AddRef(IMFMediaTypeHandler
*iface
)
1239 struct simple_type_handler
*handler
= impl_from_IMFMediaTypeHandler(iface
);
1240 ULONG refcount
= InterlockedIncrement(&handler
->refcount
);
1242 TRACE("%p, refcount %lu.\n", iface
, refcount
);
1247 static ULONG WINAPI
simple_type_handler_Release(IMFMediaTypeHandler
*iface
)
1249 struct simple_type_handler
*handler
= impl_from_IMFMediaTypeHandler(iface
);
1250 ULONG refcount
= InterlockedDecrement(&handler
->refcount
);
1252 TRACE("%p, refcount %lu.\n", iface
, refcount
);
1256 if (handler
->media_type
)
1257 IMFMediaType_Release(handler
->media_type
);
1258 DeleteCriticalSection(&handler
->cs
);
1265 static HRESULT WINAPI
simple_type_handler_IsMediaTypeSupported(IMFMediaTypeHandler
*iface
, IMFMediaType
*in_type
,
1266 IMFMediaType
**out_type
)
1268 struct simple_type_handler
*handler
= impl_from_IMFMediaTypeHandler(iface
);
1272 TRACE("%p, %p, %p.\n", iface
, in_type
, out_type
);
1277 EnterCriticalSection(&handler
->cs
);
1278 if (!handler
->media_type
)
1279 hr
= MF_E_UNEXPECTED
;
1282 if (SUCCEEDED(hr
= IMFMediaType_IsEqual(handler
->media_type
, in_type
, &flags
)))
1283 hr
= (flags
& (MF_MEDIATYPE_EQUAL_MAJOR_TYPES
| MF_MEDIATYPE_EQUAL_FORMAT_TYPES
)) ==
1284 (MF_MEDIATYPE_EQUAL_MAJOR_TYPES
| MF_MEDIATYPE_EQUAL_FORMAT_TYPES
) ? S_OK
: E_FAIL
;
1286 LeaveCriticalSection(&handler
->cs
);
1291 static HRESULT WINAPI
simple_type_handler_GetMediaTypeCount(IMFMediaTypeHandler
*iface
, DWORD
*count
)
1293 TRACE("%p, %p.\n", iface
, count
);
1303 static HRESULT WINAPI
simple_type_handler_GetMediaTypeByIndex(IMFMediaTypeHandler
*iface
, DWORD index
,
1304 IMFMediaType
**type
)
1306 struct simple_type_handler
*handler
= impl_from_IMFMediaTypeHandler(iface
);
1308 TRACE("%p, %lu, %p.\n", iface
, index
, type
);
1311 return MF_E_NO_MORE_TYPES
;
1313 EnterCriticalSection(&handler
->cs
);
1314 *type
= handler
->media_type
;
1316 IMFMediaType_AddRef(*type
);
1317 LeaveCriticalSection(&handler
->cs
);
1322 static HRESULT WINAPI
simple_type_handler_SetCurrentMediaType(IMFMediaTypeHandler
*iface
, IMFMediaType
*media_type
)
1324 struct simple_type_handler
*handler
= impl_from_IMFMediaTypeHandler(iface
);
1326 TRACE("%p, %p.\n", iface
, media_type
);
1328 EnterCriticalSection(&handler
->cs
);
1329 if (handler
->media_type
)
1330 IMFMediaType_Release(handler
->media_type
);
1331 handler
->media_type
= media_type
;
1332 if (handler
->media_type
)
1333 IMFMediaType_AddRef(handler
->media_type
);
1334 LeaveCriticalSection(&handler
->cs
);
1339 static HRESULT WINAPI
simple_type_handler_GetCurrentMediaType(IMFMediaTypeHandler
*iface
, IMFMediaType
**media_type
)
1341 struct simple_type_handler
*handler
= impl_from_IMFMediaTypeHandler(iface
);
1343 TRACE("%p, %p.\n", iface
, media_type
);
1348 EnterCriticalSection(&handler
->cs
);
1349 *media_type
= handler
->media_type
;
1351 IMFMediaType_AddRef(*media_type
);
1352 LeaveCriticalSection(&handler
->cs
);
1357 static HRESULT WINAPI
simple_type_handler_GetMajorType(IMFMediaTypeHandler
*iface
, GUID
*type
)
1359 struct simple_type_handler
*handler
= impl_from_IMFMediaTypeHandler(iface
);
1362 TRACE("%p, %p.\n", iface
, type
);
1364 EnterCriticalSection(&handler
->cs
);
1365 if (handler
->media_type
)
1366 hr
= IMFMediaType_GetGUID(handler
->media_type
, &MF_MT_MAJOR_TYPE
, type
);
1368 hr
= MF_E_NOT_INITIALIZED
;
1369 LeaveCriticalSection(&handler
->cs
);
1374 static const IMFMediaTypeHandlerVtbl simple_type_handler_vtbl
=
1376 simple_type_handler_QueryInterface
,
1377 simple_type_handler_AddRef
,
1378 simple_type_handler_Release
,
1379 simple_type_handler_IsMediaTypeSupported
,
1380 simple_type_handler_GetMediaTypeCount
,
1381 simple_type_handler_GetMediaTypeByIndex
,
1382 simple_type_handler_SetCurrentMediaType
,
1383 simple_type_handler_GetCurrentMediaType
,
1384 simple_type_handler_GetMajorType
,
1387 /*******************************************************************************
1388 * MFCreateSimpleTypeHandler (mf.@)
1390 HRESULT WINAPI
MFCreateSimpleTypeHandler(IMFMediaTypeHandler
**handler
)
1392 struct simple_type_handler
*object
;
1394 TRACE("%p.\n", handler
);
1396 if (!(object
= calloc(1, sizeof(*object
))))
1397 return E_OUTOFMEMORY
;
1399 object
->IMFMediaTypeHandler_iface
.lpVtbl
= &simple_type_handler_vtbl
;
1400 object
->refcount
= 1;
1401 InitializeCriticalSection(&object
->cs
);
1403 *handler
= &object
->IMFMediaTypeHandler_iface
;
1408 /*******************************************************************************
1409 * MFRequireProtectedEnvironment (mf.@)
1411 HRESULT WINAPI
MFRequireProtectedEnvironment(IMFPresentationDescriptor
*pd
)
1413 BOOL selected
, protected = FALSE
;
1414 unsigned int i
= 0, value
;
1415 IMFStreamDescriptor
*sd
;
1419 while (SUCCEEDED(IMFPresentationDescriptor_GetStreamDescriptorByIndex(pd
, i
++, &selected
, &sd
)))
1422 protected = SUCCEEDED(IMFStreamDescriptor_GetUINT32(sd
, &MF_SD_PROTECTED
, &value
)) && value
;
1423 IMFStreamDescriptor_Release(sd
);
1424 if (protected) break;
1427 return protected ? S_OK
: S_FALSE
;
1430 static HRESULT
create_media_sink(const CLSID
*clsid
, IMFByteStream
*stream
, IMFMediaType
*video_type
,
1431 IMFMediaType
*audio_type
, IMFMediaSink
**sink
)
1433 IMFSinkClassFactory
*factory
;
1436 if (FAILED(hr
= CoCreateInstance(clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IMFSinkClassFactory
, (void **)&factory
)))
1439 hr
= IMFSinkClassFactory_CreateMediaSink(factory
, stream
, video_type
, audio_type
, sink
);
1440 IMFSinkClassFactory_Release(factory
);
1445 /*******************************************************************************
1446 * MFCreate3GPMediaSink (mf.@)
1448 HRESULT WINAPI
MFCreate3GPMediaSink(IMFByteStream
*stream
, IMFMediaType
*video_type
,
1449 IMFMediaType
*audio_type
, IMFMediaSink
**sink
)
1451 TRACE("%p, %p, %p, %p.\n", stream
, video_type
, audio_type
, sink
);
1453 return create_media_sink(&CLSID_MF3GPSinkClassFactory
, stream
, video_type
, audio_type
, sink
);
1456 /*******************************************************************************
1457 * MFCreateAC3MediaSink (mf.@)
1459 HRESULT WINAPI
MFCreateAC3MediaSink(IMFByteStream
*stream
, IMFMediaType
*audio_type
, IMFMediaSink
**sink
)
1461 TRACE("%p, %p, %p.\n", stream
, audio_type
, sink
);
1463 return create_media_sink(&CLSID_MFAC3SinkClassFactory
, stream
, NULL
, audio_type
, sink
);
1466 /*******************************************************************************
1467 * MFCreateADTSMediaSink (mf.@)
1469 HRESULT WINAPI
MFCreateADTSMediaSink(IMFByteStream
*stream
, IMFMediaType
*audio_type
, IMFMediaSink
**sink
)
1471 TRACE("%p, %p, %p.\n", stream
, audio_type
, sink
);
1473 return create_media_sink(&CLSID_MFADTSSinkClassFactory
, stream
, NULL
, audio_type
, sink
);
1476 /*******************************************************************************
1477 * MFCreateMP3MediaSink (mf.@)
1479 HRESULT WINAPI
MFCreateMP3MediaSink(IMFByteStream
*stream
, IMFMediaSink
**sink
)
1481 TRACE("%p, %p.\n", stream
, sink
);
1483 return create_media_sink(&CLSID_MFMP3SinkClassFactory
, stream
, NULL
, NULL
, sink
);
1486 /*******************************************************************************
1487 * MFCreateMPEG4MediaSink (mf.@)
1489 HRESULT WINAPI
MFCreateMPEG4MediaSink(IMFByteStream
*stream
, IMFMediaType
*video_type
,
1490 IMFMediaType
*audio_type
, IMFMediaSink
**sink
)
1492 TRACE("%p, %p, %p, %p.\n", stream
, video_type
, audio_type
, sink
);
1494 return create_media_sink(&CLSID_MFMPEG4SinkClassFactory
, stream
, video_type
, audio_type
, sink
);
1497 /*******************************************************************************
1498 * MFCreateFMPEG4MediaSink (mf.@)
1500 HRESULT WINAPI
MFCreateFMPEG4MediaSink(IMFByteStream
*stream
, IMFMediaType
*video_type
,
1501 IMFMediaType
*audio_type
, IMFMediaSink
**sink
)
1503 TRACE("%p, %p, %p, %p.\n", stream
, video_type
, audio_type
, sink
);
1505 return create_media_sink(&CLSID_MFFMPEG4SinkClassFactory
, stream
, video_type
, audio_type
, sink
);