diff --git a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java index f8e04d3d62..d2823d9505 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java @@ -468,6 +468,10 @@ public interface ExoPlayer extends Player { } } + @Override + @Nullable + TrackSelector getTrackSelector(); + /** Returns the {@link Looper} associated with the playback thread. */ Looper getPlaybackLooper(); diff --git a/library/core/src/main/java/com/google/android/exoplayer2/Player.java b/library/core/src/main/java/com/google/android/exoplayer2/Player.java index f9e0f2c025..36d64ec07e 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/Player.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/Player.java @@ -34,7 +34,7 @@ import com.google.android.exoplayer2.source.TrackGroupArray; import com.google.android.exoplayer2.text.Cue; import com.google.android.exoplayer2.text.TextOutput; import com.google.android.exoplayer2.trackselection.TrackSelectionArray; -import com.google.android.exoplayer2.trackselection.TrackSelector; +import com.google.android.exoplayer2.trackselection.TrackSelectorInterface; import com.google.android.exoplayer2.util.MutableFlags; import com.google.android.exoplayer2.util.Util; import com.google.android.exoplayer2.video.VideoDecoderOutputBufferRenderer; @@ -1441,7 +1441,7 @@ public interface Player { * Returns the track selector that this player uses, or null if track selection is not supported. */ @Nullable - TrackSelector getTrackSelector(); + TrackSelectorInterface getTrackSelector(); /** Returns the available track groups. */ TrackGroupArray getCurrentTrackGroups(); diff --git a/library/core/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelector.java b/library/core/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelector.java index 59c5d5447b..f3d59d537e 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelector.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelector.java @@ -83,7 +83,7 @@ import com.google.android.exoplayer2.util.Assertions; * thread. The track selector may call {@link InvalidationListener#onTrackSelectionsInvalidated()} * from any thread. */ -public abstract class TrackSelector { +public abstract class TrackSelector implements TrackSelectorInterface { /** * Notified when selections previously made by a {@link TrackSelector} are no longer valid. diff --git a/library/core/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelectorInterface.java b/library/core/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelectorInterface.java new file mode 100644 index 0000000000..93ea7ca6fd --- /dev/null +++ b/library/core/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelectorInterface.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.android.exoplayer2.trackselection; + +import com.google.android.exoplayer2.Player; + +/** + * The component of a {@link Player} responsible for selecting tracks to be played. + * + *
No Player agnostic track selection is currently supported. Clients should downcast to the + * implementation's track selection. + */ +// TODO(b/172315872) Define an interface for track selection. +public interface TrackSelectorInterface {}