Commit 7e635d95 by samrobinson Committed by Oliver Woodman

Set Format gapless info separately to Metadata in Extractors.

PiperOrigin-RevId: 344838400
parent e6046a5c
...@@ -292,17 +292,11 @@ import java.util.List; ...@@ -292,17 +292,11 @@ import java.util.List;
int trackType, int trackType,
@Nullable Metadata udtaMetadata, @Nullable Metadata udtaMetadata,
@Nullable Metadata mdtaMetadata, @Nullable Metadata mdtaMetadata,
GaplessInfoHolder gaplessInfoHolder,
Format.Builder formatBuilder, Format.Builder formatBuilder,
Metadata.Entry... additionalEntries) { Metadata.Entry... additionalEntries) {
Metadata formatMetadata = new Metadata(); Metadata formatMetadata = new Metadata();
if (trackType == C.TRACK_TYPE_AUDIO) { if (trackType == C.TRACK_TYPE_AUDIO) {
if (gaplessInfoHolder.hasGaplessInfo()) {
formatBuilder
.setEncoderDelay(gaplessInfoHolder.encoderDelay)
.setEncoderPadding(gaplessInfoHolder.encoderPadding);
}
// We assume all udta metadata is associated with the audio track. // We assume all udta metadata is associated with the audio track.
if (udtaMetadata != null) { if (udtaMetadata != null) {
formatMetadata = udtaMetadata; formatMetadata = udtaMetadata;
...@@ -333,6 +327,18 @@ import java.util.List; ...@@ -333,6 +327,18 @@ import java.util.List;
} }
/** /**
* Updates a {@link Format.Builder} to include audio gapless information from the provided source.
*/
public static void setFormatGaplessInfo(
int trackType, GaplessInfoHolder gaplessInfoHolder, Format.Builder formatBuilder) {
if (trackType == C.TRACK_TYPE_AUDIO && gaplessInfoHolder.hasGaplessInfo()) {
formatBuilder
.setEncoderDelay(gaplessInfoHolder.encoderDelay)
.setEncoderPadding(gaplessInfoHolder.encoderPadding);
}
}
/**
* Parses a single userdata ilst element from a {@link ParsableByteArray}. The element is read * Parses a single userdata ilst element from a {@link ParsableByteArray}. The element is read
* starting from the current position of the {@link ParsableByteArray}, and the position is * starting from the current position of the {@link ParsableByteArray}, and the position is
* advanced by the size of the element. The position is advanced even if the element's type is * advanced by the size of the element. The position is advanced even if the element's type is
......
...@@ -514,11 +514,11 @@ public final class Mp4Extractor implements Extractor, SeekMap { ...@@ -514,11 +514,11 @@ public final class Mp4Extractor implements Extractor, SeekMap {
formatBuilder.setFrameRate(frameRate); formatBuilder.setFrameRate(frameRate);
} }
MetadataUtil.setFormatGaplessInfo(track.type, gaplessInfoHolder, formatBuilder);
MetadataUtil.setFormatMetadata( MetadataUtil.setFormatMetadata(
track.type, track.type,
udtaMetadata, udtaMetadata,
mdtaMetadata, mdtaMetadata,
gaplessInfoHolder,
formatBuilder, formatBuilder,
/* additionalEntries...= */ slowMotionMetadataEntries.toArray(new Metadata.Entry[0])); /* additionalEntries...= */ slowMotionMetadataEntries.toArray(new Metadata.Entry[0]));
mp4Track.trackOutput.format(formatBuilder.build()); mp4Track.trackOutput.format(formatBuilder.build());
......
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