Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

42
LINES

< > BotCompany Repo | #1032892 // Opus JNI Test

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 1921K of libraries. Click here for Pure Java version (3799L/19K).

1  
!7
2  
3  
lib 1400511 // VorbisJava
4  
lib 1400513 // opus-jni-1.0.0.jar 
5  
6  
import org.gagravarr.opus.*;
7  
import net.labymod.opus.*;
8  
9  
cm > DynPrintLog {
10  
  start-thread {
11  
    fixContextClassLoader();
12  
    //OpusCodec.setupWithTemporaryFolder();
13  
    //OpusCodec.loadNativesFromJar();
14  
    
15  
    //print(System.getProperty("os.name", "bare-metal?").toLowerCase());
16  
    //print(System.getProperty("java.library.path");
17  
    
18  
    var cl = OpusCodec.class.getClassLoader();
19  
    print(+cl);
20  
    File dir = javaxCaches("opus-native");
21  
    //addToNativeLibraryPath(dir);
22  
    //javaLibraryPathHack();
23  
    //var moduleCL = dm_moduleClassLoader);
24  
    
25  
    temp tempSetFieldToIF1Proxy(cl, findLibrary := (IF1<S>) name -> {
26  
      print("Looking for: " + name);
27  
      if (startsWith(name, "libopus"))
28  
        ret f2s(newFile(dir, name + ".so"));
29  
      ret (S) call(cl, "findLibrary_base", name);
30  
    });
31  
    
32  
    for (S name : ll("libopus", "libopus_jni")) {
33  
      temp var stream = OpusCodec.class.getClassLoader().getResourceAsStream("native/64/linux/libopus.so");
34  
      print("Stream: " + stream);
35  
      assertNotNull(stream);
36  
      stream2file(stream, newFile(dir, name + ".so"));
37  
    }
38  
    
39  
    System.loadLibrary("libopus");
40  
    System.loadLibrary("libopus_jni");
41  
  }
42  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): bhatertpkbcr, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1032892
Snippet name: Opus JNI Test
Eternal ID of this version: #1032892/6
Text MD5: 2b2f6aded8e4bf822d3f757bd663ad3e
Transpilation MD5: 38212548df775549808b4422f312e748
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-08 18:04:42
Source code size: 1286 bytes / 42 lines
Pitched / IR pitched: No / No
Views / Downloads: 168 / 226
Version history: 5 change(s)
Referenced in: [show references]