package tv.danmaku.ijk.media.player.ui.subtitleconverter.subtitleFile;

/* JADX INFO: loaded from: classes3.dex */
public class Time {
    protected int mseconds;

    public Time(String str, String str2) {
        if (str.equalsIgnoreCase("hh:mm:ss,ms")) {
            int i10 = Integer.parseInt(str2.substring(0, 2));
            int i11 = i10 * 3600000;
            this.mseconds = i11 + (Integer.parseInt(str2.substring(3, 5)) * 60000) + (Integer.parseInt(str2.substring(6, 8)) * 1000) + Integer.parseInt(str2.substring(9, 12));
            return;
        }
        if (str.equalsIgnoreCase("h:mm:ss.cs")) {
            String[] strArrSplit = str2.split(":");
            int i12 = Integer.parseInt(strArrSplit[0]);
            int i13 = i12 * 3600000;
            this.mseconds = i13 + (Integer.parseInt(strArrSplit[1]) * 60000) + (Integer.parseInt(strArrSplit[2].split("\\.")[0]) * 1000) + (Integer.parseInt(strArrSplit[2].split("\\.")[1]) * 10);
            return;
        }
        if (str.equalsIgnoreCase("h:m:s:f/fps")) {
            String[] strArrSplit2 = str2.split("/");
            float f10 = Float.parseFloat(strArrSplit2[1]);
            String[] strArrSplit3 = strArrSplit2[0].split(":");
            int i14 = Integer.parseInt(strArrSplit3[0]);
            int i15 = i14 * 3600000;
            this.mseconds = i15 + (Integer.parseInt(strArrSplit3[1]) * 60000) + (Integer.parseInt(strArrSplit3[2]) * 1000) + ((int) ((Integer.parseInt(strArrSplit3[3]) * 1000) / f10));
        }
    }

    public int getMseconds() {
        return this.mseconds;
    }

    public String getTime(String str) {
        StringBuilder sb = new StringBuilder();
        if (str.equalsIgnoreCase("hh:mm:ss,ms")) {
            String strValueOf = String.valueOf(this.mseconds / 3600000);
            if (strValueOf.length() == 1) {
                sb.append('0');
            }
            sb.append(strValueOf);
            sb.append(':');
            String strValueOf2 = String.valueOf((this.mseconds / 60000) % 60);
            if (strValueOf2.length() == 1) {
                sb.append('0');
            }
            sb.append(strValueOf2);
            sb.append(':');
            String strValueOf3 = String.valueOf((this.mseconds / 1000) % 60);
            if (strValueOf3.length() == 1) {
                sb.append('0');
            }
            sb.append(strValueOf3);
            sb.append(',');
            String strValueOf4 = String.valueOf(this.mseconds % 1000);
            if (strValueOf4.length() == 1) {
                sb.append("00");
            } else if (strValueOf4.length() == 2) {
                sb.append('0');
            }
            sb.append(strValueOf4);
        } else if (str.equalsIgnoreCase("h:mm:ss.cs")) {
            String strValueOf5 = String.valueOf(this.mseconds / 3600000);
            if (strValueOf5.length() == 1) {
                sb.append('0');
            }
            sb.append(strValueOf5);
            sb.append(':');
            String strValueOf6 = String.valueOf((this.mseconds / 60000) % 60);
            if (strValueOf6.length() == 1) {
                sb.append('0');
            }
            sb.append(strValueOf6);
            sb.append(':');
            String strValueOf7 = String.valueOf((this.mseconds / 1000) % 60);
            if (strValueOf7.length() == 1) {
                sb.append('0');
            }
            sb.append(strValueOf7);
            sb.append('.');
            String strValueOf8 = String.valueOf((this.mseconds / 10) % 100);
            if (strValueOf8.length() == 1) {
                sb.append('0');
            }
            sb.append(strValueOf8);
        } else if (str.startsWith("hhmmssff/")) {
            float f10 = Float.parseFloat(str.split("/")[1]);
            String strValueOf9 = String.valueOf(this.mseconds / 3600000);
            if (strValueOf9.length() == 1) {
                sb.append('0');
            }
            sb.append(strValueOf9);
            String strValueOf10 = String.valueOf((this.mseconds / 60000) % 60);
            if (strValueOf10.length() == 1) {
                sb.append('0');
            }
            sb.append(strValueOf10);
            String strValueOf11 = String.valueOf((this.mseconds / 1000) % 60);
            if (strValueOf11.length() == 1) {
                sb.append('0');
            }
            sb.append(strValueOf11);
            String strValueOf12 = String.valueOf(((this.mseconds % 1000) * ((int) f10)) / 1000);
            if (strValueOf12.length() == 1) {
                sb.append('0');
            }
            sb.append(strValueOf12);
        } else if (str.startsWith("h:m:s:f/")) {
            float f11 = Float.parseFloat(str.split("/")[1]);
            sb.append(String.valueOf(this.mseconds / 3600000));
            sb.append(':');
            sb.append(String.valueOf((this.mseconds / 60000) % 60));
            sb.append(':');
            sb.append(String.valueOf((this.mseconds / 1000) % 60));
            sb.append(':');
            sb.append(String.valueOf(((this.mseconds % 1000) * ((int) f11)) / 1000));
        } else if (str.startsWith("hh:mm:ss:ff/")) {
            float f12 = Float.parseFloat(str.split("/")[1]);
            String strValueOf13 = String.valueOf(this.mseconds / 3600000);
            if (strValueOf13.length() == 1) {
                sb.append('0');
            }
            sb.append(strValueOf13);
            sb.append(':');
            String strValueOf14 = String.valueOf((this.mseconds / 60000) % 60);
            if (strValueOf14.length() == 1) {
                sb.append('0');
            }
            sb.append(strValueOf14);
            sb.append(':');
            String strValueOf15 = String.valueOf((this.mseconds / 1000) % 60);
            if (strValueOf15.length() == 1) {
                sb.append('0');
            }
            sb.append(strValueOf15);
            sb.append(':');
            String strValueOf16 = String.valueOf(((this.mseconds % 1000) * ((int) f12)) / 1000);
            if (strValueOf16.length() == 1) {
                sb.append('0');
            }
            sb.append(strValueOf16);
        }
        return sb.toString();
    }

    public void setMseconds(int i10) {
        this.mseconds = i10;
    }

    public String toString() {
        return getTime("h:mm:ss.cs");
    }
}
