FileVideoCapturer.smali

.class public Lorg/webrtc/ali/FileVideoCapturer;
.super Ljava/lang/Object;
.source "FileVideoCapturer.java"

# interfaces
.implements Lorg/webrtc/ali/VideoCapturer;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lorg/webrtc/ali/FileVideoCapturer$VideoReaderY4M;,
        Lorg/webrtc/ali/FileVideoCapturer$VideoReader;
    }
.end annotation


# static fields
.field private static final TAG:Ljava/lang/String; = "FileVideoCapturer"


# instance fields
.field private capturerObserver:Lorg/webrtc/ali/VideoCapturer$CapturerObserver;

.field private final tickTask:Ljava/util/TimerTask;

.field private final timer:Ljava/util/Timer;

.field private final videoReader:Lorg/webrtc/ali/FileVideoCapturer$VideoReader;


# direct methods
.method static constructor <clinit>()V
    .registers 0

    .line 25
    return-void
.end method

.method public constructor <init>(Ljava/lang/String;)V
    .registers 5
    .param p1, "inputFile"    # Ljava/lang/String;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 162
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 145
    new-instance v0, Ljava/util/Timer;

    invoke-direct {v0}, Ljava/util/Timer;-><init>()V

    iput-object v0, p0, Lorg/webrtc/ali/FileVideoCapturer;->timer:Ljava/util/Timer;

    .line 147
    new-instance v0, Lorg/webrtc/ali/FileVideoCapturer$1;

    invoke-direct {v0, p0}, Lorg/webrtc/ali/FileVideoCapturer$1;-><init>(Lorg/webrtc/ali/FileVideoCapturer;)V

    iput-object v0, p0, Lorg/webrtc/ali/FileVideoCapturer;->tickTask:Ljava/util/TimerTask;

    .line 164
    :try_start_11
    new-instance v0, Lorg/webrtc/ali/FileVideoCapturer$VideoReaderY4M;

    invoke-direct {v0, p1}, Lorg/webrtc/ali/FileVideoCapturer$VideoReaderY4M;-><init>(Ljava/lang/String;)V

    iput-object v0, p0, Lorg/webrtc/ali/FileVideoCapturer;->videoReader:Lorg/webrtc/ali/FileVideoCapturer$VideoReader;
    :try_end_18
    .catch Ljava/io/IOException; {:try_start_11 .. :try_end_18} :catch_1a

    .line 168
    nop

    .line 169
    return-void

    .line 165
    :catch_1a
    move-exception v0

    .line 166
    .local v0, "e":Ljava/io/IOException;
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Could not open video file: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    const-string v2, "FileVideoCapturer"

    invoke-static {v2, v1}, Lorg/webrtc/ali/Logging;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 167
    throw v0
.end method

.method private getFrameHeight()I
    .registers 2

    .line 159
    iget-object v0, p0, Lorg/webrtc/ali/FileVideoCapturer;->videoReader:Lorg/webrtc/ali/FileVideoCapturer$VideoReader;

    invoke-interface {v0}, Lorg/webrtc/ali/FileVideoCapturer$VideoReader;->getFrameHeight()I

    move-result v0

    return v0
.end method

.method private getFrameWidth()I
    .registers 2

    .line 155
    iget-object v0, p0, Lorg/webrtc/ali/FileVideoCapturer;->videoReader:Lorg/webrtc/ali/FileVideoCapturer$VideoReader;

    invoke-interface {v0}, Lorg/webrtc/ali/FileVideoCapturer$VideoReader;->getFrameWidth()I

    move-result v0

    return v0
.end method

.method private getNextFrame()[B
    .registers 2

    .line 172
    iget-object v0, p0, Lorg/webrtc/ali/FileVideoCapturer;->videoReader:Lorg/webrtc/ali/FileVideoCapturer$VideoReader;

    invoke-interface {v0}, Lorg/webrtc/ali/FileVideoCapturer$VideoReader;->getNextFrame()[B

    move-result-object v0

    return-object v0
.end method

.method public static native nativeI420ToNV21([BII[B)V
.end method


# virtual methods
.method public changeCaptureFormat(III)V
    .registers 4
    .param p1, "width"    # I
    .param p2, "height"    # I
    .param p3, "framerate"    # I

    .line 202
    return-void
.end method

.method public dispose()V
    .registers 2

    .line 206
    iget-object v0, p0, Lorg/webrtc/ali/FileVideoCapturer;->videoReader:Lorg/webrtc/ali/FileVideoCapturer$VideoReader;

    invoke-interface {v0}, Lorg/webrtc/ali/FileVideoCapturer$VideoReader;->close()V

    .line 207
    return-void
.end method

.method public initialize(Lorg/webrtc/ali/SurfaceTextureHelper;Landroid/content/Context;Lorg/webrtc/ali/VideoCapturer$CapturerObserver;)V
    .registers 4
    .param p1, "surfaceTextureHelper"    # Lorg/webrtc/ali/SurfaceTextureHelper;
    .param p2, "applicationContext"    # Landroid/content/Context;
    .param p3, "capturerObserver"    # Lorg/webrtc/ali/VideoCapturer$CapturerObserver;

    .line 186
    iput-object p3, p0, Lorg/webrtc/ali/FileVideoCapturer;->capturerObserver:Lorg/webrtc/ali/VideoCapturer$CapturerObserver;

    .line 187
    return-void
.end method

.method public isScreencast()Z
    .registers 2

    .line 211
    const/4 v0, 0x0

    return v0
.end method

.method public startCapture(III)V
    .registers 10
    .param p1, "width"    # I
    .param p2, "height"    # I
    .param p3, "framerate"    # I

    .line 191
    iget-object v0, p0, Lorg/webrtc/ali/FileVideoCapturer;->timer:Ljava/util/Timer;

    iget-object v1, p0, Lorg/webrtc/ali/FileVideoCapturer;->tickTask:Ljava/util/TimerTask;

    const/16 v2, 0x3e8

    div-int/2addr v2, p3

    int-to-long v4, v2

    const-wide/16 v2, 0x0

    invoke-virtual/range {v0 .. v5}, Ljava/util/Timer;->schedule(Ljava/util/TimerTask;JJ)V

    .line 192
    return-void
.end method

.method public stopCapture()V
    .registers 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/InterruptedException;
        }
    .end annotation

    .line 196
    iget-object v0, p0, Lorg/webrtc/ali/FileVideoCapturer;->timer:Ljava/util/Timer;

    invoke-virtual {v0}, Ljava/util/Timer;->cancel()V

    .line 197
    return-void
.end method

.method public tick()V
    .registers 11

    .line 176
    sget-object v0, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;

    invoke-static {}, Landroid/os/SystemClock;->elapsedRealtime()J

    move-result-wide v1

    invoke-virtual {v0, v1, v2}, Ljava/util/concurrent/TimeUnit;->toNanos(J)J

    move-result-wide v0

    .line 178
    .local v0, "captureTimeNs":J
    invoke-direct {p0}, Lorg/webrtc/ali/FileVideoCapturer;->getNextFrame()[B

    move-result-object v2

    .line 179
    .local v2, "frameData":[B
    iget-object v3, p0, Lorg/webrtc/ali/FileVideoCapturer;->capturerObserver:Lorg/webrtc/ali/VideoCapturer$CapturerObserver;

    .line 180
    invoke-direct {p0}, Lorg/webrtc/ali/FileVideoCapturer;->getFrameWidth()I

    move-result v5

    invoke-direct {p0}, Lorg/webrtc/ali/FileVideoCapturer;->getFrameHeight()I

    move-result v6

    .line 179
    const/4 v7, 0x0

    move-object v4, v2

    move-wide v8, v0

    invoke-interface/range {v3 .. v9}, Lorg/webrtc/ali/VideoCapturer$CapturerObserver;->onByteBufferFrameCaptured([BIIIJ)V

    .line 181
    return-void
.end method