本文整理汇总了Java中com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement类的典型用法代码示例。如果您正苦于以下问题:Java StreamElement类的具体用法?Java StreamElement怎么用?Java StreamElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StreamElement类属于com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest包,在下文中一共展示了StreamElement类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement; //导入依赖的package包/类
@Override
public Object build() {
StreamElement[] streamElementArray = new StreamElement[streamElements.size()];
streamElements.toArray(streamElementArray);
if (protectionElement != null) {
DrmInitData drmInitData = new DrmInitData(new SchemeData(protectionElement.uuid,
MimeTypes.VIDEO_MP4, protectionElement.data));
for (StreamElement streamElement : streamElementArray) {
for (int i = 0; i < streamElement.formats.length; i++) {
streamElement.formats[i] = streamElement.formats[i].copyWithDrmInitData(drmInitData);
}
}
}
return new SsManifest(majorVersion, minorVersion, timescale, duration, dvrWindowLength,
lookAheadCount, isLive, protectionElement, streamElementArray);
}
示例2: DefaultSsChunkSource
import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement; //导入依赖的package包/类
/**
* @param manifestLoaderErrorThrower Throws errors affecting loading of manifests.
* @param manifest The initial manifest.
* @param elementIndex The index of the stream element in the manifest.
* @param trackSelection The track selection.
* @param dataSource A {@link DataSource} suitable for loading the media data.
* @param trackEncryptionBoxes Track encryption boxes for the stream.
*/
public DefaultSsChunkSource(LoaderErrorThrower manifestLoaderErrorThrower, SsManifest manifest,
int elementIndex, TrackSelection trackSelection, DataSource dataSource,
TrackEncryptionBox[] trackEncryptionBoxes) {
this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
this.manifest = manifest;
this.elementIndex = elementIndex;
this.trackSelection = trackSelection;
this.dataSource = dataSource;
StreamElement streamElement = manifest.streamElements[elementIndex];
extractorWrappers = new ChunkExtractorWrapper[trackSelection.length()];
for (int i = 0; i < extractorWrappers.length; i++) {
int manifestTrackIndex = trackSelection.getIndexInTrackGroup(i);
Format format = streamElement.formats[manifestTrackIndex];
int nalUnitLengthFieldLength = streamElement.type == C.TRACK_TYPE_VIDEO ? 4 : 0;
Track track = new Track(manifestTrackIndex, streamElement.type, streamElement.timescale,
C.TIME_UNSET, manifest.durationUs, format, Track.TRANSFORMATION_NONE,
trackEncryptionBoxes, nalUnitLengthFieldLength, null, null);
FragmentedMp4Extractor extractor = new FragmentedMp4Extractor(
FragmentedMp4Extractor.FLAG_WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME
| FragmentedMp4Extractor.FLAG_WORKAROUND_IGNORE_TFDT_BOX, null, track);
extractorWrappers[i] = new ChunkExtractorWrapper(extractor, format);
}
}
示例3: updateManifest
import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement; //导入依赖的package包/类
@Override
public void updateManifest(SsManifest newManifest) {
StreamElement currentElement = manifest.streamElements[elementIndex];
int currentElementChunkCount = currentElement.chunkCount;
StreamElement newElement = newManifest.streamElements[elementIndex];
if (currentElementChunkCount == 0 || newElement.chunkCount == 0) {
// There's no overlap between the old and new elements because at least one is empty.
currentManifestChunkOffset += currentElementChunkCount;
} else {
long currentElementEndTimeUs = currentElement.getStartTimeUs(currentElementChunkCount - 1)
+ currentElement.getChunkDurationUs(currentElementChunkCount - 1);
long newElementStartTimeUs = newElement.getStartTimeUs(0);
if (currentElementEndTimeUs <= newElementStartTimeUs) {
// There's no overlap between the old and new elements.
currentManifestChunkOffset += currentElementChunkCount;
} else {
// The new element overlaps with the old one.
currentManifestChunkOffset += currentElement.getChunkIndex(newElementStartTimeUs);
}
}
manifest = newManifest;
}
示例4: DefaultSsChunkSource
import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement; //导入依赖的package包/类
/**
* @param manifestLoaderErrorThrower Throws errors affecting loading of manifests.
* @param manifest The initial manifest.
* @param elementIndex The index of the stream element in the manifest.
* @param trackSelection The track selection.
* @param dataSource A {@link DataSource} suitable for loading the media data.
* @param trackEncryptionBoxes Track encryption boxes for the stream.
*/
public DefaultSsChunkSource(LoaderErrorThrower manifestLoaderErrorThrower, SsManifest manifest,
int elementIndex, TrackSelection trackSelection, DataSource dataSource,
TrackEncryptionBox[] trackEncryptionBoxes) {
this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
this.manifest = manifest;
this.elementIndex = elementIndex;
this.trackSelection = trackSelection;
this.dataSource = dataSource;
StreamElement streamElement = manifest.streamElements[elementIndex];
extractorWrappers = new ChunkExtractorWrapper[trackSelection.length()];
for (int i = 0; i < extractorWrappers.length; i++) {
int manifestTrackIndex = trackSelection.getIndexInTrackGroup(i);
Format format = streamElement.formats[manifestTrackIndex];
int nalUnitLengthFieldLength = streamElement.type == C.TRACK_TYPE_VIDEO ? 4 : 0;
Track track = new Track(manifestTrackIndex, streamElement.type, streamElement.timescale,
C.TIME_UNSET, manifest.durationUs, format, Track.TRANSFORMATION_NONE,
trackEncryptionBoxes, nalUnitLengthFieldLength, null, null);
FragmentedMp4Extractor extractor = new FragmentedMp4Extractor(
FragmentedMp4Extractor.FLAG_WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME
| FragmentedMp4Extractor.FLAG_WORKAROUND_IGNORE_TFDT_BOX, track, null);
extractorWrappers[i] = new ChunkExtractorWrapper(extractor, format, false, false);
}
}
示例5: DefaultSsChunkSource
import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement; //导入依赖的package包/类
/**
* @param manifestLoaderErrorThrower Throws errors affecting loading of manifests.
* @param manifest The initial manifest.
* @param elementIndex The index of the stream element in the manifest.
* @param trackSelection The track selection.
* @param dataSource A {@link DataSource} suitable for loading the media data.
* @param trackEncryptionBoxes Track encryption boxes for the stream.
*/
public DefaultSsChunkSource(LoaderErrorThrower manifestLoaderErrorThrower, SsManifest manifest,
int elementIndex, TrackSelection trackSelection, DataSource dataSource,
TrackEncryptionBox[] trackEncryptionBoxes) {
this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
this.manifest = manifest;
this.elementIndex = elementIndex;
this.trackSelection = trackSelection;
this.dataSource = dataSource;
StreamElement streamElement = manifest.streamElements[elementIndex];
extractorWrappers = new ChunkExtractorWrapper[trackSelection.length()];
for (int i = 0; i < extractorWrappers.length; i++) {
int manifestTrackIndex = trackSelection.getIndexInTrackGroup(i);
Format format = streamElement.formats[manifestTrackIndex];
int nalUnitLengthFieldLength = streamElement.type == C.TRACK_TYPE_VIDEO ? 4 : 0;
Track track = new Track(manifestTrackIndex, streamElement.type, streamElement.timescale,
C.TIME_UNSET, manifest.durationUs, format, Track.TRANSFORMATION_NONE,
trackEncryptionBoxes, nalUnitLengthFieldLength, null, null);
FragmentedMp4Extractor extractor = new FragmentedMp4Extractor(
FragmentedMp4Extractor.FLAG_WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME
| FragmentedMp4Extractor.FLAG_WORKAROUND_IGNORE_TFDT_BOX, null, track, null);
extractorWrappers[i] = new ChunkExtractorWrapper(extractor, streamElement.type, format);
}
}
示例6: assertManifestEquals
import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement; //导入依赖的package包/类
private static void assertManifestEquals(SsManifest expected, SsManifest actual) {
assertEquals(expected.durationUs, actual.durationUs);
assertEquals(expected.dvrWindowLengthUs, actual.dvrWindowLengthUs);
assertEquals(expected.isLive, actual.isLive);
assertEquals(expected.lookAheadCount, actual.lookAheadCount);
assertEquals(expected.majorVersion, actual.majorVersion);
assertEquals(expected.minorVersion, actual.minorVersion);
assertEquals(expected.protectionElement.uuid, actual.protectionElement.uuid);
assertEquals(expected.protectionElement, actual.protectionElement);
for (int i = 0; i < expected.streamElements.length; i++) {
StreamElement expectedStreamElement = expected.streamElements[i];
StreamElement actualStreamElement = actual.streamElements[i];
assertEquals(expectedStreamElement.chunkCount, actualStreamElement.chunkCount);
assertEquals(expectedStreamElement.displayHeight, actualStreamElement.displayHeight);
assertEquals(expectedStreamElement.displayWidth, actualStreamElement.displayWidth);
assertEquals(expectedStreamElement.language, actualStreamElement.language);
assertEquals(expectedStreamElement.maxHeight, actualStreamElement.maxHeight);
assertEquals(expectedStreamElement.maxWidth, actualStreamElement.maxWidth);
assertEquals(expectedStreamElement.name, actualStreamElement.name);
assertEquals(expectedStreamElement.subType, actualStreamElement.subType);
assertEquals(expectedStreamElement.timescale, actualStreamElement.timescale);
assertEquals(expectedStreamElement.type, actualStreamElement.type);
MoreAsserts.assertEquals(expectedStreamElement.formats, actualStreamElement.formats);
}
}
示例7: resolveTimeToLiveEdgeUs
import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement; //导入依赖的package包/类
private long resolveTimeToLiveEdgeUs(long playbackPositionUs) {
if (!manifest.isLive) {
return C.TIME_UNSET;
}
StreamElement currentElement = manifest.streamElements[elementIndex];
int lastChunkIndex = currentElement.chunkCount - 1;
long lastChunkEndTimeUs = currentElement.getStartTimeUs(lastChunkIndex)
+ currentElement.getChunkDurationUs(lastChunkIndex);
return lastChunkEndTimeUs - playbackPositionUs;
}
示例8: getAllSegments
import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement; //导入依赖的package包/类
@Override
protected List<Segment> getAllSegments(DataSource dataSource, SsManifest manifest,
boolean allowIndexLoadErrors) throws InterruptedException, IOException {
ArrayList<Segment> segments = new ArrayList<>();
for (int i = 0; i < manifest.streamElements.length; i++) {
StreamElement streamElement = manifest.streamElements[i];
for (int j = 0; j < streamElement.formats.length; j++) {
segments.addAll(getSegments(dataSource, manifest, new TrackKey[] {new TrackKey(i, j)},
allowIndexLoadErrors));
}
}
return segments;
}
示例9: getSegments
import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement; //导入依赖的package包/类
@Override
protected List<Segment> getSegments(DataSource dataSource, SsManifest manifest,
TrackKey[] keys, boolean allowIndexLoadErrors) throws InterruptedException, IOException {
ArrayList<Segment> segments = new ArrayList<>();
for (TrackKey key : keys) {
StreamElement streamElement = manifest.streamElements[key.streamElementIndex];
for (int i = 0; i < streamElement.chunkCount; i++) {
segments.add(new Segment(streamElement.getStartTimeUs(i),
new DataSpec(streamElement.buildRequestUri(key.trackIndex, i))));
}
}
return segments;
}
示例10: newSsManifest
import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement; //导入依赖的package包/类
private static SsManifest newSsManifest(StreamElement... streamElements) {
return new SsManifest(1, 2, 1000, 5000, 0, 0, false, DUMMY_PROTECTION_ELEMENT, streamElements);
}
示例11: newStreamElement
import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement; //导入依赖的package包/类
private static StreamElement newStreamElement(String name, Format... formats) {
return new StreamElement("baseUri", "chunkTemplate", C.TRACK_TYPE_VIDEO, "subType",
1000, name, 1024, 768, 1024, 768, null, formats, Collections.<Long>emptyList(), 0);
}