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;
int trackType,
@Nullable Metadata udtaMetadata,
@Nullable Metadata mdtaMetadata,
GaplessInfoHolder gaplessInfoHolder,
Format.Builder formatBuilder,
Metadata.Entry... additionalEntries) {
Metadata formatMetadata = new Metadata();
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.
if (udtaMetadata != null) {
formatMetadata = udtaMetadata;
......@@ -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
* 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
......
......@@ -514,11 +514,11 @@ public final class Mp4Extractor implements Extractor, SeekMap {
formatBuilder.setFrameRate(frameRate);
}
MetadataUtil.setFormatGaplessInfo(track.type, gaplessInfoHolder, formatBuilder);
MetadataUtil.setFormatMetadata(
track.type,
udtaMetadata,
mdtaMetadata,
gaplessInfoHolder,
formatBuilder,
/* additionalEntries...= */ slowMotionMetadataEntries.toArray(new Metadata.Entry[0]));
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