Commit b667a0e7 by olly Committed by Andrew Lewis

Rename closed caption variables to be non-608 specific

This is the rename-only part of https://github.com/google/ExoPlayer/pull/7370

PiperOrigin-RevId: 312057896
parent cda9417a
...@@ -488,14 +488,14 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; ...@@ -488,14 +488,14 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
int primaryGroupCount = groupedAdaptationSetIndices.length; int primaryGroupCount = groupedAdaptationSetIndices.length;
boolean[] primaryGroupHasEventMessageTrackFlags = new boolean[primaryGroupCount]; boolean[] primaryGroupHasEventMessageTrackFlags = new boolean[primaryGroupCount];
Format[][] primaryGroupCea608TrackFormats = new Format[primaryGroupCount][]; Format[][] primaryGroupClosedCaptionTrackFormats = new Format[primaryGroupCount][];
int totalEmbeddedTrackGroupCount = int totalEmbeddedTrackGroupCount =
identifyEmbeddedTracks( identifyEmbeddedTracks(
primaryGroupCount, primaryGroupCount,
adaptationSets, adaptationSets,
groupedAdaptationSetIndices, groupedAdaptationSetIndices,
primaryGroupHasEventMessageTrackFlags, primaryGroupHasEventMessageTrackFlags,
primaryGroupCea608TrackFormats); primaryGroupClosedCaptionTrackFormats);
int totalGroupCount = primaryGroupCount + totalEmbeddedTrackGroupCount + eventStreams.size(); int totalGroupCount = primaryGroupCount + totalEmbeddedTrackGroupCount + eventStreams.size();
TrackGroup[] trackGroups = new TrackGroup[totalGroupCount]; TrackGroup[] trackGroups = new TrackGroup[totalGroupCount];
...@@ -508,7 +508,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; ...@@ -508,7 +508,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
groupedAdaptationSetIndices, groupedAdaptationSetIndices,
primaryGroupCount, primaryGroupCount,
primaryGroupHasEventMessageTrackFlags, primaryGroupHasEventMessageTrackFlags,
primaryGroupCea608TrackFormats, primaryGroupClosedCaptionTrackFormats,
trackGroups, trackGroups,
trackGroupInfos); trackGroupInfos);
...@@ -616,8 +616,8 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; ...@@ -616,8 +616,8 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
* same primary group, grouped in primary track groups order. * same primary group, grouped in primary track groups order.
* @param primaryGroupHasEventMessageTrackFlags An output array to be filled with flags indicating * @param primaryGroupHasEventMessageTrackFlags An output array to be filled with flags indicating
* whether each of the primary track groups contains an embedded event message track. * whether each of the primary track groups contains an embedded event message track.
* @param primaryGroupCea608TrackFormats An output array to be filled with track formats for * @param primaryGroupClosedCaptionTrackFormats An output array to be filled with track formats
* CEA-608 tracks embedded in each of the primary track groups. * for closed caption tracks embedded in each of the primary track groups.
* @return Total number of embedded track groups. * @return Total number of embedded track groups.
*/ */
private static int identifyEmbeddedTracks( private static int identifyEmbeddedTracks(
...@@ -625,16 +625,16 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; ...@@ -625,16 +625,16 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
List<AdaptationSet> adaptationSets, List<AdaptationSet> adaptationSets,
int[][] groupedAdaptationSetIndices, int[][] groupedAdaptationSetIndices,
boolean[] primaryGroupHasEventMessageTrackFlags, boolean[] primaryGroupHasEventMessageTrackFlags,
Format[][] primaryGroupCea608TrackFormats) { Format[][] primaryGroupClosedCaptionTrackFormats) {
int numEmbeddedTrackGroups = 0; int numEmbeddedTrackGroups = 0;
for (int i = 0; i < primaryGroupCount; i++) { for (int i = 0; i < primaryGroupCount; i++) {
if (hasEventMessageTrack(adaptationSets, groupedAdaptationSetIndices[i])) { if (hasEventMessageTrack(adaptationSets, groupedAdaptationSetIndices[i])) {
primaryGroupHasEventMessageTrackFlags[i] = true; primaryGroupHasEventMessageTrackFlags[i] = true;
numEmbeddedTrackGroups++; numEmbeddedTrackGroups++;
} }
primaryGroupCea608TrackFormats[i] = primaryGroupClosedCaptionTrackFormats[i] =
getCea608TrackFormats(adaptationSets, groupedAdaptationSetIndices[i]); getClosedCaptionTrackFormats(adaptationSets, groupedAdaptationSetIndices[i]);
if (primaryGroupCea608TrackFormats[i].length != 0) { if (primaryGroupClosedCaptionTrackFormats[i].length != 0) {
numEmbeddedTrackGroups++; numEmbeddedTrackGroups++;
} }
} }
...@@ -647,7 +647,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; ...@@ -647,7 +647,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
int[][] groupedAdaptationSetIndices, int[][] groupedAdaptationSetIndices,
int primaryGroupCount, int primaryGroupCount,
boolean[] primaryGroupHasEventMessageTrackFlags, boolean[] primaryGroupHasEventMessageTrackFlags,
Format[][] primaryGroupCea608TrackFormats, Format[][] primaryGroupClosedCaptionTrackFormats,
TrackGroup[] trackGroups, TrackGroup[] trackGroups,
TrackGroupInfo[] trackGroupInfos) { TrackGroupInfo[] trackGroupInfos) {
int trackGroupCount = 0; int trackGroupCount = 0;
...@@ -673,8 +673,8 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; ...@@ -673,8 +673,8 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
int primaryTrackGroupIndex = trackGroupCount++; int primaryTrackGroupIndex = trackGroupCount++;
int eventMessageTrackGroupIndex = int eventMessageTrackGroupIndex =
primaryGroupHasEventMessageTrackFlags[i] ? trackGroupCount++ : C.INDEX_UNSET; primaryGroupHasEventMessageTrackFlags[i] ? trackGroupCount++ : C.INDEX_UNSET;
int cea608TrackGroupIndex = int closedCaptionTrackGroupIndex =
primaryGroupCea608TrackFormats[i].length != 0 ? trackGroupCount++ : C.INDEX_UNSET; primaryGroupClosedCaptionTrackFormats[i].length != 0 ? trackGroupCount++ : C.INDEX_UNSET;
trackGroups[primaryTrackGroupIndex] = new TrackGroup(formats); trackGroups[primaryTrackGroupIndex] = new TrackGroup(formats);
trackGroupInfos[primaryTrackGroupIndex] = trackGroupInfos[primaryTrackGroupIndex] =
...@@ -683,7 +683,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; ...@@ -683,7 +683,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
adaptationSetIndices, adaptationSetIndices,
primaryTrackGroupIndex, primaryTrackGroupIndex,
eventMessageTrackGroupIndex, eventMessageTrackGroupIndex,
cea608TrackGroupIndex); closedCaptionTrackGroupIndex);
if (eventMessageTrackGroupIndex != C.INDEX_UNSET) { if (eventMessageTrackGroupIndex != C.INDEX_UNSET) {
Format format = Format format =
new Format.Builder() new Format.Builder()
...@@ -694,10 +694,11 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; ...@@ -694,10 +694,11 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
trackGroupInfos[eventMessageTrackGroupIndex] = trackGroupInfos[eventMessageTrackGroupIndex] =
TrackGroupInfo.embeddedEmsgTrack(adaptationSetIndices, primaryTrackGroupIndex); TrackGroupInfo.embeddedEmsgTrack(adaptationSetIndices, primaryTrackGroupIndex);
} }
if (cea608TrackGroupIndex != C.INDEX_UNSET) { if (closedCaptionTrackGroupIndex != C.INDEX_UNSET) {
trackGroups[cea608TrackGroupIndex] = new TrackGroup(primaryGroupCea608TrackFormats[i]); trackGroups[closedCaptionTrackGroupIndex] =
trackGroupInfos[cea608TrackGroupIndex] = new TrackGroup(primaryGroupClosedCaptionTrackFormats[i]);
TrackGroupInfo.embeddedCea608Track(adaptationSetIndices, primaryTrackGroupIndex); trackGroupInfos[closedCaptionTrackGroupIndex] =
TrackGroupInfo.embeddedClosedCaptionTrack(adaptationSetIndices, primaryTrackGroupIndex);
} }
} }
return trackGroupCount; return trackGroupCount;
...@@ -728,11 +729,13 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; ...@@ -728,11 +729,13 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
trackGroups.get(trackGroupInfo.embeddedEventMessageTrackGroupIndex); trackGroups.get(trackGroupInfo.embeddedEventMessageTrackGroupIndex);
embeddedTrackCount++; embeddedTrackCount++;
} }
boolean enableCea608Tracks = trackGroupInfo.embeddedCea608TrackGroupIndex != C.INDEX_UNSET; boolean enableClosedCaptionTrack =
TrackGroup embeddedCea608TrackGroup = null; trackGroupInfo.embeddedClosedCaptionTrackGroupIndex != C.INDEX_UNSET;
if (enableCea608Tracks) { TrackGroup embeddedClosedCaptionTrackGroup = null;
embeddedCea608TrackGroup = trackGroups.get(trackGroupInfo.embeddedCea608TrackGroupIndex); if (enableClosedCaptionTrack) {
embeddedTrackCount += embeddedCea608TrackGroup.length; embeddedClosedCaptionTrackGroup =
trackGroups.get(trackGroupInfo.embeddedClosedCaptionTrackGroupIndex);
embeddedTrackCount += embeddedClosedCaptionTrackGroup.length;
} }
Format[] embeddedTrackFormats = new Format[embeddedTrackCount]; Format[] embeddedTrackFormats = new Format[embeddedTrackCount];
...@@ -743,12 +746,12 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; ...@@ -743,12 +746,12 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
embeddedTrackTypes[embeddedTrackCount] = C.TRACK_TYPE_METADATA; embeddedTrackTypes[embeddedTrackCount] = C.TRACK_TYPE_METADATA;
embeddedTrackCount++; embeddedTrackCount++;
} }
List<Format> embeddedCea608TrackFormats = new ArrayList<>(); List<Format> embeddedClosedCaptionTrackFormats = new ArrayList<>();
if (enableCea608Tracks) { if (enableClosedCaptionTrack) {
for (int i = 0; i < embeddedCea608TrackGroup.length; i++) { for (int i = 0; i < embeddedClosedCaptionTrackGroup.length; i++) {
embeddedTrackFormats[embeddedTrackCount] = embeddedCea608TrackGroup.getFormat(i); embeddedTrackFormats[embeddedTrackCount] = embeddedClosedCaptionTrackGroup.getFormat(i);
embeddedTrackTypes[embeddedTrackCount] = C.TRACK_TYPE_TEXT; embeddedTrackTypes[embeddedTrackCount] = C.TRACK_TYPE_TEXT;
embeddedCea608TrackFormats.add(embeddedTrackFormats[embeddedTrackCount]); embeddedClosedCaptionTrackFormats.add(embeddedTrackFormats[embeddedTrackCount]);
embeddedTrackCount++; embeddedTrackCount++;
} }
} }
...@@ -767,7 +770,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; ...@@ -767,7 +770,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
trackGroupInfo.trackType, trackGroupInfo.trackType,
elapsedRealtimeOffsetMs, elapsedRealtimeOffsetMs,
enableEventMessageTrack, enableEventMessageTrack,
embeddedCea608TrackFormats, embeddedClosedCaptionTrackFormats,
trackPlayerEmsgHandler, trackPlayerEmsgHandler,
transferListener); transferListener);
ChunkSampleStream<DashChunkSource> stream = ChunkSampleStream<DashChunkSource> stream =
...@@ -824,7 +827,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; ...@@ -824,7 +827,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
return false; return false;
} }
private static Format[] getCea608TrackFormats( private static Format[] getClosedCaptionTrackFormats(
List<AdaptationSet> adaptationSets, int[] adaptationSetIndices) { List<AdaptationSet> adaptationSets, int[] adaptationSetIndices) {
for (int i : adaptationSetIndices) { for (int i : adaptationSetIndices) {
AdaptationSet adaptationSet = adaptationSets.get(i); AdaptationSet adaptationSet = adaptationSets.get(i);
...@@ -916,21 +919,21 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; ...@@ -916,21 +919,21 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
public final int eventStreamGroupIndex; public final int eventStreamGroupIndex;
public final int primaryTrackGroupIndex; public final int primaryTrackGroupIndex;
public final int embeddedEventMessageTrackGroupIndex; public final int embeddedEventMessageTrackGroupIndex;
public final int embeddedCea608TrackGroupIndex; public final int embeddedClosedCaptionTrackGroupIndex;
public static TrackGroupInfo primaryTrack( public static TrackGroupInfo primaryTrack(
int trackType, int trackType,
int[] adaptationSetIndices, int[] adaptationSetIndices,
int primaryTrackGroupIndex, int primaryTrackGroupIndex,
int embeddedEventMessageTrackGroupIndex, int embeddedEventMessageTrackGroupIndex,
int embeddedCea608TrackGroupIndex) { int embeddedClosedCaptionTrackGroupIndex) {
return new TrackGroupInfo( return new TrackGroupInfo(
trackType, trackType,
CATEGORY_PRIMARY, CATEGORY_PRIMARY,
adaptationSetIndices, adaptationSetIndices,
primaryTrackGroupIndex, primaryTrackGroupIndex,
embeddedEventMessageTrackGroupIndex, embeddedEventMessageTrackGroupIndex,
embeddedCea608TrackGroupIndex, embeddedClosedCaptionTrackGroupIndex,
/* eventStreamGroupIndex= */ -1); /* eventStreamGroupIndex= */ -1);
} }
...@@ -946,8 +949,8 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; ...@@ -946,8 +949,8 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
/* eventStreamGroupIndex= */ -1); /* eventStreamGroupIndex= */ -1);
} }
public static TrackGroupInfo embeddedCea608Track(int[] adaptationSetIndices, public static TrackGroupInfo embeddedClosedCaptionTrack(
int primaryTrackGroupIndex) { int[] adaptationSetIndices, int primaryTrackGroupIndex) {
return new TrackGroupInfo( return new TrackGroupInfo(
C.TRACK_TYPE_TEXT, C.TRACK_TYPE_TEXT,
CATEGORY_EMBEDDED, CATEGORY_EMBEDDED,
...@@ -975,14 +978,14 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; ...@@ -975,14 +978,14 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
int[] adaptationSetIndices, int[] adaptationSetIndices,
int primaryTrackGroupIndex, int primaryTrackGroupIndex,
int embeddedEventMessageTrackGroupIndex, int embeddedEventMessageTrackGroupIndex,
int embeddedCea608TrackGroupIndex, int embeddedClosedCaptionTrackGroupIndex,
int eventStreamGroupIndex) { int eventStreamGroupIndex) {
this.trackType = trackType; this.trackType = trackType;
this.adaptationSetIndices = adaptationSetIndices; this.adaptationSetIndices = adaptationSetIndices;
this.trackGroupCategory = trackGroupCategory; this.trackGroupCategory = trackGroupCategory;
this.primaryTrackGroupIndex = primaryTrackGroupIndex; this.primaryTrackGroupIndex = primaryTrackGroupIndex;
this.embeddedEventMessageTrackGroupIndex = embeddedEventMessageTrackGroupIndex; this.embeddedEventMessageTrackGroupIndex = embeddedEventMessageTrackGroupIndex;
this.embeddedCea608TrackGroupIndex = embeddedCea608TrackGroupIndex; this.embeddedClosedCaptionTrackGroupIndex = embeddedClosedCaptionTrackGroupIndex;
this.eventStreamGroupIndex = eventStreamGroupIndex; this.eventStreamGroupIndex = eventStreamGroupIndex;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment