// Copyright 2014-2025 Jesper Larsson
//
// This file is part of Klipspringer, <https://klipspringer.eavadeaux.net/>
//
// Klipspringer is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// Klipspringer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
// even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with Klipspringer. If
// not, see <https://www.gnu.org/licenses/>.
package net.avadeaux.klipspringer.codec;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
/** Static initialization of common external resources, with methods to provide information about
* supported features. Should be loaded before classes that use external libraries are initialized.
*/
public class Library {
private final static int FLAC = 1, LAME = 2, ALSA = 4, VORBIS = 8, OPUS = 16;
static {
System.loadLibrary("klip");
init(FLAC, LAME, ALSA, VORBIS, OPUS,
ByteBuffer.class,
Error.class,
IOException.class,
CodeIOException.class,
FileNotFoundException.class,
AudioDecoder.PictureTarget.class,
ByteOrder.BIG_ENDIAN,
ByteOrder.LITTLE_ENDIAN);
}
/** Call to make sure that static external resources are properly initialized. */
public static void init() {
// All is done in static initialization block.
}
private static native synchronized void init(int flacbit, int lamebit, int alsabit, int vorbisbit, int opusbit,
Class bbClass,
Class errorClass,
Class ioExceptionClass,
Class ecodeExceptionClass,
Class fileNofFoundExceptionClass,
Class pictureTargetClass,
ByteOrder bigE,
ByteOrder littleE);
/** Checks if set up with a library compiled with FLAC support. */
public static boolean flacSupported() { return (support() & FLAC) != 0; }
/** Checks if set up with a library compiled with LAME MP3 encoding support. */
public static boolean lameSupported() { return (support() & LAME) != 0; }
/** Checks if set up with a library compiled with support for direct access to ALSA devices. */
public static boolean alsaSupported() { return (support() & ALSA) != 0; }
/** Checks if set up with a library compiled with Vorbis support. */
public static boolean vorbisSupported() { return (support() & VORBIS) != 0; }
/** Checks if set up with a library compiled with Opus support. */
public static boolean opusSupported() { return (support() & OPUS) != 0; }
// Gets the supported bits.
private static native int support();
/** Gets Klipspringer version string. */
public static native String version();
}
Version: v4.3.2.2 (2026-05-16T17:03:34+02:00)
Raw file
Source code overview
Klipspringer home