File tree Expand file tree Collapse file tree 1 file changed +24
-5
lines changed
src/main/kotlin/dev/silenium/libs/ffmpeg Expand file tree Collapse file tree 1 file changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -14,19 +14,38 @@ object FFmpeg {
14
14
" swresample" ,
15
15
" swscale" ,
16
16
)
17
- private var loaded = false
17
+ private var loadedGPL = false
18
+ private var loadedLGPL = false
18
19
19
20
@Synchronized
20
- fun ensureLoaded (withGPL : Boolean = false) {
21
- if (loaded) return
21
+ fun ensureLoadedGPL (): Result <Unit > {
22
+ if (loadedLGPL) return Result .failure(IllegalStateException (" GPL and LGPL libraries are mutually exclusive" ))
23
+ if (loadedGPL) return Result .success(Unit )
22
24
23
25
libs.forEach {
24
26
NativeLoader .loadLibraryFromClasspath(
25
27
baseName = it,
26
- platform = NativePlatform .platform(" -gpl" . takeIf { withGPL }.orEmpty() ),
28
+ platform = NativePlatform .platform(" -gpl" ),
27
29
)
28
30
}
29
31
30
- loaded = true
32
+ loadedGPL = true
33
+ return Result .success(Unit )
34
+ }
35
+
36
+ @Synchronized
37
+ fun ensureLoadedLGPL (): Result <Unit > {
38
+ if (loadedGPL) return Result .failure(IllegalStateException (" GPL and LGPL libraries are mutually exclusive" ))
39
+ if (loadedLGPL) return Result .success(Unit )
40
+
41
+ libs.forEach {
42
+ NativeLoader .loadLibraryFromClasspath(
43
+ baseName = it,
44
+ platform = NativePlatform .platform(),
45
+ )
46
+ }
47
+
48
+ loadedLGPL = true
49
+ return Result .success(Unit )
31
50
}
32
51
}
You can’t perform that action at this time.
0 commit comments