Publish API for using MediaParser in DASH
PiperOrigin-RevId: 361828018
This commit is contained in:
parent
bcb9eb4314
commit
383b6d42f1
@ -62,12 +62,37 @@ public class DefaultDashChunkSource implements DashChunkSource {
|
|||||||
|
|
||||||
private final DataSource.Factory dataSourceFactory;
|
private final DataSource.Factory dataSourceFactory;
|
||||||
private final int maxSegmentsPerLoad;
|
private final int maxSegmentsPerLoad;
|
||||||
|
private final ChunkExtractor.Factory chunkExtractorFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Equivalent to {@link #Factory(ChunkExtractor.Factory, DataSource.Factory, int) new
|
||||||
|
* Factory(BundledChunkExtractor.FACTORY, dataSourceFactory, maxSegmentsPerLoad = 1)}.
|
||||||
|
*/
|
||||||
public Factory(DataSource.Factory dataSourceFactory) {
|
public Factory(DataSource.Factory dataSourceFactory) {
|
||||||
this(dataSourceFactory, /* maxSegmentsPerLoad= */ 1);
|
this(dataSourceFactory, /* maxSegmentsPerLoad= */ 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Equivalent to {@link #Factory(ChunkExtractor.Factory, DataSource.Factory, int) new
|
||||||
|
* Factory(BundledChunkExtractor.FACTORY, dataSourceFactory, maxSegmentsPerLoad)}.
|
||||||
|
*/
|
||||||
public Factory(DataSource.Factory dataSourceFactory, int maxSegmentsPerLoad) {
|
public Factory(DataSource.Factory dataSourceFactory, int maxSegmentsPerLoad) {
|
||||||
|
this(BundledChunkExtractor.FACTORY, dataSourceFactory, maxSegmentsPerLoad);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance.
|
||||||
|
*
|
||||||
|
* @param chunkExtractorFactory Creates {@link ChunkExtractor} instances to use for extracting
|
||||||
|
* chunks.
|
||||||
|
* @param dataSourceFactory Creates the {@link DataSource} to use for downloading chunks.
|
||||||
|
* @param maxSegmentsPerLoad See {@link DefaultDashChunkSource#DefaultDashChunkSource}.
|
||||||
|
*/
|
||||||
|
public Factory(
|
||||||
|
ChunkExtractor.Factory chunkExtractorFactory,
|
||||||
|
DataSource.Factory dataSourceFactory,
|
||||||
|
int maxSegmentsPerLoad) {
|
||||||
|
this.chunkExtractorFactory = chunkExtractorFactory;
|
||||||
this.dataSourceFactory = dataSourceFactory;
|
this.dataSourceFactory = dataSourceFactory;
|
||||||
this.maxSegmentsPerLoad = maxSegmentsPerLoad;
|
this.maxSegmentsPerLoad = maxSegmentsPerLoad;
|
||||||
}
|
}
|
||||||
@ -90,6 +115,7 @@ public class DefaultDashChunkSource implements DashChunkSource {
|
|||||||
dataSource.addTransferListener(transferListener);
|
dataSource.addTransferListener(transferListener);
|
||||||
}
|
}
|
||||||
return new DefaultDashChunkSource(
|
return new DefaultDashChunkSource(
|
||||||
|
chunkExtractorFactory,
|
||||||
manifestLoaderErrorThrower,
|
manifestLoaderErrorThrower,
|
||||||
manifest,
|
manifest,
|
||||||
periodIndex,
|
periodIndex,
|
||||||
@ -123,6 +149,8 @@ public class DefaultDashChunkSource implements DashChunkSource {
|
|||||||
private boolean missingLastSegment;
|
private boolean missingLastSegment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param chunkExtractorFactory Creates {@link ChunkExtractor} instances to use for extracting
|
||||||
|
* chunks.
|
||||||
* @param manifestLoaderErrorThrower Throws errors affecting loading of manifests.
|
* @param manifestLoaderErrorThrower Throws errors affecting loading of manifests.
|
||||||
* @param manifest The initial manifest.
|
* @param manifest The initial manifest.
|
||||||
* @param periodIndex The index of the period in the manifest.
|
* @param periodIndex The index of the period in the manifest.
|
||||||
@ -142,6 +170,7 @@ public class DefaultDashChunkSource implements DashChunkSource {
|
|||||||
* messages targeting the player. Maybe null if this is not necessary.
|
* messages targeting the player. Maybe null if this is not necessary.
|
||||||
*/
|
*/
|
||||||
public DefaultDashChunkSource(
|
public DefaultDashChunkSource(
|
||||||
|
ChunkExtractor.Factory chunkExtractorFactory,
|
||||||
LoaderErrorThrower manifestLoaderErrorThrower,
|
LoaderErrorThrower manifestLoaderErrorThrower,
|
||||||
DashManifest manifest,
|
DashManifest manifest,
|
||||||
int periodIndex,
|
int periodIndex,
|
||||||
|
@ -24,6 +24,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|||||||
import com.google.android.exoplayer2.C;
|
import com.google.android.exoplayer2.C;
|
||||||
import com.google.android.exoplayer2.Format;
|
import com.google.android.exoplayer2.Format;
|
||||||
import com.google.android.exoplayer2.source.TrackGroup;
|
import com.google.android.exoplayer2.source.TrackGroup;
|
||||||
|
import com.google.android.exoplayer2.source.chunk.BundledChunkExtractor;
|
||||||
import com.google.android.exoplayer2.source.chunk.ChunkHolder;
|
import com.google.android.exoplayer2.source.chunk.ChunkHolder;
|
||||||
import com.google.android.exoplayer2.source.dash.manifest.DashManifest;
|
import com.google.android.exoplayer2.source.dash.manifest.DashManifest;
|
||||||
import com.google.android.exoplayer2.source.dash.manifest.DashManifestParser;
|
import com.google.android.exoplayer2.source.dash.manifest.DashManifestParser;
|
||||||
@ -58,6 +59,7 @@ public class DefaultDashChunkSourceTest {
|
|||||||
SAMPLE_MPD_LIVE_WITH_OFFSET_INSIDE_WINDOW));
|
SAMPLE_MPD_LIVE_WITH_OFFSET_INSIDE_WINDOW));
|
||||||
DefaultDashChunkSource chunkSource =
|
DefaultDashChunkSource chunkSource =
|
||||||
new DefaultDashChunkSource(
|
new DefaultDashChunkSource(
|
||||||
|
BundledChunkExtractor.FACTORY,
|
||||||
new LoaderErrorThrower.Dummy(),
|
new LoaderErrorThrower.Dummy(),
|
||||||
manifest,
|
manifest,
|
||||||
/* periodIndex= */ 0,
|
/* periodIndex= */ 0,
|
||||||
@ -104,6 +106,7 @@ public class DefaultDashChunkSourceTest {
|
|||||||
ApplicationProvider.getApplicationContext(), SAMPLE_MPD_VOD));
|
ApplicationProvider.getApplicationContext(), SAMPLE_MPD_VOD));
|
||||||
DefaultDashChunkSource chunkSource =
|
DefaultDashChunkSource chunkSource =
|
||||||
new DefaultDashChunkSource(
|
new DefaultDashChunkSource(
|
||||||
|
BundledChunkExtractor.FACTORY,
|
||||||
new LoaderErrorThrower.Dummy(),
|
new LoaderErrorThrower.Dummy(),
|
||||||
manifest,
|
manifest,
|
||||||
/* periodIndex= */ 0,
|
/* periodIndex= */ 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user