diff --git a/robolectricutils/src/main/java/com/google/android/exoplayer2/robolectric/PlaybackOutput.java b/robolectricutils/src/main/java/com/google/android/exoplayer2/robolectric/PlaybackOutput.java index bcd3561482..2724835e4e 100644 --- a/robolectricutils/src/main/java/com/google/android/exoplayer2/robolectric/PlaybackOutput.java +++ b/robolectricutils/src/main/java/com/google/android/exoplayer2/robolectric/PlaybackOutput.java @@ -19,6 +19,18 @@ import android.graphics.Bitmap; import androidx.annotation.Nullable; import com.google.android.exoplayer2.SimpleExoPlayer; import com.google.android.exoplayer2.metadata.Metadata; +import com.google.android.exoplayer2.metadata.dvbsi.AppInfoTable; +import com.google.android.exoplayer2.metadata.emsg.EventMessage; +import com.google.android.exoplayer2.metadata.flac.PictureFrame; +import com.google.android.exoplayer2.metadata.flac.VorbisComment; +import com.google.android.exoplayer2.metadata.icy.IcyHeaders; +import com.google.android.exoplayer2.metadata.icy.IcyInfo; +import com.google.android.exoplayer2.metadata.id3.Id3Frame; +import com.google.android.exoplayer2.metadata.mp4.MdtaMetadataEntry; +import com.google.android.exoplayer2.metadata.mp4.MotionPhotoMetadata; +import com.google.android.exoplayer2.metadata.mp4.SlowMotionData; +import com.google.android.exoplayer2.metadata.mp4.SmtaMetadataEntry; +import com.google.android.exoplayer2.metadata.scte35.SpliceCommand; import com.google.android.exoplayer2.testutil.CapturingRenderersFactory; import com.google.android.exoplayer2.testutil.Dumper; import com.google.android.exoplayer2.text.Cue; @@ -89,13 +101,38 @@ public final class PlaybackOutput implements Dumper.Dumpable { dumper.startBlock("Metadata[" + i + "]"); Metadata metadata = metadatas.get(i); for (int j = 0; j < metadata.length(); j++) { - dumper.add("entry[" + j + "]", metadata.get(j).getClass().getSimpleName()); + dumper.add("entry[" + j + "]", getEntryAsString(metadata.get(j))); } dumper.endBlock(); } dumper.endBlock(); } + /** + * Returns {@code entry.toString()} if we know the implementation overrides it, otherwise returns + * the simple class name. + */ + private static String getEntryAsString(Metadata.Entry entry) { + if (entry instanceof EventMessage + || entry instanceof PictureFrame + || entry instanceof VorbisComment + || entry instanceof Id3Frame + || entry instanceof MdtaMetadataEntry + || entry instanceof MotionPhotoMetadata + || entry instanceof SlowMotionData + || entry instanceof SmtaMetadataEntry + || entry instanceof AppInfoTable + || entry instanceof IcyHeaders + || entry instanceof IcyInfo + || entry instanceof SpliceCommand + || "com.google.android.exoplayer2.hls.HlsTrackMetadataEntry" + .equals(entry.getClass().getCanonicalName())) { + return entry.toString(); + } else { + return entry.getClass().getSimpleName(); + } + } + private void dumpSubtitles(Dumper dumper) { if (subtitles.isEmpty()) { return; diff --git a/testdata/src/test/assets/playbackdumps/ts/sample_ait.ts.dump b/testdata/src/test/assets/playbackdumps/ts/sample_ait.ts.dump index 5e351ddba3..75a33b8c24 100644 --- a/testdata/src/test/assets/playbackdumps/ts/sample_ait.ts.dump +++ b/testdata/src/test/assets/playbackdumps/ts/sample_ait.ts.dump @@ -22,11 +22,11 @@ MediaCodecAdapter (exotest.audio.eac3): buffers[19] = length 0, hash 1 MetadataOutput: Metadata[0]: - entry[0] = AppInfoTable - entry[1] = AppInfoTable + entry[0] = Ait(controlCode=1,url=http://static-cdn.arte.tv/redbutton/index_fr.html) + entry[1] = Ait(controlCode=2,url=http://www.arte.tv/hbbtvv2/index.html?lang=fr_FR&page=PLUS7) Metadata[1]: - entry[0] = AppInfoTable - entry[1] = AppInfoTable + entry[0] = Ait(controlCode=1,url=http://static-cdn.arte.tv/redbutton/index_fr.html) + entry[1] = Ait(controlCode=2,url=http://www.arte.tv/hbbtvv2/index.html?lang=fr_FR&page=PLUS7) Metadata[2]: - entry[0] = AppInfoTable - entry[1] = AppInfoTable + entry[0] = Ait(controlCode=1,url=http://static-cdn.arte.tv/redbutton/index_fr.html) + entry[1] = Ait(controlCode=2,url=http://www.arte.tv/hbbtvv2/index.html?lang=fr_FR&page=PLUS7) diff --git a/testdata/src/test/assets/playbackdumps/ts/sample_scte35.ts.dump b/testdata/src/test/assets/playbackdumps/ts/sample_scte35.ts.dump index ef0f2405ef..d57c3ed9df 100644 --- a/testdata/src/test/assets/playbackdumps/ts/sample_scte35.ts.dump +++ b/testdata/src/test/assets/playbackdumps/ts/sample_scte35.ts.dump @@ -12,8 +12,8 @@ MediaCodecAdapter (exotest.video.mpeg2): buffers[2] = length 0, hash 1 MetadataOutput: Metadata[0]: - entry[0] = SpliceInsertCommand + entry[0] = SCTE-35 splice command: type=SpliceInsertCommand Metadata[1]: - entry[0] = SpliceInsertCommand + entry[0] = SCTE-35 splice command: type=SpliceInsertCommand Metadata[2]: - entry[0] = SpliceInsertCommand + entry[0] = SCTE-35 splice command: type=SpliceInsertCommand diff --git a/testdata/src/test/assets/playbackdumps/ts/sample_with_id3.adts.dump b/testdata/src/test/assets/playbackdumps/ts/sample_with_id3.adts.dump index 9385ac2c57..0434d23c38 100644 --- a/testdata/src/test/assets/playbackdumps/ts/sample_with_id3.adts.dump +++ b/testdata/src/test/assets/playbackdumps/ts/sample_with_id3.adts.dump @@ -147,7 +147,7 @@ MediaCodecAdapter (exotest.audio.aac): buffers[144] = length 0, hash 1 MetadataOutput: Metadata[0]: - entry[0] = ApicFrame + entry[0] = APIC: mimeType=image/jpeg, description=Hello World Metadata[1]: - entry[0] = CommentFrame - entry[1] = ApicFrame + entry[0] = COMM: language=eng, description=description + entry[1] = APIC: mimeType=image/jpeg, description=Hello World