/* * Copyright 2016 Michael Müller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ import "mfobjects.idl"; import "mftransform.idl"; typedef unsigned __int64 TOPOID; typedef LONGLONG MFTIME; typedef DWORD MFSequencerElementId; typedef enum MF_TOPOLOGY_TYPE { MF_TOPOLOGY_OUTPUT_NODE, MF_TOPOLOGY_SOURCESTREAM_NODE, MF_TOPOLOGY_TRANSFORM_NODE, MF_TOPOLOGY_TEE_NODE, MF_TOPOLOGY_MAX = 0xffffffff } MF_TOPOLOGY_TYPE; typedef enum _MFCLOCK_STATE { MFCLOCK_STATE_INVALID, MFCLOCK_STATE_RUNNING, MFCLOCK_STATE_STOPPED, MFCLOCK_STATE_PAUSED } MFCLOCK_STATE; typedef enum MF_OBJECT_TYPE { MF_OBJECT_MEDIASOURCE, MF_OBJECT_BYTESTREAM, MF_OBJECT_INVALID } MF_OBJECT_TYPE; typedef struct _MFCLOCK_PROPERTIES { unsigned __int64 qwCorrelationRate; GUID guidClockId; DWORD dwClockFlags; unsigned __int64 qwClockFrequency; DWORD dwClockTolerance; DWORD dwClockJitter; } MFCLOCK_PROPERTIES; [ object, uuid(2eb1e945-18b8-4139-9b1a-d5d584818530), ] interface IMFClock : IUnknown { HRESULT GetClockCharacteristics([out] DWORD *characteristics); HRESULT GetCorrelatedTime([in] DWORD reserved, [out] LONGLONG *clock_time, [out] MFTIME *system_time); HRESULT GetContinuityKey([out] DWORD *key); HRESULT GetState([in] DWORD reserved, [out] MFCLOCK_STATE *state); HRESULT GetProperties([out] MFCLOCK_PROPERTIES *props); } [ object, uuid(83cf873a-f6da-4bc8-823f-bacfd55dc430), ] interface IMFTopologyNode : IMFAttributes { HRESULT SetObject([in] IUnknown *object); HRESULT GetObject([out] IUnknown **object); HRESULT GetNodeType([out] MF_TOPOLOGY_TYPE *type); HRESULT GetTopoNodeID([out] TOPOID *id); HRESULT SetTopoNodeID([in] TOPOID id); HRESULT GetInputCount([out] DWORD *count); HRESULT GetOutputCount([out] DWORD *count); [local] HRESULT ConnectOutput([in] DWORD output_index, [in] IMFTopologyNode *node, [in] DWORD input_index); [local] HRESULT DisconnectOutput([in] DWORD index); HRESULT GetInput([in] DWORD input_index, [out] IMFTopologyNode **node, [out] DWORD *output_index); HRESULT GetOutput([in] DWORD output_index, [out] IMFTopologyNode **node, [out] DWORD *input_index); [local] HRESULT SetOutputPrefType([in] DWORD index, [in] IMFMediaType *type); [local] HRESULT GetOutputPrefType([in] DWORD output_index, [out] IMFMediaType **type); [call_as(GetOutputPrefType)] HRESULT RemoteGetOutputPrefType([in] DWORD index, [out] DWORD *length, [out, size_is(, *length)] BYTE **data); [local] HRESULT SetInputPrefType([in] DWORD index, [in] IMFMediaType *type); [local] HRESULT GetInputPrefType([in] DWORD index, [out] IMFMediaType **type); [call_as(GetInputPrefType)] HRESULT RemoteGetInputPrefType([in] DWORD index, [out] DWORD *length, [out, size_is(, *length)] BYTE **data); HRESULT CloneFrom([in] IMFTopologyNode *node); } [ object, uuid(83cf873a-f6da-4bc8-823f-bacfd55dc433), ] interface IMFTopology : IMFAttributes { HRESULT GetTopologyID([out] TOPOID *id); [local] HRESULT AddNode([in] IMFTopologyNode *node); [local] HRESULT RemoveNode([in] IMFTopologyNode *node); HRESULT GetNodeCount([out] WORD *nodes); HRESULT GetNode([in] WORD index, [out] IMFTopologyNode **node); [local] HRESULT Clear(); HRESULT CloneFrom([in] IMFTopology *topology); HRESULT GetNodeByID([in] TOPOID id, [out] IMFTopologyNode **node); HRESULT GetSourceNodeCollection([out] IMFCollection **collection); HRESULT GetOutputNodeCollection([out] IMFCollection **collection); } [ object, uuid(de9a6157-f660-4643-b56a-df9f7998c7cd), local, ] interface IMFTopoLoader : IUnknown { HRESULT Load([in] IMFTopology *input_topology, [out] IMFTopology **output_topology, [in] IMFTopology *current_topology); } [ object, uuid(90377834-21d0-4dee-8214-ba2e3e6c1127), ] interface IMFMediaSession : IMFMediaEventGenerator { HRESULT SetTopology([in] DWORD flags, [in] IMFTopology *topology); HRESULT ClearTopologies(); HRESULT Start([in, unique] const GUID *format, [in, unique] const PROPVARIANT *start); HRESULT Pause(); HRESULT Stop(); HRESULT Close(); HRESULT Shutdown(); HRESULT GetClock([out] IMFClock **clock); HRESULT GetSessionCapabilities([out] DWORD *caps); HRESULT GetFullTopology([in] DWORD flags, [in] TOPOID id, [out] IMFTopology **topology); } [ object, uuid(fbe5a32d-a497-4b61-bb85-97b1a848a6e3) ] interface IMFSourceResolver : IUnknown { [local] HRESULT CreateObjectFromURL([in] const WCHAR *url, [in] DWORD flags, [in] IPropertyStore *props, [out] MF_OBJECT_TYPE *obj_type, [out] IUnknown **object); [local] HRESULT CreateObjectFromByteStream([in] IMFByteStream *stream, [in] const WCHAR *url, [in] DWORD flags, [in] IPropertyStore *props, [out] MF_OBJECT_TYPE *obj_type, [out] IUnknown **object); [local] HRESULT BeginCreateObjectFromURL([in] const WCHAR *url, [in] DWORD flags, [in] IPropertyStore *props, [out] IUnknown **cancel_cookie, [in] IMFAsyncCallback *callback, [in] IUnknown *unk_state); [call_as(BeginCreateObjectFromURL)] HRESULT RemoteBeginCreateObjectFromURL([in, string] const WCHAR *url, [in] DWORD flags, [in] IPropertyStore *props, [in] IMFRemoteAsyncCallback *callback); [local] HRESULT EndCreateObjectFromURL([in] IMFAsyncResult *result, [out] MF_OBJECT_TYPE *obj_type, [out] IUnknown **object); [call_as(EndCreateObjectFromURL)] HRESULT RemoteEndCreateObjectFromURL([in] IUnknown *result, [out] MF_OBJECT_TYPE *obj_type, [out] IUnknown **object); [local] HRESULT BeginCreateObjectFromByteStream([in] IMFByteStream *stream, [in] const WCHAR *url, [in] DWORD flags, [in] IPropertyStore *props, [out] IUnknown **cancel_cookie, [in] IMFAsyncCallback *callback, [in] IUnknown *unk_state); [call_as(BeginCreateObjectFromByteStream)] HRESULT RemoteBeginCreateObjectFromByteStream([in] IMFByteStream *stream, [in, unique] const WCHAR *url, [in] DWORD flags, [in, unique] IPropertyStore *props, [in] IMFRemoteAsyncCallback *callback); [local] HRESULT EndCreateObjectFromByteStream([in] IMFAsyncResult *result, [out] MF_OBJECT_TYPE *obj_type, [out] IUnknown **object); [call_as(EndCreateObjectFromByteStream)] HRESULT RemoteEndCreateObjectFromByteStream([in] IUnknown *result, [out] MF_OBJECT_TYPE *obj_type, [out] IUnknown **object); [local] HRESULT CanceObjectCreation([in] IUnknown *cancel_cookie); } [ object, uuid(e93dcf6c-4b07-4e1e-8123-aa16ed6eadf5) ] interface IMFMediaTypeHandler : IUnknown { [local] HRESULT IsMediaTypeSupported([in] IMFMediaType *in_type, [out] IMFMediaType **out_type); [call_as(IsMediaTypeSupported)] HRESULT RemoteIsMediaTypeSupported([in, size_is(size)] BYTE *data, [in] DWORD size, [out, size_is(, *match_count)] BYTE **match, [out] DWORD *match_count); HRESULT GetMediaTypeCount([out] DWORD *count); [local] HRESULT GetMediaTypeByIndex([in] DWORD index, [out] IMFMediaType **type); [call_as(GetMediaTypeByIndex)] HRESULT RemoteGetMediaTypeByIndex([in] DWORD index, [out, size_is(, *count)] BYTE **data, [out] DWORD *count); [local] HRESULT SetCurrentMediaType([in] IMFMediaType *type); [call_as(SetCurrentMediaType)] HRESULT RemoteSetCurrentMediaType([in, size_is(count)] BYTE *data, [in] DWORD count); [local] HRESULT GetCurrentMediaType([out] IMFMediaType **type); [call_as(GetCurrentMediaType)] HRESULT RemoteGetCurrentMediaType([out, size_is(, *count)] BYTE **data, [out] DWORD *count); HRESULT GetMajorType([out] GUID *type); } [ object, uuid(56c03d9c-9dbb-45f5-ab4b-d80f47c05938) ] interface IMFStreamDescriptor : IMFAttributes { HRESULT GetStreamIdentifier([out] DWORD *identifier); HRESULT GetMediaTypeHandler([out] IMFMediaTypeHandler **handler); } [ object, uuid(f6696e82-74f7-4f3d-a178-8a5e09c3659f) ] interface IMFClockStateSink : IUnknown { HRESULT OnClockStart( [in] MFTIME hnsSystemTime, [in] LONGLONG llClockStartOffset ); HRESULT OnClockStop( [in] MFTIME hnssSystemTime ); HRESULT OnClockPause( [in] MFTIME hnsSystemTime ); HRESULT OnClockRestart( [in] MFTIME hnsSystemTime ); HRESULT OnClockSetRate( [in] MFTIME hnsSystemTime, [in] float flRate ); } [ object, uuid(fa993888-4383-415a-a930-dd472a8cf6f7) ] interface IMFGetService : IUnknown { HRESULT GetService( [in] REFGUID guidService, [in] REFIID riid, [out, iid_is(riid)] LPVOID *ppvObject ); } [ object, uuid(03cb2711-24d7-4db6-a17f-f3a7a479a536), ] interface IMFPresentationDescriptor : IMFAttributes { HRESULT GetStreamDescriptorCount( [out] DWORD *count ); HRESULT GetStreamDescriptorByIndex( [in] DWORD index, [out] BOOL *selected, [out] IMFStreamDescriptor **descriptor ); HRESULT SelectStream( [in] DWORD index ); HRESULT DeselectStream( [in] DWORD index ); HRESULT Clone( [out] IMFPresentationDescriptor **descriptor ); } [ object, uuid(197cd219-19cb-4de1-a64c-acf2edcbe59e), local ] interface IMFSequencerSource : IUnknown { HRESULT AppendTopology( [in] IMFTopology *topology, [in] DWORD flags, [out] MFSequencerElementId *element ); HRESULT DeleteTopology( [in] MFSequencerElementId element); HRESULT GetPresentationContext( [in] IMFPresentationDescriptor *pd, [out, optional] MFSequencerElementId *id, [out, optional] IMFTopology **topology ); HRESULT UpdateTopology( [in] MFSequencerElementId od, [in] IMFTopology *topology); HRESULT UpdateTopologyFlags( [in] MFSequencerElementId id, [in] DWORD flags ); }; cpp_quote("HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **session);") cpp_quote("HRESULT WINAPI MFCreateMFByteStreamOnStream(IStream *stream, IMFByteStream **bytestream);" ) cpp_quote("HRESULT WINAPI MFCreateMFByteStreamOnStreamEx(IUnknown *stream, IMFByteStream **bytestream);") cpp_quote("HRESULT WINAPI MFCreateSequencerSource(IUnknown *reserved, IMFSequencerSource **seq_source);" ) cpp_quote("HRESULT WINAPI MFCreateSourceResolver(IMFSourceResolver **resolver);") cpp_quote("HRESULT WINAPI MFCreateStreamDescriptor(DWORD identifier, DWORD cMediaTypes,") cpp_quote(" IMFMediaType **types, IMFStreamDescriptor **descriptor);") cpp_quote("HRESULT WINAPI MFCreateTopology(IMFTopology **topology);") cpp_quote("HRESULT WINAPI MFCreateTopologyNode(MF_TOPOLOGY_TYPE node_type, IMFTopologyNode **node);") cpp_quote("HRESULT WINAPI MFCreateTopoLoader(IMFTopoLoader **loader);") cpp_quote("HRESULT WINAPI MFGetSupportedMimeTypes(PROPVARIANT *array);") cpp_quote("HRESULT WINAPI MFGetService(IUnknown *object, REFGUID service, REFIID iid, void **obj);") cpp_quote("MFTIME WINAPI MFGetSystemTime(void);") [ object, uuid(279a808d-aec7-40c8-9c6b-a6b492c78a66), ] interface IMFMediaSource : IMFMediaEventGenerator { HRESULT GetCharacteristics( [out] DWORD *characteristics ); [local] HRESULT CreatePresentationDescriptor( [out] IMFPresentationDescriptor **descriptor ); [call_as(CreatePresentationDescriptor)] HRESULT RemoteCreatePresentationDescriptor( [out] DWORD *count, [out, size_is(,*count)] BYTE **data, [out] IMFPresentationDescriptor **descriptor ); HRESULT Start( [in] IMFPresentationDescriptor *descriptor, [in, unique] const GUID *time_format, [in, unique] const PROPVARIANT *start_position ); HRESULT Stop(); HRESULT Pause(); HRESULT Shutdown(); } interface IMFStreamSink; interface IMFPresentationClock; [ object, uuid(6ef2a660-47c0-4666-b13d-cbb717f2fa2c) ] interface IMFMediaSink : IUnknown { HRESULT GetCharacteristics([out] DWORD *characteristics); HRESULT AddStreamSink( [in] DWORD stream_sink_id, [in] IMFMediaType *media_type, [out] IMFStreamSink **stream_sink); HRESULT RemoveStreamSink([in] DWORD stream_sink_id); HRESULT GetStreamSinkCount([out] DWORD *count); HRESULT GetStreamSinkByIndex([in] DWORD index, [out] IMFStreamSink **sink); HRESULT GetStreamSinkById([in] DWORD stream_sink_id, [out] IMFStreamSink **sink); HRESULT SetPresentationClock([in] IMFPresentationClock *clock); HRESULT GetPresentationClock([out] IMFPresentationClock **clock); HRESULT Shutdown(); } cpp_quote("#define MF_RESOLUTION_MEDIASOURCE 0x00000001") cpp_quote("#define MF_RESOLUTION_BYTESTREAM 0x00000002") cpp_quote("#define MF_RESOLUTION_CONTENT_DOES_NOT_HAVE_TO_MATCH_EXTENSION_OR_MIME_TYPE 0x00000010") cpp_quote("#define MF_RESOLUTION_KEEP_BYTE_STREAM_ALIVE_ON_FAIL 0x00000020") cpp_quote("#define MF_RESOLUTION_READ 0x00010000") cpp_quote("#define MF_RESOLUTION_WRITE 0x00020000") cpp_quote("#define MF_RESOLUTION_DISABLE_LOCAL_PLUGINS 0x00000040") cpp_quote("#ifdef __cplusplus") cpp_quote("static inline HRESULT MFSetAttributeSize(IMFAttributes *attributes, REFGUID key, UINT32 width, UINT32 height)") cpp_quote("{") cpp_quote(" return attributes->SetUINT64(key, ((UINT64)width << 32) | height);") cpp_quote("}") cpp_quote("static inline HRESULT MFSetAttributeRatio(IMFAttributes *attributes, REFGUID key, UINT32 numerator, UINT32 denominator)") cpp_quote("{") cpp_quote(" return attributes->SetUINT64(key, ((UINT64)numerator << 32) | denominator);") cpp_quote("}") cpp_quote("#endif")