GifCoverParser.smali
.class public Lcom/facebook/imagepipeline/decoder/GifCoverParser;
.super Ljava/lang/Object;
.source "SourceFile"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/facebook/imagepipeline/decoder/GifCoverParser$DecodeRunnable;
}
.end annotation
# static fields
.field private static STATE_IDLE:I = 0x0
.field private static STATE_PARSE:I = 0x2
.field private static STATE_SUBMIT:I = 0x1
.field private static final TAG:Ljava/lang/String; = "GifCoverParser"
# instance fields
.field private final mCallContext:Ljava/lang/Object;
.field private final mConsumer:Lcom/facebook/imagepipeline/producers/Consumer;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/facebook/imagepipeline/producers/Consumer<",
"Lcom/facebook/common/references/CloseableReference<",
"Lcom/facebook/imagepipeline/image/CloseableImage;",
">;>;"
}
.end annotation
.end field
.field private final mCoverOptions:Lcom/facebook/imagepipeline/common/AnimCoverOptions;
.field private final mDecodeExecutor:Ljava/util/concurrent/Executor;
.field private final mId:Ljava/lang/String;
.field private final mRequest:Lcom/facebook/imagepipeline/request/ImageRequest;
.field private final mStat:Ljava/util/concurrent/atomic/AtomicInteger;
.field private final mUrl:Ljava/lang/String;
# direct methods
.method static constructor <clinit>()V
.registers 0
return-void
.end method
.method public constructor <init>(Ljava/util/concurrent/Executor;Lcom/facebook/imagepipeline/producers/Consumer;Lcom/facebook/imagepipeline/request/ImageRequest;Ljava/lang/Object;Ljava/lang/String;)V
.registers 8
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/concurrent/Executor;",
"Lcom/facebook/imagepipeline/producers/Consumer<",
"Lcom/facebook/common/references/CloseableReference<",
"Lcom/facebook/imagepipeline/image/CloseableImage;",
">;>;",
"Lcom/facebook/imagepipeline/request/ImageRequest;",
"Ljava/lang/Object;",
"Ljava/lang/String;",
")V"
}
.end annotation
.line 53
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 36
new-instance v0, Ljava/util/concurrent/atomic/AtomicInteger;
sget v1, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->STATE_IDLE:I
invoke-direct {v0, v1}, Ljava/util/concurrent/atomic/AtomicInteger;-><init>(I)V
iput-object v0, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mStat:Ljava/util/concurrent/atomic/AtomicInteger;
.line 54
invoke-virtual {p3}, Lcom/facebook/imagepipeline/request/ImageRequest;->getWebPCoverOptions()Lcom/facebook/imagepipeline/common/AnimCoverOptions;
move-result-object v0
iput-object v0, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mCoverOptions:Lcom/facebook/imagepipeline/common/AnimCoverOptions;
.line 55
iput-object p1, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mDecodeExecutor:Ljava/util/concurrent/Executor;
.line 56
invoke-virtual {p3}, Lcom/facebook/imagepipeline/request/ImageRequest;->getSourceUri()Landroid/net/Uri;
move-result-object p1
if-nez p1, :cond_1c
const/4 p1, 0x0
goto :goto_20
.line 57
:cond_1c
invoke-virtual {p1}, Landroid/net/Uri;->toString()Ljava/lang/String;
move-result-object p1
:goto_20
iput-object p1, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mUrl:Ljava/lang/String;
.line 58
iput-object p2, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mConsumer:Lcom/facebook/imagepipeline/producers/Consumer;
.line 59
iput-object p3, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mRequest:Lcom/facebook/imagepipeline/request/ImageRequest;
.line 60
iput-object p4, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mCallContext:Ljava/lang/Object;
.line 61
iput-object p5, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mId:Ljava/lang/String;
return-void
.end method
.method static synthetic access$000()I
.registers 1
.line 28
sget v0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->STATE_SUBMIT:I
return v0
.end method
.method static synthetic access$100()I
.registers 1
.line 28
sget v0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->STATE_PARSE:I
return v0
.end method
.method static synthetic access$200(Lcom/facebook/imagepipeline/decoder/GifCoverParser;)Ljava/util/concurrent/atomic/AtomicInteger;
.registers 1
.line 28
iget-object p0, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mStat:Ljava/util/concurrent/atomic/AtomicInteger;
return-object p0
.end method
.method static synthetic access$300(Lcom/facebook/imagepipeline/decoder/GifCoverParser;)Lcom/facebook/imagepipeline/producers/Consumer;
.registers 1
.line 28
iget-object p0, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mConsumer:Lcom/facebook/imagepipeline/producers/Consumer;
return-object p0
.end method
.method static synthetic access$400()I
.registers 1
.line 28
sget v0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->STATE_IDLE:I
return v0
.end method
.method static synthetic access$500(Lcom/facebook/imagepipeline/decoder/GifCoverParser;)Lcom/facebook/imagepipeline/common/AnimCoverOptions;
.registers 1
.line 28
iget-object p0, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mCoverOptions:Lcom/facebook/imagepipeline/common/AnimCoverOptions;
return-object p0
.end method
.method private fetchDataFromImage(Lcom/facebook/imagepipeline/image/EncodedImage;I)[B
.registers 6
const/4 v0, 0x0
if-gtz p2, :cond_4
return-object v0
.line 91
:cond_4
new-array v1, p2, [B
.line 93
:try_start_6
invoke-virtual {p1}, Lcom/facebook/imagepipeline/image/EncodedImage;->getInputStream()Ljava/io/InputStream;
move-result-object p1
const/4 v2, 0x0
invoke-static {p1, v1, v2, p2}, Lcom/facebook/common/internal/ByteStreams;->read(Ljava/io/InputStream;[BII)I
move-result p1
:try_end_f
.catch Ljava/io/IOException; {:try_start_6 .. :try_end_f} :catch_12
if-ne p1, p2, :cond_12
return-object v1
:catch_12
:cond_12
return-object v0
.end method
# virtual methods
.method public parseMoreData(Lcom/facebook/imagepipeline/image/EncodedImage;)Z
.registers 6
.line 65
iget-object v0, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mCoverOptions:Lcom/facebook/imagepipeline/common/AnimCoverOptions;
const/4 v1, 0x0
if-eqz v0, :cond_52
iget-boolean v0, v0, Lcom/facebook/imagepipeline/common/AnimCoverOptions;->enableIncrease:Z
if-eqz v0, :cond_52
iget-object v0, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mCoverOptions:Lcom/facebook/imagepipeline/common/AnimCoverOptions;
iget v0, v0, Lcom/facebook/imagepipeline/common/AnimCoverOptions;->coverLength:I
if-gtz v0, :cond_10
goto :goto_52
.line 70
:cond_10
iget-object v0, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mStat:Ljava/util/concurrent/atomic/AtomicInteger;
sget v2, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->STATE_IDLE:I
sget v3, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->STATE_SUBMIT:I
invoke-virtual {v0, v2, v3}, Ljava/util/concurrent/atomic/AtomicInteger;->compareAndSet(II)Z
move-result v0
if-eqz v0, :cond_52
.line 71
invoke-virtual {p1}, Lcom/facebook/imagepipeline/image/EncodedImage;->getSize()I
move-result v0
.line 72
iget-object v2, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mCoverOptions:Lcom/facebook/imagepipeline/common/AnimCoverOptions;
iget v2, v2, Lcom/facebook/imagepipeline/common/AnimCoverOptions;->coverLength:I
if-ge v0, v2, :cond_2e
.line 73
iget-object p1, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mStat:Ljava/util/concurrent/atomic/AtomicInteger;
sget v0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->STATE_IDLE:I
invoke-virtual {p1, v0}, Ljava/util/concurrent/atomic/AtomicInteger;->set(I)V
return v1
.line 76
:cond_2e
iget-object v0, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mCoverOptions:Lcom/facebook/imagepipeline/common/AnimCoverOptions;
iget v0, v0, Lcom/facebook/imagepipeline/common/AnimCoverOptions;->coverLength:I
invoke-direct {p0, p1, v0}, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->fetchDataFromImage(Lcom/facebook/imagepipeline/image/EncodedImage;I)[B
move-result-object v0
if-eqz v0, :cond_4b
.line 77
array-length v2, v0
if-nez v2, :cond_3c
goto :goto_4b
.line 81
:cond_3c
iget-object v2, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mDecodeExecutor:Ljava/util/concurrent/Executor;
new-instance v3, Lcom/facebook/imagepipeline/decoder/GifCoverParser$DecodeRunnable;
.line 82
invoke-virtual {p1}, Lcom/facebook/imagepipeline/image/EncodedImage;->cloneOrNull()Lcom/facebook/imagepipeline/image/EncodedImage;
move-result-object p1
invoke-direct {v3, p0, p1, v0}, Lcom/facebook/imagepipeline/decoder/GifCoverParser$DecodeRunnable;-><init>(Lcom/facebook/imagepipeline/decoder/GifCoverParser;Lcom/facebook/imagepipeline/image/EncodedImage;[B)V
.line 81
invoke-interface {v2, v3}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V
goto :goto_52
.line 78
:cond_4b
:goto_4b
iget-object p1, p0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->mStat:Ljava/util/concurrent/atomic/AtomicInteger;
sget v0, Lcom/facebook/imagepipeline/decoder/GifCoverParser;->STATE_IDLE:I
invoke-virtual {p1, v0}, Ljava/util/concurrent/atomic/AtomicInteger;->set(I)V
:cond_52
:goto_52
return v1
.end method