ID3: Clean up logging + only add to audio track for MP4

This commit is contained in:
Oliver Woodman 2016-10-09 18:00:59 +01:00
parent ba1da140c6
commit 97e7fb85a7
2 changed files with 18 additions and 14 deletions

View File

@ -180,36 +180,38 @@ import java.util.Locale;
@Override @Override
public void onMetadata(Metadata metadata) { public void onMetadata(Metadata metadata) {
Log.i(TAG, "metadata [");
for (int i = 0; i < metadata.length(); i++) { for (int i = 0; i < metadata.length(); i++) {
Metadata.Entry entry = metadata.get(i); Metadata.Entry entry = metadata.get(i);
if (entry instanceof TxxxFrame) { if (entry instanceof TxxxFrame) {
TxxxFrame txxxFrame = (TxxxFrame) entry; TxxxFrame txxxFrame = (TxxxFrame) entry;
Log.i(TAG, String.format("ID3 TimedMetadata %s: description=%s, value=%s", txxxFrame.id, Log.i(TAG, String.format(" %s: description=%s, value=%s", txxxFrame.id,
txxxFrame.description, txxxFrame.value)); txxxFrame.description, txxxFrame.value));
} else if (entry instanceof PrivFrame) { } else if (entry instanceof PrivFrame) {
PrivFrame privFrame = (PrivFrame) entry; PrivFrame privFrame = (PrivFrame) entry;
Log.i(TAG, String.format("ID3 TimedMetadata %s: owner=%s", privFrame.id, privFrame.owner)); Log.i(TAG, String.format(" %s: owner=%s", privFrame.id, privFrame.owner));
} else if (entry instanceof GeobFrame) { } else if (entry instanceof GeobFrame) {
GeobFrame geobFrame = (GeobFrame) entry; GeobFrame geobFrame = (GeobFrame) entry;
Log.i(TAG, String.format("ID3 TimedMetadata %s: mimeType=%s, filename=%s, description=%s", Log.i(TAG, String.format(" %s: mimeType=%s, filename=%s, description=%s",
geobFrame.id, geobFrame.mimeType, geobFrame.filename, geobFrame.description)); geobFrame.id, geobFrame.mimeType, geobFrame.filename, geobFrame.description));
} else if (entry instanceof ApicFrame) { } else if (entry instanceof ApicFrame) {
ApicFrame apicFrame = (ApicFrame) entry; ApicFrame apicFrame = (ApicFrame) entry;
Log.i(TAG, String.format("ID3 TimedMetadata %s: mimeType=%s, description=%s", Log.i(TAG, String.format(" %s: mimeType=%s, description=%s",
apicFrame.id, apicFrame.mimeType, apicFrame.description)); apicFrame.id, apicFrame.mimeType, apicFrame.description));
} else if (entry instanceof TextInformationFrame) { } else if (entry instanceof TextInformationFrame) {
TextInformationFrame textInformationFrame = (TextInformationFrame) entry; TextInformationFrame textInformationFrame = (TextInformationFrame) entry;
Log.i(TAG, String.format("ID3 TimedMetadata %s: description=%s", textInformationFrame.id, Log.i(TAG, String.format(" %s: description=%s", textInformationFrame.id,
textInformationFrame.description)); textInformationFrame.description));
} else if (entry instanceof CommentFrame) { } else if (entry instanceof CommentFrame) {
CommentFrame commentFrame = (CommentFrame) entry; CommentFrame commentFrame = (CommentFrame) entry;
Log.i(TAG, String.format("ID3 TimedMetadata %s: language=%s text=%s", commentFrame.id, Log.i(TAG, String.format(" %s: language=%s description=%s", commentFrame.id,
commentFrame.language, commentFrame.text)); commentFrame.language, commentFrame.description));
} else if (entry instanceof Id3Frame) { } else if (entry instanceof Id3Frame) {
Id3Frame id3Frame = (Id3Frame) entry; Id3Frame id3Frame = (Id3Frame) entry;
Log.i(TAG, String.format("ID3 TimedMetadata %s", id3Frame.id)); Log.i(TAG, String.format(" %s", id3Frame.id));
} }
} }
Log.i(TAG, "]");
} }
// AudioRendererEventListener // AudioRendererEventListener

View File

@ -342,13 +342,15 @@ public final class Mp4Extractor implements Extractor, SeekMap {
// Allow ten source samples per output sample, like the platform extractor. // Allow ten source samples per output sample, like the platform extractor.
int maxInputSize = trackSampleTable.maximumSize + 3 * 10; int maxInputSize = trackSampleTable.maximumSize + 3 * 10;
Format format = track.format.copyWithMaxInputSize(maxInputSize); Format format = track.format.copyWithMaxInputSize(maxInputSize);
if (track.type == C.TRACK_TYPE_AUDIO && gaplessInfoHolder.hasGaplessInfo()) { if (track.type == C.TRACK_TYPE_AUDIO) {
if (gaplessInfoHolder.hasGaplessInfo()) {
format = format.copyWithGaplessInfo(gaplessInfoHolder.encoderDelay, format = format.copyWithGaplessInfo(gaplessInfoHolder.encoderDelay,
gaplessInfoHolder.encoderPadding); gaplessInfoHolder.encoderPadding);
} }
if (metadata != null) { if (metadata != null) {
format = format.copyWithMetadata(metadata); format = format.copyWithMetadata(metadata);
} }
}
mp4Track.trackOutput.format(format); mp4Track.trackOutput.format(format);
durationUs = Math.max(durationUs, track.durationUs); durationUs = Math.max(durationUs, track.durationUs);