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).

!7

lib 1400511 // VorbisJava
lib 1400513 // opus-jni-1.0.0.jar 

import org.gagravarr.opus.*;
import net.labymod.opus.*;

cm > DynPrintLog {
  start-thread {
    fixContextClassLoader();
    //OpusCodec.setupWithTemporaryFolder();
    //OpusCodec.loadNativesFromJar();
    
    //print(System.getProperty("os.name", "bare-metal?").toLowerCase());
    //print(System.getProperty("java.library.path");
    
    var cl = OpusCodec.class.getClassLoader();
    print(+cl);
    File dir = javaxCaches("opus-native");
    //addToNativeLibraryPath(dir);
    //javaLibraryPathHack();
    //var moduleCL = dm_moduleClassLoader);
    
    temp tempSetFieldToIF1Proxy(cl, findLibrary := (IF1<S>) name -> {
      print("Looking for: " + name);
      if (startsWith(name, "libopus"))
        ret f2s(newFile(dir, name + ".so"));
      ret (S) call(cl, "findLibrary_base", name);
    });
    
    for (S name : ll("libopus", "libopus_jni")) {
      temp var stream = OpusCodec.class.getClassLoader().getResourceAsStream("native/64/linux/libopus.so");
      print("Stream: " + stream);
      assertNotNull(stream);
      stream2file(stream, newFile(dir, name + ".so"));
    }
    
    System.loadLibrary("libopus");
    System.loadLibrary("libopus_jni");
  }
}

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: 302 / 365
Version history: 5 change(s)
Referenced in: [show references]