package androidx.media3.exoplayer.audio; import android.media.AudioDeviceInfo; import androidx.media3.common.AudioAttributes; import androidx.media3.common.AuxEffectInfo; import androidx.media3.common.Format; import androidx.media3.common.PlaybackParameters; import androidx.media3.exoplayer.analytics.PlayerId; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.nio.ByteBuffer; /* loaded from: classes2.dex */ public interface AudioSink { public static final long CURRENT_POSITION_NOT_SET = Long.MIN_VALUE; public static final int SINK_FORMAT_SUPPORTED_DIRECTLY = 2; public static final int SINK_FORMAT_SUPPORTED_WITH_TRANSCODING = 1; public static final int SINK_FORMAT_UNSUPPORTED = 0; /* loaded from: classes2.dex */ public interface Listener { default void onAudioCapabilitiesChanged() { } default void onAudioSinkError(Exception exc) { } default void onOffloadBufferEmptying() { } default void onOffloadBufferFull() { } default void onPositionAdvancing(long j) { } void onPositionDiscontinuity(); void onSkipSilenceEnabledChanged(boolean z); void onUnderrun(int i, long j, long j2); } @Target({ElementType.TYPE_USE}) @Documented @Retention(RetentionPolicy.SOURCE) /* loaded from: classes2.dex */ public @interface SinkFormatSupport { } void configure(Format format, int i, int[] iArr) throws ConfigurationException; void disableTunneling(); void enableTunnelingV21(); void experimentalFlushWithoutAudioTrackRelease(); void flush(); AudioAttributes getAudioAttributes(); long getCurrentPositionUs(boolean z); int getFormatSupport(Format format); PlaybackParameters getPlaybackParameters(); boolean getSkipSilenceEnabled(); boolean handleBuffer(ByteBuffer byteBuffer, long j, int i) throws InitializationException, WriteException; void handleDiscontinuity(); boolean hasPendingData(); boolean isEnded(); void pause(); void play(); void playToEndOfStream() throws WriteException; default void release() { } void reset(); void setAudioAttributes(AudioAttributes audioAttributes); void setAudioSessionId(int i); void setAuxEffectInfo(AuxEffectInfo auxEffectInfo); void setListener(Listener listener); default void setOutputStreamOffsetUs(long j) { } void setPlaybackParameters(PlaybackParameters playbackParameters); default void setPlayerId(PlayerId playerId) { } default void setPreferredDevice(AudioDeviceInfo audioDeviceInfo) { } void setSkipSilenceEnabled(boolean z); void setVolume(float f); boolean supportsFormat(Format format); /* loaded from: classes2.dex */ public static final class ConfigurationException extends Exception { public final Format format; public ConfigurationException(Throwable th, Format format) { super(th); this.format = format; } public ConfigurationException(String str, Format format) { super(str); this.format = format; } } /* loaded from: classes2.dex */ public static final class InitializationException extends Exception { public final int audioTrackState; public final Format format; public final boolean isRecoverable; public InitializationException(int i, int i2, int i3, int i4, Format format, boolean z, Exception exc) { super("AudioTrack init failed " + i + " Config(" + i2 + ", " + i3 + ", " + i4 + ") " + format + (z ? " (recoverable)" : ""), exc); this.audioTrackState = i; this.isRecoverable = z; this.format = format; } } /* loaded from: classes2.dex */ public static final class WriteException extends Exception { public final int errorCode; public final Format format; public final boolean isRecoverable; public WriteException(int i, Format format, boolean z) { super("AudioTrack write failed: " + i); this.isRecoverable = z; this.errorCode = i; this.format = format; } } /* loaded from: classes2.dex */ public static final class UnexpectedDiscontinuityException extends Exception { public final long actualPresentationTimeUs; public final long expectedPresentationTimeUs; public UnexpectedDiscontinuityException(long j, long j2) { super("Unexpected audio track timestamp discontinuity: expected " + j2 + ", got " + j); this.actualPresentationTimeUs = j; this.expectedPresentationTimeUs = j2; } } }