mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Added getter methods to ContainerMediaChunk & a callback method whenever a load loop is finished
This commit is contained in:
parent
2d11a339de
commit
6287a22285
@ -135,6 +135,7 @@ public class ContainerMediaChunk extends BaseMediaChunk {
|
||||
nextLoadPosition = input.getPosition() - dataSpec.position;
|
||||
}
|
||||
} finally {
|
||||
onLoadIterationEnded();
|
||||
DataSourceUtil.closeQuietly(dataSource);
|
||||
}
|
||||
loadCompleted = !loadCanceled;
|
||||
@ -151,6 +152,30 @@ public class ContainerMediaChunk extends BaseMediaChunk {
|
||||
return baseMediaChunkOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method that is called to signal that a {@link #load()} has concluded. This is called in both
|
||||
* successful and error scenarios.
|
||||
*/
|
||||
protected void onLoadIterationEnded() {}
|
||||
|
||||
/**
|
||||
* Returns whether the current chunk's load has been canceled from {@link #cancelLoad()}
|
||||
*
|
||||
* @return true if {@link #cancelLoad()} was invoked
|
||||
*/
|
||||
public final boolean isLoadCanceled() {
|
||||
return loadCanceled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the next position to load in the chunk on a {@link #load()}
|
||||
*
|
||||
* @return the position to load from
|
||||
*/
|
||||
public final long getNextLoadPosition() {
|
||||
return nextLoadPosition;
|
||||
}
|
||||
|
||||
private void maybeWriteEmptySamples(BaseMediaChunkOutput output) {
|
||||
if (!MimeTypes.isImage(trackFormat.containerMimeType)) {
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user