Debian Codegraph @

components/deviceinfo/cdrip/dllinterface.cpp

raw symbols SCIP
1 /* BoCA - BonkEnc Component Architecture
2 * Copyright (C) 2007-2017 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 CR_INIT ex_CR_Init = NIL;
16 CR_DEINIT ex_CR_DeInit = NIL;
17 CR_ISINITIALIZED ex_CR_IsInitialized = NIL;
18 CR_GETNUMCDROM ex_CR_GetNumCDROM = NIL;
19 CR_OPENCDROM ex_CR_OpenCDROM = NIL;
20 CR_CLOSECDROM ex_CR_CloseCDROM = NIL;
21 CR_READTOC ex_CR_ReadToc = NIL;
22 CR_GETNUMTOCENTRIES ex_CR_GetNumTocEntries = NIL;
23 CR_GETTOCENTRY ex_CR_GetTocEntry = NIL;
24 CR_GETCDROMPARAMETERS ex_CR_GetCDROMParameters = NIL;
25 CR_ISMEDIALOADED ex_CR_IsMediaLoaded = NIL;
26 CR_EJECTCD ex_CR_EjectCD = NIL;
27
28 DynamicLoader *cdripdll = NIL;
29
30 Bool LoadCDRipDLL()
31 {
32 #ifdef __WIN32__
33 if (!File(GUI::Application::GetApplicationDirectory().Append("CDRip.dll")).Exists()) return False;
34 #endif
35
36 cdripdll = new DynamicLoader("CDRip");
37
38 ex_CR_Init = (CR_INIT) cdripdll->GetFunctionAddress("CR_Init");
39 ex_CR_DeInit = (CR_DEINIT) cdripdll->GetFunctionAddress("CR_DeInit");
40 ex_CR_IsInitialized = (CR_ISINITIALIZED) cdripdll->GetFunctionAddress("CR_IsInitialized");
41 ex_CR_GetNumCDROM = (CR_GETNUMCDROM) cdripdll->GetFunctionAddress("CR_GetNumCDROM");
42 ex_CR_OpenCDROM = (CR_OPENCDROM) cdripdll->GetFunctionAddress("CR_OpenCDROM");
43 ex_CR_CloseCDROM = (CR_CLOSECDROM) cdripdll->GetFunctionAddress("CR_CloseCDROM");
44 ex_CR_ReadToc = (CR_READTOC) cdripdll->GetFunctionAddress("CR_ReadToc");
45 ex_CR_GetNumTocEntries = (CR_GETNUMTOCENTRIES) cdripdll->GetFunctionAddress("CR_GetNumTocEntries");
46 ex_CR_GetTocEntry = (CR_GETTOCENTRY) cdripdll->GetFunctionAddress("CR_GetTocEntry");
47 ex_CR_GetCDROMParameters = (CR_GETCDROMPARAMETERS) cdripdll->GetFunctionAddress("CR_GetCDROMParameters");
48 ex_CR_IsMediaLoaded = (CR_ISMEDIALOADED) cdripdll->GetFunctionAddress("CR_IsMediaLoaded");
49 ex_CR_EjectCD = (CR_EJECTCD) cdripdll->GetFunctionAddress("CR_EjectCD");
50
51 if (ex_CR_Init == NIL ||
52 ex_CR_DeInit == NIL ||
53 ex_CR_IsInitialized == NIL ||
54 ex_CR_GetNumCDROM == NIL ||
55 ex_CR_OpenCDROM == NIL ||
56 ex_CR_CloseCDROM == NIL ||
57 ex_CR_ReadToc == NIL ||
58 ex_CR_GetNumTocEntries == NIL ||
59 ex_CR_GetTocEntry == NIL ||
60 ex_CR_GetCDROMParameters == NIL ||
61 ex_CR_IsMediaLoaded == NIL ||
62 ex_CR_EjectCD == NIL) { FreeCDRipDLL(); return False; }
63
64 return True;
65 }
66
67 Void FreeCDRipDLL()
68 {
69 Object::DeleteObject(cdripdll);
70
71 cdripdll = NIL;
72 }