本文整理汇总了Java中com.google.android.exoplayer.chunk.Format类的典型用法代码示例。如果您正苦于以下问题:Java Format类的具体用法?Java Format怎么用?Java Format使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Format类属于com.google.android.exoplayer.chunk包,在下文中一共展示了Format类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMediaMimeType
import com.google.android.exoplayer.chunk.Format; //导入依赖的package包/类
private static String getMediaMimeType(Format format) {
String formatMimeType = format.mimeType;
if (MimeTypes.isAudio(formatMimeType)) {
return MimeTypes.getAudioMediaMimeType(format.codecs);
} else if (MimeTypes.isVideo(formatMimeType)) {
return MimeTypes.getVideoMediaMimeType(format.codecs);
} else if (mimeTypeIsRawText(formatMimeType)) {
return formatMimeType;
} else if (MimeTypes.APPLICATION_MP4.equals(formatMimeType)) {
if ("stpp".equals(format.codecs)) {
return MimeTypes.APPLICATION_TTML;
}
if ("wvtt".equals(format.codecs)) {
return MimeTypes.APPLICATION_MP4VTT;
}
}
return null;
}
示例2: adaptiveTrack
import com.google.android.exoplayer.chunk.Format; //导入依赖的package包/类
@Override
public void adaptiveTrack(HlsMasterPlaylist playlist, Variant[] variants) {
Arrays.sort(variants, new Comparator<Variant>() {
private final Comparator<Format> formatComparator =
new Format.DecreasingBandwidthComparator();
@Override
public int compare(Variant first, Variant second) {
return formatComparator.compare(first.format, second.format);
}
});
int defaultVariantIndex = computeDefaultVariantIndex(playlist, variants, bandwidthMeter);
int maxWidth = -1;
int maxHeight = -1;
for (int i = 0; i < variants.length; i++) {
Format variantFormat = variants[i].format;
maxWidth = Math.max(variantFormat.width, maxWidth);
maxHeight = Math.max(variantFormat.height, maxHeight);
}
// TODO: We should allow the default values to be passed through the constructor.
// TODO: Print a warning if resolution tags are omitted.
maxWidth = maxWidth > 0 ? maxWidth : 1920;
maxHeight = maxHeight > 0 ? maxHeight : 1080;
tracks.add(new ExposedTrack(variants, defaultVariantIndex, maxWidth, maxHeight));
}
示例3: onDownstreamFormatChanged
import com.google.android.exoplayer.chunk.Format; //导入依赖的package包/类
@Override
public void onDownstreamFormatChanged(int sourceId, Format format, int trigger,
long mediaTimeMs) {
if (infoListener == null) {
return;
}
if (sourceId == TYPE_VIDEO) {
videoFormat = format;
infoListener.onVideoFormatEnabled(format, trigger, mediaTimeMs);
} else if (sourceId == TYPE_AUDIO) {
infoListener.onAudioFormatEnabled(format, trigger, mediaTimeMs);
}
}
示例4: onLoadStarted
import com.google.android.exoplayer.chunk.Format; //导入依赖的package包/类
@Override
public void onLoadStarted(int sourceId, long length, int type, int trigger, Format format,
long mediaStartTimeMs, long mediaEndTimeMs) {
if (infoListener != null) {
infoListener.onLoadStarted(sourceId, length, type, trigger, format, mediaStartTimeMs,
mediaEndTimeMs);
}
}
示例5: onLoadCompleted
import com.google.android.exoplayer.chunk.Format; //导入依赖的package包/类
@Override
public void onLoadCompleted(int sourceId, long bytesLoaded, int type, int trigger,
Format format,
long mediaStartTimeMs, long mediaEndTimeMs, long elapsedRealtimeMs,
long loadDurationMs) {
if (infoListener != null) {
infoListener
.onLoadCompleted(sourceId, bytesLoaded, type, trigger, format, mediaStartTimeMs,
mediaEndTimeMs, elapsedRealtimeMs, loadDurationMs);
}
}
示例6: onDownstreamFormatChanged
import com.google.android.exoplayer.chunk.Format; //导入依赖的package包/类
@Override
public void onDownstreamFormatChanged(int sourceId, Format format, int trigger,
long mediaTimeMs) {
if (infoListener == null) {
return;
}
if (sourceId == TYPE_VIDEO) {
videoFormat = format;
infoListener.onVideoFormatEnabled(format, trigger, mediaTimeMs);
} else if (sourceId == TYPE_AUDIO) {
infoListener.onAudioFormatEnabled(format, trigger, mediaTimeMs);
}
}
示例7: onLoadCompleted
import com.google.android.exoplayer.chunk.Format; //导入依赖的package包/类
@Override
public void onLoadCompleted(int sourceId, long bytesLoaded, int type, int trigger,
Format format,
long mediaStartTimeMs, long mediaEndTimeMs, long elapsedRealtimeMs,
long loadDurationMs) {
if (infoListener != null) {
infoListener.onLoadCompleted(sourceId, bytesLoaded, type, trigger, format,
mediaStartTimeMs,
mediaEndTimeMs, elapsedRealtimeMs, loadDurationMs);
}
}
示例8: onLoadStarted
import com.google.android.exoplayer.chunk.Format; //导入依赖的package包/类
@Override
public void onLoadStarted(int sourceId, long length, int type, int trigger, Format format,
long mediaStartTimeMs, long mediaEndTimeMs) {
loadStartTimeMs[sourceId] = SystemClock.elapsedRealtime();
if (VerboseLogUtil.isTagEnabled(TAG)) {
Log.v(TAG, "loadStart [" + getSessionTimeString() + ", " + sourceId + ", " + type
+ ", " + mediaStartTimeMs + ", " + mediaEndTimeMs + "]");
}
}
示例9: onLoadCompleted
import com.google.android.exoplayer.chunk.Format; //导入依赖的package包/类
@Override
public void onLoadCompleted(int sourceId, long bytesLoaded, int type, int trigger, Format format,
long mediaStartTimeMs, long mediaEndTimeMs, long elapsedRealtimeMs, long loadDurationMs) {
if (VerboseLogUtil.isTagEnabled(TAG)) {
long downloadTime = SystemClock.elapsedRealtime() - loadStartTimeMs[sourceId];
Log.v(TAG, "loadEnd [" + getSessionTimeString() + ", " + sourceId + ", " + downloadTime
+ "]");
}
}
示例10: onDownstreamFormatChanged
import com.google.android.exoplayer.chunk.Format; //导入依赖的package包/类
@Override
public void onDownstreamFormatChanged(int sourceId, Format format, int trigger,
long mediaTimeMs) {
if (infoListener == null) {
return;
}
if (sourceId == TYPE_VIDEO) {
videoFormat = format;
infoListener.onVideoFormatEnabled(format, trigger, mediaTimeMs);
} else if (sourceId == TYPE_AUDIO) {
infoListener.onAudioFormatEnabled(format, trigger, mediaTimeMs);
}
}
示例11: onLoadStarted
import com.google.android.exoplayer.chunk.Format; //导入依赖的package包/类
@Override
public void onLoadStarted(int sourceId, long length, int type, int trigger, Format format,
long mediaStartTimeMs, long mediaEndTimeMs) {
if (infoListener != null) {
infoListener.onLoadStarted(sourceId, length, type, trigger, format, mediaStartTimeMs,
mediaEndTimeMs);
}
}
示例12: onLoadCompleted
import com.google.android.exoplayer.chunk.Format; //导入依赖的package包/类
@Override
public void onLoadCompleted(int sourceId, long bytesLoaded, int type, int trigger, Format format,
long mediaStartTimeMs, long mediaEndTimeMs, long elapsedRealtimeMs, long loadDurationMs) {
if (infoListener != null) {
infoListener.onLoadCompleted(sourceId, bytesLoaded, type, trigger, format, mediaStartTimeMs,
mediaEndTimeMs, elapsedRealtimeMs, loadDurationMs);
}
}
示例13: onLoadStarted
import com.google.android.exoplayer.chunk.Format; //导入依赖的package包/类
@Override
public void onLoadStarted(int sourceId, long length, int type, int trigger, Format format,
int mediaStartTimeMs, int mediaEndTimeMs) {
loadStartTimeMs[sourceId] = SystemClock.elapsedRealtime();
if (VerboseLogUtil.isTagEnabled(TAG)) {
Log.v(TAG, "loadStart [" + getSessionTimeString() + ", " + sourceId + ", " + type
+ ", " + mediaStartTimeMs + ", " + mediaEndTimeMs + "]");
}
}
示例14: onLoadCompleted
import com.google.android.exoplayer.chunk.Format; //导入依赖的package包/类
@Override
public void onLoadCompleted(int sourceId, long bytesLoaded, int type, int trigger, Format format,
long mediaStartTimeMs, long mediaEndTimeMs, long elapsedRealtimeMs, long loadDurationMs) {
if (infoListener != null) {
infoListener.onLoadCompleted(sourceId, bytesLoaded, type, trigger, format, mediaStartTimeMs,
mediaEndTimeMs, elapsedRealtimeMs, loadDurationMs);
}
}
示例15: onLoadStarted
import com.google.android.exoplayer.chunk.Format; //导入依赖的package包/类
@Override
public void onLoadStarted(int sourceId, long length, int type, int trigger, Format format,
long mediaStartTimeMs, long mediaEndTimeMs) {
if (infoListener != null) {
infoListener.onLoadStarted(sourceId, length, type, trigger, format, mediaStartTimeMs,
mediaEndTimeMs);
}
}