mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-27 01:22:33 -06:00
586 lines
33 KiB
Java
586 lines
33 KiB
Java
package com.google.android.exoplayer2.trackselection;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.Point;
|
|
import android.os.Bundle;
|
|
import android.os.Looper;
|
|
import android.view.accessibility.CaptioningManager;
|
|
import com.google.android.exoplayer2.Bundleable;
|
|
import com.google.android.exoplayer2.source.TrackGroup;
|
|
import com.google.android.exoplayer2.util.Assertions;
|
|
import com.google.android.exoplayer2.util.BundleableUtil;
|
|
import com.google.android.exoplayer2.util.Util;
|
|
import com.google.common.base.MoreObjects;
|
|
import com.google.common.collect.ImmutableList;
|
|
import com.google.common.collect.ImmutableMap;
|
|
import com.google.common.collect.ImmutableSet;
|
|
import com.google.common.primitives.Ints;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.HashMap;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
import java.util.Locale;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class TrackSelectionParameters implements Bundleable {
|
|
|
|
@Deprecated
|
|
public static final Bundleable.Creator<TrackSelectionParameters> CREATOR;
|
|
|
|
@Deprecated
|
|
public static final TrackSelectionParameters DEFAULT;
|
|
public static final TrackSelectionParameters DEFAULT_WITHOUT_CONTEXT;
|
|
protected static final int FIELD_CUSTOM_ID_BASE = 1000;
|
|
private static final String FIELD_DISABLED_TRACK_TYPE;
|
|
private static final String FIELD_FORCE_HIGHEST_SUPPORTED_BITRATE;
|
|
private static final String FIELD_FORCE_LOWEST_BITRATE;
|
|
private static final String FIELD_IGNORED_TEXT_SELECTION_FLAGS;
|
|
private static final String FIELD_MAX_AUDIO_BITRATE;
|
|
private static final String FIELD_MAX_AUDIO_CHANNEL_COUNT;
|
|
private static final String FIELD_MAX_VIDEO_BITRATE;
|
|
private static final String FIELD_MAX_VIDEO_FRAMERATE;
|
|
private static final String FIELD_MAX_VIDEO_HEIGHT;
|
|
private static final String FIELD_MAX_VIDEO_WIDTH;
|
|
private static final String FIELD_MIN_VIDEO_BITRATE;
|
|
private static final String FIELD_MIN_VIDEO_FRAMERATE;
|
|
private static final String FIELD_MIN_VIDEO_HEIGHT;
|
|
private static final String FIELD_MIN_VIDEO_WIDTH;
|
|
private static final String FIELD_PREFERRED_AUDIO_LANGUAGES;
|
|
private static final String FIELD_PREFERRED_AUDIO_MIME_TYPES;
|
|
private static final String FIELD_PREFERRED_AUDIO_ROLE_FLAGS;
|
|
private static final String FIELD_PREFERRED_TEXT_LANGUAGES;
|
|
private static final String FIELD_PREFERRED_TEXT_ROLE_FLAGS;
|
|
private static final String FIELD_PREFERRED_VIDEO_MIMETYPES;
|
|
private static final String FIELD_PREFERRED_VIDEO_ROLE_FLAGS;
|
|
private static final String FIELD_SELECTION_OVERRIDES;
|
|
private static final String FIELD_SELECT_UNDETERMINED_TEXT_LANGUAGE;
|
|
private static final String FIELD_VIEWPORT_HEIGHT;
|
|
private static final String FIELD_VIEWPORT_ORIENTATION_MAY_CHANGE;
|
|
private static final String FIELD_VIEWPORT_WIDTH;
|
|
public final ImmutableSet<Integer> disabledTrackTypes;
|
|
public final boolean forceHighestSupportedBitrate;
|
|
public final boolean forceLowestBitrate;
|
|
public final int ignoredTextSelectionFlags;
|
|
public final int maxAudioBitrate;
|
|
public final int maxAudioChannelCount;
|
|
public final int maxVideoBitrate;
|
|
public final int maxVideoFrameRate;
|
|
public final int maxVideoHeight;
|
|
public final int maxVideoWidth;
|
|
public final int minVideoBitrate;
|
|
public final int minVideoFrameRate;
|
|
public final int minVideoHeight;
|
|
public final int minVideoWidth;
|
|
public final ImmutableMap<TrackGroup, TrackSelectionOverride> overrides;
|
|
public final ImmutableList<String> preferredAudioLanguages;
|
|
public final ImmutableList<String> preferredAudioMimeTypes;
|
|
public final int preferredAudioRoleFlags;
|
|
public final ImmutableList<String> preferredTextLanguages;
|
|
public final int preferredTextRoleFlags;
|
|
public final ImmutableList<String> preferredVideoMimeTypes;
|
|
public final int preferredVideoRoleFlags;
|
|
public final boolean selectUndeterminedTextLanguage;
|
|
public final int viewportHeight;
|
|
public final boolean viewportOrientationMayChange;
|
|
public final int viewportWidth;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public static class Builder {
|
|
private HashSet<Integer> disabledTrackTypes;
|
|
private boolean forceHighestSupportedBitrate;
|
|
private boolean forceLowestBitrate;
|
|
private int ignoredTextSelectionFlags;
|
|
private int maxAudioBitrate;
|
|
private int maxAudioChannelCount;
|
|
private int maxVideoBitrate;
|
|
private int maxVideoFrameRate;
|
|
private int maxVideoHeight;
|
|
private int maxVideoWidth;
|
|
private int minVideoBitrate;
|
|
private int minVideoFrameRate;
|
|
private int minVideoHeight;
|
|
private int minVideoWidth;
|
|
private HashMap<TrackGroup, TrackSelectionOverride> overrides;
|
|
private ImmutableList<String> preferredAudioLanguages;
|
|
private ImmutableList<String> preferredAudioMimeTypes;
|
|
private int preferredAudioRoleFlags;
|
|
private ImmutableList<String> preferredTextLanguages;
|
|
private int preferredTextRoleFlags;
|
|
private ImmutableList<String> preferredVideoMimeTypes;
|
|
private int preferredVideoRoleFlags;
|
|
private boolean selectUndeterminedTextLanguage;
|
|
private int viewportHeight;
|
|
private boolean viewportOrientationMayChange;
|
|
private int viewportWidth;
|
|
|
|
public Builder setForceHighestSupportedBitrate(boolean z) {
|
|
this.forceHighestSupportedBitrate = z;
|
|
return this;
|
|
}
|
|
|
|
public Builder setForceLowestBitrate(boolean z) {
|
|
this.forceLowestBitrate = z;
|
|
return this;
|
|
}
|
|
|
|
public Builder setIgnoredTextSelectionFlags(int i) {
|
|
this.ignoredTextSelectionFlags = i;
|
|
return this;
|
|
}
|
|
|
|
public Builder setMaxAudioBitrate(int i) {
|
|
this.maxAudioBitrate = i;
|
|
return this;
|
|
}
|
|
|
|
public Builder setMaxAudioChannelCount(int i) {
|
|
this.maxAudioChannelCount = i;
|
|
return this;
|
|
}
|
|
|
|
public Builder setMaxVideoBitrate(int i) {
|
|
this.maxVideoBitrate = i;
|
|
return this;
|
|
}
|
|
|
|
public Builder setMaxVideoFrameRate(int i) {
|
|
this.maxVideoFrameRate = i;
|
|
return this;
|
|
}
|
|
|
|
public Builder setMaxVideoSize(int i, int i2) {
|
|
this.maxVideoWidth = i;
|
|
this.maxVideoHeight = i2;
|
|
return this;
|
|
}
|
|
|
|
public Builder setMinVideoBitrate(int i) {
|
|
this.minVideoBitrate = i;
|
|
return this;
|
|
}
|
|
|
|
public Builder setMinVideoFrameRate(int i) {
|
|
this.minVideoFrameRate = i;
|
|
return this;
|
|
}
|
|
|
|
public Builder setMinVideoSize(int i, int i2) {
|
|
this.minVideoWidth = i;
|
|
this.minVideoHeight = i2;
|
|
return this;
|
|
}
|
|
|
|
public Builder setPreferredAudioRoleFlags(int i) {
|
|
this.preferredAudioRoleFlags = i;
|
|
return this;
|
|
}
|
|
|
|
public Builder setPreferredTextRoleFlags(int i) {
|
|
this.preferredTextRoleFlags = i;
|
|
return this;
|
|
}
|
|
|
|
public Builder setPreferredVideoRoleFlags(int i) {
|
|
this.preferredVideoRoleFlags = i;
|
|
return this;
|
|
}
|
|
|
|
public Builder setSelectUndeterminedTextLanguage(boolean z) {
|
|
this.selectUndeterminedTextLanguage = z;
|
|
return this;
|
|
}
|
|
|
|
public Builder setViewportSize(int i, int i2, boolean z) {
|
|
this.viewportWidth = i;
|
|
this.viewportHeight = i2;
|
|
this.viewportOrientationMayChange = z;
|
|
return this;
|
|
}
|
|
|
|
@Deprecated
|
|
public Builder() {
|
|
this.maxVideoWidth = Integer.MAX_VALUE;
|
|
this.maxVideoHeight = Integer.MAX_VALUE;
|
|
this.maxVideoFrameRate = Integer.MAX_VALUE;
|
|
this.maxVideoBitrate = Integer.MAX_VALUE;
|
|
this.viewportWidth = Integer.MAX_VALUE;
|
|
this.viewportHeight = Integer.MAX_VALUE;
|
|
this.viewportOrientationMayChange = true;
|
|
this.preferredVideoMimeTypes = ImmutableList.of();
|
|
this.preferredVideoRoleFlags = 0;
|
|
this.preferredAudioLanguages = ImmutableList.of();
|
|
this.preferredAudioRoleFlags = 0;
|
|
this.maxAudioChannelCount = Integer.MAX_VALUE;
|
|
this.maxAudioBitrate = Integer.MAX_VALUE;
|
|
this.preferredAudioMimeTypes = ImmutableList.of();
|
|
this.preferredTextLanguages = ImmutableList.of();
|
|
this.preferredTextRoleFlags = 0;
|
|
this.ignoredTextSelectionFlags = 0;
|
|
this.selectUndeterminedTextLanguage = false;
|
|
this.forceLowestBitrate = false;
|
|
this.forceHighestSupportedBitrate = false;
|
|
this.overrides = new HashMap<>();
|
|
this.disabledTrackTypes = new HashSet<>();
|
|
}
|
|
|
|
public Builder(Context context) {
|
|
this();
|
|
setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettings(context);
|
|
setViewportSizeToPhysicalDisplaySize(context, true);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
public Builder(TrackSelectionParameters trackSelectionParameters) {
|
|
init(trackSelectionParameters);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public Builder(Bundle bundle) {
|
|
ImmutableList fromBundleList;
|
|
this.maxVideoWidth = bundle.getInt(TrackSelectionParameters.FIELD_MAX_VIDEO_WIDTH, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.maxVideoWidth);
|
|
this.maxVideoHeight = bundle.getInt(TrackSelectionParameters.FIELD_MAX_VIDEO_HEIGHT, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.maxVideoHeight);
|
|
this.maxVideoFrameRate = bundle.getInt(TrackSelectionParameters.FIELD_MAX_VIDEO_FRAMERATE, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.maxVideoFrameRate);
|
|
this.maxVideoBitrate = bundle.getInt(TrackSelectionParameters.FIELD_MAX_VIDEO_BITRATE, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.maxVideoBitrate);
|
|
this.minVideoWidth = bundle.getInt(TrackSelectionParameters.FIELD_MIN_VIDEO_WIDTH, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.minVideoWidth);
|
|
this.minVideoHeight = bundle.getInt(TrackSelectionParameters.FIELD_MIN_VIDEO_HEIGHT, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.minVideoHeight);
|
|
this.minVideoFrameRate = bundle.getInt(TrackSelectionParameters.FIELD_MIN_VIDEO_FRAMERATE, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.minVideoFrameRate);
|
|
this.minVideoBitrate = bundle.getInt(TrackSelectionParameters.FIELD_MIN_VIDEO_BITRATE, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.minVideoBitrate);
|
|
this.viewportWidth = bundle.getInt(TrackSelectionParameters.FIELD_VIEWPORT_WIDTH, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.viewportWidth);
|
|
this.viewportHeight = bundle.getInt(TrackSelectionParameters.FIELD_VIEWPORT_HEIGHT, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.viewportHeight);
|
|
this.viewportOrientationMayChange = bundle.getBoolean(TrackSelectionParameters.FIELD_VIEWPORT_ORIENTATION_MAY_CHANGE, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.viewportOrientationMayChange);
|
|
this.preferredVideoMimeTypes = ImmutableList.copyOf((String[]) MoreObjects.firstNonNull(bundle.getStringArray(TrackSelectionParameters.FIELD_PREFERRED_VIDEO_MIMETYPES), new String[0]));
|
|
this.preferredVideoRoleFlags = bundle.getInt(TrackSelectionParameters.FIELD_PREFERRED_VIDEO_ROLE_FLAGS, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.preferredVideoRoleFlags);
|
|
this.preferredAudioLanguages = normalizeLanguageCodes((String[]) MoreObjects.firstNonNull(bundle.getStringArray(TrackSelectionParameters.FIELD_PREFERRED_AUDIO_LANGUAGES), new String[0]));
|
|
this.preferredAudioRoleFlags = bundle.getInt(TrackSelectionParameters.FIELD_PREFERRED_AUDIO_ROLE_FLAGS, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.preferredAudioRoleFlags);
|
|
this.maxAudioChannelCount = bundle.getInt(TrackSelectionParameters.FIELD_MAX_AUDIO_CHANNEL_COUNT, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.maxAudioChannelCount);
|
|
this.maxAudioBitrate = bundle.getInt(TrackSelectionParameters.FIELD_MAX_AUDIO_BITRATE, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.maxAudioBitrate);
|
|
this.preferredAudioMimeTypes = ImmutableList.copyOf((String[]) MoreObjects.firstNonNull(bundle.getStringArray(TrackSelectionParameters.FIELD_PREFERRED_AUDIO_MIME_TYPES), new String[0]));
|
|
this.preferredTextLanguages = normalizeLanguageCodes((String[]) MoreObjects.firstNonNull(bundle.getStringArray(TrackSelectionParameters.FIELD_PREFERRED_TEXT_LANGUAGES), new String[0]));
|
|
this.preferredTextRoleFlags = bundle.getInt(TrackSelectionParameters.FIELD_PREFERRED_TEXT_ROLE_FLAGS, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.preferredTextRoleFlags);
|
|
this.ignoredTextSelectionFlags = bundle.getInt(TrackSelectionParameters.FIELD_IGNORED_TEXT_SELECTION_FLAGS, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.ignoredTextSelectionFlags);
|
|
this.selectUndeterminedTextLanguage = bundle.getBoolean(TrackSelectionParameters.FIELD_SELECT_UNDETERMINED_TEXT_LANGUAGE, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.selectUndeterminedTextLanguage);
|
|
this.forceLowestBitrate = bundle.getBoolean(TrackSelectionParameters.FIELD_FORCE_LOWEST_BITRATE, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.forceLowestBitrate);
|
|
this.forceHighestSupportedBitrate = bundle.getBoolean(TrackSelectionParameters.FIELD_FORCE_HIGHEST_SUPPORTED_BITRATE, TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.forceHighestSupportedBitrate);
|
|
ArrayList parcelableArrayList = bundle.getParcelableArrayList(TrackSelectionParameters.FIELD_SELECTION_OVERRIDES);
|
|
if (parcelableArrayList == null) {
|
|
fromBundleList = ImmutableList.of();
|
|
} else {
|
|
fromBundleList = BundleableUtil.fromBundleList(TrackSelectionOverride.CREATOR, parcelableArrayList);
|
|
}
|
|
this.overrides = new HashMap<>();
|
|
for (int i = 0; i < fromBundleList.size(); i++) {
|
|
TrackSelectionOverride trackSelectionOverride = (TrackSelectionOverride) fromBundleList.get(i);
|
|
this.overrides.put(trackSelectionOverride.mediaTrackGroup, trackSelectionOverride);
|
|
}
|
|
int[] iArr = (int[]) MoreObjects.firstNonNull(bundle.getIntArray(TrackSelectionParameters.FIELD_DISABLED_TRACK_TYPE), new int[0]);
|
|
this.disabledTrackTypes = new HashSet<>();
|
|
for (int i2 : iArr) {
|
|
this.disabledTrackTypes.add(Integer.valueOf(i2));
|
|
}
|
|
}
|
|
|
|
@EnsuresNonNull({"preferredVideoMimeTypes", "preferredAudioLanguages", "preferredAudioMimeTypes", "preferredTextLanguages", "overrides", "disabledTrackTypes"})
|
|
private void init(TrackSelectionParameters trackSelectionParameters) {
|
|
this.maxVideoWidth = trackSelectionParameters.maxVideoWidth;
|
|
this.maxVideoHeight = trackSelectionParameters.maxVideoHeight;
|
|
this.maxVideoFrameRate = trackSelectionParameters.maxVideoFrameRate;
|
|
this.maxVideoBitrate = trackSelectionParameters.maxVideoBitrate;
|
|
this.minVideoWidth = trackSelectionParameters.minVideoWidth;
|
|
this.minVideoHeight = trackSelectionParameters.minVideoHeight;
|
|
this.minVideoFrameRate = trackSelectionParameters.minVideoFrameRate;
|
|
this.minVideoBitrate = trackSelectionParameters.minVideoBitrate;
|
|
this.viewportWidth = trackSelectionParameters.viewportWidth;
|
|
this.viewportHeight = trackSelectionParameters.viewportHeight;
|
|
this.viewportOrientationMayChange = trackSelectionParameters.viewportOrientationMayChange;
|
|
this.preferredVideoMimeTypes = trackSelectionParameters.preferredVideoMimeTypes;
|
|
this.preferredVideoRoleFlags = trackSelectionParameters.preferredVideoRoleFlags;
|
|
this.preferredAudioLanguages = trackSelectionParameters.preferredAudioLanguages;
|
|
this.preferredAudioRoleFlags = trackSelectionParameters.preferredAudioRoleFlags;
|
|
this.maxAudioChannelCount = trackSelectionParameters.maxAudioChannelCount;
|
|
this.maxAudioBitrate = trackSelectionParameters.maxAudioBitrate;
|
|
this.preferredAudioMimeTypes = trackSelectionParameters.preferredAudioMimeTypes;
|
|
this.preferredTextLanguages = trackSelectionParameters.preferredTextLanguages;
|
|
this.preferredTextRoleFlags = trackSelectionParameters.preferredTextRoleFlags;
|
|
this.ignoredTextSelectionFlags = trackSelectionParameters.ignoredTextSelectionFlags;
|
|
this.selectUndeterminedTextLanguage = trackSelectionParameters.selectUndeterminedTextLanguage;
|
|
this.forceLowestBitrate = trackSelectionParameters.forceLowestBitrate;
|
|
this.forceHighestSupportedBitrate = trackSelectionParameters.forceHighestSupportedBitrate;
|
|
this.disabledTrackTypes = new HashSet<>(trackSelectionParameters.disabledTrackTypes);
|
|
this.overrides = new HashMap<>(trackSelectionParameters.overrides);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
public Builder set(TrackSelectionParameters trackSelectionParameters) {
|
|
init(trackSelectionParameters);
|
|
return this;
|
|
}
|
|
|
|
public Builder setMaxVideoSizeSd() {
|
|
return setMaxVideoSize(1279, 719);
|
|
}
|
|
|
|
public Builder clearVideoSizeConstraints() {
|
|
return setMaxVideoSize(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
|
}
|
|
|
|
public Builder setViewportSizeToPhysicalDisplaySize(Context context, boolean z) {
|
|
Point currentDisplayModeSize = Util.getCurrentDisplayModeSize(context);
|
|
return setViewportSize(currentDisplayModeSize.x, currentDisplayModeSize.y, z);
|
|
}
|
|
|
|
public Builder clearViewportSizeConstraints() {
|
|
return setViewportSize(Integer.MAX_VALUE, Integer.MAX_VALUE, true);
|
|
}
|
|
|
|
public Builder setPreferredVideoMimeType(String str) {
|
|
return str == null ? setPreferredVideoMimeTypes(new String[0]) : setPreferredVideoMimeTypes(str);
|
|
}
|
|
|
|
public Builder setPreferredVideoMimeTypes(String... strArr) {
|
|
this.preferredVideoMimeTypes = ImmutableList.copyOf(strArr);
|
|
return this;
|
|
}
|
|
|
|
public Builder setPreferredAudioLanguage(String str) {
|
|
if (str == null) {
|
|
return setPreferredAudioLanguages(new String[0]);
|
|
}
|
|
return setPreferredAudioLanguages(str);
|
|
}
|
|
|
|
public Builder setPreferredAudioLanguages(String... strArr) {
|
|
this.preferredAudioLanguages = normalizeLanguageCodes(strArr);
|
|
return this;
|
|
}
|
|
|
|
public Builder setPreferredAudioMimeType(String str) {
|
|
return str == null ? setPreferredAudioMimeTypes(new String[0]) : setPreferredAudioMimeTypes(str);
|
|
}
|
|
|
|
public Builder setPreferredAudioMimeTypes(String... strArr) {
|
|
this.preferredAudioMimeTypes = ImmutableList.copyOf(strArr);
|
|
return this;
|
|
}
|
|
|
|
public Builder setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettings(Context context) {
|
|
if (Util.SDK_INT >= 19) {
|
|
setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettingsV19(context);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public Builder setPreferredTextLanguage(String str) {
|
|
if (str == null) {
|
|
return setPreferredTextLanguages(new String[0]);
|
|
}
|
|
return setPreferredTextLanguages(str);
|
|
}
|
|
|
|
public Builder setPreferredTextLanguages(String... strArr) {
|
|
this.preferredTextLanguages = normalizeLanguageCodes(strArr);
|
|
return this;
|
|
}
|
|
|
|
public Builder addOverride(TrackSelectionOverride trackSelectionOverride) {
|
|
this.overrides.put(trackSelectionOverride.mediaTrackGroup, trackSelectionOverride);
|
|
return this;
|
|
}
|
|
|
|
public Builder setOverrideForType(TrackSelectionOverride trackSelectionOverride) {
|
|
clearOverridesOfType(trackSelectionOverride.getType());
|
|
this.overrides.put(trackSelectionOverride.mediaTrackGroup, trackSelectionOverride);
|
|
return this;
|
|
}
|
|
|
|
public Builder clearOverride(TrackGroup trackGroup) {
|
|
this.overrides.remove(trackGroup);
|
|
return this;
|
|
}
|
|
|
|
public Builder clearOverridesOfType(int i) {
|
|
Iterator<TrackSelectionOverride> it = this.overrides.values().iterator();
|
|
while (it.hasNext()) {
|
|
if (it.next().getType() == i) {
|
|
it.remove();
|
|
}
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public Builder clearOverrides() {
|
|
this.overrides.clear();
|
|
return this;
|
|
}
|
|
|
|
@Deprecated
|
|
public Builder setDisabledTrackTypes(Set<Integer> set) {
|
|
this.disabledTrackTypes.clear();
|
|
this.disabledTrackTypes.addAll(set);
|
|
return this;
|
|
}
|
|
|
|
public Builder setTrackTypeDisabled(int i, boolean z) {
|
|
if (z) {
|
|
this.disabledTrackTypes.add(Integer.valueOf(i));
|
|
} else {
|
|
this.disabledTrackTypes.remove(Integer.valueOf(i));
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public TrackSelectionParameters build() {
|
|
return new TrackSelectionParameters(this);
|
|
}
|
|
|
|
private void setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettingsV19(Context context) {
|
|
CaptioningManager captioningManager;
|
|
if ((Util.SDK_INT >= 23 || Looper.myLooper() != null) && (captioningManager = (CaptioningManager) context.getSystemService("captioning")) != null && captioningManager.isEnabled()) {
|
|
this.preferredTextRoleFlags = 1088;
|
|
Locale locale = captioningManager.getLocale();
|
|
if (locale != null) {
|
|
this.preferredTextLanguages = ImmutableList.of(Util.getLocaleLanguageTag(locale));
|
|
}
|
|
}
|
|
}
|
|
|
|
private static ImmutableList<String> normalizeLanguageCodes(String[] strArr) {
|
|
ImmutableList.Builder builder = ImmutableList.builder();
|
|
for (String str : (String[]) Assertions.checkNotNull(strArr)) {
|
|
builder.add((ImmutableList.Builder) Util.normalizeLanguageCode((String) Assertions.checkNotNull(str)));
|
|
}
|
|
return builder.build();
|
|
}
|
|
}
|
|
|
|
static {
|
|
TrackSelectionParameters build = new Builder().build();
|
|
DEFAULT_WITHOUT_CONTEXT = build;
|
|
DEFAULT = build;
|
|
FIELD_PREFERRED_AUDIO_LANGUAGES = Util.intToStringMaxRadix(1);
|
|
FIELD_PREFERRED_AUDIO_ROLE_FLAGS = Util.intToStringMaxRadix(2);
|
|
FIELD_PREFERRED_TEXT_LANGUAGES = Util.intToStringMaxRadix(3);
|
|
FIELD_PREFERRED_TEXT_ROLE_FLAGS = Util.intToStringMaxRadix(4);
|
|
FIELD_SELECT_UNDETERMINED_TEXT_LANGUAGE = Util.intToStringMaxRadix(5);
|
|
FIELD_MAX_VIDEO_WIDTH = Util.intToStringMaxRadix(6);
|
|
FIELD_MAX_VIDEO_HEIGHT = Util.intToStringMaxRadix(7);
|
|
FIELD_MAX_VIDEO_FRAMERATE = Util.intToStringMaxRadix(8);
|
|
FIELD_MAX_VIDEO_BITRATE = Util.intToStringMaxRadix(9);
|
|
FIELD_MIN_VIDEO_WIDTH = Util.intToStringMaxRadix(10);
|
|
FIELD_MIN_VIDEO_HEIGHT = Util.intToStringMaxRadix(11);
|
|
FIELD_MIN_VIDEO_FRAMERATE = Util.intToStringMaxRadix(12);
|
|
FIELD_MIN_VIDEO_BITRATE = Util.intToStringMaxRadix(13);
|
|
FIELD_VIEWPORT_WIDTH = Util.intToStringMaxRadix(14);
|
|
FIELD_VIEWPORT_HEIGHT = Util.intToStringMaxRadix(15);
|
|
FIELD_VIEWPORT_ORIENTATION_MAY_CHANGE = Util.intToStringMaxRadix(16);
|
|
FIELD_PREFERRED_VIDEO_MIMETYPES = Util.intToStringMaxRadix(17);
|
|
FIELD_MAX_AUDIO_CHANNEL_COUNT = Util.intToStringMaxRadix(18);
|
|
FIELD_MAX_AUDIO_BITRATE = Util.intToStringMaxRadix(19);
|
|
FIELD_PREFERRED_AUDIO_MIME_TYPES = Util.intToStringMaxRadix(20);
|
|
FIELD_FORCE_LOWEST_BITRATE = Util.intToStringMaxRadix(21);
|
|
FIELD_FORCE_HIGHEST_SUPPORTED_BITRATE = Util.intToStringMaxRadix(22);
|
|
FIELD_SELECTION_OVERRIDES = Util.intToStringMaxRadix(23);
|
|
FIELD_DISABLED_TRACK_TYPE = Util.intToStringMaxRadix(24);
|
|
FIELD_PREFERRED_VIDEO_ROLE_FLAGS = Util.intToStringMaxRadix(25);
|
|
FIELD_IGNORED_TEXT_SELECTION_FLAGS = Util.intToStringMaxRadix(26);
|
|
CREATOR = new Bundleable.Creator() { // from class: com.google.android.exoplayer2.trackselection.TrackSelectionParameters$$ExternalSyntheticLambda0
|
|
@Override // com.google.android.exoplayer2.Bundleable.Creator
|
|
public final Bundleable fromBundle(Bundle bundle) {
|
|
return TrackSelectionParameters.fromBundle(bundle);
|
|
}
|
|
};
|
|
}
|
|
|
|
public static TrackSelectionParameters getDefaults(Context context) {
|
|
return new Builder(context).build();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
public TrackSelectionParameters(Builder builder) {
|
|
this.maxVideoWidth = builder.maxVideoWidth;
|
|
this.maxVideoHeight = builder.maxVideoHeight;
|
|
this.maxVideoFrameRate = builder.maxVideoFrameRate;
|
|
this.maxVideoBitrate = builder.maxVideoBitrate;
|
|
this.minVideoWidth = builder.minVideoWidth;
|
|
this.minVideoHeight = builder.minVideoHeight;
|
|
this.minVideoFrameRate = builder.minVideoFrameRate;
|
|
this.minVideoBitrate = builder.minVideoBitrate;
|
|
this.viewportWidth = builder.viewportWidth;
|
|
this.viewportHeight = builder.viewportHeight;
|
|
this.viewportOrientationMayChange = builder.viewportOrientationMayChange;
|
|
this.preferredVideoMimeTypes = builder.preferredVideoMimeTypes;
|
|
this.preferredVideoRoleFlags = builder.preferredVideoRoleFlags;
|
|
this.preferredAudioLanguages = builder.preferredAudioLanguages;
|
|
this.preferredAudioRoleFlags = builder.preferredAudioRoleFlags;
|
|
this.maxAudioChannelCount = builder.maxAudioChannelCount;
|
|
this.maxAudioBitrate = builder.maxAudioBitrate;
|
|
this.preferredAudioMimeTypes = builder.preferredAudioMimeTypes;
|
|
this.preferredTextLanguages = builder.preferredTextLanguages;
|
|
this.preferredTextRoleFlags = builder.preferredTextRoleFlags;
|
|
this.ignoredTextSelectionFlags = builder.ignoredTextSelectionFlags;
|
|
this.selectUndeterminedTextLanguage = builder.selectUndeterminedTextLanguage;
|
|
this.forceLowestBitrate = builder.forceLowestBitrate;
|
|
this.forceHighestSupportedBitrate = builder.forceHighestSupportedBitrate;
|
|
this.overrides = ImmutableMap.copyOf((Map) builder.overrides);
|
|
this.disabledTrackTypes = ImmutableSet.copyOf((Collection) builder.disabledTrackTypes);
|
|
}
|
|
|
|
public Builder buildUpon() {
|
|
return new Builder(this);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (obj == null || getClass() != obj.getClass()) {
|
|
return false;
|
|
}
|
|
TrackSelectionParameters trackSelectionParameters = (TrackSelectionParameters) obj;
|
|
return this.maxVideoWidth == trackSelectionParameters.maxVideoWidth && this.maxVideoHeight == trackSelectionParameters.maxVideoHeight && this.maxVideoFrameRate == trackSelectionParameters.maxVideoFrameRate && this.maxVideoBitrate == trackSelectionParameters.maxVideoBitrate && this.minVideoWidth == trackSelectionParameters.minVideoWidth && this.minVideoHeight == trackSelectionParameters.minVideoHeight && this.minVideoFrameRate == trackSelectionParameters.minVideoFrameRate && this.minVideoBitrate == trackSelectionParameters.minVideoBitrate && this.viewportOrientationMayChange == trackSelectionParameters.viewportOrientationMayChange && this.viewportWidth == trackSelectionParameters.viewportWidth && this.viewportHeight == trackSelectionParameters.viewportHeight && this.preferredVideoMimeTypes.equals(trackSelectionParameters.preferredVideoMimeTypes) && this.preferredVideoRoleFlags == trackSelectionParameters.preferredVideoRoleFlags && this.preferredAudioLanguages.equals(trackSelectionParameters.preferredAudioLanguages) && this.preferredAudioRoleFlags == trackSelectionParameters.preferredAudioRoleFlags && this.maxAudioChannelCount == trackSelectionParameters.maxAudioChannelCount && this.maxAudioBitrate == trackSelectionParameters.maxAudioBitrate && this.preferredAudioMimeTypes.equals(trackSelectionParameters.preferredAudioMimeTypes) && this.preferredTextLanguages.equals(trackSelectionParameters.preferredTextLanguages) && this.preferredTextRoleFlags == trackSelectionParameters.preferredTextRoleFlags && this.ignoredTextSelectionFlags == trackSelectionParameters.ignoredTextSelectionFlags && this.selectUndeterminedTextLanguage == trackSelectionParameters.selectUndeterminedTextLanguage && this.forceLowestBitrate == trackSelectionParameters.forceLowestBitrate && this.forceHighestSupportedBitrate == trackSelectionParameters.forceHighestSupportedBitrate && this.overrides.equals(trackSelectionParameters.overrides) && this.disabledTrackTypes.equals(trackSelectionParameters.disabledTrackTypes);
|
|
}
|
|
|
|
public int hashCode() {
|
|
return ((((((((((((((((((((((((((((((((((((((((((((((((((this.maxVideoWidth + 31) * 31) + this.maxVideoHeight) * 31) + this.maxVideoFrameRate) * 31) + this.maxVideoBitrate) * 31) + this.minVideoWidth) * 31) + this.minVideoHeight) * 31) + this.minVideoFrameRate) * 31) + this.minVideoBitrate) * 31) + (this.viewportOrientationMayChange ? 1 : 0)) * 31) + this.viewportWidth) * 31) + this.viewportHeight) * 31) + this.preferredVideoMimeTypes.hashCode()) * 31) + this.preferredVideoRoleFlags) * 31) + this.preferredAudioLanguages.hashCode()) * 31) + this.preferredAudioRoleFlags) * 31) + this.maxAudioChannelCount) * 31) + this.maxAudioBitrate) * 31) + this.preferredAudioMimeTypes.hashCode()) * 31) + this.preferredTextLanguages.hashCode()) * 31) + this.preferredTextRoleFlags) * 31) + this.ignoredTextSelectionFlags) * 31) + (this.selectUndeterminedTextLanguage ? 1 : 0)) * 31) + (this.forceLowestBitrate ? 1 : 0)) * 31) + (this.forceHighestSupportedBitrate ? 1 : 0)) * 31) + this.overrides.hashCode()) * 31) + this.disabledTrackTypes.hashCode();
|
|
}
|
|
|
|
@Override // com.google.android.exoplayer2.Bundleable
|
|
public Bundle toBundle() {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putInt(FIELD_MAX_VIDEO_WIDTH, this.maxVideoWidth);
|
|
bundle.putInt(FIELD_MAX_VIDEO_HEIGHT, this.maxVideoHeight);
|
|
bundle.putInt(FIELD_MAX_VIDEO_FRAMERATE, this.maxVideoFrameRate);
|
|
bundle.putInt(FIELD_MAX_VIDEO_BITRATE, this.maxVideoBitrate);
|
|
bundle.putInt(FIELD_MIN_VIDEO_WIDTH, this.minVideoWidth);
|
|
bundle.putInt(FIELD_MIN_VIDEO_HEIGHT, this.minVideoHeight);
|
|
bundle.putInt(FIELD_MIN_VIDEO_FRAMERATE, this.minVideoFrameRate);
|
|
bundle.putInt(FIELD_MIN_VIDEO_BITRATE, this.minVideoBitrate);
|
|
bundle.putInt(FIELD_VIEWPORT_WIDTH, this.viewportWidth);
|
|
bundle.putInt(FIELD_VIEWPORT_HEIGHT, this.viewportHeight);
|
|
bundle.putBoolean(FIELD_VIEWPORT_ORIENTATION_MAY_CHANGE, this.viewportOrientationMayChange);
|
|
bundle.putStringArray(FIELD_PREFERRED_VIDEO_MIMETYPES, (String[]) this.preferredVideoMimeTypes.toArray(new String[0]));
|
|
bundle.putInt(FIELD_PREFERRED_VIDEO_ROLE_FLAGS, this.preferredVideoRoleFlags);
|
|
bundle.putStringArray(FIELD_PREFERRED_AUDIO_LANGUAGES, (String[]) this.preferredAudioLanguages.toArray(new String[0]));
|
|
bundle.putInt(FIELD_PREFERRED_AUDIO_ROLE_FLAGS, this.preferredAudioRoleFlags);
|
|
bundle.putInt(FIELD_MAX_AUDIO_CHANNEL_COUNT, this.maxAudioChannelCount);
|
|
bundle.putInt(FIELD_MAX_AUDIO_BITRATE, this.maxAudioBitrate);
|
|
bundle.putStringArray(FIELD_PREFERRED_AUDIO_MIME_TYPES, (String[]) this.preferredAudioMimeTypes.toArray(new String[0]));
|
|
bundle.putStringArray(FIELD_PREFERRED_TEXT_LANGUAGES, (String[]) this.preferredTextLanguages.toArray(new String[0]));
|
|
bundle.putInt(FIELD_PREFERRED_TEXT_ROLE_FLAGS, this.preferredTextRoleFlags);
|
|
bundle.putInt(FIELD_IGNORED_TEXT_SELECTION_FLAGS, this.ignoredTextSelectionFlags);
|
|
bundle.putBoolean(FIELD_SELECT_UNDETERMINED_TEXT_LANGUAGE, this.selectUndeterminedTextLanguage);
|
|
bundle.putBoolean(FIELD_FORCE_LOWEST_BITRATE, this.forceLowestBitrate);
|
|
bundle.putBoolean(FIELD_FORCE_HIGHEST_SUPPORTED_BITRATE, this.forceHighestSupportedBitrate);
|
|
bundle.putParcelableArrayList(FIELD_SELECTION_OVERRIDES, BundleableUtil.toBundleArrayList(this.overrides.values()));
|
|
bundle.putIntArray(FIELD_DISABLED_TRACK_TYPE, Ints.toArray(this.disabledTrackTypes));
|
|
return bundle;
|
|
}
|
|
|
|
public static TrackSelectionParameters fromBundle(Bundle bundle) {
|
|
return new Builder(bundle).build();
|
|
}
|
|
}
|