Debian Codegraph @

components/decoder/fdkaac/dllinterface.cpp

raw symbols SCIP
1 /* BoCA - BonkEnc Component Architecture
2 * Copyright (C) 2007-2026 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 AACDECODER_OPEN ex_aacDecoder_Open = NIL;
17 AACDECODER_CONFIGRAW ex_aacDecoder_ConfigRaw = NIL;
18 AACDECODER_FILL ex_aacDecoder_Fill = NIL;
19 AACDECODER_GETSTREAMINFO ex_aacDecoder_GetStreamInfo = NIL;
20 AACDECODER_DECODEFRAME ex_aacDecoder_DecodeFrame = NIL;
21 AACDECODER_CLOSE ex_aacDecoder_Close = NIL;
22 AACDECODER_GETLIBINFO ex_aacDecoder_GetLibInfo = NIL;
23
24 MP4READ ex_MP4Read = NIL;
25 MP4READCALLBACKS ex_MP4ReadCallbacks = NIL;
26 MP4CLOSE ex_MP4Close = NIL;
27 MP4FREE ex_MP4Free = NIL;
28 MP4FINDTRACKID ex_MP4FindTrackId = NIL;
29 MP4GETTRACKAUDIOMPEG4TYPE ex_MP4GetTrackAudioMpeg4Type = NIL;
30 MP4GETTRACKAUDIOCHANNELS ex_MP4GetTrackAudioChannels = NIL;
31 MP4GETTRACKESCONFIGURATION ex_MP4GetTrackESConfiguration = NIL;
32 MP4GETTRACKTIMESCALE ex_MP4GetTrackTimeScale = NIL;
33 MP4GETTRACKNUMBEROFSAMPLES ex_MP4GetTrackNumberOfSamples = NIL;
34 MP4GETSAMPLETIME ex_MP4GetSampleTime = NIL;
35 MP4GETSAMPLEIDFROMTIME ex_MP4GetSampleIdFromTime = NIL;
36 MP4GETSAMPLESIZE ex_MP4GetSampleSize = NIL;
37 MP4READSAMPLE ex_MP4ReadSample = NIL;
38 MP4ITMFGETITEMSBYMEANING ex_MP4ItmfGetItemsByMeaning = NIL;
39 MP4ITMFITEMLISTFREE ex_MP4ItmfItemListFree = NIL;
40
41 DynamicLoader *fdkaacdll = NIL;
42 DynamicLoader *mp4v2dll = NIL;
43
44 Bool LoadFDKAACDLL()
45 {
46 fdkaacdll = BoCA::Utilities::LoadCodecDLL("fdk-aac");
47
48 if (fdkaacdll == NIL) return False;
49
50 ex_aacDecoder_Open = (AACDECODER_OPEN) fdkaacdll->GetFunctionAddress("aacDecoder_Open");
51 ex_aacDecoder_ConfigRaw = (AACDECODER_CONFIGRAW) fdkaacdll->GetFunctionAddress("aacDecoder_ConfigRaw");
52 ex_aacDecoder_Fill = (AACDECODER_FILL) fdkaacdll->GetFunctionAddress("aacDecoder_Fill");
53 ex_aacDecoder_GetStreamInfo = (AACDECODER_GETSTREAMINFO) fdkaacdll->GetFunctionAddress("aacDecoder_GetStreamInfo");
54 ex_aacDecoder_DecodeFrame = (AACDECODER_DECODEFRAME) fdkaacdll->GetFunctionAddress("aacDecoder_DecodeFrame");
55 ex_aacDecoder_Close = (AACDECODER_CLOSE) fdkaacdll->GetFunctionAddress("aacDecoder_Close");
56 ex_aacDecoder_GetLibInfo = (AACDECODER_GETLIBINFO) fdkaacdll->GetFunctionAddress("aacDecoder_GetLibInfo");
57
58 if (ex_aacDecoder_Open == NIL ||
59 ex_aacDecoder_ConfigRaw == NIL ||
60 ex_aacDecoder_Fill == NIL ||
61 ex_aacDecoder_GetStreamInfo == NIL ||
62 ex_aacDecoder_DecodeFrame == NIL ||
63 ex_aacDecoder_Close == NIL ||
64 ex_aacDecoder_GetLibInfo == NIL) { FreeFDKAACDLL(); return False; }
65
66 return True;
67 }
68
69 Void FreeFDKAACDLL()
70 {
71 BoCA::Utilities::FreeCodecDLL(fdkaacdll);
72
73 fdkaacdll = NIL;
74 }
75
76 Bool LoadMP4v2DLL()
77 {
78 mp4v2dll = BoCA::Utilities::LoadCodecDLL("mp4v2");
79
80 if (mp4v2dll == NIL) return False;
81
82 ex_MP4Read = (MP4READ) mp4v2dll->GetFunctionAddress("MP4Read");
83 ex_MP4ReadCallbacks = (MP4READCALLBACKS) mp4v2dll->GetFunctionAddress("MP4ReadCallbacks");
84 ex_MP4Close = (MP4CLOSE) mp4v2dll->GetFunctionAddress("MP4Close");
85 ex_MP4Free = (MP4FREE) mp4v2dll->GetFunctionAddress("MP4Free");
86 ex_MP4FindTrackId = (MP4FINDTRACKID) mp4v2dll->GetFunctionAddress("MP4FindTrackId");
87 ex_MP4GetTrackAudioMpeg4Type = (MP4GETTRACKAUDIOMPEG4TYPE) mp4v2dll->GetFunctionAddress("MP4GetTrackAudioMpeg4Type");
88 ex_MP4GetTrackAudioChannels = (MP4GETTRACKAUDIOCHANNELS) mp4v2dll->GetFunctionAddress("MP4GetTrackAudioChannels");
89 ex_MP4GetTrackESConfiguration = (MP4GETTRACKESCONFIGURATION) mp4v2dll->GetFunctionAddress("MP4GetTrackESConfiguration");
90 ex_MP4GetTrackTimeScale = (MP4GETTRACKTIMESCALE) mp4v2dll->GetFunctionAddress("MP4GetTrackTimeScale");
91 ex_MP4GetTrackNumberOfSamples = (MP4GETTRACKNUMBEROFSAMPLES) mp4v2dll->GetFunctionAddress("MP4GetTrackNumberOfSamples");
92 ex_MP4GetSampleTime = (MP4GETSAMPLETIME) mp4v2dll->GetFunctionAddress("MP4GetSampleTime");
93 ex_MP4GetSampleIdFromTime = (MP4GETSAMPLEIDFROMTIME) mp4v2dll->GetFunctionAddress("MP4GetSampleIdFromTime");
94 ex_MP4GetSampleSize = (MP4GETSAMPLESIZE) mp4v2dll->GetFunctionAddress("MP4GetSampleSize");
95 ex_MP4ReadSample = (MP4READSAMPLE) mp4v2dll->GetFunctionAddress("MP4ReadSample");
96 ex_MP4ItmfGetItemsByMeaning = (MP4ITMFGETITEMSBYMEANING) mp4v2dll->GetFunctionAddress("MP4ItmfGetItemsByMeaning");
97 ex_MP4ItmfItemListFree = (MP4ITMFITEMLISTFREE) mp4v2dll->GetFunctionAddress("MP4ItmfItemListFree");
98
99 if (ex_MP4Read == NIL ||
100 ex_MP4ReadCallbacks == NIL ||
101 ex_MP4Close == NIL ||
102 ex_MP4Free == NIL ||
103 ex_MP4FindTrackId == NIL ||
104 ex_MP4GetTrackAudioMpeg4Type == NIL ||
105 ex_MP4GetTrackAudioChannels == NIL ||
106 ex_MP4GetTrackESConfiguration == NIL ||
107 ex_MP4GetTrackTimeScale == NIL ||
108 ex_MP4GetTrackNumberOfSamples == NIL ||
109 ex_MP4GetSampleTime == NIL ||
110 ex_MP4GetSampleIdFromTime == NIL ||
111 ex_MP4GetSampleSize == NIL ||
112 ex_MP4ReadSample == NIL ||
113 ex_MP4ItmfGetItemsByMeaning == NIL ||
114 ex_MP4ItmfItemListFree == NIL) { FreeMP4v2DLL(); return False; }
115
116 return True;
117 }
118
119 Void FreeMP4v2DLL()
120 {
121 BoCA::Utilities::FreeCodecDLL(mp4v2dll);
122
123 mp4v2dll = NIL;
124 }