Remove SingleSampleMediaSource.EventListener and constructors

They have been deprecated since r2.7.0

PiperOrigin-RevId: 351777769
This commit is contained in:
christosts 2021-01-14 13:01:46 +00:00 committed by Ian Baker
parent 4c3f580b0c
commit eb71d730cb
2 changed files with 8 additions and 115 deletions

View file

@ -3,7 +3,7 @@
### dev-v2 (not yet released)
* Core library:
* Remove long deprecated methods:
* Remove long deprecated symbols:
* `DefaultEventListener.onTimelineChanged(Timeline, Object)`. Use
`Player.EventListener.onTimelineChanged(Timeline, int)` instead.
* `DefaultLoadControl` constructors. Use `DefaultLoadControl.Builder`
@ -55,8 +55,11 @@
application is calling `SimpleExoPlayer.setVideoListener(null)`,
make sure to replace this call with
`SimpleExoPlayer.removeVideoListener(VideoListener)`.
* Remove deprecated interface `AdaptiveMediaSourceEventListener`. Use
`MediaSourceEventListener` instead.
* `SingleSampleMediaSource.EventListener` and constructors. Use
`MediaSourceEventListener` and `SingleSampleMediaSource.Factory`
instead.
* Remove deprecated interface `AdaptiveMediaSourceEventListener`. Use
`MediaSourceEventListener` instead.
* Add a `LivePlaybackSpeedControl` component to control the playback speed
during live playbacks. This allows the player to stay close to the
configured live offset. A configurable default implementation
@ -97,8 +100,8 @@
`MediaItem.playbackProperties.subtitles`
([#8430](https://github.com/google/ExoPlayer/issues/8430)).
* Remove `ExoPlaybackException.OutOfMemoryError`.
* Remove `setVideoDecoderOutputBufferRenderer` from Player API.
Clients should use `setOutputSurface` directly instead.
* Remove `setVideoDecoderOutputBufferRenderer` from Player API. Clients
should use `setOutputSurface` directly instead.
* Extractors:
* Populate codecs string for H.264/AVC in MP4, Matroska and FLV streams to
allow decoder capability checks based on codec profile/level

View file

@ -19,9 +19,7 @@ import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
import static com.google.android.exoplayer2.util.Util.castNonNull;
import android.net.Uri;
import android.os.Handler;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Timeline;
@ -31,7 +29,6 @@ import com.google.android.exoplayer2.upstream.DataSpec;
import com.google.android.exoplayer2.upstream.DefaultLoadErrorHandlingPolicy;
import com.google.android.exoplayer2.upstream.LoadErrorHandlingPolicy;
import com.google.android.exoplayer2.upstream.TransferListener;
import java.io.IOException;
import java.util.Collections;
/**
@ -39,24 +36,6 @@ import java.util.Collections;
*/
public final class SingleSampleMediaSource extends BaseMediaSource {
/**
* Listener of {@link SingleSampleMediaSource} events.
*
* @deprecated Use {@link MediaSourceEventListener}.
*/
@Deprecated
public interface EventListener {
/**
* Called when an error occurs loading media data.
*
* @param sourceId The id of the reporting {@link SingleSampleMediaSource}.
* @param e The cause of the failure.
*/
void onLoadError(int sourceId, IOException e);
}
/** Factory for {@link SingleSampleMediaSource}. */
public static final class Factory {
@ -195,67 +174,6 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
@Nullable private TransferListener transferListener;
/** @deprecated Use {@link Factory} instead. */
@Deprecated
@SuppressWarnings("deprecation")
public SingleSampleMediaSource(
Uri uri, DataSource.Factory dataSourceFactory, Format format, long durationUs) {
this(
uri,
dataSourceFactory,
format,
durationUs,
DefaultLoadErrorHandlingPolicy.DEFAULT_MIN_LOADABLE_RETRY_COUNT);
}
/** @deprecated Use {@link Factory} instead. */
@SuppressWarnings("deprecation")
@Deprecated
public SingleSampleMediaSource(
Uri uri,
DataSource.Factory dataSourceFactory,
Format format,
long durationUs,
int minLoadableRetryCount) {
this(
uri,
dataSourceFactory,
format,
durationUs,
minLoadableRetryCount,
/* eventHandler= */ null,
/* eventListener= */ null,
/* ignored */ C.INDEX_UNSET,
/* treatLoadErrorsAsEndOfStream= */ false);
}
/** @deprecated Use {@link Factory} instead. */
@SuppressWarnings("deprecation")
@Deprecated
public SingleSampleMediaSource(
Uri uri,
DataSource.Factory dataSourceFactory,
Format format,
long durationUs,
int minLoadableRetryCount,
@Nullable Handler eventHandler,
@Nullable EventListener eventListener,
int eventSourceId,
boolean treatLoadErrorsAsEndOfStream) {
this(
/* trackId= */ null,
new MediaItem.Subtitle(
uri, checkNotNull(format.sampleMimeType), format.language, format.selectionFlags),
dataSourceFactory,
durationUs,
new DefaultLoadErrorHandlingPolicy(minLoadableRetryCount),
treatLoadErrorsAsEndOfStream,
/* tag= */ null);
if (eventHandler != null && eventListener != null) {
addEventListener(eventHandler, new EventListenerWrapper(eventListener, eventSourceId));
}
}
private SingleSampleMediaSource(
@Nullable String trackId,
MediaItem.Subtitle subtitle,
@ -347,32 +265,4 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
protected void releaseSourceInternal() {
// Do nothing.
}
/**
* Wraps a deprecated {@link EventListener}, invoking its callback from the equivalent callback in
* {@link MediaSourceEventListener}.
*/
@Deprecated
@SuppressWarnings("deprecation")
private static final class EventListenerWrapper implements MediaSourceEventListener {
private final EventListener eventListener;
private final int eventSourceId;
public EventListenerWrapper(EventListener eventListener, int eventSourceId) {
this.eventListener = checkNotNull(eventListener);
this.eventSourceId = eventSourceId;
}
@Override
public void onLoadError(
int windowIndex,
@Nullable MediaPeriodId mediaPeriodId,
LoadEventInfo loadEventInfo,
MediaLoadData mediaLoadData,
IOException error,
boolean wasCanceled) {
eventListener.onLoadError(eventSourceId, error);
}
}
}