当前位置: 首页>>代码示例>>Java>>正文


Java StreamElement类代码示例

本文整理汇总了Java中com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.StreamElement的典型用法代码示例。如果您正苦于以下问题:Java StreamElement类的具体用法?Java StreamElement怎么用?Java StreamElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StreamElement类属于com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest包,在下文中一共展示了StreamElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseStreamElementStartTag

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.StreamElement; //导入依赖的package包/类
private void parseStreamElementStartTag(XmlPullParser parser) throws ParserException {
  type = parseType(parser);
  putNormalizedAttribute(KEY_TYPE, type);
  if (type == StreamElement.TYPE_TEXT) {
    subType = parseRequiredString(parser, KEY_SUB_TYPE);
  } else {
    subType = parser.getAttributeValue(null, KEY_SUB_TYPE);
  }
  name = parser.getAttributeValue(null, KEY_NAME);
  qualityLevels = parseInt(parser, KEY_QUALITY_LEVELS, -1);
  url = parseRequiredString(parser, KEY_URL);
  maxWidth = parseInt(parser, KEY_MAX_WIDTH, -1);
  maxHeight = parseInt(parser, KEY_MAX_HEIGHT, -1);
  displayWidth = parseInt(parser, KEY_DISPLAY_WIDTH, -1);
  displayHeight = parseInt(parser, KEY_DISPLAY_HEIGHT, -1);
  language = parser.getAttributeValue(null, KEY_LANGUAGE);
  timescale = parseInt(parser, KEY_TIME_SCALE, -1);
  if (timescale == -1) {
    timescale = (Long) getNormalizedAttribute(KEY_TIME_SCALE);
  }
  startTimes = new ArrayList<>();
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:23,代码来源:SmoothStreamingManifestParser.java

示例2: parseStreamElementStartTag

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.StreamElement; //导入依赖的package包/类
private void parseStreamElementStartTag(XmlPullParser parser) throws ParserException {
  type = parseType(parser);
  putNormalizedAttribute(KEY_TYPE, type);
  if (type == StreamElement.TYPE_TEXT) {
    subType = parseRequiredString(parser, KEY_SUB_TYPE);
  } else {
    subType = parser.getAttributeValue(null, KEY_SUB_TYPE);
  }
  name = parser.getAttributeValue(null, KEY_NAME);
  qualityLevels = parseInt(parser, KEY_QUALITY_LEVELS, -1);
  url = parseRequiredString(parser, KEY_URL);
  maxWidth = parseInt(parser, KEY_MAX_WIDTH, -1);
  maxHeight = parseInt(parser, KEY_MAX_HEIGHT, -1);
  displayWidth = parseInt(parser, KEY_DISPLAY_WIDTH, -1);
  displayHeight = parseInt(parser, KEY_DISPLAY_HEIGHT, -1);
  language = parser.getAttributeValue(null, KEY_LANGUAGE);
  putNormalizedAttribute(KEY_LANGUAGE, language);
  timescale = parseInt(parser, KEY_TIME_SCALE, -1);
  if (timescale == -1) {
    timescale = (Long) getNormalizedAttribute(KEY_TIME_SCALE);
  }
  startTimes = new ArrayList<>();
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:24,代码来源:SmoothStreamingManifestParser.java

示例3: adaptiveTrack

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.StreamElement; //导入依赖的package包/类
@Override
public void adaptiveTrack(SmoothStreamingManifest manifest, int element, int[] trackIndices) {
  if (adaptiveFormatEvaluator == null) {
    // Do nothing.
    return;
  }
  MediaFormat maxHeightMediaFormat = null;
  StreamElement streamElement = manifest.streamElements[element];
  int maxWidth = -1;
  int maxHeight = -1;
  Format[] formats = new Format[trackIndices.length];
  for (int i = 0; i < formats.length; i++) {
    int manifestTrackIndex = trackIndices[i];
    formats[i] = streamElement.tracks[manifestTrackIndex].format;
    MediaFormat mediaFormat = initManifestTrack(manifest, element, manifestTrackIndex);
    if (maxHeightMediaFormat == null || mediaFormat.height > maxHeight) {
      maxHeightMediaFormat = mediaFormat;
    }
    maxWidth = Math.max(maxWidth, mediaFormat.width);
    maxHeight = Math.max(maxHeight, mediaFormat.height);
  }
  Arrays.sort(formats, new DecreasingBandwidthComparator());
  MediaFormat adaptiveMediaFormat = maxHeightMediaFormat.copyAsAdaptive(null);
  tracks.add(new ExposedTrack(adaptiveMediaFormat, element, formats, maxWidth, maxHeight));
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:26,代码来源:SmoothStreamingChunkSource.java

示例4: parseStreamElementStartTag

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.StreamElement; //导入依赖的package包/类
private void parseStreamElementStartTag(XmlPullParser parser) throws ParserException {
  type = parseType(parser);
  putNormalizedAttribute(KEY_TYPE, type);
  if (type == StreamElement.TYPE_TEXT) {
    subType = parseRequiredString(parser, KEY_SUB_TYPE);
  } else {
    subType = parser.getAttributeValue(null, KEY_SUB_TYPE);
  }
  name = parser.getAttributeValue(null, KEY_NAME);
  qualityLevels = parseInt(parser, KEY_QUALITY_LEVELS, -1);
  url = parseRequiredString(parser, KEY_URL);
  maxWidth = parseInt(parser, KEY_MAX_WIDTH, -1);
  maxHeight = parseInt(parser, KEY_MAX_HEIGHT, -1);
  displayWidth = parseInt(parser, KEY_DISPLAY_WIDTH, -1);
  displayHeight = parseInt(parser, KEY_DISPLAY_HEIGHT, -1);
  language = parser.getAttributeValue(null, KEY_LANGUAGE);
  timescale = parseInt(parser, KEY_TIME_SCALE, -1);
  if (timescale == -1) {
    timescale = (Long) getNormalizedAttribute(KEY_TIME_SCALE);
  }
  startTimes = new ArrayList<Long>();
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:23,代码来源:SmoothStreamingManifestParser.java

示例5: continueBuffering

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.StreamElement; //导入依赖的package包/类
@Override
public void continueBuffering(long playbackPositionUs) {
  if (manifestFetcher == null || !currentManifest.isLive || fatalError != null) {
    return;
  }

  SmoothStreamingManifest newManifest = manifestFetcher.getManifest();
  if (currentManifest != newManifest && newManifest != null) {
    StreamElement currentElement = getElement(currentManifest);
    StreamElement newElement = getElement(newManifest);
    if (newElement.chunkCount == 0) {
      currentManifestChunkOffset += currentElement.chunkCount;
    } else if (currentElement.chunkCount > 0) {
      currentManifestChunkOffset += currentElement.getChunkIndex(newElement.getStartTimeUs(0));
    }
    currentManifest = newManifest;
    finishedCurrentManifest = false;
  }

  if (finishedCurrentManifest && (SystemClock.elapsedRealtime()
      > manifestFetcher.getManifestLoadTimestamp() + MINIMUM_MANIFEST_REFRESH_PERIOD_MS)) {
    manifestFetcher.requestRefresh();
  }
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:25,代码来源:SmoothStreamingChunkSource.java

示例6: parseStreamElementStartTag

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.StreamElement; //导入依赖的package包/类
private void parseStreamElementStartTag(XmlPullParser parser) throws ParserException {
  type = parseType(parser);
  putNormalizedAttribute(KEY_TYPE, type);
  if (type == StreamElement.TYPE_TEXT) {
    subType = parseRequiredString(parser, KEY_SUB_TYPE);
  } else {
    subType = parser.getAttributeValue(null, KEY_SUB_TYPE);
  }
  name = parser.getAttributeValue(null, KEY_NAME);
  qualityLevels = parseInt(parser, KEY_QUALITY_LEVELS, -1);
  url = parseRequiredString(parser, KEY_URL);
  maxWidth = parseInt(parser, KEY_MAX_WIDTH, -1);
  maxHeight = parseInt(parser, KEY_MAX_HEIGHT, -1);
  displayWidth = parseInt(parser, KEY_DISPLAY_WIDTH, -1);
  displayHeight = parseInt(parser, KEY_DISPLAY_HEIGHT, -1);
  language = parser.getAttributeValue(null, KEY_LANGUAGE);
  timeScale = parseInt(parser, KEY_TIME_SCALE, -1);
  if (timeScale == -1) {
    timeScale = (Long) getNormalizedAttribute(KEY_TIME_SCALE);
  }
  startTimes = new long[parseRequiredInt(parser, KEY_CHUNKS)];
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:23,代码来源:SmoothStreamingManifestParser.java

示例7: build

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.StreamElement; //导入依赖的package包/类
@Override
public Object build() {
  StreamElement[] streamElementArray = new StreamElement[streamElements.size()];
  streamElements.toArray(streamElementArray);
  return new SmoothStreamingManifest(majorVersion, minorVersion, timescale, duration,
      dvrWindowLength, lookAheadCount, isLive, protectionElement, streamElementArray);
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:8,代码来源:SmoothStreamingManifestParser.java

示例8: parseType

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.StreamElement; //导入依赖的package包/类
private int parseType(XmlPullParser parser) throws ParserException {
  String value = parser.getAttributeValue(null, KEY_TYPE);
  if (value != null) {
    if (KEY_TYPE_AUDIO.equalsIgnoreCase(value)) {
      return StreamElement.TYPE_AUDIO;
    } else if (KEY_TYPE_VIDEO.equalsIgnoreCase(value)) {
      return StreamElement.TYPE_VIDEO;
    } else if (KEY_TYPE_TEXT.equalsIgnoreCase(value)) {
      return StreamElement.TYPE_TEXT;
    } else {
      throw new ParserException("Invalid key value[" + value + "]");
    }
  }
  throw new MissingFieldException(KEY_TYPE);
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:16,代码来源:SmoothStreamingManifestParser.java

示例9: continueBuffering

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.StreamElement; //导入依赖的package包/类
@Override
public void continueBuffering(long playbackPositionUs) {
  if (manifestFetcher == null || !currentManifest.isLive || fatalError != null) {
    return;
  }

  SmoothStreamingManifest newManifest = manifestFetcher.getManifest();
  if (currentManifest != newManifest && newManifest != null) {
    StreamElement currentElement = getElement(currentManifest);
    int currentElementChunkCount = currentElement.chunkCount;
    StreamElement newElement = getElement(newManifest);
    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);
      }
    }
    currentManifest = newManifest;
    finishedCurrentManifest = false;
  }

  if (finishedCurrentManifest && (SystemClock.elapsedRealtime()
      > manifestFetcher.getManifestLoadStartTimestamp() + MINIMUM_MANIFEST_REFRESH_PERIOD_MS)) {
    manifestFetcher.requestRefresh();
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:36,代码来源:SmoothStreamingChunkSource.java

示例10: getLiveSeekPosition

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.StreamElement; //导入依赖的package包/类
/**
 * For live playbacks, determines the seek position that snaps playback to be
 * {@link #liveEdgeLatencyUs} behind the live edge of the current manifest
 *
 * @return The seek position in microseconds.
 */
private long getLiveSeekPosition() {
  long liveEdgeTimestampUs = Long.MIN_VALUE;
  for (int i = 0; i < currentManifest.streamElements.length; i++) {
    StreamElement streamElement = currentManifest.streamElements[i];
    if (streamElement.chunkCount > 0) {
      long elementLiveEdgeTimestampUs =
          streamElement.getStartTimeUs(streamElement.chunkCount - 1)
          + streamElement.getChunkDurationUs(streamElement.chunkCount - 1);
      liveEdgeTimestampUs = Math.max(liveEdgeTimestampUs, elementLiveEdgeTimestampUs);
    }
  }
  return liveEdgeTimestampUs - liveEdgeLatencyUs;
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:20,代码来源:SmoothStreamingChunkSource.java

示例11: selectTracks

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.StreamElement; //导入依赖的package包/类
@Override
public void selectTracks(SmoothStreamingManifest manifest, Output output) throws IOException {
  for (int i = 0; i < manifest.streamElements.length; i++) {
    TrackElement[] tracks = manifest.streamElements[i].tracks;
    if (manifest.streamElements[i].type == streamElementType) {
      if (streamElementType == StreamElement.TYPE_VIDEO) {
        int[] trackIndices;
        if (filterVideoRepresentations) {
          trackIndices = VideoFormatSelectorUtil.selectVideoFormatsForDefaultDisplay(
              context, Arrays.asList(tracks), null,
              filterProtectedHdContent && manifest.protectionElement != null);
        } else {
          trackIndices = Util.firstIntegersArray(tracks.length);
        }
        int trackCount = trackIndices.length;
        if (trackCount > 1) {
          output.adaptiveTrack(manifest, i, trackIndices);
        }
        for (int j = 0; j < trackCount; j++) {
          output.fixedTrack(manifest, i, trackIndices[j]);
        }
      } else {
        for (int j = 0; j < tracks.length; j++) {
          output.fixedTrack(manifest, i, j);
        }
      }
    }
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:30,代码来源:DefaultSmoothStreamingTrackSelector.java

示例12: continueBuffering

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.StreamElement; //导入依赖的package包/类
@Override
public void continueBuffering(long playbackPositionUs) {
  if (manifestFetcher == null || !currentManifest.isLive || fatalError != null) {
    return;
  }

  SmoothStreamingManifest newManifest = manifestFetcher.getManifest();
  if (currentManifest != newManifest && newManifest != null) {
    StreamElement currentElement = currentManifest.streamElements[enabledTrack.elementIndex];
    int currentElementChunkCount = currentElement.chunkCount;
    StreamElement newElement = newManifest.streamElements[enabledTrack.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);
      }
    }
    currentManifest = newManifest;
    needManifestRefresh = false;
  }

  if (needManifestRefresh && (SystemClock.elapsedRealtime()
      > manifestFetcher.getManifestLoadStartTimestamp() + MINIMUM_MANIFEST_REFRESH_PERIOD_MS)) {
    manifestFetcher.requestRefresh();
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:36,代码来源:SmoothStreamingChunkSource.java

示例13: getLiveSeekPosition

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.StreamElement; //导入依赖的package包/类
/**
 * For live playbacks, determines the seek position that snaps playback to be
 * {@code liveEdgeLatencyUs} behind the live edge of the provided manifest.
 *
 * @param manifest The manifest.
 * @param liveEdgeLatencyUs The live edge latency, in microseconds.
 * @return The seek position in microseconds.
 */
private static long getLiveSeekPosition(SmoothStreamingManifest manifest,
    long liveEdgeLatencyUs) {
  long liveEdgeTimestampUs = Long.MIN_VALUE;
  for (int i = 0; i < manifest.streamElements.length; i++) {
    StreamElement streamElement = manifest.streamElements[i];
    if (streamElement.chunkCount > 0) {
      long elementLiveEdgeTimestampUs =
          streamElement.getStartTimeUs(streamElement.chunkCount - 1)
          + streamElement.getChunkDurationUs(streamElement.chunkCount - 1);
      liveEdgeTimestampUs = Math.max(liveEdgeTimestampUs, elementLiveEdgeTimestampUs);
    }
  }
  return liveEdgeTimestampUs - liveEdgeLatencyUs;
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:23,代码来源:SmoothStreamingChunkSource.java

示例14: getManifestTrackIndex

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.StreamElement; //导入依赖的package包/类
private static int getManifestTrackIndex(StreamElement element, Format format) {
  TrackElement[] tracks = element.tracks;
  for (int i = 0; i < tracks.length; i++) {
    if (tracks[i].format.equals(format)) {
      return i;
    }
  }
  // Should never happen.
  throw new IllegalStateException("Invalid format: " + format);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:11,代码来源:SmoothStreamingChunkSource.java

示例15: build

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.StreamElement; //导入依赖的package包/类
@Override
public Object build() {
  StreamElement[] streamElementArray = new StreamElement[streamElements.size()];
  streamElements.toArray(streamElementArray);
  return new SmoothStreamingManifest(majorVersion, minorVersion, timeScale, duration,
      lookAheadCount, protectionElement, streamElementArray);
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:8,代码来源:SmoothStreamingManifestParser.java


注:本文中的com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.StreamElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。