com.google.android.exoplayer2.RendererCapabilities Java Examples
The following examples show how to use
com.google.android.exoplayer2.RendererCapabilities.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Util.java From MediaSDK with Apache License 2.0 | 6 votes |
/** * Extract renderer capabilities for the renderers created by the provided renderers factory. * * @param renderersFactory A {@link RenderersFactory}. * @param drmSessionManager An optional {@link DrmSessionManager} used by the renderers. * @return The {@link RendererCapabilities} for each renderer created by the {@code * renderersFactory}. */ public static RendererCapabilities[] getRendererCapabilities( RenderersFactory renderersFactory, @Nullable DrmSessionManager<FrameworkMediaCrypto> drmSessionManager) { Renderer[] renderers = renderersFactory.createRenderers( new Handler(), new VideoRendererEventListener() {}, new AudioRendererEventListener() {}, (cues) -> {}, (metadata) -> {}, drmSessionManager); RendererCapabilities[] capabilities = new RendererCapabilities[renderers.length]; for (int i = 0; i < renderers.length; i++) { capabilities[i] = renderers[i].getCapabilities(); } return capabilities; }
Example #2
Source File: MappingTrackSelector.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
/** * Returns the extent to which a renderer can play the tracks that are 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 @RendererSupport int getRendererSupport(int rendererIndex) { int bestRendererSupport = RENDERER_SUPPORT_NO_TRACKS; int[][] rendererFormatSupport = rendererFormatSupports[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; }
Example #3
Source File: DownloadHelper.java From Telegram with GNU General Public License v2.0 | 6 votes |
/** * Creates download helper. * * @param downloadType A download type. This value will be used as {@link DownloadRequest#type}. * @param uri A {@link Uri}. * @param cacheKey An optional cache key. * @param mediaSource A {@link MediaSource} for which tracks are selected, or null if no track * selection needs to be made. * @param trackSelectorParameters {@link DefaultTrackSelector.Parameters} for selecting tracks for * downloading. * @param rendererCapabilities The {@link RendererCapabilities} of the renderers for which tracks * are selected. */ public DownloadHelper( String downloadType, Uri uri, @Nullable String cacheKey, @Nullable MediaSource mediaSource, DefaultTrackSelector.Parameters trackSelectorParameters, RendererCapabilities[] rendererCapabilities) { this.downloadType = downloadType; this.uri = uri; this.cacheKey = cacheKey; this.mediaSource = mediaSource; this.trackSelector = new DefaultTrackSelector(new DownloadTrackSelection.Factory()); this.rendererCapabilities = rendererCapabilities; this.scratchSet = new SparseIntArray(); trackSelector.setParameters(trackSelectorParameters); trackSelector.init(/* listener= */ () -> {}, new DummyBandwidthMeter()); callbackHandler = new Handler(Util.getLooper()); }
Example #4
Source File: DefaultTrackSelector.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
/** * Returns whether a renderer supports tunneling for a {@link TrackSelection}. * * @param formatSupports 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[][] formatSupports, 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 = formatSupports[trackGroupIndex][selection.getIndexInTrackGroup(i)]; if ((trackFormatSupport & RendererCapabilities.TUNNELING_SUPPORT_MASK) != RendererCapabilities.TUNNELING_SUPPORTED) { return false; } } return true; }
Example #5
Source File: MappingTrackSelector.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
/** * Returns the extent to which a renderer supports adaptation between specified tracks within a * {@link TrackGroup}. * * @param rendererIndex The renderer index. * @param groupIndex The index of the track 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 = rendererTrackGroups[rendererIndex].get(groupIndex).getFormat(trackIndex).sampleMimeType; if (handledTrackCount++ == 0) { firstSampleMimeType = sampleMimeType; } else { multipleMimeTypes |= !Util.areEqual(firstSampleMimeType, sampleMimeType); } adaptiveSupport = Math.min( adaptiveSupport, rendererFormatSupports[rendererIndex][groupIndex][i] & RendererCapabilities.ADAPTIVE_SUPPORT_MASK); } return multipleMimeTypes ? Math.min(adaptiveSupport, rendererMixedMimeTypeAdaptiveSupports[rendererIndex]) : adaptiveSupport; }
Example #6
Source File: MappingTrackSelector.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
/** * Returns the extent to which a renderer supports adaptation between specified tracks within a * {@link TrackGroup}. * * @param rendererIndex The renderer index. * @param groupIndex The index of the track 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 = rendererTrackGroups[rendererIndex].get(groupIndex).getFormat(trackIndex).sampleMimeType; if (handledTrackCount++ == 0) { firstSampleMimeType = sampleMimeType; } else { multipleMimeTypes |= !Util.areEqual(firstSampleMimeType, sampleMimeType); } adaptiveSupport = Math.min( adaptiveSupport, rendererFormatSupports[rendererIndex][groupIndex][i] & RendererCapabilities.ADAPTIVE_SUPPORT_MASK); } return multipleMimeTypes ? Math.min(adaptiveSupport, rendererMixedMimeTypeAdaptiveSupports[rendererIndex]) : adaptiveSupport; }
Example #7
Source File: MappingTrackSelector.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
/** * Finds the renderer to which the provided {@link TrackGroup} should be mapped. * <p> * A {@link TrackGroup} is mapped to the renderer that reports the highest of (listed in * decreasing order of support) {@link RendererCapabilities#FORMAT_HANDLED}, * {@link RendererCapabilities#FORMAT_EXCEEDS_CAPABILITIES}, * {@link RendererCapabilities#FORMAT_UNSUPPORTED_DRM} and * {@link RendererCapabilities#FORMAT_UNSUPPORTED_SUBTYPE}. 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 the group was * not mapped to any renderer. * * @param rendererCapabilities The {@link RendererCapabilities} of the renderers. * @param group The track group to map to a renderer. * @return The index of the renderer to which the track group was mapped, or * {@code renderers.length} if it was not mapped to any renderer. * @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; }
Example #8
Source File: DefaultTrackSelector.java From K-Sonic with MIT License | 6 votes |
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; }
Example #9
Source File: MappingTrackSelector.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
/** * Returns the extent to which a renderer can play the tracks that are 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 @RendererSupport int getRendererSupport(int rendererIndex) { int bestRendererSupport = RENDERER_SUPPORT_NO_TRACKS; int[][] rendererFormatSupport = rendererFormatSupports[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; }
Example #10
Source File: DefaultTrackSelector.java From K-Sonic with MIT License | 6 votes |
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; }
Example #11
Source File: DashTest.java From ExoPlayer-Offline with Apache License 2.0 | 6 votes |
@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; }
Example #12
Source File: DownloadHelper.java From MediaSDK with Apache License 2.0 | 6 votes |
/** * Creates download helper. * * @param downloadType A download type. This value will be used as {@link DownloadRequest#type}. * @param uri A {@link Uri}. * @param cacheKey An optional cache key. * @param mediaSource A {@link MediaSource} for which tracks are selected, or null if no track * selection needs to be made. * @param trackSelectorParameters {@link DefaultTrackSelector.Parameters} for selecting tracks for * downloading. * @param rendererCapabilities The {@link RendererCapabilities} of the renderers for which tracks * are selected. */ public DownloadHelper( String downloadType, Uri uri, @Nullable String cacheKey, @Nullable MediaSource mediaSource, DefaultTrackSelector.Parameters trackSelectorParameters, RendererCapabilities[] rendererCapabilities) { this.downloadType = downloadType; this.uri = uri; this.cacheKey = cacheKey; this.mediaSource = mediaSource; this.trackSelector = new DefaultTrackSelector(trackSelectorParameters, new DownloadTrackSelection.Factory()); this.rendererCapabilities = rendererCapabilities; this.scratchSet = new SparseIntArray(); trackSelector.init(/* listener= */ () -> {}, new DummyBandwidthMeter()); callbackHandler = new Handler(Util.getLooper()); window = new Timeline.Window(); }
Example #13
Source File: DownloadHelper.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
/** * Creates download helper. * * @param downloadType A download type. This value will be used as {@link DownloadRequest#type}. * @param uri A {@link Uri}. * @param cacheKey An optional cache key. * @param mediaSource A {@link MediaSource} for which tracks are selected, or null if no track * selection needs to be made. * @param trackSelectorParameters {@link DefaultTrackSelector.Parameters} for selecting tracks for * downloading. * @param rendererCapabilities The {@link RendererCapabilities} of the renderers for which tracks * are selected. */ public DownloadHelper( String downloadType, Uri uri, @Nullable String cacheKey, @Nullable MediaSource mediaSource, DefaultTrackSelector.Parameters trackSelectorParameters, RendererCapabilities[] rendererCapabilities) { this.downloadType = downloadType; this.uri = uri; this.cacheKey = cacheKey; this.mediaSource = mediaSource; this.trackSelector = new DefaultTrackSelector(new DownloadTrackSelection.Factory()); this.rendererCapabilities = rendererCapabilities; this.scratchSet = new SparseIntArray(); trackSelector.setParameters(trackSelectorParameters); trackSelector.init(/* listener= */ () -> {}, new DummyBandwidthMeter()); callbackHandler = new Handler(Util.getLooper()); }
Example #14
Source File: EventLogger.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
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 "?"; } }
Example #15
Source File: EventLogger.java From MediaSDK with Apache License 2.0 | 6 votes |
private static String getAdaptiveSupportString( int trackCount, @AdaptiveSupport int adaptiveSupport) { if (trackCount < 2) { return "N/A"; } switch (adaptiveSupport) { case RendererCapabilities.ADAPTIVE_SEAMLESS: return "YES"; case RendererCapabilities.ADAPTIVE_NOT_SEAMLESS: return "YES_NOT_SEAMLESS"; case RendererCapabilities.ADAPTIVE_NOT_SUPPORTED: return "NO"; default: throw new IllegalStateException(); } }
Example #16
Source File: DefaultTrackSelector.java From Telegram with GNU General Public License v2.0 | 6 votes |
/** * Returns whether a renderer supports tunneling for a {@link TrackSelection}. * * @param formatSupports 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[][] formatSupports, 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 = formatSupports[trackGroupIndex][selection.getIndexInTrackGroup(i)]; if ((trackFormatSupport & RendererCapabilities.TUNNELING_SUPPORT_MASK) != RendererCapabilities.TUNNELING_SUPPORTED) { return false; } } return true; }
Example #17
Source File: TrackSelectionHelper.java From ExoPlayer-Offline with Apache License 2.0 | 6 votes |
/** * 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(); }
Example #18
Source File: MappingTrackSelector.java From Telegram with GNU General Public License v2.0 | 6 votes |
/** * Returns the extent to which a renderer supports adaptation between specified tracks within a * {@link TrackGroup}. * * @param rendererIndex The renderer index. * @param groupIndex The index of the track 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 = rendererTrackGroups[rendererIndex].get(groupIndex).getFormat(trackIndex).sampleMimeType; if (handledTrackCount++ == 0) { firstSampleMimeType = sampleMimeType; } else { multipleMimeTypes |= !Util.areEqual(firstSampleMimeType, sampleMimeType); } adaptiveSupport = Math.min( adaptiveSupport, rendererFormatSupports[rendererIndex][groupIndex][i] & RendererCapabilities.ADAPTIVE_SUPPORT_MASK); } return multipleMimeTypes ? Math.min(adaptiveSupport, rendererMixedMimeTypeAdaptiveSupports[rendererIndex]) : adaptiveSupport; }
Example #19
Source File: EventLogger.java From Telegram with GNU General Public License v2.0 | 6 votes |
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 "?"; } }
Example #20
Source File: MappingTrackSelector.java From MediaSDK with Apache License 2.0 | 6 votes |
/** * Finds the renderer to which the provided {@link TrackGroup} should be mapped. * <p> * A {@link TrackGroup} is mapped to the renderer that reports the highest of (listed in * decreasing order of support) {@link RendererCapabilities#FORMAT_HANDLED}, * {@link RendererCapabilities#FORMAT_EXCEEDS_CAPABILITIES}, * {@link RendererCapabilities#FORMAT_UNSUPPORTED_DRM} and * {@link RendererCapabilities#FORMAT_UNSUPPORTED_SUBTYPE}. 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 the group was * not mapped to any renderer. * * @param rendererCapabilities The {@link RendererCapabilities} of the renderers. * @param group The track group to map to a renderer. * @return The index of the renderer to which the track group was mapped, or * {@code renderers.length} if it was not mapped to any renderer. * @throws ExoPlaybackException If an error occurs finding a renderer. */ private static int findRenderer(RendererCapabilities[] rendererCapabilities, TrackGroup group) throws ExoPlaybackException { int bestRendererIndex = rendererCapabilities.length; @FormatSupport 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++) { @FormatSupport int formatSupportLevel = RendererCapabilities.getFormatSupport( rendererCapability.supportsFormat(group.getFormat(trackIndex))); if (formatSupportLevel > bestFormatSupportLevel) { bestRendererIndex = rendererIndex; bestFormatSupportLevel = formatSupportLevel; if (bestFormatSupportLevel == RendererCapabilities.FORMAT_HANDLED) { // We can't do better. return bestRendererIndex; } } } } return bestRendererIndex; }
Example #21
Source File: MappingTrackSelector.java From K-Sonic with MIT License | 6 votes |
/** * 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; }
Example #22
Source File: MappingTrackSelector.java From K-Sonic with MIT License | 6 votes |
/** * 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; }
Example #23
Source File: EventLogger.java From GSYVideoPlayer with Apache License 2.0 | 6 votes |
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 "?"; } }
Example #24
Source File: MappingTrackSelector.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
/** * Finds the renderer to which the provided {@link TrackGroup} should be mapped. * <p> * A {@link TrackGroup} is mapped to the renderer that reports the highest of (listed in * decreasing order of support) {@link RendererCapabilities#FORMAT_HANDLED}, * {@link RendererCapabilities#FORMAT_EXCEEDS_CAPABILITIES}, * {@link RendererCapabilities#FORMAT_UNSUPPORTED_DRM} and * {@link RendererCapabilities#FORMAT_UNSUPPORTED_SUBTYPE}. 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 the group was * not mapped to any renderer. * * @param rendererCapabilities The {@link RendererCapabilities} of the renderers. * @param group The track group to map to a renderer. * @return The index of the renderer to which the track group was mapped, or * {@code renderers.length} if it was not mapped to any renderer. * @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; }
Example #25
Source File: EventLogger.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
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 "?"; } }
Example #26
Source File: EventLogger.java From TubiPlayer with MIT License | 5 votes |
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_SUBTYPE: return "NO_UNSUPPORTED_TYPE"; case RendererCapabilities.FORMAT_UNSUPPORTED_TYPE: return "NO"; default: return "?"; } }
Example #27
Source File: DownloadHelper.java From Telegram with GNU General Public License v2.0 | 5 votes |
/** * Creates a {@link DownloadHelper} for progressive streams. * * @param uri A stream {@link Uri}. * @param cacheKey An optional cache key. * @return A {@link DownloadHelper} for progressive streams. */ public static DownloadHelper forProgressive(Uri uri, @Nullable String cacheKey) { return new DownloadHelper( DownloadRequest.TYPE_PROGRESSIVE, uri, cacheKey, /* mediaSource= */ null, DEFAULT_TRACK_SELECTOR_PARAMETERS, /* rendererCapabilities= */ new RendererCapabilities[0]); }
Example #28
Source File: EventLogger.java From PowerFileExplorer with GNU General Public License v3.0 | 5 votes |
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_SUBTYPE: return "NO_UNSUPPORTED_TYPE"; case RendererCapabilities.FORMAT_UNSUPPORTED_TYPE: return "NO"; default: return "?"; } }
Example #29
Source File: EventLogger.java From evercam-android with GNU Affero General Public License v3.0 | 5 votes |
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_SUBTYPE: return "NO_UNSUPPORTED_TYPE"; case RendererCapabilities.FORMAT_UNSUPPORTED_TYPE: return "NO"; default: return "?"; } }
Example #30
Source File: EventLogger.java From TigerVideo with Apache License 2.0 | 5 votes |
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_SUBTYPE: return "NO_UNSUPPORTED_TYPE"; case RendererCapabilities.FORMAT_UNSUPPORTED_TYPE: return "NO"; default: return "?"; } }