| 1 | /* BoCA - BonkEnc Component Architecture |
| 2 | * Copyright (C) 2007-2019 Robert Kausch <[email protected]> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation, either version 2 of |
| 7 | * the License, or (at your option) any later version. |
| 8 | * |
| 9 | * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR |
| 10 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
| 11 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ |
| 12 | |
| 13 | #include "dllinterface.h" |
| 14 | |
| 15 | MFSTARTUP ex_MFStartup = NIL; |
| 16 | MFSHUTDOWN ex_MFShutdown = NIL; |
| 17 | MFCREATEASYNCRESULT ex_MFCreateAsyncResult = NIL; |
| 18 | MFINVOKECALLBACK ex_MFInvokeCallback = NIL; |
| 19 | MFCREATEMEDIATYPE ex_MFCreateMediaType = NIL; |
| 20 | MFINITMEDIATYPEFROMWAVEFORMATEX ex_MFInitMediaTypeFromWaveFormatEx = NIL; |
| 21 | |
| 22 | MFCREATESOURCEREADERFROMBYTESTREAM ex_MFCreateSourceReaderFromByteStream = NIL; |
| 23 | |
| 24 | DynamicLoader *mfplatdll = NIL; |
| 25 | DynamicLoader *mfreadwritedll = NIL; |
| 26 | |
| 27 | Bool LoadMFPlatDLL() |
| 28 | { |
| 29 | mfplatdll = new DynamicLoader("MFPlat"); |
| 30 | |
| 31 | ex_MFStartup = (MFSTARTUP) mfplatdll->GetFunctionAddress("MFStartup"); |
| 32 | ex_MFShutdown = (MFSHUTDOWN) mfplatdll->GetFunctionAddress("MFShutdown"); |
| 33 | ex_MFCreateAsyncResult = (MFCREATEASYNCRESULT) mfplatdll->GetFunctionAddress("MFCreateAsyncResult"); |
| 34 | ex_MFInvokeCallback = (MFINVOKECALLBACK) mfplatdll->GetFunctionAddress("MFInvokeCallback"); |
| 35 | ex_MFCreateMediaType = (MFCREATEMEDIATYPE) mfplatdll->GetFunctionAddress("MFCreateMediaType"); |
| 36 | ex_MFInitMediaTypeFromWaveFormatEx = (MFINITMEDIATYPEFROMWAVEFORMATEX) mfplatdll->GetFunctionAddress("MFInitMediaTypeFromWaveFormatEx"); |
| 37 | |
| 38 | if (ex_MFStartup == NIL || |
| 39 | ex_MFShutdown == NIL || |
| 40 | ex_MFCreateAsyncResult == NIL || |
| 41 | ex_MFInvokeCallback == NIL || |
| 42 | ex_MFCreateMediaType == NIL || |
| 43 | ex_MFInitMediaTypeFromWaveFormatEx == NIL) { FreeMFPlatDLL(); return False; } |
| 44 | |
| 45 | return True; |
| 46 | } |
| 47 | |
| 48 | Void FreeMFPlatDLL() |
| 49 | { |
| 50 | Object::DeleteObject(mfplatdll); |
| 51 | |
| 52 | mfplatdll = NIL; |
| 53 | } |
| 54 | |
| 55 | Bool LoadMFReadWriteDLL() |
| 56 | { |
| 57 | mfreadwritedll = new DynamicLoader("MFReadWrite"); |
| 58 | |
| 59 | ex_MFCreateSourceReaderFromByteStream = (MFCREATESOURCEREADERFROMBYTESTREAM) mfreadwritedll->GetFunctionAddress("MFCreateSourceReaderFromByteStream"); |
| 60 | |
| 61 | if (ex_MFCreateSourceReaderFromByteStream == NIL) { FreeMFReadWriteDLL(); return False; } |
| 62 | |
| 63 | return True; |
| 64 | } |
| 65 | |
| 66 | Void FreeMFReadWriteDLL() |
| 67 | { |
| 68 | Object::DeleteObject(mfreadwritedll); |
| 69 | |
| 70 | mfreadwritedll = NIL; |
| 71 | } |