use of androidx.media3.exoplayer.metadata.MetadataRenderer in project media by androidx.
the class MetadataRendererTest method runRenderer.
private static List<Metadata> runRenderer(byte[] input) throws ExoPlaybackException {
List<Metadata> metadata = new ArrayList<>();
MetadataRenderer renderer = new MetadataRenderer(metadata::add, /* outputLooper= */
null);
FakeSampleStream fakeSampleStream = new FakeSampleStream(new DefaultAllocator(/* trimOnReset= */
true, /* individualAllocationSize= */
1024), /* mediaSourceEventDispatcher= */
null, DrmSessionManager.DRM_UNSUPPORTED, new DrmSessionEventListener.EventDispatcher(), EMSG_FORMAT, ImmutableList.of(sample(/* timeUs= */
0, C.BUFFER_FLAG_KEY_FRAME, input), END_OF_STREAM_ITEM));
fakeSampleStream.writeData(/* startPositionUs= */
0);
renderer.replaceStream(new Format[] { EMSG_FORMAT }, fakeSampleStream, /* startPositionUs= */
0L, /* offsetUs= */
0L);
// Read the format
renderer.render(/* positionUs= */
0, /* elapsedRealtimeUs= */
0);
// Read the data
renderer.render(/* positionUs= */
0, /* elapsedRealtimeUs= */
0);
return Collections.unmodifiableList(metadata);
}
Aggregations