本文整理汇总了Java中com.google.android.exoplayer2.RendererCapabilities类的典型用法代码示例。如果您正苦于以下问题:Java RendererCapabilities类的具体用法?Java RendererCapabilities怎么用?Java RendererCapabilities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RendererCapabilities类属于com.google.android.exoplayer2包,在下文中一共展示了RendererCapabilities类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setSelector
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
private void setSelector(MappingTrackSelector selector) {
this.selector = selector;
setTrackInfo(selector.getCurrentMappedTrackInfo());
setTrackGroups(trackInfo.getTrackGroups(rendererIndex));
setOverride(selector.getSelectionOverride(rendererIndex, trackGroups));
trackGroupsAdaptive = new boolean[trackGroups.length];
for (int i = 0; i < trackGroups.length; i++) {
trackGroupsAdaptive[i] = adaptiveTrackSelectionFactory != null
&& trackInfo.getAdaptiveSupport(rendererIndex, i, false)
!= RendererCapabilities.ADAPTIVE_NOT_SUPPORTED
&& trackGroups.get(i).length > 1;
}
// isDisabled = selector.getRendererDisabled(rendererIndex);
// override = selector.getSelectionOverride(rendererIndex, trackGroups);
}
开发者ID:Tubitv,项目名称:TubiPlayer,代码行数:17,代码来源:TubiQualityDialogView.java
示例2: showSelectionDialog
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
/**
* Shows the selection dialog for a given renderer.
*
* @param activity The parent activity.
* @param title The dialog's title.
* @param trackInfo The current track information.
* @param rendererIndex The index of the renderer.
*/
public void showSelectionDialog(Activity activity, CharSequence title, MappedTrackInfo trackInfo,
int rendererIndex) {
this.trackInfo = trackInfo;
this.rendererIndex = rendererIndex;
trackGroups = trackInfo.getTrackGroups(rendererIndex);
trackGroupsAdaptive = new boolean[trackGroups.length];
for (int i = 0; i < trackGroups.length; i++) {
trackGroupsAdaptive[i] = adaptiveVideoTrackSelectionFactory != null
&& trackInfo.getAdaptiveSupport(rendererIndex, i, false)
!= RendererCapabilities.ADAPTIVE_NOT_SUPPORTED
&& trackGroups.get(i).length > 1;
}
isDisabled = selector.getRendererDisabled(rendererIndex);
override = selector.getSelectionOverride(rendererIndex, trackGroups);
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(title)
.setView(buildView(builder.getContext()))
.setPositiveButton(android.R.string.ok, this)
.setNegativeButton(android.R.string.cancel, null)
.create()
.show();
}
开发者ID:ashwanijanghu,项目名称:ExoPlayer-Offline,代码行数:33,代码来源:TrackSelectionHelper.java
示例3: selectTracks
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
@Override
protected TrackSelection[] selectTracks(RendererCapabilities[] rendererCapabilities,
TrackGroupArray[] rendererTrackGroupArrays, int[][][] rendererFormatSupports)
throws ExoPlaybackException {
Assertions.checkState(rendererCapabilities[VIDEO_RENDERER_INDEX].getTrackType()
== C.TRACK_TYPE_VIDEO);
Assertions.checkState(rendererCapabilities[AUDIO_RENDERER_INDEX].getTrackType()
== C.TRACK_TYPE_AUDIO);
Assertions.checkState(rendererTrackGroupArrays[VIDEO_RENDERER_INDEX].length == 1);
Assertions.checkState(rendererTrackGroupArrays[AUDIO_RENDERER_INDEX].length == 1);
TrackSelection[] selections = new TrackSelection[rendererCapabilities.length];
selections[VIDEO_RENDERER_INDEX] = new RandomTrackSelection(
rendererTrackGroupArrays[VIDEO_RENDERER_INDEX].get(0),
getVideoTrackIndices(rendererTrackGroupArrays[VIDEO_RENDERER_INDEX].get(0),
rendererFormatSupports[VIDEO_RENDERER_INDEX][0], videoFormatIds,
canIncludeAdditionalVideoFormats),
0 /* seed */);
selections[AUDIO_RENDERER_INDEX] = new FixedTrackSelection(
rendererTrackGroupArrays[AUDIO_RENDERER_INDEX].get(0),
getTrackIndex(rendererTrackGroupArrays[AUDIO_RENDERER_INDEX].get(0), audioFormatId));
includedAdditionalVideoFormats =
selections[VIDEO_RENDERER_INDEX].length() > videoFormatIds.length;
return selections;
}
开发者ID:ashwanijanghu,项目名称:ExoPlayer-Offline,代码行数:25,代码来源:DashTest.java
示例4: selectVideoTrack
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
protected TrackSelection selectVideoTrack(RendererCapabilities rendererCapabilities,
TrackGroupArray groups, int[][] formatSupport, int maxVideoWidth, int maxVideoHeight,
int maxVideoBitrate, boolean allowNonSeamlessAdaptiveness, boolean allowMixedMimeAdaptiveness,
int viewportWidth, int viewportHeight, boolean orientationMayChange,
TrackSelection.Factory adaptiveTrackSelectionFactory, boolean exceedConstraintsIfNecessary,
boolean exceedRendererCapabilitiesIfNecessary) throws ExoPlaybackException {
TrackSelection selection = null;
if (adaptiveTrackSelectionFactory != null) {
selection = selectAdaptiveVideoTrack(rendererCapabilities, groups, formatSupport,
maxVideoWidth, maxVideoHeight, maxVideoBitrate, allowNonSeamlessAdaptiveness,
allowMixedMimeAdaptiveness, viewportWidth, viewportHeight,
orientationMayChange, adaptiveTrackSelectionFactory);
}
if (selection == null) {
selection = selectFixedVideoTrack(groups, formatSupport, maxVideoWidth, maxVideoHeight,
maxVideoBitrate, viewportWidth, viewportHeight, orientationMayChange,
exceedConstraintsIfNecessary, exceedRendererCapabilitiesIfNecessary);
}
return selection;
}
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:21,代码来源:DefaultTrackSelector.java
示例5: selectAdaptiveVideoTrack
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
private static TrackSelection selectAdaptiveVideoTrack(RendererCapabilities rendererCapabilities,
TrackGroupArray groups, int[][] formatSupport, int maxVideoWidth, int maxVideoHeight,
int maxVideoBitrate, boolean allowNonSeamlessAdaptiveness, boolean allowMixedMimeAdaptiveness,
int viewportWidth, int viewportHeight, boolean orientationMayChange,
TrackSelection.Factory adaptiveTrackSelectionFactory) throws ExoPlaybackException {
int requiredAdaptiveSupport = allowNonSeamlessAdaptiveness
? (RendererCapabilities.ADAPTIVE_NOT_SEAMLESS | RendererCapabilities.ADAPTIVE_SEAMLESS)
: RendererCapabilities.ADAPTIVE_SEAMLESS;
boolean allowMixedMimeTypes = allowMixedMimeAdaptiveness
&& (rendererCapabilities.supportsMixedMimeTypeAdaptation() & requiredAdaptiveSupport) != 0;
for (int i = 0; i < groups.length; i++) {
TrackGroup group = groups.get(i);
int[] adaptiveTracks = getAdaptiveVideoTracksForGroup(group, formatSupport[i],
allowMixedMimeTypes, requiredAdaptiveSupport, maxVideoWidth, maxVideoHeight,
maxVideoBitrate, viewportWidth, viewportHeight, orientationMayChange);
if (adaptiveTracks.length > 0) {
return adaptiveTrackSelectionFactory.createTrackSelection(group, adaptiveTracks);
}
}
return null;
}
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:22,代码来源:DefaultTrackSelector.java
示例6: findRenderer
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
/**
* Finds the renderer to which the provided {@link TrackGroup} should be associated.
* <p>
* A {@link TrackGroup} is associated to a renderer that reports
* {@link RendererCapabilities#FORMAT_HANDLED} support for one or more of the tracks in the group,
* or {@link RendererCapabilities#FORMAT_EXCEEDS_CAPABILITIES} if no such renderer exists, or
* {@link RendererCapabilities#FORMAT_UNSUPPORTED_SUBTYPE} if again no such renderer exists. In
* the case that two or more renderers report the same level of support, the renderer with the
* lowest index is associated.
* <p>
* If all renderers report {@link RendererCapabilities#FORMAT_UNSUPPORTED_TYPE} for all of the
* tracks in the group, then {@code renderers.length} is returned to indicate that no association
* was made.
*
* @param rendererCapabilities The {@link RendererCapabilities} of the renderers.
* @param group The {@link TrackGroup} whose associated renderer is to be found.
* @return The index of the associated renderer, or {@code renderers.length} if no
* association was made.
* @throws ExoPlaybackException If an error occurs finding a renderer.
*/
private static int findRenderer(RendererCapabilities[] rendererCapabilities, TrackGroup group)
throws ExoPlaybackException {
int bestRendererIndex = rendererCapabilities.length;
int bestFormatSupportLevel = RendererCapabilities.FORMAT_UNSUPPORTED_TYPE;
for (int rendererIndex = 0; rendererIndex < rendererCapabilities.length; rendererIndex++) {
RendererCapabilities rendererCapability = rendererCapabilities[rendererIndex];
for (int trackIndex = 0; trackIndex < group.length; trackIndex++) {
int formatSupportLevel = rendererCapability.supportsFormat(group.getFormat(trackIndex))
& RendererCapabilities.FORMAT_SUPPORT_MASK;
if (formatSupportLevel > bestFormatSupportLevel) {
bestRendererIndex = rendererIndex;
bestFormatSupportLevel = formatSupportLevel;
if (bestFormatSupportLevel == RendererCapabilities.FORMAT_HANDLED) {
// We can't do better.
return bestRendererIndex;
}
}
}
}
return bestRendererIndex;
}
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:42,代码来源:MappingTrackSelector.java
示例7: rendererSupportsTunneling
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
/**
* Returns whether a renderer supports tunneling for a {@link TrackSelection}.
*
* @param formatSupport The result of {@link RendererCapabilities#supportsFormat} for each
* track, indexed by group index and track index (in that order).
* @param trackGroups The {@link TrackGroupArray}s for the renderer.
* @param selection The track selection.
* @return Whether the renderer supports tunneling for the {@link TrackSelection}.
*/
private static boolean rendererSupportsTunneling(int[][] formatSupport,
TrackGroupArray trackGroups, TrackSelection selection) {
if (selection == null) {
return false;
}
int trackGroupIndex = trackGroups.indexOf(selection.getTrackGroup());
for (int i = 0; i < selection.length(); i++) {
int trackFormatSupport = formatSupport[trackGroupIndex][selection.getIndexInTrackGroup(i)];
if ((trackFormatSupport & RendererCapabilities.TUNNELING_SUPPORT_MASK)
!= RendererCapabilities.TUNNELING_SUPPORTED) {
return false;
}
}
return true;
}
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:25,代码来源:MappingTrackSelector.java
示例8: getRendererSupport
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
/**
* Returns the extent to which a renderer can support playback of the tracks associated to it.
*
* @param rendererIndex The renderer index.
* @return One of {@link #RENDERER_SUPPORT_PLAYABLE_TRACKS},
* {@link #RENDERER_SUPPORT_EXCEEDS_CAPABILITIES_TRACKS},
* {@link #RENDERER_SUPPORT_UNSUPPORTED_TRACKS} and {@link #RENDERER_SUPPORT_NO_TRACKS}.
*/
public int getRendererSupport(int rendererIndex) {
int bestRendererSupport = RENDERER_SUPPORT_NO_TRACKS;
int[][] rendererFormatSupport = formatSupport[rendererIndex];
for (int i = 0; i < rendererFormatSupport.length; i++) {
for (int j = 0; j < rendererFormatSupport[i].length; j++) {
int trackRendererSupport;
switch (rendererFormatSupport[i][j] & RendererCapabilities.FORMAT_SUPPORT_MASK) {
case RendererCapabilities.FORMAT_HANDLED:
return RENDERER_SUPPORT_PLAYABLE_TRACKS;
case RendererCapabilities.FORMAT_EXCEEDS_CAPABILITIES:
trackRendererSupport = RENDERER_SUPPORT_EXCEEDS_CAPABILITIES_TRACKS;
break;
default:
trackRendererSupport = RENDERER_SUPPORT_UNSUPPORTED_TRACKS;
break;
}
bestRendererSupport = Math.max(bestRendererSupport, trackRendererSupport);
}
}
return bestRendererSupport;
}
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:30,代码来源:MappingTrackSelector.java
示例9: getAdaptiveSupport
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
/**
* Returns the extent to which the renderer supports adaptation between specified tracks within
* a {@link TrackGroup}.
*
* @param rendererIndex The renderer index.
* @param groupIndex The index of the group.
* @return One of {@link RendererCapabilities#ADAPTIVE_SEAMLESS},
* {@link RendererCapabilities#ADAPTIVE_NOT_SEAMLESS} and
* {@link RendererCapabilities#ADAPTIVE_NOT_SUPPORTED}.
*/
public int getAdaptiveSupport(int rendererIndex, int groupIndex, int[] trackIndices) {
int handledTrackCount = 0;
int adaptiveSupport = RendererCapabilities.ADAPTIVE_SEAMLESS;
boolean multipleMimeTypes = false;
String firstSampleMimeType = null;
for (int i = 0; i < trackIndices.length; i++) {
int trackIndex = trackIndices[i];
String sampleMimeType = trackGroups[rendererIndex].get(groupIndex).getFormat(trackIndex)
.sampleMimeType;
if (handledTrackCount++ == 0) {
firstSampleMimeType = sampleMimeType;
} else {
multipleMimeTypes |= !Util.areEqual(firstSampleMimeType, sampleMimeType);
}
adaptiveSupport = Math.min(adaptiveSupport, formatSupport[rendererIndex][groupIndex][i]
& RendererCapabilities.ADAPTIVE_SUPPORT_MASK);
}
return multipleMimeTypes
? Math.min(adaptiveSupport, mixedMimeTypeAdaptiveSupport[rendererIndex])
: adaptiveSupport;
}
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:32,代码来源:MappingTrackSelector.java
示例10: getFormatSupportString
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
private static String getFormatSupportString(int formatSupport) {
switch (formatSupport) {
case RendererCapabilities.FORMAT_HANDLED:
return "YES";
case RendererCapabilities.FORMAT_EXCEEDS_CAPABILITIES:
return "NO_EXCEEDS_CAPABILITIES";
case RendererCapabilities.FORMAT_UNSUPPORTED_DRM:
return "NO_UNSUPPORTED_DRM";
case RendererCapabilities.FORMAT_UNSUPPORTED_SUBTYPE:
return "NO_UNSUPPORTED_TYPE";
case RendererCapabilities.FORMAT_UNSUPPORTED_TYPE:
return "NO";
default:
return "?";
}
}
开发者ID:CarGuo,项目名称:GSYVideoPlayer,代码行数:17,代码来源:EventLogger.java
示例11: selectVideoTrack
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
protected TrackSelection selectVideoTrack(RendererCapabilities rendererCapabilities,
TrackGroupArray groups, int[][] formatSupport, int maxVideoWidth, int maxVideoHeight,
int maxVideoBitrate, boolean allowNonSeamlessAdaptiveness, boolean allowMixedMimeAdaptiveness,
int viewportWidth, int viewportHeight, boolean orientationMayChange,
TrackSelection.Factory adaptiveVideoTrackSelectionFactory,
boolean exceedConstraintsIfNecessary, boolean exceedRendererCapabilitiesIfNecessary)
throws ExoPlaybackException {
TrackSelection selection = null;
if (adaptiveVideoTrackSelectionFactory != null) {
selection = selectAdaptiveVideoTrack(rendererCapabilities, groups, formatSupport,
maxVideoWidth, maxVideoHeight, maxVideoBitrate, allowNonSeamlessAdaptiveness,
allowMixedMimeAdaptiveness, viewportWidth, viewportHeight,
orientationMayChange, adaptiveVideoTrackSelectionFactory);
}
if (selection == null) {
selection = selectFixedVideoTrack(groups, formatSupport, maxVideoWidth, maxVideoHeight,
maxVideoBitrate, viewportWidth, viewportHeight, orientationMayChange,
exceedConstraintsIfNecessary, exceedRendererCapabilitiesIfNecessary);
}
return selection;
}
开发者ID:jcodeing,项目名称:K-Sonic,代码行数:22,代码来源:DefaultTrackSelector.java
示例12: selectAdaptiveVideoTrack
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
private static TrackSelection selectAdaptiveVideoTrack(RendererCapabilities rendererCapabilities,
TrackGroupArray groups, int[][] formatSupport, int maxVideoWidth, int maxVideoHeight,
int maxVideoBitrate, boolean allowNonSeamlessAdaptiveness, boolean allowMixedMimeAdaptiveness,
int viewportWidth, int viewportHeight, boolean orientationMayChange,
TrackSelection.Factory adaptiveVideoTrackSelectionFactory) throws ExoPlaybackException {
int requiredAdaptiveSupport = allowNonSeamlessAdaptiveness
? (RendererCapabilities.ADAPTIVE_NOT_SEAMLESS | RendererCapabilities.ADAPTIVE_SEAMLESS)
: RendererCapabilities.ADAPTIVE_SEAMLESS;
boolean allowMixedMimeTypes = allowMixedMimeAdaptiveness
&& (rendererCapabilities.supportsMixedMimeTypeAdaptation() & requiredAdaptiveSupport) != 0;
for (int i = 0; i < groups.length; i++) {
TrackGroup group = groups.get(i);
int[] adaptiveTracks = getAdaptiveTracksForGroup(group, formatSupport[i],
allowMixedMimeTypes, requiredAdaptiveSupport, maxVideoWidth, maxVideoHeight,
maxVideoBitrate, viewportWidth, viewportHeight, orientationMayChange);
if (adaptiveTracks.length > 0) {
return adaptiveVideoTrackSelectionFactory.createTrackSelection(group, adaptiveTracks);
}
}
return null;
}
开发者ID:jcodeing,项目名称:K-Sonic,代码行数:22,代码来源:DefaultTrackSelector.java
示例13: showSelectionDialog
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
/**
* Shows the selection dialog for a given renderer.
*
* @param activity The parent activity.
* @param title The dialog's title.
* @param trackInfo The current track information.
* @param rendererIndex The index of the renderer.
*/
public void showSelectionDialog(Activity activity, CharSequence title, MappedTrackInfo trackInfo,
int rendererIndex) {
this.trackInfo = trackInfo;
this.rendererIndex = rendererIndex;
trackGroups = trackInfo.getTrackGroups(rendererIndex);
trackGroupsAdaptive = new boolean[trackGroups.length];
for (int i = 0; i < trackGroups.length; i++) {
trackGroupsAdaptive[i] = adaptiveVideoTrackSelectionFactory != null
&& trackInfo.getAdaptiveSupport(rendererIndex, i, false)
!= RendererCapabilities.ADAPTIVE_NOT_SUPPORTED
&& trackGroups.get(i).length > 1;
}
isDisabled = selector.getRendererDisabled(rendererIndex);
override = selector.getSelectionOverride(rendererIndex, trackGroups);
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(title)
.setView(buildView(LayoutInflater.from(builder.getContext())))
.setPositiveButton(android.R.string.ok, this)
.setNegativeButton(android.R.string.cancel, null)
.create()
.show();
}
开发者ID:AndroidTips,项目名称:MDVideo,代码行数:33,代码来源:TrackSelectionHelper.java
示例14: selectVideoTrack
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
protected TrackSelection selectVideoTrack(RendererCapabilities rendererCapabilities,
TrackGroupArray groups, int[][] formatSupport, int maxVideoWidth, int maxVideoHeight,
boolean allowNonSeamlessAdaptiveness, boolean allowMixedMimeAdaptiveness, int viewportWidth,
int viewportHeight, boolean orientationMayChange,
TrackSelection.Factory adaptiveVideoTrackSelectionFactory,
boolean exceedConstraintsIfNecessary) throws ExoPlaybackException {
TrackSelection selection = null;
if (adaptiveVideoTrackSelectionFactory != null) {
selection = selectAdaptiveVideoTrack(rendererCapabilities, groups, formatSupport,
maxVideoWidth, maxVideoHeight, allowNonSeamlessAdaptiveness,
allowMixedMimeAdaptiveness, viewportWidth, viewportHeight,
orientationMayChange, adaptiveVideoTrackSelectionFactory);
}
if (selection == null) {
selection = selectFixedVideoTrack(groups, formatSupport, maxVideoWidth, maxVideoHeight,
viewportWidth, viewportHeight, orientationMayChange, exceedConstraintsIfNecessary);
}
return selection;
}
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:20,代码来源:DefaultTrackSelector.java
示例15: selectAdaptiveVideoTrack
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
private static TrackSelection selectAdaptiveVideoTrack(RendererCapabilities rendererCapabilities,
TrackGroupArray groups, int[][] formatSupport, int maxVideoWidth, int maxVideoHeight,
boolean allowNonSeamlessAdaptiveness, boolean allowMixedMimeAdaptiveness, int viewportWidth,
int viewportHeight, boolean orientationMayChange,
TrackSelection.Factory adaptiveVideoTrackSelectionFactory) throws ExoPlaybackException {
int requiredAdaptiveSupport = allowNonSeamlessAdaptiveness
? (RendererCapabilities.ADAPTIVE_NOT_SEAMLESS | RendererCapabilities.ADAPTIVE_SEAMLESS)
: RendererCapabilities.ADAPTIVE_SEAMLESS;
boolean allowMixedMimeTypes = allowMixedMimeAdaptiveness
&& (rendererCapabilities.supportsMixedMimeTypeAdaptation() & requiredAdaptiveSupport) != 0;
for (int i = 0; i < groups.length; i++) {
TrackGroup group = groups.get(i);
int[] adaptiveTracks = getAdaptiveTracksForGroup(group, formatSupport[i],
allowMixedMimeTypes, requiredAdaptiveSupport, maxVideoWidth, maxVideoHeight,
viewportWidth, viewportHeight, orientationMayChange);
if (adaptiveTracks.length > 0) {
return adaptiveVideoTrackSelectionFactory.createTrackSelection(group, adaptiveTracks);
}
}
return null;
}
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:22,代码来源:DefaultTrackSelector.java
示例16: findRenderer
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
/**
* Finds the renderer to which the provided {@link TrackGroup} should be associated.
* <p>
* A {@link TrackGroup} is associated to a renderer that reports
* {@link RendererCapabilities#FORMAT_HANDLED} support for one or more of the tracks in the group,
* or {@link RendererCapabilities#FORMAT_EXCEEDS_CAPABILITIES} if no such renderer exists, or
* {@link RendererCapabilities#FORMAT_UNSUPPORTED_SUBTYPE} if again no such renderer exists. In
* the case that two or more renderers report the same level of support, the renderer with the
* lowest index is associated.
* <p>
* If all renderers report {@link RendererCapabilities#FORMAT_UNSUPPORTED_TYPE} for all of the
* tracks in the group, then {@code renderers.length} is returned to indicate that no association
* was made.
*
* @param rendererCapabilities The {@link RendererCapabilities} of the renderers.
* @param group The {@link TrackGroup} whose associated renderer is to be found.
* @return The index of the associated renderer, or {@code renderers.length} if no
* association was made.
* @throws ExoPlaybackException If an error occurs finding a renderer.
*/
private static int findRenderer(RendererCapabilities[] rendererCapabilities, TrackGroup group)
throws ExoPlaybackException {
int bestRendererIndex = rendererCapabilities.length;
int bestSupportLevel = RendererCapabilities.FORMAT_UNSUPPORTED_TYPE;
for (int rendererIndex = 0; rendererIndex < rendererCapabilities.length; rendererIndex++) {
RendererCapabilities rendererCapability = rendererCapabilities[rendererIndex];
for (int trackIndex = 0; trackIndex < group.length; trackIndex++) {
int trackSupportLevel = rendererCapability.supportsFormat(group.getFormat(trackIndex));
if (trackSupportLevel > bestSupportLevel) {
bestRendererIndex = rendererIndex;
bestSupportLevel = trackSupportLevel;
if (bestSupportLevel == RendererCapabilities.FORMAT_HANDLED) {
// We can't do better.
return bestRendererIndex;
}
}
}
}
return bestRendererIndex;
}
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:41,代码来源:MappingTrackSelector.java
示例17: showSelectionDialog
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
/**
* Shows the selection dialog for a given renderer.
*
* @param activity The parent activity.
* @param title The dialog's title.
* @param trackInfo The current track information.
* @param rendererIndex The index of the renderer.
*/
public void showSelectionDialog(Activity activity, CharSequence title, MappedTrackInfo trackInfo,
int rendererIndex) {
this.trackInfo = trackInfo;
this.rendererIndex = rendererIndex;
trackGroups = trackInfo.getTrackGroups(rendererIndex);
trackGroupsAdaptive = new boolean[trackGroups.length];
for (int i = 0; i < trackGroups.length; i++) {
trackGroupsAdaptive[i] = adaptiveVideoTrackSelectionFactory != null
&& trackInfo.getAdaptiveSupport(rendererIndex, i, false)
!= RendererCapabilities.ADAPTIVE_NOT_SUPPORTED
&& trackGroups.get(i).length > 1;
}
isDisabled = selector.getRendererDisabled(rendererIndex);
override = selector.getSelectionOverride(rendererIndex, trackGroups);
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(title)
.setView(buildView(builder.getContext()))
.setPositiveButton(android.R.string.ok, this)
.setNegativeButton(android.R.string.cancel, null)
.create()
.show();
}
开发者ID:TakumaMochizuki,项目名称:Komica,代码行数:33,代码来源:TrackSelectionHelper.java
示例18: showSelectionDialog
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
/**
* Shows the selection dialog for a given renderer.
*
* @param activity The parent activity.
* @param title The dialog's title.
* @param trackInfo The current track information.
* @param rendererIndex The index of the renderer.
*/
public void showSelectionDialog(Activity activity, CharSequence title, MappedTrackInfo trackInfo,
int rendererIndex) {
this.trackInfo = trackInfo;
this.rendererIndex = rendererIndex;
trackGroups = trackInfo.getTrackGroups(rendererIndex);
trackGroupsAdaptive = new boolean[trackGroups.length];
for (int i = 0; i < trackGroups.length; i++) {
trackGroupsAdaptive[i] = adaptiveTrackSelectionFactory != null
&& trackInfo.getAdaptiveSupport(rendererIndex, i, false)
!= RendererCapabilities.ADAPTIVE_NOT_SUPPORTED
&& trackGroups.get(i).length > 1;
}
isDisabled = selector.getRendererDisabled(rendererIndex);
override = selector.getSelectionOverride(rendererIndex, trackGroups);
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(title)
.setView(buildView(builder.getContext()))
.setPositiveButton(android.R.string.ok, this)
.setNegativeButton(android.R.string.cancel, null)
.create()
.show();
}
开发者ID:y20k,项目名称:transistor,代码行数:33,代码来源:TrackSelectionHelper.java
示例19: selectAdaptiveVideoTrack
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
private static TrackSelection selectAdaptiveVideoTrack(RendererCapabilities rendererCapabilities,
TrackGroupArray groups, int[][] formatSupport, Parameters params,
TrackSelection.Factory adaptiveTrackSelectionFactory) throws ExoPlaybackException {
int requiredAdaptiveSupport = params.allowNonSeamlessAdaptiveness
? (RendererCapabilities.ADAPTIVE_NOT_SEAMLESS | RendererCapabilities.ADAPTIVE_SEAMLESS)
: RendererCapabilities.ADAPTIVE_SEAMLESS;
boolean allowMixedMimeTypes = params.allowMixedMimeAdaptiveness
&& (rendererCapabilities.supportsMixedMimeTypeAdaptation() & requiredAdaptiveSupport) != 0;
for (int i = 0; i < groups.length; i++) {
TrackGroup group = groups.get(i);
int[] adaptiveTracks = getAdaptiveVideoTracksForGroup(group, formatSupport[i],
allowMixedMimeTypes, requiredAdaptiveSupport, params.maxVideoWidth, params.maxVideoHeight,
params.maxVideoBitrate, params.viewportWidth, params.viewportHeight,
params.viewportOrientationMayChange);
if (adaptiveTracks.length > 0) {
return adaptiveTrackSelectionFactory.createTrackSelection(group, adaptiveTracks);
}
}
return null;
}
开发者ID:y20k,项目名称:transistor,代码行数:21,代码来源:DefaultTrackSelector.java
示例20: getRendererSupport
import com.google.android.exoplayer2.RendererCapabilities; //导入依赖的package包/类
/**
* Returns the extent to which a renderer can play the tracks in the track groups mapped to it.
*
* @param rendererIndex The renderer index.
* @return One of {@link #RENDERER_SUPPORT_PLAYABLE_TRACKS},
* {@link #RENDERER_SUPPORT_EXCEEDS_CAPABILITIES_TRACKS},
* {@link #RENDERER_SUPPORT_UNSUPPORTED_TRACKS} and {@link #RENDERER_SUPPORT_NO_TRACKS}.
*/
public int getRendererSupport(int rendererIndex) {
int bestRendererSupport = RENDERER_SUPPORT_NO_TRACKS;
int[][] rendererFormatSupport = formatSupport[rendererIndex];
for (int i = 0; i < rendererFormatSupport.length; i++) {
for (int j = 0; j < rendererFormatSupport[i].length; j++) {
int trackRendererSupport;
switch (rendererFormatSupport[i][j] & RendererCapabilities.FORMAT_SUPPORT_MASK) {
case RendererCapabilities.FORMAT_HANDLED:
return RENDERER_SUPPORT_PLAYABLE_TRACKS;
case RendererCapabilities.FORMAT_EXCEEDS_CAPABILITIES:
trackRendererSupport = RENDERER_SUPPORT_EXCEEDS_CAPABILITIES_TRACKS;
break;
default:
trackRendererSupport = RENDERER_SUPPORT_UNSUPPORTED_TRACKS;
break;
}
bestRendererSupport = Math.max(bestRendererSupport, trackRendererSupport);
}
}
return bestRendererSupport;
}
开发者ID:y20k,项目名称:transistor,代码行数:30,代码来源:MappingTrackSelector.java
注:本文中的com.google.android.exoplayer2.RendererCapabilities类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论