public abstract class MappingTrackSelector extends TrackSelector
TrackSelectors that first establish a mapping between TrackGroups
and renderers, and then from that mapping create a TrackSelection for each renderer.| Modifier and Type | Class and Description |
|---|---|
static class |
MappingTrackSelector.MappedTrackInfo
Provides track information for each renderer.
|
static class |
MappingTrackSelector.SelectionOverride
A track selection override.
|
TrackSelector.InvalidationListener| Constructor and Description |
|---|
MappingTrackSelector() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearSelectionOverride(int rendererIndex,
TrackGroupArray groups)
Clears a track selection override for the specified renderer and
TrackGroupArray. |
void |
clearSelectionOverrides()
Clears all track selection overrides.
|
void |
clearSelectionOverrides(int rendererIndex)
Clears all track selection override for the specified renderer.
|
MappingTrackSelector.MappedTrackInfo |
getCurrentMappedTrackInfo()
Returns the mapping information associated with the current track selections, or null if no
selection is currently active.
|
boolean |
getRendererDisabled(int rendererIndex)
Returns whether the renderer is disabled.
|
MappingTrackSelector.SelectionOverride |
getSelectionOverride(int rendererIndex,
TrackGroupArray groups)
Returns the override for the specified renderer and
TrackGroupArray. |
boolean |
hasSelectionOverride(int rendererIndex,
TrackGroupArray groups)
Returns whether there is an override for the specified renderer and
TrackGroupArray. |
void |
onSelectionActivated(java.lang.Object info)
Called when a
TrackSelectorResult previously generated by
TrackSelector.selectTracks(RendererCapabilities[], TrackGroupArray) is activated. |
TrackSelectorResult |
selectTracks(RendererCapabilities[] rendererCapabilities,
TrackGroupArray trackGroups)
Performs a track selection for renderers.
|
protected abstract TrackSelection[] |
selectTracks(RendererCapabilities[] rendererCapabilities,
TrackGroupArray[] rendererTrackGroupArrays,
int[][][] rendererFormatSupports)
Given an array of renderers and a set of
TrackGroups mapped to each of them, provides a
TrackSelection per renderer. |
void |
setRendererDisabled(int rendererIndex,
boolean disabled)
Sets whether the renderer at the specified index is disabled.
|
void |
setSelectionOverride(int rendererIndex,
TrackGroupArray groups,
MappingTrackSelector.SelectionOverride override)
Overrides the track selection for the renderer at a specified index.
|
void |
setTunnelingAudioSessionId(int tunnelingAudioSessionId)
Enables or disables tunneling.
|
init, invalidatepublic final MappingTrackSelector.MappedTrackInfo getCurrentMappedTrackInfo()
public final void setRendererDisabled(int rendererIndex,
boolean disabled)
rendererIndex - The renderer index.disabled - Whether the renderer is disabled.public final boolean getRendererDisabled(int rendererIndex)
rendererIndex - The renderer index.public final void setSelectionOverride(int rendererIndex,
TrackGroupArray groups,
MappingTrackSelector.SelectionOverride override)
When the TrackGroupArray available to the renderer at the specified index matches the
one provided, the override is applied. When the TrackGroupArray does not match, the
override has no effect. The override replaces any previous override for the renderer and the
provided TrackGroupArray.
Passing a null override will explicitly disable the renderer. To remove overrides use
clearSelectionOverride(int, TrackGroupArray), clearSelectionOverrides(int)
or clearSelectionOverrides().
rendererIndex - The renderer index.groups - The TrackGroupArray for which the override should be applied.override - The override.public final boolean hasSelectionOverride(int rendererIndex,
TrackGroupArray groups)
TrackGroupArray.rendererIndex - The renderer index.groups - The TrackGroupArray.public final MappingTrackSelector.SelectionOverride getSelectionOverride(int rendererIndex, TrackGroupArray groups)
TrackGroupArray.rendererIndex - The renderer index.groups - The TrackGroupArray.public final void clearSelectionOverride(int rendererIndex,
TrackGroupArray groups)
TrackGroupArray.rendererIndex - The renderer index.groups - The TrackGroupArray for which the override should be cleared.public final void clearSelectionOverrides(int rendererIndex)
rendererIndex - The renderer index.public final void clearSelectionOverrides()
public void setTunnelingAudioSessionId(int tunnelingAudioSessionId)
C.generateAudioSessionIdV21(Context). To disable tunneling pass
C.AUDIO_SESSION_ID_UNSET. Tunneling will only be activated if it's both enabled and
supported by the audio and video renderers for the selected tracks.tunnelingAudioSessionId - The audio session id to use when tunneling, or
C.AUDIO_SESSION_ID_UNSET to disable tunneling.public final TrackSelectorResult selectTracks(RendererCapabilities[] rendererCapabilities, TrackGroupArray trackGroups) throws ExoPlaybackException
TrackSelectorselectTracks in class TrackSelectorrendererCapabilities - The RendererCapabilities of the renderers for which tracks
are to be selected.trackGroups - The available track groups.TrackSelectorResult describing the track selections.ExoPlaybackException - If an error occurs selecting tracks.public final void onSelectionActivated(java.lang.Object info)
TrackSelectorTrackSelectorResult previously generated by
TrackSelector.selectTracks(RendererCapabilities[], TrackGroupArray) is activated.onSelectionActivated in class TrackSelectorinfo - The value of TrackSelectorResult.info in the activated result.protected abstract TrackSelection[] selectTracks(RendererCapabilities[] rendererCapabilities, TrackGroupArray[] rendererTrackGroupArrays, int[][][] rendererFormatSupports) throws ExoPlaybackException
TrackGroups mapped to each of them, provides a
TrackSelection per renderer.rendererCapabilities - The RendererCapabilities of the renderers for which
TrackSelections are to be generated.rendererTrackGroupArrays - An array of TrackGroupArrays where each entry
corresponds to the renderer of equal index in renderers.rendererFormatSupports - Maps every available track to a specific level of support as
defined by the renderer FORMAT_* constants.ExoPlaybackException - If an error occurs while selecting the tracks.