mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-12-06 12:29:32 +01:00
57 lines
1.8 KiB
Java
57 lines
1.8 KiB
Java
package com.google.android.exoplayer2;
|
|
|
|
import androidx.annotation.CheckResult;
|
|
import androidx.annotation.Nullable;
|
|
import com.google.android.exoplayer2.util.Assertions;
|
|
import com.google.android.exoplayer2.util.Util;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes7.dex */
|
|
public final class PlaybackParameters {
|
|
public static final PlaybackParameters DEFAULT = new PlaybackParameters(1.0f);
|
|
public final float pitch;
|
|
private final int scaledUsPerMs;
|
|
public final float speed;
|
|
|
|
public PlaybackParameters(float f, float f2) {
|
|
Assertions.checkArgument(f > 0.0f);
|
|
Assertions.checkArgument(f2 > 0.0f);
|
|
this.speed = f;
|
|
this.pitch = f2;
|
|
this.scaledUsPerMs = Math.round(f * 1000.0f);
|
|
}
|
|
|
|
public boolean equals(@Nullable Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (obj != null && PlaybackParameters.class == obj.getClass()) {
|
|
PlaybackParameters playbackParameters = (PlaybackParameters) obj;
|
|
if (this.speed == playbackParameters.speed && this.pitch == playbackParameters.pitch) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public long getMediaTimeUsForPlayoutTimeMs(long j) {
|
|
return j * this.scaledUsPerMs;
|
|
}
|
|
|
|
public int hashCode() {
|
|
return Float.floatToRawIntBits(this.pitch) + ((Float.floatToRawIntBits(this.speed) + 527) * 31);
|
|
}
|
|
|
|
public String toString() {
|
|
return Util.formatInvariant("PlaybackParameters(speed=%.2f, pitch=%.2f)", Float.valueOf(this.speed), Float.valueOf(this.pitch));
|
|
}
|
|
|
|
@CheckResult
|
|
public PlaybackParameters withSpeed(float f) {
|
|
return new PlaybackParameters(f, this.pitch);
|
|
}
|
|
|
|
public PlaybackParameters(float f) {
|
|
this(f, 1.0f);
|
|
}
|
|
}
|