mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-09 15:28:18 +07:00
Pass BIK reference to child BinkAudio for flags and version validation
This commit is contained in:
@ -114,7 +114,7 @@ public class BIK {
|
|||||||
for (int i = 0, s = numTracks; i < s; i++) {
|
for (int i = 0, s = numTracks; i < s; i++) {
|
||||||
try {
|
try {
|
||||||
MDC.put("track", i);
|
MDC.put("track", i);
|
||||||
tracks[i] = new BinkAudio(in);
|
tracks[i] = new BinkAudio(this, in);
|
||||||
} finally {
|
} finally {
|
||||||
MDC.remove("track");
|
MDC.remove("track");
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ public class BinkAudio {
|
|||||||
private final int[] BANDS;
|
private final int[] BANDS;
|
||||||
private final float[][] PREVIOUS = new float[MAX_CHANNELS][BLOCK_MAX_SIZE >>> 4];
|
private final float[][] PREVIOUS = new float[MAX_CHANNELS][BLOCK_MAX_SIZE >>> 4];
|
||||||
|
|
||||||
|
final BIK bik;
|
||||||
final short numChannels;
|
final short numChannels;
|
||||||
final int sampleRate;
|
final int sampleRate;
|
||||||
final int flags;
|
final int flags;
|
||||||
@ -48,7 +49,9 @@ public class BinkAudio {
|
|||||||
|
|
||||||
boolean first;
|
boolean first;
|
||||||
|
|
||||||
BinkAudio(ByteInput in) {
|
BinkAudio(BIK bik, ByteInput in) {
|
||||||
|
this.bik = bik;
|
||||||
|
|
||||||
log.trace("slicing {} bytes", SIZE);
|
log.trace("slicing {} bytes", SIZE);
|
||||||
in = in.readSlice(SIZE);
|
in = in.readSlice(SIZE);
|
||||||
|
|
||||||
@ -122,6 +125,12 @@ public class BinkAudio {
|
|||||||
return (flags & FLAG_AUDIO_STEREO) == 0;
|
return (flags & FLAG_AUDIO_STEREO) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static float readFloat29(BitInput bits) {
|
||||||
|
int power = bits.read31u(5);
|
||||||
|
float f = FastMath.scalb(bits.read31u(23), power - 23);
|
||||||
|
return bits.readBoolean() ? -f : f;
|
||||||
|
}
|
||||||
|
|
||||||
void decode(BitInput bits, float[][] out) {
|
void decode(BitInput bits, float[][] out) {
|
||||||
int ch, i, j, k;
|
int ch, i, j, k;
|
||||||
float q;
|
float q;
|
||||||
@ -143,11 +152,12 @@ public class BinkAudio {
|
|||||||
// parse coefficients
|
// parse coefficients
|
||||||
i = 2;
|
i = 2;
|
||||||
while (i < frameLen) {
|
while (i < frameLen) {
|
||||||
|
assert bik.version == 'i';
|
||||||
{
|
{
|
||||||
int v = bits.read1();
|
int v = bits.read1();
|
||||||
if (v != 0) {
|
if (v != 0) {
|
||||||
v = bits.read7u(4);
|
v = bits.read7u(4);
|
||||||
j = i + RLE[v] << 3;
|
j = i + RLE[v] * 8;
|
||||||
} else {
|
} else {
|
||||||
j = i + 8;
|
j = i + 8;
|
||||||
}
|
}
|
||||||
@ -202,10 +212,4 @@ public class BinkAudio {
|
|||||||
|
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static float readFloat29(BitInput bits) {
|
|
||||||
int power = bits.read32(5);
|
|
||||||
float f = FastMath.scalb(bits.read32(23), power - 23);
|
|
||||||
return bits.readBoolean() ? f : -f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ public class VideoPlayer implements Disposable {
|
|||||||
private int frame;
|
private int frame;
|
||||||
private float time, nextFrame;
|
private float time, nextFrame;
|
||||||
private ExecutorService audioStreams;
|
private ExecutorService audioStreams;
|
||||||
|
// FIXME: child threads should throw an error to parent?
|
||||||
|
|
||||||
public VideoPlayer() {
|
public VideoPlayer() {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user