.class public final Lcom/google/android/exoplayer2/text/webvtt/WebvttParserUtil; .super Ljava/lang/Object; .source "WebvttParserUtil.java" # static fields .field private static final COMMENT:Ljava/util/regex/Pattern; .field private static final HEADER:Ljava/util/regex/Pattern; # direct methods .method public static constructor ()V .locals 1 const-string v0, "^NOTE(( |\t).*)?$" .line 1 invoke-static {v0}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern; move-result-object v0 sput-object v0, Lcom/google/android/exoplayer2/text/webvtt/WebvttParserUtil;->COMMENT:Ljava/util/regex/Pattern; const-string v0, "^\ufeff?WEBVTT(( |\t).*)?$" .line 2 invoke-static {v0}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern; move-result-object v0 sput-object v0, Lcom/google/android/exoplayer2/text/webvtt/WebvttParserUtil;->HEADER:Ljava/util/regex/Pattern; return-void .end method .method private constructor ()V .locals 0 .line 1 invoke-direct {p0}, Ljava/lang/Object;->()V return-void .end method .method public static findNextCueHeader(Lcom/google/android/exoplayer2/util/ParsableByteArray;)Ljava/util/regex/Matcher; .locals 2 .line 1 :cond_0 invoke-virtual {p0}, Lcom/google/android/exoplayer2/util/ParsableByteArray;->readLine()Ljava/lang/String; move-result-object v0 if-eqz v0, :cond_2 .line 2 sget-object v1, Lcom/google/android/exoplayer2/text/webvtt/WebvttParserUtil;->COMMENT:Ljava/util/regex/Pattern; invoke-virtual {v1, v0}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher; move-result-object v1 invoke-virtual {v1}, Ljava/util/regex/Matcher;->matches()Z move-result v1 if-eqz v1, :cond_1 .line 3 :goto_0 invoke-virtual {p0}, Lcom/google/android/exoplayer2/util/ParsableByteArray;->readLine()Ljava/lang/String; move-result-object v0 if-eqz v0, :cond_0 invoke-virtual {v0}, Ljava/lang/String;->isEmpty()Z move-result v0 if-nez v0, :cond_0 goto :goto_0 .line 4 :cond_1 sget-object v1, Lcom/google/android/exoplayer2/text/webvtt/WebvttCueParser;->CUE_HEADER_PATTERN:Ljava/util/regex/Pattern; invoke-virtual {v1, v0}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher; move-result-object v0 .line 5 invoke-virtual {v0}, Ljava/util/regex/Matcher;->matches()Z move-result v1 if-eqz v1, :cond_0 return-object v0 :cond_2 const/4 p0, 0x0 return-object p0 .end method .method public static parsePercentage(Ljava/lang/String;)F .locals 2 .annotation system Ldalvik/annotation/Throws; value = { Ljava/lang/NumberFormatException; } .end annotation const-string v0, "%" .line 1 invoke-virtual {p0, v0}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z move-result v0 if-eqz v0, :cond_0 const/4 v0, 0x0 .line 2 invoke-virtual {p0}, Ljava/lang/String;->length()I move-result v1 add-int/lit8 v1, v1, -0x1 invoke-virtual {p0, v0, v1}, Ljava/lang/String;->substring(II)Ljava/lang/String; move-result-object p0 invoke-static {p0}, Ljava/lang/Float;->parseFloat(Ljava/lang/String;)F move-result p0 const/high16 v0, 0x42c80000 # 100.0f div-float/2addr p0, v0 return p0 .line 3 :cond_0 new-instance p0, Ljava/lang/NumberFormatException; const-string v0, "Percentages must end with %" invoke-direct {p0, v0}, Ljava/lang/NumberFormatException;->(Ljava/lang/String;)V throw p0 .end method .method public static parseTimestampUs(Ljava/lang/String;)J .locals 8 .annotation system Ldalvik/annotation/Throws; value = { Ljava/lang/NumberFormatException; } .end annotation const-string v0, "\\." const/4 v1, 0x2 .line 1 invoke-virtual {p0, v0, v1}, Ljava/lang/String;->split(Ljava/lang/String;I)[Ljava/lang/String; move-result-object p0 const/4 v0, 0x0 .line 2 aget-object v1, p0, v0 const-string v2, ":" invoke-virtual {v1, v2}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String; move-result-object v1 .line 3 array-length v2, v1 const-wide/16 v3, 0x0 :goto_0 if-ge v0, v2, :cond_0 aget-object v5, v1, v0 const-wide/16 v6, 0x3c mul-long/2addr v3, v6 .line 4 invoke-static {v5}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J move-result-wide v5 add-long/2addr v3, v5 add-int/lit8 v0, v0, 0x1 goto :goto_0 :cond_0 const-wide/16 v0, 0x3e8 mul-long/2addr v3, v0 const/4 v2, 0x1 .line 5 aget-object p0, p0, v2 invoke-static {p0}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J move-result-wide v5 add-long/2addr v5, v3 mul-long/2addr v5, v0 return-wide v5 .end method .method public static validateWebvttHeaderLine(Lcom/google/android/exoplayer2/util/ParsableByteArray;)V .locals 2 .annotation system Ldalvik/annotation/Throws; value = { Lcom/google/android/exoplayer2/text/SubtitleDecoderException; } .end annotation .line 1 invoke-virtual {p0}, Lcom/google/android/exoplayer2/util/ParsableByteArray;->readLine()Ljava/lang/String; move-result-object p0 if-eqz p0, :cond_0 .line 2 sget-object v0, Lcom/google/android/exoplayer2/text/webvtt/WebvttParserUtil;->HEADER:Ljava/util/regex/Pattern; invoke-virtual {v0, p0}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher; move-result-object v0 invoke-virtual {v0}, Ljava/util/regex/Matcher;->matches()Z move-result v0 if-eqz v0, :cond_0 return-void .line 3 :cond_0 new-instance v0, Lcom/google/android/exoplayer2/text/SubtitleDecoderException; const-string v1, "Expected WEBVTT. Got " invoke-static {v1, p0}, Lc/g;->a(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; move-result-object p0 invoke-direct {v0, p0}, Lcom/google/android/exoplayer2/text/SubtitleDecoderException;->(Ljava/lang/String;)V throw v0 .end method