Debian Codegraph @

components/encoder/bonk/dllinterface.cpp

raw symbols SCIP
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 using namespace BoCA;
17
18 BONKENCODERCREATE ex_bonk_encoder_create = NIL;
19 BONKENCODERINIT ex_bonk_encoder_init = NIL;
20 BONKENCODERENCODEPACKET ex_bonk_encoder_encode_packet = NIL;
21 BONKENCODERFINISH ex_bonk_encoder_finish = NIL;
22 BONKENCODERCLOSE ex_bonk_encoder_close = NIL;
23 BONKENCODERGETSAMPLECOUNT ex_bonk_encoder_get_sample_count = NIL;
24 BONKENCODERGETSAMPLECOUNTOFFSET ex_bonk_encoder_get_sample_count_offset= NIL;
25 BONKENCODERSETID3DATA ex_bonk_encoder_set_id3_data = NIL;
26 BONKGETVERSIONSTRING ex_bonk_get_version_string = NIL;
27
28 DynamicLoader *bonkdll = NIL;
29
30 Bool LoadBonkDLL()
31 {
32 bonkdll = BoCA::Utilities::LoadCodecDLL("bonk");
33
34 if (bonkdll == NIL) return False;
35
36 ex_bonk_encoder_create = (BONKENCODERCREATE) bonkdll->GetFunctionAddress("bonk_encoder_create");
37 ex_bonk_encoder_init = (BONKENCODERINIT) bonkdll->GetFunctionAddress("bonk_encoder_init");
38 ex_bonk_encoder_encode_packet = (BONKENCODERENCODEPACKET) bonkdll->GetFunctionAddress("bonk_encoder_encode_packet");
39 ex_bonk_encoder_finish = (BONKENCODERFINISH) bonkdll->GetFunctionAddress("bonk_encoder_finish");
40 ex_bonk_encoder_close = (BONKENCODERCLOSE) bonkdll->GetFunctionAddress("bonk_encoder_close");
41 ex_bonk_encoder_get_sample_count = (BONKENCODERGETSAMPLECOUNT) bonkdll->GetFunctionAddress("bonk_encoder_get_sample_count");
42 ex_bonk_encoder_get_sample_count_offset = (BONKENCODERGETSAMPLECOUNTOFFSET) bonkdll->GetFunctionAddress("bonk_encoder_get_sample_count_offset");
43 ex_bonk_encoder_set_id3_data = (BONKENCODERSETID3DATA) bonkdll->GetFunctionAddress("bonk_encoder_set_id3_data");
44 ex_bonk_get_version_string = (BONKGETVERSIONSTRING) bonkdll->GetFunctionAddress("bonk_get_version_string");
45
46 if (ex_bonk_encoder_create == NIL ||
47 ex_bonk_encoder_init == NIL ||
48 ex_bonk_encoder_encode_packet == NIL ||
49 ex_bonk_encoder_finish == NIL ||
50 ex_bonk_encoder_close == NIL ||
51 ex_bonk_encoder_get_sample_count == NIL ||
52 ex_bonk_encoder_get_sample_count_offset == NIL ||
53 ex_bonk_encoder_set_id3_data == NIL ||
54 ex_bonk_get_version_string == NIL) { FreeBonkDLL(); return False; }
55
56 return True;
57 }
58
59 Void FreeBonkDLL()
60 {
61 BoCA::Utilities::FreeCodecDLL(bonkdll);
62
63 bonkdll = NIL;
64 }