Skip to content

Commit

Permalink
DLL renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
sheinbergon committed Nov 23, 2023
1 parent a312b2c commit 8e7dbef
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/org/sheinbergon/aac/jna/FdkAACLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.sheinbergon.aac.jna.structure.AACEncInfo;
import org.sheinbergon.aac.jna.structure.AACEncOutArgs;
import org.sheinbergon.aac.jna.structure.AACEncoder;
import org.sheinbergon.aac.jna.structure.LibInfo;

@SuppressWarnings("MethodName")
public final class FdkAACLib {
Expand Down Expand Up @@ -46,6 +47,8 @@ static native int aacEncEncode(

static native int aacEncInfo(AACEncoder hAacEncoder, AACEncInfo pInfo);

static native int aacEncGetLibInfo(LibInfo info);

static native int aacEncoder_SetParam(AACEncoder encoder, int param, int value);

private FdkAACLib() {
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/org/sheinbergon/aac/jna/FdkAACLibFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import com.sun.jna.Memory;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.PointerByReference;
import lombok.extern.java.Log;
import org.sheinbergon.aac.encoder.util.WAVAudioSupport;
import org.sheinbergon.aac.jna.structure.AACEncBufDesc;
import org.sheinbergon.aac.jna.structure.AACEncInArgs;
import org.sheinbergon.aac.jna.structure.AACEncInfo;
import org.sheinbergon.aac.jna.structure.AACEncOutArgs;
import org.sheinbergon.aac.jna.structure.AACEncoder;
import org.sheinbergon.aac.jna.structure.LibInfo;
import org.sheinbergon.aac.jna.util.AACEncError;
import org.sheinbergon.aac.jna.util.AACEncParam;
import org.sheinbergon.aac.jna.util.FdkAACLibException;
Expand All @@ -17,8 +19,16 @@
import javax.annotation.Nonnull;
import java.util.Optional;

@Log
public final class FdkAACLibFacade {

static {
LibInfo info = new LibInfo();
FdkAACLib.aacEncGetLibInfo(info);
info.read();
log.info(String.format("=== FDK-AAC Library reported version - %s ===", new String(info.versionStr)));
}

private static final int IN_BUFFER_COUNT = 1;
private static final int IN_BUFFER_IDENTIFIER = 0;
private static final int IN_BUFFER_ELEMENT_SIZE = 2;
Expand Down
40 changes: 40 additions & 0 deletions src/main/java/org/sheinbergon/aac/jna/structure/LibInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.sheinbergon.aac.jna.structure;

import com.sun.jna.Structure;
import org.sheinbergon.aac.jna.util.JNASupport;

import java.util.List;

/**
* Maps to LIB_INFO struct.
*
* @see <a href="https://github.com/mstorsjo/fdk-aac/blob/v2.0.2/libSYS/include/FDK_audio.h">fdk-aac/libSYS/include/FDK_audio.h</a>
*/
@SuppressWarnings({"JavadocVariable", "VisibilityModifier", "MemberName"})
public final class LibInfo extends Structure {

private static final int VERSION_STRING_SIZE = 32;

private static final List<String> FIELD_ORDER = JNASupport.structureFieldOrder(LibInfo.class);

/**
* Library Info mapping.
*/
public LibInfo() {
setAlignType(Structure.ALIGN_NONE); // Make sure field size alignments are as expected
read(); // Read once after initialize from provided pointer
}

public String title;
public String build_date;
public String build_time;
public int module_id;
public int version;
public int flags;
public byte[] versionStr = new byte[VERSION_STRING_SIZE];

@Override
protected List<String> getFieldOrder() {
return FIELD_ORDER;
}
}

0 comments on commit 8e7dbef

Please sign in to comment.