Commit 42f5e53d by krocard Committed by Ian Baker

Add an TrackSelector base interface

This will allow Player to move in common without
trackSelector and all its many dependency.

Currently all users of `getTrackSelector` are
downcasting it in `DefaultTrackSelector`, this change
thus does not break them.

Track selection API is intended to be reworked, methods
will be added to the currently empty interface.

#player-to-common

PiperOrigin-RevId: 346159765
parent b5f0379b
...@@ -468,6 +468,10 @@ public interface ExoPlayer extends Player { ...@@ -468,6 +468,10 @@ public interface ExoPlayer extends Player {
} }
} }
@Override
@Nullable
TrackSelector getTrackSelector();
/** Returns the {@link Looper} associated with the playback thread. */ /** Returns the {@link Looper} associated with the playback thread. */
Looper getPlaybackLooper(); Looper getPlaybackLooper();
......
...@@ -34,7 +34,7 @@ import com.google.android.exoplayer2.source.TrackGroupArray; ...@@ -34,7 +34,7 @@ import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.text.Cue; import com.google.android.exoplayer2.text.Cue;
import com.google.android.exoplayer2.text.TextOutput; import com.google.android.exoplayer2.text.TextOutput;
import com.google.android.exoplayer2.trackselection.TrackSelectionArray; 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.MutableFlags;
import com.google.android.exoplayer2.util.Util; import com.google.android.exoplayer2.util.Util;
import com.google.android.exoplayer2.video.VideoDecoderOutputBufferRenderer; import com.google.android.exoplayer2.video.VideoDecoderOutputBufferRenderer;
...@@ -1441,7 +1441,7 @@ public interface Player { ...@@ -1441,7 +1441,7 @@ public interface Player {
* Returns the track selector that this player uses, or null if track selection is not supported. * Returns the track selector that this player uses, or null if track selection is not supported.
*/ */
@Nullable @Nullable
TrackSelector getTrackSelector(); TrackSelectorInterface getTrackSelector();
/** Returns the available track groups. */ /** Returns the available track groups. */
TrackGroupArray getCurrentTrackGroups(); TrackGroupArray getCurrentTrackGroups();
......
...@@ -83,7 +83,7 @@ import com.google.android.exoplayer2.util.Assertions; ...@@ -83,7 +83,7 @@ import com.google.android.exoplayer2.util.Assertions;
* thread. The track selector may call {@link InvalidationListener#onTrackSelectionsInvalidated()} * thread. The track selector may call {@link InvalidationListener#onTrackSelectionsInvalidated()}
* from any thread. * 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. * Notified when selections previously made by a {@link TrackSelector} are no longer valid.
......
/*
* 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.
*
* <p>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 {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment