| 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 | MAD_DECODER_INIT ex_mad_decoder_init = NIL; |
| 17 | MAD_DECODER_RUN ex_mad_decoder_run = NIL; |
| 18 | MAD_DECODER_FINISH ex_mad_decoder_finish = NIL; |
| 19 | MAD_STREAM_BUFFER ex_mad_stream_buffer = NIL; |
| 20 | |
| 21 | DynamicLoader *maddll = NIL; |
| 22 | |
| 23 | Bool LoadMADDLL() |
| 24 | { |
| 25 | maddll = BoCA::Utilities::LoadCodecDLL("mad"); |
| 26 | |
| 27 | if (maddll == NIL) return False; |
| 28 | |
| 29 | ex_mad_decoder_init = (MAD_DECODER_INIT) maddll->GetFunctionAddress("mad_decoder_init"); |
| 30 | ex_mad_decoder_run = (MAD_DECODER_RUN) maddll->GetFunctionAddress("mad_decoder_run"); |
| 31 | ex_mad_decoder_finish = (MAD_DECODER_FINISH) maddll->GetFunctionAddress("mad_decoder_finish"); |
| 32 | ex_mad_stream_buffer = (MAD_STREAM_BUFFER) maddll->GetFunctionAddress("mad_stream_buffer"); |
| 33 | |
| 34 | if (ex_mad_decoder_init == NIL || |
| 35 | ex_mad_decoder_run == NIL || |
| 36 | ex_mad_decoder_finish == NIL || |
| 37 | ex_mad_stream_buffer == NIL) { FreeMADDLL(); return False; } |
| 38 | |
| 39 | return True; |
| 40 | } |
| 41 | |
| 42 | Void FreeMADDLL() |
| 43 | { |
| 44 | BoCA::Utilities::FreeCodecDLL(maddll); |
| 45 | |
| 46 | maddll = NIL; |
| 47 | } |