FlacDecoderJni.smali
.class final Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;
.super Ljava/lang/Object;
.source "FlacDecoderJni.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni$FlacFrameDecodeException;
}
.end annotation
# static fields
.field private static final TEMP_BUFFER_SIZE:I
# instance fields
.field private byteBufferData:Ljava/nio/ByteBuffer;
.field private endOfExtractorInput:Z
.field private extractorInput:Lcom/google/android/exoplayer2/extractor/ExtractorInput;
.field private final nativeDecoderContext:J
.field private tempBuffer:[B
# direct methods
.method static constructor <clinit>()V
.registers 1
const v0, 0x356f
invoke-static {v0}, Lnp/NPFog;->d(I)I
move-result v0
sput v0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->TEMP_BUFFER_SIZE:I
return-void
.end method
.method public constructor <init>()V
.registers 6
.annotation system Ldalvik/annotation/Throws;
value = {
Lcom/google/android/exoplayer2/ext/flac/FlacDecoderException;
}
.end annotation
.line 49
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 50
invoke-direct {p0}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->flacInit()J
move-result-wide v0
iput-wide v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->nativeDecoderContext:J
.line 51
const-wide/16 v2, 0x0
cmp-long v4, v0, v2
if-eqz v4, :cond_10
.line 54
return-void
.line 52
:cond_10
new-instance v0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderException;
const-string v1, "Failed to initialize decoder"
invoke-direct {v0, v1}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method private native flacDecodeMetadata(J)Lcom/google/android/exoplayer2/util/FlacStreamInfo;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;,
Ljava/lang/InterruptedException;
}
.end annotation
.end method
.method private native flacDecodeToArray(J[B)I
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;,
Ljava/lang/InterruptedException;
}
.end annotation
.end method
.method private native flacDecodeToBuffer(JLjava/nio/ByteBuffer;)I
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;,
Ljava/lang/InterruptedException;
}
.end annotation
.end method
.method private native flacFlush(J)V
.end method
.method private native flacGetDecodePosition(J)J
.end method
.method private native flacGetLastFrameFirstSampleIndex(J)J
.end method
.method private native flacGetLastFrameTimestamp(J)J
.end method
.method private native flacGetNextFrameFirstSampleIndex(J)J
.end method
.method private native flacGetSeekPosition(JJ)J
.end method
.method private native flacGetStateString(J)Ljava/lang/String;
.end method
.method private native flacInit()J
.end method
.method private native flacIsDecoderAtEndOfStream(J)Z
.end method
.method private native flacRelease(J)V
.end method
.method private native flacReset(JJ)V
.end method
.method private readFromExtractorInput(II)I
.registers 5
.param p1, "offset" # I
.param p2, "length" # I
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;,
Ljava/lang/InterruptedException;
}
.end annotation
.line 236
iget-object v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->extractorInput:Lcom/google/android/exoplayer2/extractor/ExtractorInput;
iget-object v1, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->tempBuffer:[B
invoke-interface {v0, v1, p1, p2}, Lcom/google/android/exoplayer2/extractor/ExtractorInput;->read([BII)I
move-result v0
.line 237
.local v0, "read":I
const/4 v1, -0x1
if-ne v0, v1, :cond_f
.line 238
const/4 v1, 0x1
iput-boolean v1, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->endOfExtractorInput:Z
.line 239
const/4 v0, 0x0
.line 241
:cond_f
return v0
.end method
# virtual methods
.method public decodeMetadata()Lcom/google/android/exoplayer2/util/FlacStreamInfo;
.registers 3
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;,
Ljava/lang/InterruptedException;
}
.end annotation
.line 129
iget-wide v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->nativeDecoderContext:J
invoke-direct {p0, v0, v1}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->flacDecodeMetadata(J)Lcom/google/android/exoplayer2/util/FlacStreamInfo;
move-result-object v0
return-object v0
.end method
.method public decodeSample(Ljava/nio/ByteBuffer;)V
.registers 5
.param p1, "output" # Ljava/nio/ByteBuffer;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;,
Ljava/lang/InterruptedException;,
Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni$FlacFrameDecodeException;
}
.end annotation
.line 158
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->clear()Ljava/nio/Buffer;
.line 159
nop
.line 160
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->isDirect()Z
move-result v0
if-eqz v0, :cond_11
iget-wide v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->nativeDecoderContext:J
.line 161
invoke-direct {p0, v0, v1, p1}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->flacDecodeToBuffer(JLjava/nio/ByteBuffer;)I
move-result v0
goto :goto_1b
:cond_11
iget-wide v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->nativeDecoderContext:J
.line 162
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->array()[B
move-result-object v2
invoke-direct {p0, v0, v1, v2}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->flacDecodeToArray(J[B)I
move-result v0
:goto_1b
nop
.line 163
.local v0, "frameSize":I
if-gez v0, :cond_31
.line 164
invoke-virtual {p0}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->isDecoderAtEndOfInput()Z
move-result v1
if-eqz v1, :cond_29
.line 168
const/4 v1, 0x0
invoke-virtual {p1, v1}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer;
goto :goto_34
.line 165
:cond_29
new-instance v1, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni$FlacFrameDecodeException;
const-string v2, "Cannot decode FLAC frame"
invoke-direct {v1, v2, v0}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni$FlacFrameDecodeException;-><init>(Ljava/lang/String;I)V
throw v1
.line 170
:cond_31
invoke-virtual {p1, v0}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer;
.line 172
:goto_34
return-void
.end method
.method public decodeSampleWithBacktrackPosition(Ljava/nio/ByteBuffer;J)V
.registers 8
.param p1, "output" # Ljava/nio/ByteBuffer;
.param p2, "retryPosition" # J
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/lang/InterruptedException;,
Ljava/io/IOException;,
Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni$FlacFrameDecodeException;
}
.end annotation
.line 142
:try_start_0
invoke-virtual {p0, p1}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->decodeSample(Ljava/nio/ByteBuffer;)V
:try_end_3
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_3} :catch_5
.line 151
nop
.line 152
return-void
.line 143
:catch_5
move-exception v0
.line 144
.local v0, "e":Ljava/io/IOException;
const-wide/16 v1, 0x0
cmp-long v3, p2, v1
if-ltz v3, :cond_16
.line 145
invoke-virtual {p0, p2, p3}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->reset(J)V
.line 146
iget-object v1, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->extractorInput:Lcom/google/android/exoplayer2/extractor/ExtractorInput;
if-eqz v1, :cond_16
.line 147
invoke-interface {v1, p2, p3, v0}, Lcom/google/android/exoplayer2/extractor/ExtractorInput;->setRetryPosition(JLjava/lang/Throwable;)V
.line 150
:cond_16
throw v0
.end method
.method public flush()V
.registers 3
.line 218
iget-wide v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->nativeDecoderContext:J
invoke-direct {p0, v0, v1}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->flacFlush(J)V
.line 219
return-void
.end method
.method public getDecodePosition()J
.registers 3
.line 178
iget-wide v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->nativeDecoderContext:J
invoke-direct {p0, v0, v1}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->flacGetDecodePosition(J)J
move-result-wide v0
return-wide v0
.end method
.method public getLastFrameFirstSampleIndex()J
.registers 3
.line 188
iget-wide v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->nativeDecoderContext:J
invoke-direct {p0, v0, v1}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->flacGetLastFrameFirstSampleIndex(J)J
move-result-wide v0
return-wide v0
.end method
.method public getLastFrameTimestamp()J
.registers 3
.line 183
iget-wide v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->nativeDecoderContext:J
invoke-direct {p0, v0, v1}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->flacGetLastFrameTimestamp(J)J
move-result-wide v0
return-wide v0
.end method
.method public getNextFrameFirstSampleIndex()J
.registers 3
.line 193
iget-wide v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->nativeDecoderContext:J
invoke-direct {p0, v0, v1}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->flacGetNextFrameFirstSampleIndex(J)J
move-result-wide v0
return-wide v0
.end method
.method public getSeekPosition(J)J
.registers 5
.param p1, "timeUs" # J
.line 205
iget-wide v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->nativeDecoderContext:J
invoke-direct {p0, v0, v1, p1, p2}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->flacGetSeekPosition(JJ)J
move-result-wide v0
return-wide v0
.end method
.method public getStateString()Ljava/lang/String;
.registers 3
.line 209
iget-wide v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->nativeDecoderContext:J
invoke-direct {p0, v0, v1}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->flacGetStateString(J)Ljava/lang/String;
move-result-object v0
return-object v0
.end method
.method public isDecoderAtEndOfInput()Z
.registers 3
.line 214
iget-wide v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->nativeDecoderContext:J
invoke-direct {p0, v0, v1}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->flacIsDecoderAtEndOfStream(J)Z
move-result v0
return v0
.end method
.method public isEndOfData()Z
.registers 3
.line 80
iget-object v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->byteBufferData:Ljava/nio/ByteBuffer;
const/4 v1, 0x1
if-eqz v0, :cond_e
.line 81
invoke-virtual {v0}, Ljava/nio/ByteBuffer;->remaining()I
move-result v0
if-nez v0, :cond_c
goto :goto_d
:cond_c
const/4 v1, 0x0
:goto_d
return v1
.line 82
:cond_e
iget-object v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->extractorInput:Lcom/google/android/exoplayer2/extractor/ExtractorInput;
if-eqz v0, :cond_15
.line 83
iget-boolean v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->endOfExtractorInput:Z
return v0
.line 85
:cond_15
return v1
.end method
.method public read(Ljava/nio/ByteBuffer;)I
.registers 6
.param p1, "target" # Ljava/nio/ByteBuffer;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;,
Ljava/lang/InterruptedException;
}
.end annotation
.line 101
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I
move-result v0
.line 102
.local v0, "byteCount":I
iget-object v1, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->byteBufferData:Ljava/nio/ByteBuffer;
if-eqz v1, :cond_2b
.line 103
invoke-virtual {v1}, Ljava/nio/ByteBuffer;->remaining()I
move-result v1
invoke-static {v0, v1}, Ljava/lang/Math;->min(II)I
move-result v0
.line 104
iget-object v1, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->byteBufferData:Ljava/nio/ByteBuffer;
invoke-virtual {v1}, Ljava/nio/ByteBuffer;->limit()I
move-result v1
.line 105
.local v1, "originalLimit":I
iget-object v2, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->byteBufferData:Ljava/nio/ByteBuffer;
invoke-virtual {v2}, Ljava/nio/ByteBuffer;->position()I
move-result v3
add-int/2addr v3, v0
invoke-virtual {v2, v3}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer;
.line 107
iget-object v2, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->byteBufferData:Ljava/nio/ByteBuffer;
invoke-virtual {p1, v2}, Ljava/nio/ByteBuffer;->put(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;
.line 109
iget-object v2, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->byteBufferData:Ljava/nio/ByteBuffer;
invoke-virtual {v2, v1}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer;
.line 110
.end local v1 # "originalLimit":I
goto :goto_4b
:cond_2b
iget-object v1, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->extractorInput:Lcom/google/android/exoplayer2/extractor/ExtractorInput;
if-eqz v1, :cond_4c
.line 111
const/16 v1, 0x2000
invoke-static {v0, v1}, Ljava/lang/Math;->min(II)I
move-result v0
.line 112
const/4 v1, 0x0
invoke-direct {p0, v1, v0}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->readFromExtractorInput(II)I
move-result v2
.line 113
.local v2, "read":I
const/4 v3, 0x4
if-ge v2, v3, :cond_44
.line 117
sub-int v3, v0, v2
invoke-direct {p0, v2, v3}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->readFromExtractorInput(II)I
move-result v3
add-int/2addr v2, v3
.line 119
:cond_44
move v0, v2
.line 120
iget-object v3, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->tempBuffer:[B
invoke-virtual {p1, v3, v1, v0}, Ljava/nio/ByteBuffer;->put([BII)Ljava/nio/ByteBuffer;
.line 121
.end local v2 # "read":I
nop
.line 124
:goto_4b
return v0
.line 122
:cond_4c
const/4 v1, -0x1
return v1
.end method
.method public release()V
.registers 3
.line 231
iget-wide v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->nativeDecoderContext:J
invoke-direct {p0, v0, v1}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->flacRelease(J)V
.line 232
return-void
.end method
.method public reset(J)V
.registers 5
.param p1, "newPosition" # J
.line 227
iget-wide v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->nativeDecoderContext:J
invoke-direct {p0, v0, v1, p1, p2}, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->flacReset(JJ)V
.line 228
return-void
.end method
.method public setData(Lcom/google/android/exoplayer2/extractor/ExtractorInput;)V
.registers 3
.param p1, "extractorInput" # Lcom/google/android/exoplayer2/extractor/ExtractorInput;
.line 71
const/4 v0, 0x0
iput-object v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->byteBufferData:Ljava/nio/ByteBuffer;
.line 72
iput-object p1, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->extractorInput:Lcom/google/android/exoplayer2/extractor/ExtractorInput;
.line 73
iget-object v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->tempBuffer:[B
if-nez v0, :cond_f
.line 74
const/16 v0, 0x2000
new-array v0, v0, [B
iput-object v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->tempBuffer:[B
.line 76
:cond_f
const/4 v0, 0x0
iput-boolean v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->endOfExtractorInput:Z
.line 77
return-void
.end method
.method public setData(Ljava/nio/ByteBuffer;)V
.registers 3
.param p1, "byteBufferData" # Ljava/nio/ByteBuffer;
.line 61
iput-object p1, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->byteBufferData:Ljava/nio/ByteBuffer;
.line 62
const/4 v0, 0x0
iput-object v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->extractorInput:Lcom/google/android/exoplayer2/extractor/ExtractorInput;
.line 63
iput-object v0, p0, Lcom/google/android/exoplayer2/ext/flac/FlacDecoderJni;->tempBuffer:[B
.line 64
return-void
.end method