Merge pull request #10047 from LuGO0:9432/added-filtering-for-forced-text-tracks
PiperOrigin-RevId: 439262085
This commit is contained in:
commit
ea61511a24
@ -41,6 +41,9 @@
|
||||
views to be used with other `Player` implementations, and removes the
|
||||
dependency from the UI module to the ExoPlayer module. This is a
|
||||
breaking change.
|
||||
* Don't show forced text tracks in the `PlayerView` track selector, and
|
||||
keep a suitable forced text track selected if "None" is selected
|
||||
([#9432](https://github.com/google/ExoPlayer/issues/9432)).
|
||||
* HLS:
|
||||
* Fallback to chunkful preparation if the playlist CODECS attribute
|
||||
does not contain the audio codec
|
||||
|
@ -96,6 +96,7 @@ public class TrackSelectionParameters implements Bundleable {
|
||||
// Text
|
||||
private ImmutableList<String> preferredTextLanguages;
|
||||
private @C.RoleFlags int preferredTextRoleFlags;
|
||||
private @C.SelectionFlags int ignoredTextSelectionFlags;
|
||||
private boolean selectUndeterminedTextLanguage;
|
||||
// General
|
||||
private boolean forceLowestBitrate;
|
||||
@ -129,6 +130,7 @@ public class TrackSelectionParameters implements Bundleable {
|
||||
// Text
|
||||
preferredTextLanguages = ImmutableList.of();
|
||||
preferredTextRoleFlags = 0;
|
||||
ignoredTextSelectionFlags = 0;
|
||||
selectUndeterminedTextLanguage = false;
|
||||
// General
|
||||
forceLowestBitrate = false;
|
||||
@ -229,6 +231,10 @@ public class TrackSelectionParameters implements Bundleable {
|
||||
bundle.getInt(
|
||||
keyForField(FIELD_PREFERRED_TEXT_ROLE_FLAGS),
|
||||
DEFAULT_WITHOUT_CONTEXT.preferredTextRoleFlags);
|
||||
ignoredTextSelectionFlags =
|
||||
bundle.getInt(
|
||||
keyForField(FIELD_IGNORED_TEXT_SELECTION_FLAGS),
|
||||
DEFAULT_WITHOUT_CONTEXT.ignoredTextSelectionFlags);
|
||||
selectUndeterminedTextLanguage =
|
||||
bundle.getBoolean(
|
||||
keyForField(FIELD_SELECT_UNDETERMINED_TEXT_LANGUAGE),
|
||||
@ -292,6 +298,7 @@ public class TrackSelectionParameters implements Bundleable {
|
||||
// Text
|
||||
preferredTextLanguages = parameters.preferredTextLanguages;
|
||||
preferredTextRoleFlags = parameters.preferredTextRoleFlags;
|
||||
ignoredTextSelectionFlags = parameters.ignoredTextSelectionFlags;
|
||||
selectUndeterminedTextLanguage = parameters.selectUndeterminedTextLanguage;
|
||||
// General
|
||||
forceLowestBitrate = parameters.forceLowestBitrate;
|
||||
@ -615,6 +622,18 @@ public class TrackSelectionParameters implements Bundleable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a bitmask of selection flags that are ignored for text track selections.
|
||||
*
|
||||
* @param ignoredTextSelectionFlags A bitmask of {@link C.SelectionFlags} that are ignored for
|
||||
* text track selections.
|
||||
* @return This builder.
|
||||
*/
|
||||
public Builder setIgnoredTextSelectionFlags(@C.SelectionFlags int ignoredTextSelectionFlags) {
|
||||
this.ignoredTextSelectionFlags = ignoredTextSelectionFlags;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether a text track with undetermined language should be selected if no track with
|
||||
* {@link #setPreferredTextLanguages(String...) a preferred language} is available, or if the
|
||||
@ -900,6 +919,11 @@ public class TrackSelectionParameters implements Bundleable {
|
||||
* is enabled.
|
||||
*/
|
||||
public final @C.RoleFlags int preferredTextRoleFlags;
|
||||
/**
|
||||
* Bitmask of selection flags that are ignored for text track selections. See {@link
|
||||
* C.SelectionFlags}. The default value is {@code 0} (i.e., no flags are ignored).
|
||||
*/
|
||||
public final @C.SelectionFlags int ignoredTextSelectionFlags;
|
||||
/**
|
||||
* Whether a text track with undetermined language should be selected if no track with {@link
|
||||
* #preferredTextLanguages} is available, or if {@link #preferredTextLanguages} is unset. The
|
||||
@ -953,6 +977,7 @@ public class TrackSelectionParameters implements Bundleable {
|
||||
// Text
|
||||
this.preferredTextLanguages = builder.preferredTextLanguages;
|
||||
this.preferredTextRoleFlags = builder.preferredTextRoleFlags;
|
||||
this.ignoredTextSelectionFlags = builder.ignoredTextSelectionFlags;
|
||||
this.selectUndeterminedTextLanguage = builder.selectUndeterminedTextLanguage;
|
||||
// General
|
||||
this.forceLowestBitrate = builder.forceLowestBitrate;
|
||||
@ -996,8 +1021,10 @@ public class TrackSelectionParameters implements Bundleable {
|
||||
&& maxAudioChannelCount == other.maxAudioChannelCount
|
||||
&& maxAudioBitrate == other.maxAudioBitrate
|
||||
&& preferredAudioMimeTypes.equals(other.preferredAudioMimeTypes)
|
||||
// Text
|
||||
&& preferredTextLanguages.equals(other.preferredTextLanguages)
|
||||
&& preferredTextRoleFlags == other.preferredTextRoleFlags
|
||||
&& ignoredTextSelectionFlags == other.ignoredTextSelectionFlags
|
||||
&& selectUndeterminedTextLanguage == other.selectUndeterminedTextLanguage
|
||||
// General
|
||||
&& forceLowestBitrate == other.forceLowestBitrate
|
||||
@ -1032,6 +1059,7 @@ public class TrackSelectionParameters implements Bundleable {
|
||||
// Text
|
||||
result = 31 * result + preferredTextLanguages.hashCode();
|
||||
result = 31 * result + preferredTextRoleFlags;
|
||||
result = 31 * result + ignoredTextSelectionFlags;
|
||||
result = 31 * result + (selectUndeterminedTextLanguage ? 1 : 0);
|
||||
// General
|
||||
result = 31 * result + (forceLowestBitrate ? 1 : 0);
|
||||
@ -1046,11 +1074,7 @@ public class TrackSelectionParameters implements Bundleable {
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({
|
||||
FIELD_PREFERRED_AUDIO_LANGUAGES,
|
||||
FIELD_PREFERRED_AUDIO_ROLE_FLAGS,
|
||||
FIELD_PREFERRED_TEXT_LANGUAGES,
|
||||
FIELD_PREFERRED_TEXT_ROLE_FLAGS,
|
||||
FIELD_SELECT_UNDETERMINED_TEXT_LANGUAGE,
|
||||
// Video
|
||||
FIELD_MAX_VIDEO_WIDTH,
|
||||
FIELD_MAX_VIDEO_HEIGHT,
|
||||
FIELD_MAX_VIDEO_FRAMERATE,
|
||||
@ -1063,14 +1087,23 @@ public class TrackSelectionParameters implements Bundleable {
|
||||
FIELD_VIEWPORT_HEIGHT,
|
||||
FIELD_VIEWPORT_ORIENTATION_MAY_CHANGE,
|
||||
FIELD_PREFERRED_VIDEO_MIMETYPES,
|
||||
FIELD_PREFERRED_VIDEO_ROLE_FLAGS,
|
||||
// Audio
|
||||
FIELD_PREFERRED_AUDIO_LANGUAGES,
|
||||
FIELD_PREFERRED_AUDIO_ROLE_FLAGS,
|
||||
FIELD_MAX_AUDIO_CHANNEL_COUNT,
|
||||
FIELD_MAX_AUDIO_BITRATE,
|
||||
FIELD_PREFERRED_AUDIO_MIME_TYPES,
|
||||
// Text
|
||||
FIELD_PREFERRED_TEXT_LANGUAGES,
|
||||
FIELD_PREFERRED_TEXT_ROLE_FLAGS,
|
||||
FIELD_IGNORED_TEXT_SELECTION_FLAGS,
|
||||
FIELD_SELECT_UNDETERMINED_TEXT_LANGUAGE,
|
||||
// General
|
||||
FIELD_FORCE_LOWEST_BITRATE,
|
||||
FIELD_FORCE_HIGHEST_SUPPORTED_BITRATE,
|
||||
FIELD_SELECTION_OVERRIDES,
|
||||
FIELD_DISABLED_TRACK_TYPE,
|
||||
FIELD_PREFERRED_VIDEO_ROLE_FLAGS
|
||||
})
|
||||
private @interface FieldNumber {}
|
||||
|
||||
@ -1099,6 +1132,7 @@ public class TrackSelectionParameters implements Bundleable {
|
||||
private static final int FIELD_SELECTION_OVERRIDES = 23;
|
||||
private static final int FIELD_DISABLED_TRACK_TYPE = 24;
|
||||
private static final int FIELD_PREFERRED_VIDEO_ROLE_FLAGS = 25;
|
||||
private static final int FIELD_IGNORED_TEXT_SELECTION_FLAGS = 26;
|
||||
|
||||
@UnstableApi
|
||||
@Override
|
||||
@ -1136,6 +1170,7 @@ public class TrackSelectionParameters implements Bundleable {
|
||||
bundle.putStringArray(
|
||||
keyForField(FIELD_PREFERRED_TEXT_LANGUAGES), preferredTextLanguages.toArray(new String[0]));
|
||||
bundle.putInt(keyForField(FIELD_PREFERRED_TEXT_ROLE_FLAGS), preferredTextRoleFlags);
|
||||
bundle.putInt(keyForField(FIELD_IGNORED_TEXT_SELECTION_FLAGS), ignoredTextSelectionFlags);
|
||||
bundle.putBoolean(
|
||||
keyForField(FIELD_SELECT_UNDETERMINED_TEXT_LANGUAGE), selectUndeterminedTextLanguage);
|
||||
// General
|
||||
|
@ -56,6 +56,7 @@ public final class TrackSelectionParametersTest {
|
||||
assertThat(parameters.preferredAudioMimeTypes).isEmpty();
|
||||
assertThat(parameters.preferredTextLanguages).isEmpty();
|
||||
assertThat(parameters.preferredTextRoleFlags).isEqualTo(0);
|
||||
assertThat(parameters.ignoredTextSelectionFlags).isEqualTo(0);
|
||||
assertThat(parameters.selectUndeterminedTextLanguage).isFalse();
|
||||
// General
|
||||
assertThat(parameters.forceLowestBitrate).isFalse();
|
||||
@ -98,6 +99,7 @@ public final class TrackSelectionParametersTest {
|
||||
// Text
|
||||
.setPreferredTextLanguages("de", "en")
|
||||
.setPreferredTextRoleFlags(C.ROLE_FLAG_CAPTION)
|
||||
.setIgnoredTextSelectionFlags(C.SELECTION_FLAG_AUTOSELECT)
|
||||
.setSelectUndeterminedTextLanguage(true)
|
||||
// General
|
||||
.setForceLowestBitrate(false)
|
||||
@ -141,6 +143,7 @@ public final class TrackSelectionParametersTest {
|
||||
// Text
|
||||
assertThat(parameters.preferredTextLanguages).containsExactly("de", "en").inOrder();
|
||||
assertThat(parameters.preferredTextRoleFlags).isEqualTo(C.ROLE_FLAG_CAPTION);
|
||||
assertThat(parameters.ignoredTextSelectionFlags).isEqualTo(C.SELECTION_FLAG_AUTOSELECT);
|
||||
assertThat(parameters.selectUndeterminedTextLanguage).isTrue();
|
||||
// General
|
||||
assertThat(parameters.forceLowestBitrate).isFalse();
|
||||
|
@ -118,13 +118,11 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
private boolean allowAudioMixedSampleRateAdaptiveness;
|
||||
private boolean allowAudioMixedChannelCountAdaptiveness;
|
||||
private boolean allowAudioMixedDecoderSupportAdaptiveness;
|
||||
// Text
|
||||
private @C.SelectionFlags int disabledTextTrackSelectionFlags;
|
||||
// General
|
||||
private boolean exceedRendererCapabilitiesIfNecessary;
|
||||
private boolean tunnelingEnabled;
|
||||
private boolean allowMultipleAdaptiveSelections;
|
||||
|
||||
// Overrides
|
||||
private final SparseArray<Map<TrackGroupArray, @NullableType SelectionOverride>>
|
||||
selectionOverrides;
|
||||
private final SparseBooleanArray rendererDisabledFlags;
|
||||
@ -160,8 +158,6 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
*/
|
||||
private ParametersBuilder(Parameters initialValues) {
|
||||
super(initialValues);
|
||||
// Text
|
||||
disabledTextTrackSelectionFlags = initialValues.disabledTextTrackSelectionFlags;
|
||||
// Video
|
||||
exceedVideoConstraintsIfNecessary = initialValues.exceedVideoConstraintsIfNecessary;
|
||||
allowVideoMixedMimeTypeAdaptiveness = initialValues.allowVideoMixedMimeTypeAdaptiveness;
|
||||
@ -229,11 +225,6 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
Parameters.keyForField(
|
||||
Parameters.FIELD_ALLOW_AUDIO_MIXED_DECODER_SUPPORT_ADAPTIVENESS),
|
||||
defaultValue.allowAudioMixedDecoderSupportAdaptiveness));
|
||||
// Text
|
||||
setDisabledTextTrackSelectionFlags(
|
||||
bundle.getInt(
|
||||
Parameters.keyForField(Parameters.FIELD_DISABLED_TEXT_TRACK_SELECTION_FLAGS),
|
||||
defaultValue.disabledTextTrackSelectionFlags));
|
||||
// General
|
||||
setExceedRendererCapabilitiesIfNecessary(
|
||||
bundle.getBoolean(
|
||||
@ -247,10 +238,9 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
bundle.getBoolean(
|
||||
Parameters.keyForField(Parameters.FIELD_ALLOW_MULTIPLE_ADAPTIVE_SELECTIONS),
|
||||
defaultValue.allowMultipleAdaptiveSelections));
|
||||
|
||||
// Overrides
|
||||
selectionOverrides = new SparseArray<>();
|
||||
setSelectionOverridesFromBundle(bundle);
|
||||
|
||||
rendererDisabledFlags =
|
||||
makeSparseBooleanArrayFromTrueKeys(
|
||||
bundle.getIntArray(
|
||||
@ -559,6 +549,13 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParametersBuilder setIgnoredTextSelectionFlags(
|
||||
@C.SelectionFlags int ignoredTextSelectionFlags) {
|
||||
super.setIgnoredTextSelectionFlags(ignoredTextSelectionFlags);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParametersBuilder setSelectUndeterminedTextLanguage(
|
||||
boolean selectUndeterminedTextLanguage) {
|
||||
@ -567,16 +564,12 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a bitmask of selection flags that are disabled for text track selections.
|
||||
*
|
||||
* @param disabledTextTrackSelectionFlags A bitmask of {@link C.SelectionFlags} that are
|
||||
* disabled for text track selections.
|
||||
* @return This builder.
|
||||
* @deprecated Use {@link #setIgnoredTextSelectionFlags}.
|
||||
*/
|
||||
@Deprecated
|
||||
public ParametersBuilder setDisabledTextTrackSelectionFlags(
|
||||
@C.SelectionFlags int disabledTextTrackSelectionFlags) {
|
||||
this.disabledTextTrackSelectionFlags = disabledTextTrackSelectionFlags;
|
||||
return this;
|
||||
return setIgnoredTextSelectionFlags(disabledTextTrackSelectionFlags);
|
||||
}
|
||||
|
||||
// General
|
||||
@ -828,8 +821,6 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
allowAudioMixedSampleRateAdaptiveness = false;
|
||||
allowAudioMixedChannelCountAdaptiveness = false;
|
||||
allowAudioMixedDecoderSupportAdaptiveness = false;
|
||||
// Text
|
||||
disabledTextTrackSelectionFlags = 0;
|
||||
// General
|
||||
exceedRendererCapabilitiesIfNecessary = true;
|
||||
tunnelingEnabled = false;
|
||||
@ -917,12 +908,6 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
*/
|
||||
@Deprecated public static final Parameters DEFAULT = DEFAULT_WITHOUT_CONTEXT;
|
||||
|
||||
/**
|
||||
* Bitmask of selection flags that are disabled for text track selections. See {@link
|
||||
* C.SelectionFlags}. The default value is {@code 0} (i.e. no flags).
|
||||
*/
|
||||
public final @C.SelectionFlags int disabledTextTrackSelectionFlags;
|
||||
|
||||
/** Returns an instance configured with default values. */
|
||||
public static Parameters getDefaults(Context context) {
|
||||
return new ParametersBuilder(context).build();
|
||||
@ -1020,8 +1005,6 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
allowAudioMixedSampleRateAdaptiveness = builder.allowAudioMixedSampleRateAdaptiveness;
|
||||
allowAudioMixedChannelCountAdaptiveness = builder.allowAudioMixedChannelCountAdaptiveness;
|
||||
allowAudioMixedDecoderSupportAdaptiveness = builder.allowAudioMixedDecoderSupportAdaptiveness;
|
||||
// Text
|
||||
disabledTextTrackSelectionFlags = builder.disabledTextTrackSelectionFlags;
|
||||
// General
|
||||
exceedRendererCapabilitiesIfNecessary = builder.exceedRendererCapabilitiesIfNecessary;
|
||||
tunnelingEnabled = builder.tunnelingEnabled;
|
||||
@ -1109,8 +1092,6 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
== other.allowAudioMixedChannelCountAdaptiveness
|
||||
&& allowAudioMixedDecoderSupportAdaptiveness
|
||||
== other.allowAudioMixedDecoderSupportAdaptiveness
|
||||
// Text
|
||||
&& disabledTextTrackSelectionFlags == other.disabledTextTrackSelectionFlags
|
||||
// General
|
||||
&& exceedRendererCapabilitiesIfNecessary == other.exceedRendererCapabilitiesIfNecessary
|
||||
&& tunnelingEnabled == other.tunnelingEnabled
|
||||
@ -1135,8 +1116,6 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
result = 31 * result + (allowAudioMixedSampleRateAdaptiveness ? 1 : 0);
|
||||
result = 31 * result + (allowAudioMixedChannelCountAdaptiveness ? 1 : 0);
|
||||
result = 31 * result + (allowAudioMixedDecoderSupportAdaptiveness ? 1 : 0);
|
||||
// Text
|
||||
result = 31 * result + disabledTextTrackSelectionFlags;
|
||||
// General
|
||||
result = 31 * result + (exceedRendererCapabilitiesIfNecessary ? 1 : 0);
|
||||
result = 31 * result + (tunnelingEnabled ? 1 : 0);
|
||||
@ -1151,23 +1130,26 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@Target(TYPE_USE)
|
||||
@IntDef({
|
||||
// Video
|
||||
FIELD_EXCEED_VIDEO_CONSTRAINTS_IF_NECESSARY,
|
||||
FIELD_ALLOW_VIDEO_MIXED_MIME_TYPE_ADAPTIVENESS,
|
||||
FIELD_ALLOW_VIDEO_NON_SEAMLESS_ADAPTIVENESS,
|
||||
FIELD_ALLOW_VIDEO_MIXED_DECODER_SUPPORT_ADAPTIVENESS,
|
||||
// Audio
|
||||
FIELD_EXCEED_AUDIO_CONSTRAINTS_IF_NCESSARY,
|
||||
FIELD_ALLOW_AUDIO_MIXED_MIME_TYPE_ADAPTIVENESS,
|
||||
FIELD_ALLOW_AUDIO_MIXED_SAMPLE_RATE_ADAPTIVENESS,
|
||||
FIELD_ALLOW_AUDIO_MIXED_CHANNEL_COUNT_ADAPTIVENESS,
|
||||
FIELD_DISABLED_TEXT_TRACK_SELECTION_FLAGS,
|
||||
FIELD_ALLOW_AUDIO_MIXED_DECODER_SUPPORT_ADAPTIVENESS,
|
||||
// General
|
||||
FIELD_EXCEED_RENDERER_CAPABILITIES_IF_NECESSARY,
|
||||
FIELD_TUNNELING_ENABLED,
|
||||
FIELD_ALLOW_MULTIPLE_ADAPTIVE_SELECTIONS,
|
||||
// Overrides
|
||||
FIELD_SELECTION_OVERRIDES_RENDERER_INDICES,
|
||||
FIELD_SELECTION_OVERRIDES_TRACK_GROUP_ARRAYS,
|
||||
FIELD_SELECTION_OVERRIDES,
|
||||
FIELD_RENDERER_DISABLED_INDICES,
|
||||
FIELD_ALLOW_VIDEO_MIXED_DECODER_SUPPORT_ADAPTIVENESS,
|
||||
FIELD_ALLOW_AUDIO_MIXED_DECODER_SUPPORT_ADAPTIVENESS
|
||||
})
|
||||
private @interface FieldNumber {}
|
||||
|
||||
@ -1179,16 +1161,15 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
private static final int FIELD_ALLOW_AUDIO_MIXED_MIME_TYPE_ADAPTIVENESS = 1004;
|
||||
private static final int FIELD_ALLOW_AUDIO_MIXED_SAMPLE_RATE_ADAPTIVENESS = 1005;
|
||||
private static final int FIELD_ALLOW_AUDIO_MIXED_CHANNEL_COUNT_ADAPTIVENESS = 1006;
|
||||
private static final int FIELD_DISABLED_TEXT_TRACK_SELECTION_FLAGS = 1007;
|
||||
private static final int FIELD_EXCEED_RENDERER_CAPABILITIES_IF_NECESSARY = 1008;
|
||||
private static final int FIELD_TUNNELING_ENABLED = 1009;
|
||||
private static final int FIELD_ALLOW_MULTIPLE_ADAPTIVE_SELECTIONS = 1010;
|
||||
private static final int FIELD_SELECTION_OVERRIDES_RENDERER_INDICES = 1011;
|
||||
private static final int FIELD_SELECTION_OVERRIDES_TRACK_GROUP_ARRAYS = 1012;
|
||||
private static final int FIELD_SELECTION_OVERRIDES = 1013;
|
||||
private static final int FIELD_RENDERER_DISABLED_INDICES = 1014;
|
||||
private static final int FIELD_ALLOW_VIDEO_MIXED_DECODER_SUPPORT_ADAPTIVENESS = 1015;
|
||||
private static final int FIELD_ALLOW_AUDIO_MIXED_DECODER_SUPPORT_ADAPTIVENESS = 1016;
|
||||
private static final int FIELD_EXCEED_RENDERER_CAPABILITIES_IF_NECESSARY = 1007;
|
||||
private static final int FIELD_TUNNELING_ENABLED = 1008;
|
||||
private static final int FIELD_ALLOW_MULTIPLE_ADAPTIVE_SELECTIONS = 1009;
|
||||
private static final int FIELD_SELECTION_OVERRIDES_RENDERER_INDICES = 1010;
|
||||
private static final int FIELD_SELECTION_OVERRIDES_TRACK_GROUP_ARRAYS = 1011;
|
||||
private static final int FIELD_SELECTION_OVERRIDES = 1012;
|
||||
private static final int FIELD_RENDERER_DISABLED_INDICES = 1013;
|
||||
private static final int FIELD_ALLOW_VIDEO_MIXED_DECODER_SUPPORT_ADAPTIVENESS = 1014;
|
||||
private static final int FIELD_ALLOW_AUDIO_MIXED_DECODER_SUPPORT_ADAPTIVENESS = 1015;
|
||||
|
||||
@Override
|
||||
public Bundle toBundle() {
|
||||
@ -1223,9 +1204,6 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
bundle.putBoolean(
|
||||
keyForField(FIELD_ALLOW_AUDIO_MIXED_DECODER_SUPPORT_ADAPTIVENESS),
|
||||
allowAudioMixedDecoderSupportAdaptiveness);
|
||||
// Text
|
||||
bundle.putInt(
|
||||
keyForField(FIELD_DISABLED_TEXT_TRACK_SELECTION_FLAGS), disabledTextTrackSelectionFlags);
|
||||
// General
|
||||
bundle.putBoolean(
|
||||
keyForField(FIELD_EXCEED_RENDERER_CAPABILITIES_IF_NECESSARY),
|
||||
@ -2745,8 +2723,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||
super(rendererIndex, trackGroup, trackIndex);
|
||||
isWithinRendererCapabilities =
|
||||
isSupported(trackFormatSupport, /* allowExceedsCapabilities= */ false);
|
||||
int maskedSelectionFlags =
|
||||
format.selectionFlags & ~parameters.disabledTextTrackSelectionFlags;
|
||||
int maskedSelectionFlags = format.selectionFlags & ~parameters.ignoredTextSelectionFlags;
|
||||
isDefault = (maskedSelectionFlags & C.SELECTION_FLAG_DEFAULT) != 0;
|
||||
isForced = (maskedSelectionFlags & C.SELECTION_FLAG_FORCED) != 0;
|
||||
int bestLanguageIndex = Integer.MAX_VALUE;
|
||||
|
@ -1130,7 +1130,7 @@ public final class DefaultTrackSelectorTest {
|
||||
// selected.
|
||||
trackGroups = wrapFormats(defaultOnly, noFlag, forcedOnly, forcedDefault);
|
||||
trackSelector.setParameters(
|
||||
defaultParameters.buildUpon().setDisabledTextTrackSelectionFlags(C.SELECTION_FLAG_DEFAULT));
|
||||
defaultParameters.buildUpon().setIgnoredTextSelectionFlags(C.SELECTION_FLAG_DEFAULT));
|
||||
result = trackSelector.selectTracks(textRendererCapabilities, trackGroups, periodId, TIMELINE);
|
||||
assertNoSelection(result.selections[0]);
|
||||
|
||||
@ -1141,8 +1141,7 @@ public final class DefaultTrackSelectorTest {
|
||||
trackSelector
|
||||
.getParameters()
|
||||
.buildUpon()
|
||||
.setDisabledTextTrackSelectionFlags(
|
||||
C.SELECTION_FLAG_DEFAULT | C.SELECTION_FLAG_FORCED));
|
||||
.setIgnoredTextSelectionFlags(C.SELECTION_FLAG_DEFAULT | C.SELECTION_FLAG_FORCED));
|
||||
result = trackSelector.selectTracks(textRendererCapabilities, trackGroups, periodId, TIMELINE);
|
||||
assertNoSelection(result.selections[0]);
|
||||
|
||||
@ -1160,7 +1159,7 @@ public final class DefaultTrackSelectorTest {
|
||||
trackSelector
|
||||
.getParameters()
|
||||
.buildUpon()
|
||||
.setDisabledTextTrackSelectionFlags(C.SELECTION_FLAG_DEFAULT));
|
||||
.setIgnoredTextSelectionFlags(C.SELECTION_FLAG_DEFAULT));
|
||||
result = trackSelector.selectTracks(textRendererCapabilities, trackGroups, periodId, TIMELINE);
|
||||
assertFixedSelection(result.selections[0], trackGroups, noFlag);
|
||||
}
|
||||
@ -2371,7 +2370,7 @@ public final class DefaultTrackSelectorTest {
|
||||
.setPreferredTextLanguages("de", "en")
|
||||
.setPreferredTextRoleFlags(C.ROLE_FLAG_CAPTION)
|
||||
.setSelectUndeterminedTextLanguage(true)
|
||||
.setDisabledTextTrackSelectionFlags(C.SELECTION_FLAG_AUTOSELECT)
|
||||
.setIgnoredTextSelectionFlags(C.SELECTION_FLAG_AUTOSELECT)
|
||||
// General
|
||||
.setForceLowestBitrate(false)
|
||||
.setForceHighestSupportedBitrate(true)
|
||||
|
@ -56,6 +56,7 @@ import android.widget.TextView;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.media3.common.C;
|
||||
import androidx.media3.common.Format;
|
||||
import androidx.media3.common.ForwardingPlayer;
|
||||
import androidx.media3.common.MediaLibraryInfo;
|
||||
import androidx.media3.common.Player;
|
||||
@ -1124,8 +1125,11 @@ public class PlayerControlView extends FrameLayout {
|
||||
if (!trackGroupInfo.isTrackSupported(trackIndex)) {
|
||||
continue;
|
||||
}
|
||||
String trackName =
|
||||
trackNameProvider.getTrackName(trackGroupInfo.getTrackFormat(trackIndex));
|
||||
Format trackFormat = trackGroupInfo.getTrackFormat(trackIndex);
|
||||
if ((trackFormat.selectionFlags & C.SELECTION_FLAG_FORCED) != 0) {
|
||||
continue;
|
||||
}
|
||||
String trackName = trackNameProvider.getTrackName(trackFormat);
|
||||
tracks.add(new TrackInformation(tracksInfo, trackGroupIndex, trackIndex, trackName));
|
||||
}
|
||||
}
|
||||
@ -1864,7 +1868,8 @@ public class PlayerControlView extends FrameLayout {
|
||||
player.setTrackSelectionParameters(
|
||||
trackSelectionParameters
|
||||
.buildUpon()
|
||||
.setTrackTypeDisabled(C.TRACK_TYPE_TEXT, /* disabled= */ true)
|
||||
.clearOverridesOfType(C.TRACK_TYPE_TEXT)
|
||||
.setIgnoredTextSelectionFlags(~C.SELECTION_FLAG_FORCED)
|
||||
.build());
|
||||
settingsWindow.dismiss();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user