Search in sources :

Example 1 with TrackSelectionOverride

use of androidx.media3.common.TrackSelectionOverrides.TrackSelectionOverride in project media by androidx.

the class TrackSelectionOverridesTest method newTrackSelectionOverride_with0Tracks_selectsAllSpecifiedTracks.

@Test
public void newTrackSelectionOverride_with0Tracks_selectsAllSpecifiedTracks() {
    TrackSelectionOverride trackSelectionOverride = new TrackSelectionOverride(newTrackGroupWithIds(1, 2), ImmutableList.of());
    assertThat(trackSelectionOverride.trackGroup).isEqualTo(newTrackGroupWithIds(1, 2));
    assertThat(trackSelectionOverride.trackIndices).isEmpty();
}
Also used : TrackSelectionOverride(androidx.media3.common.TrackSelectionOverrides.TrackSelectionOverride) Test(org.junit.Test)

Example 2 with TrackSelectionOverride

use of androidx.media3.common.TrackSelectionOverrides.TrackSelectionOverride in project media by androidx.

the class TrackSelectionOverridesTest method addOverride_onDifferentGroups_addsOverride.

@Test
public void addOverride_onDifferentGroups_addsOverride() {
    TrackSelectionOverride override1 = new TrackSelectionOverride(newTrackGroupWithIds(1));
    TrackSelectionOverride override2 = new TrackSelectionOverride(newTrackGroupWithIds(2));
    TrackSelectionOverrides trackSelectionOverrides = new TrackSelectionOverrides.Builder().addOverride(override1).addOverride(override2).build();
    assertThat(trackSelectionOverrides.asList()).containsExactly(override1, override2);
    assertThat(trackSelectionOverrides.getOverride(override1.trackGroup)).isEqualTo(override1);
    assertThat(trackSelectionOverrides.getOverride(override2.trackGroup)).isEqualTo(override2);
}
Also used : TrackSelectionOverride(androidx.media3.common.TrackSelectionOverrides.TrackSelectionOverride) Test(org.junit.Test)

Example 3 with TrackSelectionOverride

use of androidx.media3.common.TrackSelectionOverrides.TrackSelectionOverride in project media by androidx.

the class TrackSelectionOverridesTest method setOverrideForType_onSameType_replacesOverride.

@Test
public void setOverrideForType_onSameType_replacesOverride() {
    TrackSelectionOverride override1 = new TrackSelectionOverride(newTrackGroupWithIds(1));
    TrackSelectionOverride override2 = new TrackSelectionOverride(newTrackGroupWithIds(2));
    TrackSelectionOverrides trackSelectionOverrides = new TrackSelectionOverrides.Builder().setOverrideForType(override1).setOverrideForType(override2).build();
    assertThat(trackSelectionOverrides.asList()).containsExactly(override2);
    assertThat(trackSelectionOverrides.getOverride(override2.trackGroup)).isEqualTo(override2);
}
Also used : TrackSelectionOverride(androidx.media3.common.TrackSelectionOverrides.TrackSelectionOverride) Test(org.junit.Test)

Example 4 with TrackSelectionOverride

use of androidx.media3.common.TrackSelectionOverrides.TrackSelectionOverride in project media by androidx.

the class TrackSelectionOverridesTest method newTrackSelectionOverride_withJustTrackGroup_selectsAllTracks.

@Test
public void newTrackSelectionOverride_withJustTrackGroup_selectsAllTracks() {
    TrackSelectionOverride trackSelectionOverride = new TrackSelectionOverride(newTrackGroupWithIds(1, 2));
    assertThat(trackSelectionOverride.trackGroup).isEqualTo(newTrackGroupWithIds(1, 2));
    assertThat(trackSelectionOverride.trackIndices).containsExactly(0, 1).inOrder();
}
Also used : TrackSelectionOverride(androidx.media3.common.TrackSelectionOverrides.TrackSelectionOverride) Test(org.junit.Test)

Example 5 with TrackSelectionOverride

use of androidx.media3.common.TrackSelectionOverrides.TrackSelectionOverride in project media by androidx.

the class TrackSelectionOverridesTest method newTrackSelectionOverride_withTracks_selectsOnlySpecifiedTracks.

@Test
public void newTrackSelectionOverride_withTracks_selectsOnlySpecifiedTracks() {
    TrackSelectionOverride trackSelectionOverride = new TrackSelectionOverride(newTrackGroupWithIds(1, 2), ImmutableList.of(1));
    assertThat(trackSelectionOverride.trackGroup).isEqualTo(newTrackGroupWithIds(1, 2));
    assertThat(trackSelectionOverride.trackIndices).containsExactly(1);
}
Also used : TrackSelectionOverride(androidx.media3.common.TrackSelectionOverrides.TrackSelectionOverride) Test(org.junit.Test)

Aggregations

TrackSelectionOverride (androidx.media3.common.TrackSelectionOverrides.TrackSelectionOverride)16 Test (org.junit.Test)14 TrackGroupArray (androidx.media3.common.TrackGroupArray)5 TrackGroup (androidx.media3.common.TrackGroup)4 ParametersBuilder (androidx.media3.exoplayer.trackselection.DefaultTrackSelector.ParametersBuilder)4 SuppressLint (android.annotation.SuppressLint)3 Point (android.graphics.Point)3 Pair (android.util.Pair)2 Format (androidx.media3.common.Format)2 RendererCapabilities (androidx.media3.exoplayer.RendererCapabilities)2 SparseArray (android.util.SparseArray)1 Nullable (androidx.annotation.Nullable)1 TrackSelectionParameters (androidx.media3.common.TrackSelectionParameters)1 RendererConfiguration (androidx.media3.exoplayer.RendererConfiguration)1 NullableType (org.checkerframework.checker.nullness.compatqual.NullableType)1