mirror of
https://github.com/androidx/media.git
synced 2025-05-04 06:00:37 +08:00
Fix naming to reflect that CEA-708 is supported too
PiperOrigin-RevId: 312131816
This commit is contained in:
parent
be098401e9
commit
0de9c007af
@ -33,8 +33,8 @@ public final class CeaUtil {
|
|||||||
private static final int PROVIDER_CODE_DIRECTV = 0x2F;
|
private static final int PROVIDER_CODE_DIRECTV = 0x2F;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Consumes the unescaped content of an SEI NAL unit, writing the content of any CEA-608 messages
|
* Consumes the unescaped content of an SEI NAL unit, writing the content of any CEA-608/708
|
||||||
* as samples to all of the provided outputs.
|
* messages as samples to all of the provided outputs.
|
||||||
*
|
*
|
||||||
* @param presentationTimeUs The presentation time in microseconds for any samples.
|
* @param presentationTimeUs The presentation time in microseconds for any samples.
|
||||||
* @param seiBuffer The unescaped SEI NAL unit data, excluding the NAL unit start code and type.
|
* @param seiBuffer The unescaped SEI NAL unit data, excluding the NAL unit start code and type.
|
||||||
|
@ -171,7 +171,7 @@ public class FragmentedMp4Extractor implements Extractor {
|
|||||||
// Extractor output.
|
// Extractor output.
|
||||||
private @MonotonicNonNull ExtractorOutput extractorOutput;
|
private @MonotonicNonNull ExtractorOutput extractorOutput;
|
||||||
private TrackOutput[] emsgTrackOutputs;
|
private TrackOutput[] emsgTrackOutputs;
|
||||||
private TrackOutput[] cea608TrackOutputs;
|
private TrackOutput[] ceaTrackOutputs;
|
||||||
|
|
||||||
// Whether extractorOutput.seekMap has been called.
|
// Whether extractorOutput.seekMap has been called.
|
||||||
private boolean haveOutputSeekMap;
|
private boolean haveOutputSeekMap;
|
||||||
@ -576,12 +576,12 @@ public class FragmentedMp4Extractor implements Extractor {
|
|||||||
eventMessageTrackOutput.format(EMSG_FORMAT);
|
eventMessageTrackOutput.format(EMSG_FORMAT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cea608TrackOutputs == null) {
|
if (ceaTrackOutputs == null) {
|
||||||
cea608TrackOutputs = new TrackOutput[closedCaptionFormats.size()];
|
ceaTrackOutputs = new TrackOutput[closedCaptionFormats.size()];
|
||||||
for (int i = 0; i < cea608TrackOutputs.length; i++) {
|
for (int i = 0; i < ceaTrackOutputs.length; i++) {
|
||||||
TrackOutput output = extractorOutput.track(trackBundles.size() + 1 + i, C.TRACK_TYPE_TEXT);
|
TrackOutput output = extractorOutput.track(trackBundles.size() + 1 + i, C.TRACK_TYPE_TEXT);
|
||||||
output.format(closedCaptionFormats.get(i));
|
output.format(closedCaptionFormats.get(i));
|
||||||
cea608TrackOutputs[i] = output;
|
ceaTrackOutputs[i] = output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1328,8 +1328,9 @@ public class FragmentedMp4Extractor implements Extractor {
|
|||||||
output.sampleData(nalStartCode, 4);
|
output.sampleData(nalStartCode, 4);
|
||||||
// Write the NAL unit type byte.
|
// Write the NAL unit type byte.
|
||||||
output.sampleData(nalPrefix, 1);
|
output.sampleData(nalPrefix, 1);
|
||||||
processSeiNalUnitPayload = cea608TrackOutputs.length > 0
|
processSeiNalUnitPayload =
|
||||||
&& NalUnitUtil.isNalUnitSei(track.format.sampleMimeType, nalPrefixData[4]);
|
ceaTrackOutputs.length > 0
|
||||||
|
&& NalUnitUtil.isNalUnitSei(track.format.sampleMimeType, nalPrefixData[4]);
|
||||||
sampleBytesWritten += 5;
|
sampleBytesWritten += 5;
|
||||||
sampleSize += nalUnitLengthFieldLengthDiff;
|
sampleSize += nalUnitLengthFieldLengthDiff;
|
||||||
} else {
|
} else {
|
||||||
@ -1345,7 +1346,7 @@ public class FragmentedMp4Extractor implements Extractor {
|
|||||||
// If the format is H.265/HEVC the NAL unit header has two bytes so skip one more byte.
|
// If the format is H.265/HEVC the NAL unit header has two bytes so skip one more byte.
|
||||||
nalBuffer.setPosition(MimeTypes.VIDEO_H265.equals(track.format.sampleMimeType) ? 1 : 0);
|
nalBuffer.setPosition(MimeTypes.VIDEO_H265.equals(track.format.sampleMimeType) ? 1 : 0);
|
||||||
nalBuffer.setLimit(unescapedLength);
|
nalBuffer.setLimit(unescapedLength);
|
||||||
CeaUtil.consume(sampleTimeUs, nalBuffer, cea608TrackOutputs);
|
CeaUtil.consume(sampleTimeUs, nalBuffer, ceaTrackOutputs);
|
||||||
} else {
|
} else {
|
||||||
// Write the payload of the NAL unit.
|
// Write the payload of the NAL unit.
|
||||||
writtenBytes = output.sampleData(input, sampleCurrentNalBytesRemaining, false);
|
writtenBytes = output.sampleData(input, sampleCurrentNalBytesRemaining, false);
|
||||||
|
@ -27,7 +27,7 @@ import com.google.android.exoplayer2.util.MimeTypes;
|
|||||||
import com.google.android.exoplayer2.util.ParsableByteArray;
|
import com.google.android.exoplayer2.util.ParsableByteArray;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/** Consumes SEI buffers, outputting contained CEA-608 messages to a {@link TrackOutput}. */
|
/** Consumes SEI buffers, outputting contained CEA-608/708 messages to a {@link TrackOutput}. */
|
||||||
public final class SeiReader {
|
public final class SeiReader {
|
||||||
|
|
||||||
private final List<Format> closedCaptionFormats;
|
private final List<Format> closedCaptionFormats;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user