• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java TrackElement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: build

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.TrackElement; //导入依赖的package包/类
@Override
public Object build() {
  TrackElement[] trackElements = new TrackElement[tracks.size()];
  tracks.toArray(trackElements);
  return new StreamElement(baseUri, url, type, subType, timescale, name, qualityLevels,
      maxWidth, maxHeight, displayWidth, displayHeight, language, trackElements, startTimes,
      lastChunkDuration);
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:9,代码来源:SmoothStreamingManifestParser.java


示例2: getTrackIndex

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.TrackElement; //导入依赖的package包/类
private int getTrackIndex(Format format) {
  TrackElement[] tracks = currentManifest.streamElements[streamElementIndex].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:XueyanLiu,项目名称:miku,代码行数:11,代码来源:SmoothStreamingChunkSource.java


示例3: selectTracks

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.TrackElement; //导入依赖的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


示例4: getManifestTrackIndex

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.TrackElement; //导入依赖的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


示例5: build

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.TrackElement; //导入依赖的package包/类
@Override
public Object build() {
  TrackElement[] trackElements = new TrackElement[tracks.size()];
  tracks.toArray(trackElements);
  return new StreamElement(type, subType, timeScale, name, qualityLevels, url, maxWidth,
      maxHeight, displayWidth, displayHeight, language, trackElements, startTimes);
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:8,代码来源:SmoothStreamingManifestParser.java


示例6: addChild

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.TrackElement; //导入依赖的package包/类
@Override
public void addChild(Object child) {
  if (child instanceof TrackElement) {
    tracks.add((TrackElement) child);
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:7,代码来源:SmoothStreamingManifestParser.java


示例7: onManifest

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.TrackElement; //导入依赖的package包/类
@Override
public void onManifest(String contentId, SmoothStreamingManifest manifest) {
  Handler mainHandler = playerActivity.getMainHandler();
  LoadControl loadControl = new DefaultLoadControl(new BufferPool(BUFFER_SEGMENT_SIZE));
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();

  // Obtain stream elements for playback.
  int maxDecodableFrameSize = MediaCodecUtil.maxH264DecodableFrameSize();
  int audioStreamElementIndex = -1;
  int videoStreamElementIndex = -1;
  ArrayList<Integer> videoTrackIndexList = new ArrayList<Integer>();
  for (int i = 0; i < manifest.streamElements.length; i++) {
    if (audioStreamElementIndex == -1
        && manifest.streamElements[i].type == StreamElement.TYPE_AUDIO) {
      audioStreamElementIndex = i;
    } else if (videoStreamElementIndex == -1
        && manifest.streamElements[i].type == StreamElement.TYPE_VIDEO) {
      videoStreamElementIndex = i;
      StreamElement streamElement = manifest.streamElements[i];
      for (int j = 0; j < streamElement.tracks.length; j++) {
        TrackElement trackElement = streamElement.tracks[j];
        if (trackElement.maxWidth * trackElement.maxHeight <= maxDecodableFrameSize) {
          videoTrackIndexList.add(j);
        } else {
          // The device isn't capable of playing this stream.
        }
      }
    }
  }
  int[] videoTrackIndices = Util.toArray(videoTrackIndexList);

  // Build the video renderer.
  DataSource videoDataSource = new UriDataSource(userAgent, bandwidthMeter);
  ChunkSource videoChunkSource = new SmoothStreamingChunkSource(manifestFetcher,
      videoStreamElementIndex, videoTrackIndices, videoDataSource,
      new AdaptiveEvaluator(bandwidthMeter), LIVE_EDGE_LATENCY_MS);
  ChunkSampleSource videoSampleSource = new ChunkSampleSource(videoChunkSource, loadControl,
      VIDEO_BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, true);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(videoSampleSource,
      MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 0, mainHandler, playerActivity, 50);

  // Build the audio renderer.
  DataSource audioDataSource = new UriDataSource(userAgent, bandwidthMeter);
  ChunkSource audioChunkSource = new SmoothStreamingChunkSource(manifestFetcher,
      audioStreamElementIndex, new int[] {0}, audioDataSource,
      new FormatEvaluator.FixedEvaluator(), LIVE_EDGE_LATENCY_MS);
  SampleSource audioSampleSource = new ChunkSampleSource(audioChunkSource, loadControl,
      AUDIO_BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, true);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(
      audioSampleSource);
  callback.onRenderers(videoRenderer, audioRenderer);
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:53,代码来源:SmoothStreamingRendererBuilder.java


示例8: StreamElementParser

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.TrackElement; //导入依赖的package包/类
public StreamElementParser(ElementParser parent, Uri baseUri) {
  super(parent, baseUri, TAG);
  this.baseUri = baseUri;
  tracks = new LinkedList<TrackElement>();
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:6,代码来源:SmoothStreamingManifestParser.java


示例9: SmoothStreamingChunkSource

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.TrackElement; //导入依赖的package包/类
private SmoothStreamingChunkSource(ManifestFetcher<SmoothStreamingManifest> manifestFetcher,
    SmoothStreamingManifest initialManifest, int streamElementIndex, int[] trackIndices,
    DataSource dataSource, FormatEvaluator formatEvaluator, long liveEdgeLatencyMs) {
  this.manifestFetcher = manifestFetcher;
  this.streamElementIndex = streamElementIndex;
  this.currentManifest = initialManifest;
  this.dataSource = dataSource;
  this.formatEvaluator = formatEvaluator;
  this.liveEdgeLatencyUs = liveEdgeLatencyMs * 1000;

  StreamElement streamElement = getElement(initialManifest);
  trackInfo = new TrackInfo(streamElement.tracks[0].mimeType, initialManifest.durationUs);
  evaluation = new Evaluation();

  TrackEncryptionBox[] trackEncryptionBoxes = null;
  ProtectionElement protectionElement = initialManifest.protectionElement;
  if (protectionElement != null) {
    byte[] keyId = getKeyId(protectionElement.data);
    trackEncryptionBoxes = new TrackEncryptionBox[1];
    trackEncryptionBoxes[0] = new TrackEncryptionBox(true, INITIALIZATION_VECTOR_SIZE, keyId);
    psshInfo = Collections.singletonMap(protectionElement.uuid, protectionElement.data);
  } else {
    psshInfo = null;
  }

  int trackCount = trackIndices != null ? trackIndices.length : streamElement.tracks.length;
  formats = new SmoothStreamingFormat[trackCount];
  extractors = new SparseArray<FragmentedMp4Extractor>();
  int maxWidth = 0;
  int maxHeight = 0;
  for (int i = 0; i < trackCount; i++) {
    int trackIndex = trackIndices != null ? trackIndices[i] : i;
    TrackElement trackElement = streamElement.tracks[trackIndex];
    formats[i] = new SmoothStreamingFormat(String.valueOf(trackIndex), trackElement.mimeType,
        trackElement.maxWidth, trackElement.maxHeight, trackElement.numChannels,
        trackElement.sampleRate, trackElement.bitrate, trackIndex);
    maxWidth = Math.max(maxWidth, trackElement.maxWidth);
    maxHeight = Math.max(maxHeight, trackElement.maxHeight);

    MediaFormat mediaFormat = getMediaFormat(streamElement, trackIndex);
    int trackType = streamElement.type == StreamElement.TYPE_VIDEO ? Track.TYPE_VIDEO
        : Track.TYPE_AUDIO;
    FragmentedMp4Extractor extractor = new FragmentedMp4Extractor(
        FragmentedMp4Extractor.WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME);
    extractor.setTrack(new Track(trackIndex, trackType, streamElement.timescale, mediaFormat,
        trackEncryptionBoxes));
    extractors.put(trackIndex, extractor);
  }
  this.maxHeight = maxHeight;
  this.maxWidth = maxWidth;
  Arrays.sort(formats, new DecreasingBandwidthComparator());
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:53,代码来源:SmoothStreamingChunkSource.java


示例10: SmoothStreamingChunkSource

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.TrackElement; //导入依赖的package包/类
private SmoothStreamingChunkSource(ManifestFetcher<SmoothStreamingManifest> manifestFetcher,
    SmoothStreamingManifest initialManifest, int streamElementIndex, int[] trackIndices,
    DataSource dataSource, FormatEvaluator formatEvaluator, long liveEdgeLatencyMs) {
  this.manifestFetcher = manifestFetcher;
  this.streamElementIndex = streamElementIndex;
  this.currentManifest = initialManifest;
  this.dataSource = dataSource;
  this.formatEvaluator = formatEvaluator;
  this.liveEdgeLatencyUs = liveEdgeLatencyMs * 1000;

  StreamElement streamElement = getElement(initialManifest);
  trackInfo = new TrackInfo(streamElement.tracks[0].mimeType, initialManifest.durationUs);
  evaluation = new Evaluation();

  TrackEncryptionBox[] trackEncryptionBoxes = null;
  ProtectionElement protectionElement = initialManifest.protectionElement;
  if (protectionElement != null) {
    byte[] keyId = getKeyId(protectionElement.data);
    trackEncryptionBoxes = new TrackEncryptionBox[1];
    trackEncryptionBoxes[0] = new TrackEncryptionBox(true, INITIALIZATION_VECTOR_SIZE, keyId);
    psshInfo = Collections.singletonMap(protectionElement.uuid, protectionElement.data);
  } else {
    psshInfo = null;
  }

  int trackCount = trackIndices != null ? trackIndices.length : streamElement.tracks.length;
  formats = new SmoothStreamingFormat[trackCount];
  extractors = new SparseArray<FragmentedMp4Extractor>();
  int maxWidth = 0;
  int maxHeight = 0;
  for (int i = 0; i < trackCount; i++) {
    int trackIndex = trackIndices != null ? trackIndices[i] : i;
    TrackElement trackElement = streamElement.tracks[trackIndex];
    formats[i] = new SmoothStreamingFormat(String.valueOf(trackIndex), trackElement.mimeType,
        trackElement.maxWidth, trackElement.maxHeight, trackElement.numChannels,
        trackElement.sampleRate, trackElement.bitrate, trackIndex);
    maxWidth = Math.max(maxWidth, trackElement.maxWidth);
    maxHeight = Math.max(maxHeight, trackElement.maxHeight);

    MediaFormat mediaFormat = getMediaFormat(streamElement, trackIndex);
    int trackType = streamElement.type == StreamElement.TYPE_VIDEO ? Track.TYPE_VIDEO
        : Track.TYPE_AUDIO;
    FragmentedMp4Extractor extractor = new FragmentedMp4Extractor(
        FragmentedMp4Extractor.WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME);
    extractor.setTrack(new Track(trackIndex, trackType, streamElement.timescale,
        initialManifest.durationUs, mediaFormat, trackEncryptionBoxes));
    extractors.put(trackIndex, extractor);
  }
  this.maxHeight = maxHeight;
  this.maxWidth = maxWidth;
  Arrays.sort(formats, new DecreasingBandwidthComparator());
}
 
开发者ID:tyazid,项目名称:Exoplayer_VLC,代码行数:53,代码来源:SmoothStreamingChunkSource.java


示例11: StreamElementParser

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.TrackElement; //导入依赖的package包/类
public StreamElementParser(ElementParser parent) {
  super(TAG, parent);
  tracks = new LinkedList<TrackElement>();
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:5,代码来源:SmoothStreamingManifestParser.java


示例12: SmoothStreamingChunkSource

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.TrackElement; //导入依赖的package包/类
/**
 * @param baseUrl The base URL for the streams.
 * @param manifest The manifest parsed from {@code baseUrl + "/Manifest"}.
 * @param streamElementIndex The index of the stream element in the manifest to be provided by
 *     the source.
 * @param trackIndices The indices of the tracks within the stream element to be considered by
 *     the source. May be null if all tracks within the element should be considered.
 * @param dataSource A {@link DataSource} suitable for loading the media data.
 * @param formatEvaluator Selects from the available formats.
 */
public SmoothStreamingChunkSource(String baseUrl, SmoothStreamingManifest manifest,
    int streamElementIndex, int[] trackIndices, DataSource dataSource,
    FormatEvaluator formatEvaluator) {
  this.baseUrl = baseUrl;
  this.streamElement = manifest.streamElements[streamElementIndex];
  this.trackInfo = new TrackInfo(streamElement.tracks[0].mimeType, manifest.getDurationUs());
  this.dataSource = dataSource;
  this.formatEvaluator = formatEvaluator;
  this.evaluation = new Evaluation();

  TrackEncryptionBox[] trackEncryptionBoxes = null;
  ProtectionElement protectionElement = manifest.protectionElement;
  if (protectionElement != null) {
    byte[] keyId = getKeyId(protectionElement.data);
    trackEncryptionBoxes = new TrackEncryptionBox[1];
    trackEncryptionBoxes[0] = new TrackEncryptionBox(true, INITIALIZATION_VECTOR_SIZE, keyId);
  }

  int trackCount = trackIndices != null ? trackIndices.length : streamElement.tracks.length;
  formats = new SmoothStreamingFormat[trackCount];
  extractors = new SparseArray<FragmentedMp4Extractor>();
  int maxWidth = 0;
  int maxHeight = 0;
  for (int i = 0; i < trackCount; i++) {
    int trackIndex = trackIndices != null ? trackIndices[i] : i;
    TrackElement trackElement = streamElement.tracks[trackIndex];
    formats[i] = new SmoothStreamingFormat(String.valueOf(trackIndex), trackElement.mimeType,
        trackElement.maxWidth, trackElement.maxHeight, trackElement.numChannels,
        trackElement.sampleRate, trackElement.bitrate, trackIndex);
    maxWidth = Math.max(maxWidth, trackElement.maxWidth);
    maxHeight = Math.max(maxHeight, trackElement.maxHeight);

    MediaFormat mediaFormat = getMediaFormat(streamElement, trackIndex);
    int trackType = streamElement.type == StreamElement.TYPE_VIDEO ? Track.TYPE_VIDEO
        : Track.TYPE_AUDIO;
    FragmentedMp4Extractor extractor = new FragmentedMp4Extractor(
        FragmentedMp4Extractor.WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME);
    extractor.setTrack(new Track(trackIndex, trackType, streamElement.timeScale, mediaFormat,
        trackEncryptionBoxes));
    if (protectionElement != null) {
      extractor.putPsshInfo(protectionElement.uuid, protectionElement.data);
    }
    extractors.put(trackIndex, extractor);
  }
  this.maxHeight = maxHeight;
  this.maxWidth = maxWidth;
  Arrays.sort(formats, new DecreasingBandwidthComparator());
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:59,代码来源:SmoothStreamingChunkSource.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Configuration类代码示例发布时间:2022-05-23
下一篇:
Java SPacketCombatEvent类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap