Wed, 31 Dec 2014 06:55:46 +0100
Added tag TORBROWSER_REPLICA for changeset 6474c204b198
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim:set ts=2 sw=2 sts=2 et cindent: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef WMF_H_ |
michael@0 | 8 | #define WMF_H_ |
michael@0 | 9 | |
michael@0 | 10 | #if WINVER < _WIN32_WINNT_WIN7 |
michael@0 | 11 | #error \ |
michael@0 | 12 | You must include WMF.h before including mozilla headers, \ |
michael@0 | 13 | otherwise mozconfig.h will be included \ |
michael@0 | 14 | and that sets WINVER to WinXP, \ |
michael@0 | 15 | which makes Windows Media Foundation unavailable. |
michael@0 | 16 | #endif |
michael@0 | 17 | |
michael@0 | 18 | #pragma push_macro("WINVER") |
michael@0 | 19 | #undef WINVER |
michael@0 | 20 | #define WINVER _WIN32_WINNT_WIN7 |
michael@0 | 21 | |
michael@0 | 22 | #include <windows.h> |
michael@0 | 23 | #include <mfapi.h> |
michael@0 | 24 | #include <mfidl.h> |
michael@0 | 25 | #include <mfreadwrite.h> |
michael@0 | 26 | #include <mfobjects.h> |
michael@0 | 27 | #include <ks.h> |
michael@0 | 28 | #include <stdio.h> |
michael@0 | 29 | #include <mferror.h> |
michael@0 | 30 | #include <propvarutil.h> |
michael@0 | 31 | #include <wmcodecdsp.h> |
michael@0 | 32 | #include <d3d9.h> |
michael@0 | 33 | #include <dxva2api.h> |
michael@0 | 34 | #include <wmcodecdsp.h> |
michael@0 | 35 | #include <codecapi.h> |
michael@0 | 36 | |
michael@0 | 37 | // Some SDK versions don't define the AAC decoder CLSID. |
michael@0 | 38 | #ifndef CLSID_CMSAACDecMFT |
michael@0 | 39 | extern "C" const CLSID CLSID_CMSAACDecMFT; |
michael@0 | 40 | #define WMF_MUST_DEFINE_AAC_MFT_CLSID |
michael@0 | 41 | #endif |
michael@0 | 42 | |
michael@0 | 43 | namespace mozilla { |
michael@0 | 44 | namespace wmf { |
michael@0 | 45 | |
michael@0 | 46 | // Loads/Unloads all the DLLs in which the WMF functions are located. |
michael@0 | 47 | // The DLLs must be loaded before any of the WMF functions below will work. |
michael@0 | 48 | // All the function definitions below are wrappers which locate the |
michael@0 | 49 | // corresponding WMF function in the appropriate DLL (hence why LoadDLL() |
michael@0 | 50 | // must be called first...). |
michael@0 | 51 | HRESULT LoadDLLs(); |
michael@0 | 52 | HRESULT UnloadDLLs(); |
michael@0 | 53 | |
michael@0 | 54 | // All functions below are wrappers around the corresponding WMF function, |
michael@0 | 55 | // and automatically locate and call the corresponding function in the WMF DLLs. |
michael@0 | 56 | |
michael@0 | 57 | HRESULT MFStartup(); |
michael@0 | 58 | |
michael@0 | 59 | HRESULT MFShutdown(); |
michael@0 | 60 | |
michael@0 | 61 | HRESULT MFCreateAsyncResult(IUnknown *aUunkObject, |
michael@0 | 62 | IMFAsyncCallback *aCallback, |
michael@0 | 63 | IUnknown *aUnkState, |
michael@0 | 64 | IMFAsyncResult **aOutAsyncResult); |
michael@0 | 65 | |
michael@0 | 66 | HRESULT MFInvokeCallback(IMFAsyncResult *aAsyncResult); |
michael@0 | 67 | |
michael@0 | 68 | HRESULT MFCreateMediaType(IMFMediaType **aOutMFType); |
michael@0 | 69 | |
michael@0 | 70 | HRESULT MFCreateSourceReaderFromByteStream(IMFByteStream *aByteStream, |
michael@0 | 71 | IMFAttributes *aAttributes, |
michael@0 | 72 | IMFSourceReader **aOutSourceReader); |
michael@0 | 73 | |
michael@0 | 74 | HRESULT PropVariantToUInt32(REFPROPVARIANT aPropvar, ULONG *aOutUL); |
michael@0 | 75 | |
michael@0 | 76 | HRESULT PropVariantToInt64(REFPROPVARIANT aPropVar, LONGLONG *aOutLL); |
michael@0 | 77 | |
michael@0 | 78 | HRESULT MFTGetInfo(CLSID aClsidMFT, |
michael@0 | 79 | LPWSTR *aOutName, |
michael@0 | 80 | MFT_REGISTER_TYPE_INFO **aOutInputTypes, |
michael@0 | 81 | UINT32 *aOutNumInputTypes, |
michael@0 | 82 | MFT_REGISTER_TYPE_INFO **aOutOutputTypes, |
michael@0 | 83 | UINT32 *aOutNumOutputTypes, |
michael@0 | 84 | IMFAttributes **aOutAttributes); |
michael@0 | 85 | |
michael@0 | 86 | HRESULT MFGetStrideForBitmapInfoHeader(DWORD aFormat, |
michael@0 | 87 | DWORD aWidth, |
michael@0 | 88 | LONG *aOutStride); |
michael@0 | 89 | |
michael@0 | 90 | // Note: We shouldn't use this in production code; it's really only |
michael@0 | 91 | // here so we can compare behaviour of the SourceReader using WMF's |
michael@0 | 92 | // byte stream and ours when debugging. |
michael@0 | 93 | HRESULT MFCreateSourceReaderFromURL(LPCWSTR aURL, |
michael@0 | 94 | IMFAttributes *aAttributes, |
michael@0 | 95 | IMFSourceReader **aSourceReader); |
michael@0 | 96 | |
michael@0 | 97 | HRESULT MFCreateAttributes(IMFAttributes **ppMFAttributes, UINT32 cInitialSize); |
michael@0 | 98 | |
michael@0 | 99 | HRESULT MFGetPluginControl(IMFPluginControl **aOutPluginControl); |
michael@0 | 100 | |
michael@0 | 101 | HRESULT MFTEnumEx(GUID guidCategory, |
michael@0 | 102 | UINT32 Flags, |
michael@0 | 103 | const MFT_REGISTER_TYPE_INFO *pInputType, |
michael@0 | 104 | const MFT_REGISTER_TYPE_INFO *pOutputType, |
michael@0 | 105 | IMFActivate ***pppMFTActivate, |
michael@0 | 106 | UINT32 *pcMFTActivate); |
michael@0 | 107 | |
michael@0 | 108 | HRESULT MFGetService(IUnknown *punkObject, |
michael@0 | 109 | REFGUID guidService, |
michael@0 | 110 | REFIID riid, |
michael@0 | 111 | LPVOID *ppvObject); |
michael@0 | 112 | |
michael@0 | 113 | HRESULT DXVA2CreateDirect3DDeviceManager9(UINT *pResetToken, |
michael@0 | 114 | IDirect3DDeviceManager9 **ppDXVAManager); |
michael@0 | 115 | |
michael@0 | 116 | HRESULT MFCreateSample(IMFSample **ppIMFSample); |
michael@0 | 117 | |
michael@0 | 118 | HRESULT MFCreateAlignedMemoryBuffer(DWORD cbMaxLength, |
michael@0 | 119 | DWORD fAlignmentFlags, |
michael@0 | 120 | IMFMediaBuffer **ppBuffer); |
michael@0 | 121 | |
michael@0 | 122 | } // end namespace wmf |
michael@0 | 123 | } // end namespace mozilla |
michael@0 | 124 | |
michael@0 | 125 | |
michael@0 | 126 | |
michael@0 | 127 | #pragma pop_macro("WINVER") |
michael@0 | 128 | |
michael@0 | 129 | #endif |