Search in sources :

Example 1 with Bundleable

use of com.google.android.exoplayer2.Bundleable in project ExoPlayer by google.

the class DefaultTrackSelectorTest method roundTripViaBundle_ofSelectionOverride_yieldsEqualInstance.

/**
 * Tests {@link SelectionOverride}'s {@link Bundleable} implementation.
 */
@Test
public void roundTripViaBundle_ofSelectionOverride_yieldsEqualInstance() {
    SelectionOverride selectionOverrideToBundle = new SelectionOverride(/* groupIndex= */
    1, /* tracks...= */
    2, 3);
    SelectionOverride selectionOverrideFromBundle = DefaultTrackSelector.SelectionOverride.CREATOR.fromBundle(selectionOverrideToBundle.toBundle());
    assertThat(selectionOverrideFromBundle).isEqualTo(selectionOverrideToBundle);
}
Also used : SelectionOverride(com.google.android.exoplayer2.trackselection.DefaultTrackSelector.SelectionOverride) TrackSelectionOverride(com.google.android.exoplayer2.trackselection.TrackSelectionOverrides.TrackSelectionOverride) Test(org.junit.Test)

Example 2 with Bundleable

use of com.google.android.exoplayer2.Bundleable in project ExoPlayer by google.

the class DefaultTrackSelectorTest method roundTripViaBundle_ofParameters_yieldsEqualInstance.

/**
 * Tests {@link Parameters} {@link Bundleable} implementation.
 */
@Test
public void roundTripViaBundle_ofParameters_yieldsEqualInstance() {
    Parameters parametersToBundle = buildParametersForEqualsTest();
    Parameters parametersFromBundle = Parameters.CREATOR.fromBundle(parametersToBundle.toBundle());
    assertThat(parametersFromBundle).isEqualTo(parametersToBundle);
}
Also used : Parameters(com.google.android.exoplayer2.trackselection.DefaultTrackSelector.Parameters) Test(org.junit.Test)

Example 3 with Bundleable

use of com.google.android.exoplayer2.Bundleable in project ExoPlayer by google.

the class BundleableUtil method toBundleList.

/**
 * Converts a list of {@link Bundleable} to a list {@link Bundle}.
 */
public static <T extends Bundleable> ImmutableList<Bundle> toBundleList(List<T> bundleableList) {
    ImmutableList.Builder<Bundle> builder = ImmutableList.builder();
    for (int i = 0; i < bundleableList.size(); i++) {
        Bundleable bundleable = bundleableList.get(i);
        builder.add(bundleable.toBundle());
    }
    return builder.build();
}
Also used : Bundleable(com.google.android.exoplayer2.Bundleable) ImmutableList(com.google.common.collect.ImmutableList) Bundle(android.os.Bundle)

Aggregations

Test (org.junit.Test)2 Bundle (android.os.Bundle)1 Bundleable (com.google.android.exoplayer2.Bundleable)1 Parameters (com.google.android.exoplayer2.trackselection.DefaultTrackSelector.Parameters)1 SelectionOverride (com.google.android.exoplayer2.trackselection.DefaultTrackSelector.SelectionOverride)1 TrackSelectionOverride (com.google.android.exoplayer2.trackselection.TrackSelectionOverrides.TrackSelectionOverride)1 ImmutableList (com.google.common.collect.ImmutableList)1