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


Java TrackInfo类代码示例

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


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

示例1: vlc2exoTracks

import com.google.android.exoplayer.TrackInfo; //导入依赖的package包/类
/**
 * 
 * @param media
 * @param vlcTracks
 * @param lib
 * @return
 */
static com.google.android.exoplayer.TrackInfo[] vlc2exoTracks(long duration,
		org.videolan.libvlc.Media.Track[] vlcTracks, LibVLC lib) {
	com.google.android.exoplayer.TrackInfo[] res = new com.google.android.exoplayer.TrackInfo[vlcTracks.length];
	System.out.println("ExoVlcUtil.vlc2exoTracks() vlcTracks = " + vlcTracks.length);
	// Media.Track
	for (int i = 0; i < res.length; i++) {
		MediaFormat mf = track2mediaFormat(vlcTracks[i]);

		res[i] = new TrackInfo(mf.getString(MediaFormat.KEY_MIME), duration);
		System.out.println("\t track " + i + " mime type =" + mf.getString(MediaFormat.KEY_MIME) + " duration ="
				+ duration);
	}
	/*
	 * System.out.println(">>>> ExoVlcUtil.vlc2exoTracks() vlcTracks.length = "
	 * +vlcTracks.length); long l; for (int i = 0; i < vlcTracks.length;
	 * i++) { org.videolan.libvlc.TrackInfo vt = vlcTracks[i];
	 * System.out.println("\t\t >>>>>Codec("+i+") "+vlcTracks[i].Codec);
	 * res[i] = new TrackInfo( vt.Codec, (l=lib.getLength()) == -1 ?
	 * com.google.android.exoplayer.C.UNKNOWN_TIME_US : l * MS_2_MICRO); }
	 */
	return res;
}
 
开发者ID:tyazid,项目名称:Exoplayer_VLC,代码行数:30,代码来源:ExoVlcUtil.java

示例2: prepare

import com.google.android.exoplayer.TrackInfo; //导入依赖的package包/类
@Override
public boolean prepare() throws IOException {
  if (context != null) {
    mediaExtractor.setDataSource(context, uri, headers);
  } else {
    mediaExtractor.setDataSource(fileDescriptor, fileDescriptorOffset, fileDescriptorLength);
  }

  int trackCount = mediaExtractor.getTrackCount();
  trackInfos = new TrackInfo[trackCount];
  for (int i = 0; i < trackCount; i++) {
    android.media.MediaFormat format = mediaExtractor.getTrackFormat(i);
    long durationUs = format.containsKey(android.media.MediaFormat.KEY_DURATION)
        ? format.getLong(android.media.MediaFormat.KEY_DURATION) : C.UNKNOWN_TIME_US;
    String mime = format.getString(android.media.MediaFormat.KEY_MIME);
    trackInfos[i] = new TrackInfo(mime, durationUs);
  }

  return true;
}
 
开发者ID:tyazid,项目名称:Exoplayer_VLC,代码行数:21,代码来源:FrameworkSampleExtractor.java

示例3: prepare

import com.google.android.exoplayer.TrackInfo; //导入依赖的package包/类
@Override
public boolean prepare() throws IOException {
  if (!prepared) {
    extractor = new MediaExtractor();
    extractor.setDataSource(context, uri, headers);
    trackStates = new int[extractor.getTrackCount()];
    pendingDiscontinuities = new boolean[trackStates.length];
    trackInfos = new TrackInfo[trackStates.length];
    for (int i = 0; i < trackStates.length; i++) {
      android.media.MediaFormat format = extractor.getTrackFormat(i);
      long duration = format.containsKey(android.media.MediaFormat.KEY_DURATION) ?
          format.getLong(android.media.MediaFormat.KEY_DURATION) : TrackRenderer.UNKNOWN_TIME_US;
      String mime = format.getString(android.media.MediaFormat.KEY_MIME);
      trackInfos[i] = new TrackInfo(mime, duration);
    }
    prepared = true;
  }
  return true;
}
 
开发者ID:lsjwzh,项目名称:ExoPlayerCompat,代码行数:20,代码来源:FrameworkSampleSource.java

示例4: SingleSampleChunkSource

import com.google.android.exoplayer.TrackInfo; //导入依赖的package包/类
/**
 * @param dataSource A {@link DataSource} suitable for loading the sample data.
 * @param dataSpec Defines the location of the sample.
 * @param format The format of the sample.
 * @param durationUs The duration of the sample in microseconds, or {@link C#UNKNOWN_TIME_US} if
 *     the duration is unknown, or {@link C#MATCH_LONGEST_US} if the duration should match the
 *     duration of the longest track whose duration is known.
 * @param mediaFormat The sample media format. May be null.
 */
public SingleSampleChunkSource(DataSource dataSource, DataSpec dataSpec, Format format,
    long durationUs, MediaFormat mediaFormat) {
  this.dataSource = dataSource;
  this.dataSpec = dataSpec;
  this.format = format;
  this.durationUs = durationUs;
  this.mediaFormat = mediaFormat;
  trackInfo = new TrackInfo(format.mimeType, durationUs);
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:19,代码来源:SingleSampleChunkSource.java

示例5: SingleSampleChunkSource

import com.google.android.exoplayer.TrackInfo; //导入依赖的package包/类
/**
 * @param dataSource A {@link DataSource} suitable for loading the sample data.
 * @param dataSpec Defines the location of the sample.
 * @param format The format of the sample.
 * @param durationUs The duration of the sample in microseconds, or {@link C#UNKNOWN_TIME_US} if
 *     the duration is unknown.
 * @param mediaFormat The sample media format. May be null.
 */
public SingleSampleChunkSource(DataSource dataSource, DataSpec dataSpec, Format format,
    long durationUs, MediaFormat mediaFormat) {
  this.dataSource = dataSource;
  this.dataSpec = dataSpec;
  this.format = format;
  this.durationUs = durationUs;
  this.mediaFormat = mediaFormat;
  trackInfo = new TrackInfo(format.mimeType, durationUs);
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:18,代码来源:SingleSampleChunkSource.java

示例6: DashChunkSource

import com.google.android.exoplayer.TrackInfo; //导入依赖的package包/类
private DashChunkSource(ManifestFetcher<MediaPresentationDescription> manifestFetcher,
    MediaPresentationDescription initialManifest, int adaptationSetIndex,
    int[] representationIndices, DataSource dataSource, FormatEvaluator formatEvaluator,
    long liveEdgeLatencyUs) {
  this.manifestFetcher = manifestFetcher;
  this.currentManifest = initialManifest;
  this.adaptationSetIndex = adaptationSetIndex;
  this.representationIndices = representationIndices;
  this.dataSource = dataSource;
  this.evaluator = formatEvaluator;
  this.liveEdgeLatencyUs = liveEdgeLatencyUs;
  this.evaluation = new Evaluation();
  this.headerBuilder = new StringBuilder();

  psshInfo = getPsshInfo(currentManifest, adaptationSetIndex);
  Representation[] representations = getFilteredRepresentations(currentManifest,
      adaptationSetIndex, representationIndices);
  long periodDurationUs = (representations[0].periodDurationMs == TrackRenderer.UNKNOWN_TIME_US)
      ? TrackRenderer.UNKNOWN_TIME_US : representations[0].periodDurationMs * 1000;
  this.trackInfo = new TrackInfo(representations[0].format.mimeType, periodDurationUs);

  this.formats = new Format[representations.length];
  this.representationHolders = new HashMap<String, RepresentationHolder>();
  int maxWidth = 0;
  int maxHeight = 0;
  for (int i = 0; i < representations.length; i++) {
    formats[i] = representations[i].format;
    maxWidth = Math.max(formats[i].width, maxWidth);
    maxHeight = Math.max(formats[i].height, maxHeight);
    Extractor extractor = mimeTypeIsWebm(formats[i].mimeType) ? new WebmExtractor()
        : new FragmentedMp4Extractor();
    representationHolders.put(formats[i].id,
        new RepresentationHolder(representations[i], extractor));
  }
  this.maxWidth = maxWidth;
  this.maxHeight = maxHeight;
  Arrays.sort(formats, new DecreasingBandwidthComparator());
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:39,代码来源:DashChunkSource.java

示例7: getTrackInfos

import com.google.android.exoplayer.TrackInfo; //导入依赖的package包/类
@Override
public TrackInfo[] getTrackInfos() {
	Assertions.checkState(prepared);
	TrackInfo[] r = new TrackInfo[trackInfos.length];
	System.arraycopy(trackInfos, 0, r, 0, trackInfos.length);
	return r;
}
 
开发者ID:tyazid,项目名称:Exoplayer_VLC,代码行数:8,代码来源:VLCSampleExtractor.java

示例8: isActiveTrack

import com.google.android.exoplayer.TrackInfo; //导入依赖的package包/类
boolean isActiveTrack(int track) {
	Assertions.checkState(prepared);
	System.out.println(">>> VLCSampleExtractor.isActiveTrack() track = " + track);
	System.out.println(">>> VLCSampleExtractor.isActiveTrack() vlctracks.length = " + vlctracks.length);
	System.out.println(">>> VLCSampleExtractor.isActiveTrack() trackInfos.length = " + trackInfos.length);
	if (vlctracks.length != trackInfos.length) {
		if ((track < 0) && (track >= trackInfos.length)) {
			ExoVlcUtil.log(this, "getTrackMediaFormat() out of range : " + track + "; track len="
					+ trackInfos.length);
			return false;
		}
		/*
		 * if(track == trackInfos.length - 1 ) return true;
		 */
		TrackInfo t = trackInfos[track];
		System.out.println(">>> VLCSampleExtractor.isActiveTrack() track mime = " + t.mimeType);
		System.out.println(">>> VLCSampleExtractor.isActiveTrack() isVLCAudioMimeType = "
				+ ExoVlcUtil.isVLCAudioMimeType(t.mimeType));

		System.out.println(">>> VLCSampleExtractor.isActiveTrack() isVLCVideoMimeType= "
				+ ExoVlcUtil.isVLCVideoMimeType(t.mimeType));

		if ((ExoVlcUtil.isVLCAudioMimeType(t.mimeType) && track == lib.getAudioTrack())
				|| (ExoVlcUtil.isVLCVideoMimeType(t.mimeType)))
			return true;

		return false;
	}

	if ((track < 0) && (track >= vlctracks.length)) {
		ExoVlcUtil.log(this, "getTrackMediaFormat() out of range : " + track + "; track len=" + vlctracks.length);
		return false;
	}
	Track vt = vlctracks[track];
	if ((vt.type == Track.Type.Video) || (vt.type == Track.Type.Audio && track == lib.getAudioTrack())
			|| (vt.type == Track.Type.Text && track == lib.getSpuTrack()))
		return true;
	return false;
}
 
开发者ID:tyazid,项目名称:Exoplayer_VLC,代码行数:40,代码来源:VLCSampleExtractor.java

示例9: getTrackInfo

import com.google.android.exoplayer.TrackInfo; //导入依赖的package包/类
@Override
public TrackInfo getTrackInfo(int track) {
	Assertions.checkState(prepared);
	TrackInfo[] infos = extractor.getTrackInfos();
	if (track >= 0 && track < infos.length)
		return infos[track];
	ExoVlcUtil.log(this, " getTrackInfo : track=" + track + " is out of range [strat:0,lenght:" + infos.length
			+ "] => ret NULL");
	return null;
}
 
开发者ID:tyazid,项目名称:Exoplayer_VLC,代码行数:11,代码来源:VLCSampleSource.java

示例10: DashChunkSource

import com.google.android.exoplayer.TrackInfo; //导入依赖的package包/类
/**
 * @param dataSource A {@link DataSource} suitable for loading the media data.
 * @param evaluator Selects from the available formats.
 * @param representations The representations to be considered by the source.
 */
public DashChunkSource(DataSource dataSource, FormatEvaluator evaluator,
    Representation... representations) {
  this.dataSource = dataSource;
  this.evaluator = evaluator;
  this.formats = new Format[representations.length];
  this.extractors = new HashMap<String, Extractor>();
  this.segmentIndexes = new HashMap<String, DashSegmentIndex>();
  this.representations = new HashMap<String, Representation>();
  this.trackInfo = new TrackInfo(representations[0].format.mimeType,
      representations[0].periodDurationMs * 1000);
  this.evaluation = new Evaluation();
  int maxWidth = 0;
  int maxHeight = 0;
  for (int i = 0; i < representations.length; i++) {
    formats[i] = representations[i].format;
    maxWidth = Math.max(formats[i].width, maxWidth);
    maxHeight = Math.max(formats[i].height, maxHeight);
    Extractor extractor = formats[i].mimeType.startsWith(MimeTypes.VIDEO_WEBM)
        ? new WebmExtractor() : new FragmentedMp4Extractor();
    extractors.put(formats[i].id, extractor);
    this.representations.put(formats[i].id, representations[i]);
    DashSegmentIndex segmentIndex = representations[i].getIndex();
    if (segmentIndex != null) {
      segmentIndexes.put(formats[i].id, segmentIndex);
    }
  }
  this.maxWidth = maxWidth;
  this.maxHeight = maxHeight;
  Arrays.sort(formats, new DecreasingBandwidthComparator());
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:36,代码来源:DashChunkSource.java

示例11: getTrackInfo

import com.google.android.exoplayer.TrackInfo; //导入依赖的package包/类
@Override
public TrackInfo getTrackInfo(int track) {
  Assertions.checkState(prepared);
  return trackInfos[track];
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:6,代码来源:HlsSampleSource.java

示例12: getTrackInfo

import com.google.android.exoplayer.TrackInfo; //导入依赖的package包/类
@Override
public TrackInfo getTrackInfo() {
  return selectedSource.getTrackInfo();
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:5,代码来源:MultiTrackChunkSource.java

示例13: getTrackInfo

import com.google.android.exoplayer.TrackInfo; //导入依赖的package包/类
@Override
public TrackInfo getTrackInfo() {
  return trackInfo;
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:5,代码来源:SingleSampleChunkSource.java

示例14: getTrackInfo

import com.google.android.exoplayer.TrackInfo; //导入依赖的package包/类
@Override
public TrackInfo getTrackInfo(int track) {
  Assertions.checkState(state == STATE_PREPARED || state == STATE_ENABLED);
  Assertions.checkState(track == 0);
  return chunkSource.getTrackInfo();
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:7,代码来源:ChunkSampleSource.java

示例15: DashChunkSource

import com.google.android.exoplayer.TrackInfo; //导入依赖的package包/类
DashChunkSource(ManifestFetcher<MediaPresentationDescription> manifestFetcher,
    MediaPresentationDescription initialManifest, int adaptationSetIndex,
    int[] representationIndices, DataSource dataSource, FormatEvaluator formatEvaluator,
    Clock systemClock, long liveEdgeLatencyUs, long elapsedRealtimeOffsetUs,
    boolean startAtLiveEdge, Handler eventHandler, EventListener eventListener) {
  this.manifestFetcher = manifestFetcher;
  this.currentManifest = initialManifest;
  this.adaptationSetIndex = adaptationSetIndex;
  this.representationIndices = representationIndices;
  this.dataSource = dataSource;
  this.formatEvaluator = formatEvaluator;
  this.systemClock = systemClock;
  this.liveEdgeLatencyUs = liveEdgeLatencyUs;
  this.elapsedRealtimeOffsetUs = elapsedRealtimeOffsetUs;
  this.startAtLiveEdge = startAtLiveEdge;
  this.eventHandler = eventHandler;
  this.eventListener = eventListener;
  this.evaluation = new Evaluation();
  this.headerBuilder = new StringBuilder();
  this.seekRangeValues = new long[2];

  drmInitData = getDrmInitData(currentManifest, adaptationSetIndex);
  Representation[] representations = getFilteredRepresentations(currentManifest,
      adaptationSetIndex, representationIndices);
  long periodDurationUs = (representations[0].periodDurationMs == TrackRenderer.UNKNOWN_TIME_US)
      ? TrackRenderer.UNKNOWN_TIME_US : representations[0].periodDurationMs * 1000;
  this.trackInfo = new TrackInfo(representations[0].format.mimeType, periodDurationUs);

  this.formats = new Format[representations.length];
  this.representationHolders = new HashMap<>();
  int maxWidth = 0;
  int maxHeight = 0;
  for (int i = 0; i < representations.length; i++) {
    formats[i] = representations[i].format;
    maxWidth = Math.max(formats[i].width, maxWidth);
    maxHeight = Math.max(formats[i].height, maxHeight);
    Extractor extractor = mimeTypeIsWebm(formats[i].mimeType) ? new WebmExtractor()
        : new FragmentedMp4Extractor();
    representationHolders.put(formats[i].id,
        new RepresentationHolder(representations[i], new ChunkExtractorWrapper(extractor)));
  }
  this.maxWidth = maxWidth;
  this.maxHeight = maxHeight;
  Arrays.sort(formats, new DecreasingBandwidthComparator());
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:46,代码来源:DashChunkSource.java


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