MpegAudioHeader.smali

.class public final Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;
.super Ljava/lang/Object;
.source "MpegAudioHeader.java"


# static fields
.field private static final BITRATE_V1_L1:[I

.field private static final BITRATE_V1_L2:[I

.field private static final BITRATE_V1_L3:[I

.field private static final BITRATE_V2:[I

.field private static final BITRATE_V2_L1:[I

.field public static final MAX_FRAME_SIZE_BYTES:I = 0x1000

.field private static final MIME_TYPE_BY_LAYER:[Ljava/lang/String;

.field private static final SAMPLING_RATE_V1:[I


# instance fields
.field public bitrate:I

.field public channels:I

.field public frameSize:I

.field public mimeType:Ljava/lang/String;

.field public sampleRate:I

.field public samplesPerFrame:I

.field public version:I


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

    .line 34
    const-string v0, "audio/mpeg-L1"

    const-string v1, "audio/mpeg-L2"

    const-string v2, "audio/mpeg"

    filled-new-array {v0, v1, v2}, [Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->MIME_TYPE_BY_LAYER:[Ljava/lang/String;

    .line 36
    const/4 v0, 0x3

    new-array v0, v0, [I

    fill-array-data v0, :array_3a

    sput-object v0, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->SAMPLING_RATE_V1:[I

    .line 37
    const/16 v0, 0xe

    new-array v1, v0, [I

    fill-array-data v1, :array_44

    sput-object v1, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->BITRATE_V1_L1:[I

    .line 41
    new-array v1, v0, [I

    fill-array-data v1, :array_64

    sput-object v1, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->BITRATE_V2_L1:[I

    .line 45
    new-array v1, v0, [I

    fill-array-data v1, :array_84

    sput-object v1, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->BITRATE_V1_L2:[I

    .line 49
    new-array v1, v0, [I

    fill-array-data v1, :array_a4

    sput-object v1, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->BITRATE_V1_L3:[I

    .line 53
    new-array v0, v0, [I

    fill-array-data v0, :array_c4

    sput-object v0, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->BITRATE_V2:[I

    return-void

    :array_3a
    .array-data 4
        0xac44
        0xbb80
        0x7d00
    .end array-data

    :array_44
    .array-data 4
        0x7d00
        0xfa00
        0x17700
        0x1f400
        0x27100
        0x2ee00
        0x36b00
        0x3e800
        0x46500
        0x4e200
        0x55f00
        0x5dc00
        0x65900
        0x6d600
    .end array-data

    :array_64
    .array-data 4
        0x7d00
        0xbb80
        0xdac0
        0xfa00
        0x13880
        0x17700
        0x1b580
        0x1f400
        0x23280
        0x27100
        0x2af80
        0x2ee00
        0x36b00
        0x3e800
    .end array-data

    :array_84
    .array-data 4
        0x7d00
        0xbb80
        0xdac0
        0xfa00
        0x13880
        0x17700
        0x1b580
        0x1f400
        0x27100
        0x2ee00
        0x36b00
        0x3e800
        0x4e200
        0x5dc00
    .end array-data

    :array_a4
    .array-data 4
        0x7d00
        0x9c40
        0xbb80
        0xdac0
        0xfa00
        0x13880
        0x17700
        0x1b580
        0x1f400
        0x27100
        0x2ee00
        0x36b00
        0x3e800
        0x4e200
    .end array-data

    :array_c4
    .array-data 4
        0x1f40
        0x3e80
        0x5dc0
        0x7d00
        0x9c40
        0xbb80
        0xdac0
        0xfa00
        0x13880
        0x17700
        0x1b580
        0x1f400
        0x23280
        0x27100
    .end array-data
.end method

.method public constructor <init>()V
    .registers 1

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

    return-void
.end method

.method public static getFrameSize(I)I
    .registers 11
    .param p0, "header"    # I

    .line 63
    const/high16 v0, -0x200000

    and-int v1, p0, v0

    const/4 v2, -0x1

    if-eq v1, v0, :cond_8

    .line 64
    return v2

    .line 67
    :cond_8
    ushr-int/lit8 v0, p0, 0x13

    const/4 v1, 0x3

    and-int/2addr v0, v1

    .line 68
    .local v0, "version":I
    const/4 v3, 0x1

    if-ne v0, v3, :cond_10

    .line 69
    return v2

    .line 72
    :cond_10
    ushr-int/lit8 v4, p0, 0x11

    and-int/2addr v4, v1

    .line 73
    .local v4, "layer":I
    if-nez v4, :cond_16

    .line 74
    return v2

    .line 77
    :cond_16
    ushr-int/lit8 v5, p0, 0xc

    const/16 v6, 0xf

    and-int/2addr v5, v6

    .line 78
    .local v5, "bitrateIndex":I
    if-eqz v5, :cond_7a

    if-ne v5, v6, :cond_20

    goto :goto_7a

    .line 83
    :cond_20
    ushr-int/lit8 v6, p0, 0xa

    and-int/2addr v6, v1

    .line 84
    .local v6, "samplingRateIndex":I
    if-ne v6, v1, :cond_26

    .line 85
    return v2

    .line 88
    :cond_26
    sget-object v2, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->SAMPLING_RATE_V1:[I

    aget v2, v2, v6

    .line 89
    .local v2, "samplingRate":I
    const/4 v7, 0x2

    if-ne v0, v7, :cond_30

    .line 91
    div-int/lit8 v2, v2, 0x2

    goto :goto_34

    .line 92
    :cond_30
    if-nez v0, :cond_34

    .line 94
    div-int/lit8 v2, v2, 0x4

    .line 98
    :cond_34
    :goto_34
    ushr-int/lit8 v8, p0, 0x9

    and-int/2addr v8, v3

    .line 99
    .local v8, "padding":I
    if-ne v4, v1, :cond_4f

    .line 101
    if-ne v0, v1, :cond_42

    sget-object v1, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->BITRATE_V1_L1:[I

    add-int/lit8 v3, v5, -0x1

    aget v1, v1, v3

    goto :goto_48

    :cond_42
    sget-object v1, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->BITRATE_V2_L1:[I

    add-int/lit8 v3, v5, -0x1

    aget v1, v1, v3

    .line 102
    .local v1, "bitrate":I
    :goto_48
    mul-int/lit8 v3, v1, 0xc

    div-int/2addr v3, v2

    add-int/2addr v3, v8

    mul-int/lit8 v3, v3, 0x4

    return v3

    .line 105
    .end local v1    # "bitrate":I
    :cond_4f
    if-ne v0, v1, :cond_61

    .line 106
    if-ne v4, v7, :cond_5a

    sget-object v7, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->BITRATE_V1_L2:[I

    add-int/lit8 v9, v5, -0x1

    aget v7, v7, v9

    goto :goto_60

    :cond_5a
    sget-object v7, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->BITRATE_V1_L3:[I

    add-int/lit8 v9, v5, -0x1

    aget v7, v7, v9

    .local v7, "bitrate":I
    :goto_60
    goto :goto_67

    .line 109
    .end local v7    # "bitrate":I
    :cond_61
    sget-object v7, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->BITRATE_V2:[I

    add-int/lit8 v9, v5, -0x1

    aget v7, v7, v9

    .line 113
    .restart local v7    # "bitrate":I
    :goto_67
    if-ne v0, v1, :cond_6e

    .line 115
    mul-int/lit16 v1, v7, 0x90

    div-int/2addr v1, v2

    add-int/2addr v1, v8

    return v1

    .line 118
    :cond_6e
    if-ne v4, v3, :cond_73

    const/16 v1, 0x48

    goto :goto_75

    :cond_73
    const/16 v1, 0x90

    :goto_75
    mul-int v1, v1, v7

    div-int/2addr v1, v2

    add-int/2addr v1, v8

    return v1

    .line 80
    .end local v2    # "samplingRate":I
    .end local v6    # "samplingRateIndex":I
    .end local v7    # "bitrate":I
    .end local v8    # "padding":I
    :cond_7a
    :goto_7a
    return v2
.end method

.method public static populateHeader(ILcom/google/android/exoplayer2/extractor/MpegAudioHeader;)Z
    .registers 22
    .param p0, "headerData"    # I
    .param p1, "header"    # Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;

    .line 131
    const/high16 v0, -0x200000

    and-int v1, p0, v0

    const/4 v2, 0x0

    if-eq v1, v0, :cond_8

    .line 132
    return v2

    .line 135
    :cond_8
    ushr-int/lit8 v0, p0, 0x13

    const/4 v1, 0x3

    and-int/2addr v0, v1

    .line 136
    .local v0, "version":I
    const/4 v11, 0x1

    if-ne v0, v11, :cond_10

    .line 137
    return v2

    .line 140
    :cond_10
    ushr-int/lit8 v3, p0, 0x11

    and-int/lit8 v12, v3, 0x3

    .line 141
    .local v12, "layer":I
    if-nez v12, :cond_17

    .line 142
    return v2

    .line 145
    :cond_17
    ushr-int/lit8 v3, p0, 0xc

    const/16 v4, 0xf

    and-int/lit8 v13, v3, 0xf

    .line 146
    .local v13, "bitrateIndex":I
    if-eqz v13, :cond_b7

    if-ne v13, v4, :cond_23

    goto/16 :goto_b7

    .line 151
    :cond_23
    ushr-int/lit8 v3, p0, 0xa

    and-int/lit8 v14, v3, 0x3

    .line 152
    .local v14, "samplingRateIndex":I
    if-ne v14, v1, :cond_2a

    .line 153
    return v2

    .line 156
    :cond_2a
    sget-object v2, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->SAMPLING_RATE_V1:[I

    aget v2, v2, v14

    .line 157
    .local v2, "sampleRate":I
    const/4 v3, 0x2

    if-ne v0, v3, :cond_34

    .line 159
    div-int/lit8 v2, v2, 0x2

    goto :goto_38

    .line 160
    :cond_34
    if-nez v0, :cond_38

    .line 162
    div-int/lit8 v2, v2, 0x4

    .line 165
    :cond_38
    :goto_38
    ushr-int/lit8 v4, p0, 0x9

    and-int/lit8 v15, v4, 0x1

    .line 169
    .local v15, "padding":I
    if-ne v12, v1, :cond_5a

    .line 171
    if-ne v0, v1, :cond_47

    sget-object v4, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->BITRATE_V1_L1:[I

    add-int/lit8 v5, v13, -0x1

    aget v4, v4, v5

    goto :goto_4d

    :cond_47
    sget-object v4, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->BITRATE_V2_L1:[I

    add-int/lit8 v5, v13, -0x1

    aget v4, v4, v5

    .line 172
    .local v4, "bitrate":I
    :goto_4d
    mul-int/lit8 v5, v4, 0xc

    div-int/2addr v5, v2

    add-int/2addr v5, v15

    mul-int/lit8 v5, v5, 0x4

    .line 173
    .local v5, "frameSize":I
    const/16 v6, 0x180

    move/from16 v16, v5

    move/from16 v17, v6

    .local v6, "samplesPerFrame":I
    goto :goto_93

    .line 176
    .end local v4    # "bitrate":I
    .end local v5    # "frameSize":I
    .end local v6    # "samplesPerFrame":I
    :cond_5a
    if-ne v0, v1, :cond_76

    .line 178
    if-ne v12, v3, :cond_65

    sget-object v4, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->BITRATE_V1_L2:[I

    add-int/lit8 v5, v13, -0x1

    aget v4, v4, v5

    goto :goto_6b

    :cond_65
    sget-object v4, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->BITRATE_V1_L3:[I

    add-int/lit8 v5, v13, -0x1

    aget v4, v4, v5

    .line 179
    .restart local v4    # "bitrate":I
    :goto_6b
    const/16 v6, 0x480

    .line 180
    .restart local v6    # "samplesPerFrame":I
    mul-int/lit16 v5, v4, 0x90

    div-int/2addr v5, v2

    add-int/2addr v5, v15

    move/from16 v16, v5

    move/from16 v17, v6

    .restart local v5    # "frameSize":I
    goto :goto_93

    .line 183
    .end local v4    # "bitrate":I
    .end local v5    # "frameSize":I
    .end local v6    # "samplesPerFrame":I
    :cond_76
    sget-object v4, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->BITRATE_V2:[I

    add-int/lit8 v5, v13, -0x1

    aget v4, v4, v5

    .line 184
    .restart local v4    # "bitrate":I
    if-ne v12, v11, :cond_81

    const/16 v5, 0x240

    goto :goto_83

    :cond_81
    const/16 v5, 0x480

    :goto_83
    move v6, v5

    .line 185
    .restart local v6    # "samplesPerFrame":I
    if-ne v12, v11, :cond_89

    const/16 v5, 0x48

    goto :goto_8b

    :cond_89
    const/16 v5, 0x90

    :goto_8b
    mul-int v5, v5, v4

    div-int/2addr v5, v2

    add-int/2addr v5, v15

    move/from16 v16, v5

    move/from16 v17, v6

    .line 192
    .end local v6    # "samplesPerFrame":I
    .local v16, "frameSize":I
    .local v17, "samplesPerFrame":I
    :goto_93
    mul-int/lit8 v5, v16, 0x8

    mul-int v5, v5, v2

    div-int v18, v5, v17

    .line 193
    .end local v4    # "bitrate":I
    .local v18, "bitrate":I
    sget-object v4, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->MIME_TYPE_BY_LAYER:[Ljava/lang/String;

    rsub-int/lit8 v5, v12, 0x3

    aget-object v19, v4, v5

    .line 194
    .local v19, "mimeType":Ljava/lang/String;
    shr-int/lit8 v4, p0, 0x6

    and-int/2addr v4, v1

    if-ne v4, v1, :cond_a6

    const/4 v8, 0x1

    goto :goto_a7

    :cond_a6
    const/4 v8, 0x2

    .line 195
    .local v8, "channels":I
    :goto_a7
    move-object/from16 v3, p1

    move v4, v0

    move-object/from16 v5, v19

    move/from16 v6, v16

    move v7, v2

    move/from16 v9, v18

    move/from16 v10, v17

    invoke-direct/range {v3 .. v10}, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->setValues(ILjava/lang/String;IIIII)V

    .line 196
    return v11

    .line 148
    .end local v2    # "sampleRate":I
    .end local v8    # "channels":I
    .end local v14    # "samplingRateIndex":I
    .end local v15    # "padding":I
    .end local v16    # "frameSize":I
    .end local v17    # "samplesPerFrame":I
    .end local v18    # "bitrate":I
    .end local v19    # "mimeType":Ljava/lang/String;
    :cond_b7
    :goto_b7
    return v2
.end method

.method private setValues(ILjava/lang/String;IIIII)V
    .registers 8
    .param p1, "version"    # I
    .param p2, "mimeType"    # Ljava/lang/String;
    .param p3, "frameSize"    # I
    .param p4, "sampleRate"    # I
    .param p5, "channels"    # I
    .param p6, "bitrate"    # I
    .param p7, "samplesPerFrame"    # I

    .line 222
    iput p1, p0, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->version:I

    .line 223
    iput-object p2, p0, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->mimeType:Ljava/lang/String;

    .line 224
    iput p3, p0, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->frameSize:I

    .line 225
    iput p4, p0, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->sampleRate:I

    .line 226
    iput p5, p0, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->channels:I

    .line 227
    iput p6, p0, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->bitrate:I

    .line 228
    iput p7, p0, Lcom/google/android/exoplayer2/extractor/MpegAudioHeader;->samplesPerFrame:I

    .line 229
    return-void
.end method