Rabbit-R1/android (non root)/java/sources/androidx/media3/common/PlaybackParameters.java
2024-05-21 17:08:36 -04:00

74 lines
2.7 KiB
Java

package androidx.media3.common;
import android.os.Bundle;
import androidx.media3.common.Bundleable;
import androidx.media3.common.util.Assertions;
import androidx.media3.common.util.Util;
/* loaded from: classes2.dex */
public final class PlaybackParameters implements Bundleable {
public final float pitch;
private final int scaledUsPerMs;
public final float speed;
public static final PlaybackParameters DEFAULT = new PlaybackParameters(1.0f);
private static final String FIELD_SPEED = Util.intToStringMaxRadix(0);
private static final String FIELD_PITCH = Util.intToStringMaxRadix(1);
public static final Bundleable.Creator<PlaybackParameters> CREATOR = new Bundleable.Creator() { // from class: androidx.media3.common.PlaybackParameters$$ExternalSyntheticLambda0
@Override // androidx.media3.common.Bundleable.Creator
public final Bundleable fromBundle(Bundle bundle) {
return PlaybackParameters.lambda$static$0(bundle);
}
};
public long getMediaTimeUsForPlayoutTimeMs(long j) {
return j * this.scaledUsPerMs;
}
public PlaybackParameters(float f) {
this(f, 1.0f);
}
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 PlaybackParameters withSpeed(float f) {
return new PlaybackParameters(f, this.pitch);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
PlaybackParameters playbackParameters = (PlaybackParameters) obj;
return this.speed == playbackParameters.speed && this.pitch == playbackParameters.pitch;
}
public int hashCode() {
return ((527 + Float.floatToRawIntBits(this.speed)) * 31) + Float.floatToRawIntBits(this.pitch);
}
public String toString() {
return Util.formatInvariant("PlaybackParameters(speed=%.2f, pitch=%.2f)", Float.valueOf(this.speed), Float.valueOf(this.pitch));
}
@Override // androidx.media3.common.Bundleable
public Bundle toBundle() {
Bundle bundle = new Bundle();
bundle.putFloat(FIELD_SPEED, this.speed);
bundle.putFloat(FIELD_PITCH, this.pitch);
return bundle;
}
/* JADX INFO: Access modifiers changed from: package-private */
public static /* synthetic */ PlaybackParameters lambda$static$0(Bundle bundle) {
return new PlaybackParameters(bundle.getFloat(FIELD_SPEED, 1.0f), bundle.getFloat(FIELD_PITCH, 1.0f));
}
}