| 1 | /* BoCA - BonkEnc Component Architecture |
| 2 | * Copyright (C) 2007-2015 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 <boca.h> |
| 14 | #include "dllinterface.h" |
| 15 | |
| 16 | BEINITSTREAM ex_beInitStream = NIL; |
| 17 | BEENCODECHUNK ex_beEncodeChunk = NIL; |
| 18 | BEDEINITSTREAM ex_beDeinitStream = NIL; |
| 19 | BECLOSESTREAM ex_beCloseStream = NIL; |
| 20 | BEVERSION ex_beVersion = NIL; |
| 21 | |
| 22 | DynamicLoader *bladedll = NIL; |
| 23 | |
| 24 | Bool LoadBladeDLL() |
| 25 | { |
| 26 | bladedll = BoCA::Utilities::LoadCodecDLL("BladeEnc"); |
| 27 | |
| 28 | if (bladedll == NIL) return False; |
| 29 | |
| 30 | ex_beInitStream = (BEINITSTREAM) bladedll->GetFunctionAddress("beInitStream"); |
| 31 | ex_beEncodeChunk = (BEENCODECHUNK) bladedll->GetFunctionAddress("beEncodeChunk"); |
| 32 | ex_beDeinitStream = (BEDEINITSTREAM) bladedll->GetFunctionAddress("beDeinitStream"); |
| 33 | ex_beCloseStream = (BECLOSESTREAM) bladedll->GetFunctionAddress("beCloseStream"); |
| 34 | ex_beVersion = (BEVERSION) bladedll->GetFunctionAddress("beVersion"); |
| 35 | |
| 36 | if (ex_beInitStream == NIL || |
| 37 | ex_beEncodeChunk == NIL || |
| 38 | ex_beDeinitStream == NIL || |
| 39 | ex_beCloseStream == NIL || |
| 40 | ex_beVersion == NIL) { FreeBladeDLL(); return False; } |
| 41 | |
| 42 | return True; |
| 43 | } |
| 44 | |
| 45 | Void FreeBladeDLL() |
| 46 | { |
| 47 | Object::DeleteObject(bladedll); |
| 48 | |
| 49 | bladedll = NIL; |
| 50 | } |