Generalize manifest parser parameters in DASH and SmoothStreaming MediaSources
This allows custom parsers to be used. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=152005477
This commit is contained in:
parent
107e0ebc46
commit
dd2914f580
@ -59,7 +59,7 @@ public final class ParsingLoadable<T> implements Loadable {
|
|||||||
public final int type;
|
public final int type;
|
||||||
|
|
||||||
private final DataSource dataSource;
|
private final DataSource dataSource;
|
||||||
private final Parser<T> parser;
|
private final Parser<? extends T> parser;
|
||||||
|
|
||||||
private volatile T result;
|
private volatile T result;
|
||||||
private volatile boolean isCanceled;
|
private volatile boolean isCanceled;
|
||||||
@ -71,7 +71,7 @@ public final class ParsingLoadable<T> implements Loadable {
|
|||||||
* @param type See {@link #type}.
|
* @param type See {@link #type}.
|
||||||
* @param parser Parses the object from the response.
|
* @param parser Parses the object from the response.
|
||||||
*/
|
*/
|
||||||
public ParsingLoadable(DataSource dataSource, Uri uri, int type, Parser<T> parser) {
|
public ParsingLoadable(DataSource dataSource, Uri uri, int type, Parser<? extends T> parser) {
|
||||||
this.dataSource = dataSource;
|
this.dataSource = dataSource;
|
||||||
this.dataSpec = new DataSpec(uri, DataSpec.FLAG_ALLOW_GZIP);
|
this.dataSpec = new DataSpec(uri, DataSpec.FLAG_ALLOW_GZIP);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
@ -88,7 +88,7 @@ public final class DashMediaSource implements MediaSource {
|
|||||||
private final int minLoadableRetryCount;
|
private final int minLoadableRetryCount;
|
||||||
private final long livePresentationDelayMs;
|
private final long livePresentationDelayMs;
|
||||||
private final EventDispatcher eventDispatcher;
|
private final EventDispatcher eventDispatcher;
|
||||||
private final DashManifestParser manifestParser;
|
private final ParsingLoadable.Parser<? extends DashManifest> manifestParser;
|
||||||
private final ManifestCallback manifestCallback;
|
private final ManifestCallback manifestCallback;
|
||||||
private final Object manifestUriLock;
|
private final Object manifestUriLock;
|
||||||
private final SparseArray<DashMediaPeriod> periodsById;
|
private final SparseArray<DashMediaPeriod> periodsById;
|
||||||
@ -200,15 +200,17 @@ public final class DashMediaSource implements MediaSource {
|
|||||||
* @param eventListener A listener of events. May be null if delivery of events is not required.
|
* @param eventListener A listener of events. May be null if delivery of events is not required.
|
||||||
*/
|
*/
|
||||||
public DashMediaSource(Uri manifestUri, DataSource.Factory manifestDataSourceFactory,
|
public DashMediaSource(Uri manifestUri, DataSource.Factory manifestDataSourceFactory,
|
||||||
DashManifestParser manifestParser, DashChunkSource.Factory chunkSourceFactory,
|
ParsingLoadable.Parser<? extends DashManifest> manifestParser,
|
||||||
int minLoadableRetryCount, long livePresentationDelayMs, Handler eventHandler,
|
DashChunkSource.Factory chunkSourceFactory, int minLoadableRetryCount,
|
||||||
|
long livePresentationDelayMs, Handler eventHandler,
|
||||||
AdaptiveMediaSourceEventListener eventListener) {
|
AdaptiveMediaSourceEventListener eventListener) {
|
||||||
this(null, manifestUri, manifestDataSourceFactory, manifestParser, chunkSourceFactory,
|
this(null, manifestUri, manifestDataSourceFactory, manifestParser, chunkSourceFactory,
|
||||||
minLoadableRetryCount, livePresentationDelayMs, eventHandler, eventListener);
|
minLoadableRetryCount, livePresentationDelayMs, eventHandler, eventListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DashMediaSource(DashManifest manifest, Uri manifestUri,
|
private DashMediaSource(DashManifest manifest, Uri manifestUri,
|
||||||
DataSource.Factory manifestDataSourceFactory, DashManifestParser manifestParser,
|
DataSource.Factory manifestDataSourceFactory,
|
||||||
|
ParsingLoadable.Parser<? extends DashManifest> manifestParser,
|
||||||
DashChunkSource.Factory chunkSourceFactory, int minLoadableRetryCount,
|
DashChunkSource.Factory chunkSourceFactory, int minLoadableRetryCount,
|
||||||
long livePresentationDelayMs, Handler eventHandler,
|
long livePresentationDelayMs, Handler eventHandler,
|
||||||
AdaptiveMediaSourceEventListener eventListener) {
|
AdaptiveMediaSourceEventListener eventListener) {
|
||||||
|
@ -71,7 +71,7 @@ public final class SsMediaSource implements MediaSource,
|
|||||||
private final int minLoadableRetryCount;
|
private final int minLoadableRetryCount;
|
||||||
private final long livePresentationDelayMs;
|
private final long livePresentationDelayMs;
|
||||||
private final EventDispatcher eventDispatcher;
|
private final EventDispatcher eventDispatcher;
|
||||||
private final SsManifestParser manifestParser;
|
private final ParsingLoadable.Parser<? extends SsManifest> manifestParser;
|
||||||
private final ArrayList<SsMediaPeriod> mediaPeriods;
|
private final ArrayList<SsMediaPeriod> mediaPeriods;
|
||||||
|
|
||||||
private Listener sourceListener;
|
private Listener sourceListener;
|
||||||
@ -171,15 +171,17 @@ public final class SsMediaSource implements MediaSource,
|
|||||||
* @param eventListener A listener of events. May be null if delivery of events is not required.
|
* @param eventListener A listener of events. May be null if delivery of events is not required.
|
||||||
*/
|
*/
|
||||||
public SsMediaSource(Uri manifestUri, DataSource.Factory manifestDataSourceFactory,
|
public SsMediaSource(Uri manifestUri, DataSource.Factory manifestDataSourceFactory,
|
||||||
SsManifestParser manifestParser, SsChunkSource.Factory chunkSourceFactory,
|
ParsingLoadable.Parser<? extends SsManifest> manifestParser,
|
||||||
int minLoadableRetryCount, long livePresentationDelayMs, Handler eventHandler,
|
SsChunkSource.Factory chunkSourceFactory, int minLoadableRetryCount,
|
||||||
|
long livePresentationDelayMs, Handler eventHandler,
|
||||||
AdaptiveMediaSourceEventListener eventListener) {
|
AdaptiveMediaSourceEventListener eventListener) {
|
||||||
this(null, manifestUri, manifestDataSourceFactory, manifestParser, chunkSourceFactory,
|
this(null, manifestUri, manifestDataSourceFactory, manifestParser, chunkSourceFactory,
|
||||||
minLoadableRetryCount, livePresentationDelayMs, eventHandler, eventListener);
|
minLoadableRetryCount, livePresentationDelayMs, eventHandler, eventListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SsMediaSource(SsManifest manifest, Uri manifestUri,
|
private SsMediaSource(SsManifest manifest, Uri manifestUri,
|
||||||
DataSource.Factory manifestDataSourceFactory, SsManifestParser manifestParser,
|
DataSource.Factory manifestDataSourceFactory,
|
||||||
|
ParsingLoadable.Parser<? extends SsManifest> manifestParser,
|
||||||
SsChunkSource.Factory chunkSourceFactory, int minLoadableRetryCount,
|
SsChunkSource.Factory chunkSourceFactory, int minLoadableRetryCount,
|
||||||
long livePresentationDelayMs, Handler eventHandler,
|
long livePresentationDelayMs, Handler eventHandler,
|
||||||
AdaptiveMediaSourceEventListener eventListener) {
|
AdaptiveMediaSourceEventListener eventListener) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user