Kiwano Engine v1.3.x
mflib.h
1// Copyright (c) 2016-2018 Kiwano - Nomango
2//
3// Permission is hereby granted, free of charge, to any person obtaining a copy
4// of this software and associated documentation files (the "Software"), to deal
5// in the Software without restriction, including without limitation the rights
6// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7// copies of the Software, and to permit persons to whom the Software is
8// furnished to do so, subject to the following conditions:
9//
10// The above copyright notice and this permission notice shall be included in
11// all copies or substantial portions of the Software.
12//
13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19// THE SOFTWARE.
20
21#pragma once
22
23#ifndef INITGUID
24#define INITGUID // MFAudioFormat_PCM, MF_MT_MAJOR_TYPE, MF_MT_SUBTYPE, MFMediaType_Audio
25#endif
26
27#include <kiwano/core/Library.h>
28#include <mfapi.h>
29#include <mfidl.h>
30#include <mfreadwrite.h>
31
32#ifndef KGE_DOXYGEN_DO_NOT_INCLUDE
33
34namespace kiwano
35{
36namespace audio
37{
38namespace dlls
39{
40class KGE_API MediaFoundation
41{
42public:
43 static inline MediaFoundation& Get()
44 {
45 static MediaFoundation instance;
46 return instance;
47 }
48
49 // MediaFoundation functions
50 typedef HRESULT(WINAPI* PFN_MFStartup)(ULONG, DWORD);
51 typedef HRESULT(WINAPI* PFN_MFShutdown)();
52 typedef HRESULT(WINAPI* PFN_MFCreateMediaType)(IMFMediaType**);
53 typedef HRESULT(WINAPI* PFN_MFCreateWaveFormatExFromMFMediaType)(IMFMediaType*, WAVEFORMATEX**, UINT32*, UINT32);
54 typedef HRESULT(WINAPI* PFN_MFCreateSourceReaderFromURL)(LPCWSTR, IMFAttributes*, IMFSourceReader**);
55 typedef HRESULT(WINAPI* PFN_MFCreateSourceReaderFromByteStream)(IMFByteStream*, IMFAttributes*, IMFSourceReader**);
56 typedef HRESULT(WINAPI* PFN_MFCreateMFByteStreamOnStream)(IStream*, IMFByteStream**);
57
58 PFN_MFStartup MFStartup;
59 PFN_MFShutdown MFShutdown;
60 PFN_MFCreateMediaType MFCreateMediaType;
61 PFN_MFCreateWaveFormatExFromMFMediaType MFCreateWaveFormatExFromMFMediaType;
62 PFN_MFCreateSourceReaderFromURL MFCreateSourceReaderFromURL;
63 PFN_MFCreateSourceReaderFromByteStream MFCreateSourceReaderFromByteStream;
64 PFN_MFCreateMFByteStreamOnStream MFCreateMFByteStreamOnStream;
65
66private:
67 MediaFoundation();
68
69 MediaFoundation(const MediaFoundation&) = delete;
70 MediaFoundation& operator=(const MediaFoundation&) = delete;
71
72 Library mfplat;
73 Library mfreadwrite;
74};
75} // namespace dlls
76} // namespace audio
77} // namespace kiwano
78
79#endif