mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Allow ContainerMediaChunks to provide their own TrackOutputProvider.
Adding a protected method for that allows to supply a customized TrackOutputProvider to the ExtractorWrapper used by the ContainerMediaChunk (e.g. for logging purposes). The alternative would be to provide a TrackOutputProvider through the ChunkSampleStream constructor, but the extra initialization taking place in the ChunkSampleStream constructor would need to move somewhere else and some methods of BaseMediaChunkOutput would need to move to the TrackOutputProvider interface. This seems too much effort for niche customization case. PiperOrigin-RevId: 242448776
This commit is contained in:
parent
66e416b615
commit
2d7b9d876f
@ -121,7 +121,7 @@ public class ContainerMediaChunk extends BaseMediaChunk {
|
|||||||
BaseMediaChunkOutput output = getOutput();
|
BaseMediaChunkOutput output = getOutput();
|
||||||
output.setSampleOffsetUs(sampleOffsetUs);
|
output.setSampleOffsetUs(sampleOffsetUs);
|
||||||
extractorWrapper.init(
|
extractorWrapper.init(
|
||||||
output,
|
getTrackOutputProvider(output),
|
||||||
clippedStartTimeUs == C.TIME_UNSET
|
clippedStartTimeUs == C.TIME_UNSET
|
||||||
? C.TIME_UNSET
|
? C.TIME_UNSET
|
||||||
: (clippedStartTimeUs - sampleOffsetUs),
|
: (clippedStartTimeUs - sampleOffsetUs),
|
||||||
@ -144,4 +144,17 @@ public class ContainerMediaChunk extends BaseMediaChunk {
|
|||||||
loadCompleted = true;
|
loadCompleted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link ChunkExtractorWrapper.TrackOutputProvider} to be used by the wrapped
|
||||||
|
* extractor.
|
||||||
|
*
|
||||||
|
* @param baseMediaChunkOutput The {@link BaseMediaChunkOutput} most recently passed to {@link
|
||||||
|
* #init(BaseMediaChunkOutput)}.
|
||||||
|
* @return A {@link ChunkExtractorWrapper.TrackOutputProvider} to be used by the wrapped
|
||||||
|
* extractor.
|
||||||
|
*/
|
||||||
|
protected ChunkExtractorWrapper.TrackOutputProvider getTrackOutputProvider(
|
||||||
|
BaseMediaChunkOutput baseMediaChunkOutput) {
|
||||||
|
return baseMediaChunkOutput;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user