com.google.android.exoplayer2.trackselection.MappingTrackSelector.MappedTrackInfo Java Examples
The following examples show how to use
com.google.android.exoplayer2.trackselection.MappingTrackSelector.MappedTrackInfo.
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: DownloadHelper.java From MediaSDK with Apache License 2.0 | 6 votes |
/** * Convenience method to add selections of tracks for all specified audio languages. If an audio * track in one of the specified languages is not available, the default fallback audio track is * used instead. Must not be called until after preparation completes. * * @param languages A list of audio languages for which tracks should be added to the download * selection, as IETF BCP 47 conformant tags. */ public void addAudioLanguagesToSelection(String... languages) { assertPreparedWithMedia(); for (int periodIndex = 0; periodIndex < mappedTrackInfos.length; periodIndex++) { DefaultTrackSelector.ParametersBuilder parametersBuilder = DEFAULT_TRACK_SELECTOR_PARAMETERS_WITHOUT_CONTEXT.buildUpon(); MappedTrackInfo mappedTrackInfo = mappedTrackInfos[periodIndex]; int rendererCount = mappedTrackInfo.getRendererCount(); for (int rendererIndex = 0; rendererIndex < rendererCount; rendererIndex++) { if (mappedTrackInfo.getRendererType(rendererIndex) != C.TRACK_TYPE_AUDIO) { parametersBuilder.setRendererDisabled(rendererIndex, /* disabled= */ true); } } for (String language : languages) { parametersBuilder.setPreferredAudioLanguage(language); addTrackSelection(periodIndex, parametersBuilder.build()); } } }
Example #2
Source File: DownloadHelper.java From MediaSDK with Apache License 2.0 | 6 votes |
/** * Convenience method to add selections of tracks for all specified text languages. Must not be * called until after preparation completes. * * @param selectUndeterminedTextLanguage Whether a text track with undetermined language should be * selected for downloading if no track with one of the specified {@code languages} is * available. * @param languages A list of text languages for which tracks should be added to the download * selection, as IETF BCP 47 conformant tags. */ public void addTextLanguagesToSelection( boolean selectUndeterminedTextLanguage, String... languages) { assertPreparedWithMedia(); for (int periodIndex = 0; periodIndex < mappedTrackInfos.length; periodIndex++) { DefaultTrackSelector.ParametersBuilder parametersBuilder = DEFAULT_TRACK_SELECTOR_PARAMETERS_WITHOUT_CONTEXT.buildUpon(); MappedTrackInfo mappedTrackInfo = mappedTrackInfos[periodIndex]; int rendererCount = mappedTrackInfo.getRendererCount(); for (int rendererIndex = 0; rendererIndex < rendererCount; rendererIndex++) { if (mappedTrackInfo.getRendererType(rendererIndex) != C.TRACK_TYPE_TEXT) { parametersBuilder.setRendererDisabled(rendererIndex, /* disabled= */ true); } } parametersBuilder.setSelectUndeterminedTextLanguage(selectUndeterminedTextLanguage); for (String language : languages) { parametersBuilder.setPreferredTextLanguage(language); addTrackSelection(periodIndex, parametersBuilder.build()); } } }
Example #3
Source File: DownloadHelper.java From Telegram with GNU General Public License v2.0 | 6 votes |
/** * Convenience method to add selections of tracks for all specified text languages. Must not be * called until after preparation completes. * * @param selectUndeterminedTextLanguage Whether a text track with undetermined language should be * selected for downloading if no track with one of the specified {@code languages} is * available. * @param languages A list of text languages for which tracks should be added to the download * selection, as IETF BCP 47 conformant tags. */ public void addTextLanguagesToSelection( boolean selectUndeterminedTextLanguage, String... languages) { assertPreparedWithMedia(); for (int periodIndex = 0; periodIndex < mappedTrackInfos.length; periodIndex++) { DefaultTrackSelector.ParametersBuilder parametersBuilder = DEFAULT_TRACK_SELECTOR_PARAMETERS.buildUpon(); MappedTrackInfo mappedTrackInfo = mappedTrackInfos[periodIndex]; int rendererCount = mappedTrackInfo.getRendererCount(); for (int rendererIndex = 0; rendererIndex < rendererCount; rendererIndex++) { if (mappedTrackInfo.getRendererType(rendererIndex) != C.TRACK_TYPE_TEXT) { parametersBuilder.setRendererDisabled(rendererIndex, /* disabled= */ true); } } parametersBuilder.setSelectUndeterminedTextLanguage(selectUndeterminedTextLanguage); for (String language : languages) { parametersBuilder.setPreferredTextLanguage(language); addTrackSelection(periodIndex, parametersBuilder.build()); } } }
Example #4
Source File: TrackSelectionHelper.java From leafpicrevived with GNU General Public License v3.0 | 6 votes |
@Override public void onClick(DialogInterface dialog, int which) { DefaultTrackSelector.ParametersBuilder parametersBuilder = DEFAULT_TRACK_SELECTOR_PARAMETERS.buildUpon(); MappedTrackInfo mappedTrackInfo = this.trackInfo; int rendererCount = trackInfo.getRendererCount(); for (int rendererIndex = 0; rendererIndex < rendererCount; rendererIndex++) { if (trackInfo.getRendererType(rendererIndex) != C.TRACK_TYPE_TEXT) { parametersBuilder.setRendererDisabled(rendererIndex, true); } if (override != null) { parametersBuilder.setSelectionOverride(rendererIndex, trackGroups, override); } else { parametersBuilder.clearSelectionOverrides(rendererIndex); } } // @TODO fix this // mappedTrackInfo.setParameters(parametersBuilder.build()); }
Example #5
Source File: PlayerActivity.java From leafpicrevived with GNU General Public License v3.0 | 6 votes |
@Override @SuppressWarnings("ReferenceEquality") public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) { if (trackGroups != lastSeenTrackGroupArray) { MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo(); if (mappedTrackInfo != null) { if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_VIDEO) == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) { showToast(R.string.error_unsupported_video); } if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_AUDIO) == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) { showToast(R.string.error_unsupported_audio); } } lastSeenTrackGroupArray = trackGroups; } }
Example #6
Source File: DownloadHelper.java From Telegram with GNU General Public License v2.0 | 6 votes |
/** * Convenience method to add selections of tracks for all specified audio languages. If an audio * track in one of the specified languages is not available, the default fallback audio track is * used instead. Must not be called until after preparation completes. * * @param languages A list of audio languages for which tracks should be added to the download * selection, as IETF BCP 47 conformant tags. */ public void addAudioLanguagesToSelection(String... languages) { assertPreparedWithMedia(); for (int periodIndex = 0; periodIndex < mappedTrackInfos.length; periodIndex++) { DefaultTrackSelector.ParametersBuilder parametersBuilder = DEFAULT_TRACK_SELECTOR_PARAMETERS.buildUpon(); MappedTrackInfo mappedTrackInfo = mappedTrackInfos[periodIndex]; int rendererCount = mappedTrackInfo.getRendererCount(); for (int rendererIndex = 0; rendererIndex < rendererCount; rendererIndex++) { if (mappedTrackInfo.getRendererType(rendererIndex) != C.TRACK_TYPE_AUDIO) { parametersBuilder.setRendererDisabled(rendererIndex, /* disabled= */ true); } } for (String language : languages) { parametersBuilder.setPreferredAudioLanguage(language); addTrackSelection(periodIndex, parametersBuilder.build()); } } }
Example #7
Source File: TrackSelectionHelper.java From PowerFileExplorer with GNU General Public License v3.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] = 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(); }
Example #8
Source File: DownloadHelper.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
/** * Convenience method to add selections of tracks for all specified text languages. Must not be * called until after preparation completes. * * @param selectUndeterminedTextLanguage Whether a text track with undetermined language should be * selected for downloading if no track with one of the specified {@code languages} is * available. * @param languages A list of text languages for which tracks should be added to the download * selection, as IETF BCP 47 conformant tags. */ public void addTextLanguagesToSelection( boolean selectUndeterminedTextLanguage, String... languages) { assertPreparedWithMedia(); for (int periodIndex = 0; periodIndex < mappedTrackInfos.length; periodIndex++) { DefaultTrackSelector.ParametersBuilder parametersBuilder = DEFAULT_TRACK_SELECTOR_PARAMETERS.buildUpon(); MappedTrackInfo mappedTrackInfo = mappedTrackInfos[periodIndex]; int rendererCount = mappedTrackInfo.getRendererCount(); for (int rendererIndex = 0; rendererIndex < rendererCount; rendererIndex++) { if (mappedTrackInfo.getRendererType(rendererIndex) != C.TRACK_TYPE_TEXT) { parametersBuilder.setRendererDisabled(rendererIndex, /* disabled= */ true); } } parametersBuilder.setSelectUndeterminedTextLanguage(selectUndeterminedTextLanguage); for (String language : languages) { parametersBuilder.setPreferredTextLanguage(language); addTrackSelection(periodIndex, parametersBuilder.build()); } } }
Example #9
Source File: DownloadHelper.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
/** * Convenience method to add selections of tracks for all specified audio languages. If an audio * track in one of the specified languages is not available, the default fallback audio track is * used instead. Must not be called until after preparation completes. * * @param languages A list of audio languages for which tracks should be added to the download * selection, as IETF BCP 47 conformant tags. */ public void addAudioLanguagesToSelection(String... languages) { assertPreparedWithMedia(); for (int periodIndex = 0; periodIndex < mappedTrackInfos.length; periodIndex++) { DefaultTrackSelector.ParametersBuilder parametersBuilder = DEFAULT_TRACK_SELECTOR_PARAMETERS.buildUpon(); MappedTrackInfo mappedTrackInfo = mappedTrackInfos[periodIndex]; int rendererCount = mappedTrackInfo.getRendererCount(); for (int rendererIndex = 0; rendererIndex < rendererCount; rendererIndex++) { if (mappedTrackInfo.getRendererType(rendererIndex) != C.TRACK_TYPE_AUDIO) { parametersBuilder.setRendererDisabled(rendererIndex, /* disabled= */ true); } } for (String language : languages) { parametersBuilder.setPreferredAudioLanguage(language); addTrackSelection(periodIndex, parametersBuilder.build()); } } }
Example #10
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 #11
Source File: DownloadHelper.java From Telegram with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unchecked") private void onMediaPrepared() { Assertions.checkNotNull(mediaPreparer); Assertions.checkNotNull(mediaPreparer.mediaPeriods); Assertions.checkNotNull(mediaPreparer.timeline); int periodCount = mediaPreparer.mediaPeriods.length; int rendererCount = rendererCapabilities.length; trackSelectionsByPeriodAndRenderer = (List<TrackSelection>[][]) new List<?>[periodCount][rendererCount]; immutableTrackSelectionsByPeriodAndRenderer = (List<TrackSelection>[][]) new List<?>[periodCount][rendererCount]; for (int i = 0; i < periodCount; i++) { for (int j = 0; j < rendererCount; j++) { trackSelectionsByPeriodAndRenderer[i][j] = new ArrayList<>(); immutableTrackSelectionsByPeriodAndRenderer[i][j] = Collections.unmodifiableList(trackSelectionsByPeriodAndRenderer[i][j]); } } trackGroupArrays = new TrackGroupArray[periodCount]; mappedTrackInfos = new MappedTrackInfo[periodCount]; for (int i = 0; i < periodCount; i++) { trackGroupArrays[i] = mediaPreparer.mediaPeriods[i].getTrackGroups(); TrackSelectorResult trackSelectorResult = runTrackSelection(/* periodIndex= */ i); trackSelector.onSelectionActivated(trackSelectorResult.info); mappedTrackInfos[i] = Assertions.checkNotNull(trackSelector.getCurrentMappedTrackInfo()); } setPreparedWithMedia(); Assertions.checkNotNull(callbackHandler) .post(() -> Assertions.checkNotNull(callback).onPrepared(this)); }
Example #12
Source File: DownloadHelper.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unchecked") private void onMediaPrepared() { Assertions.checkNotNull(mediaPreparer); Assertions.checkNotNull(mediaPreparer.mediaPeriods); Assertions.checkNotNull(mediaPreparer.timeline); int periodCount = mediaPreparer.mediaPeriods.length; int rendererCount = rendererCapabilities.length; trackSelectionsByPeriodAndRenderer = (List<TrackSelection>[][]) new List<?>[periodCount][rendererCount]; immutableTrackSelectionsByPeriodAndRenderer = (List<TrackSelection>[][]) new List<?>[periodCount][rendererCount]; for (int i = 0; i < periodCount; i++) { for (int j = 0; j < rendererCount; j++) { trackSelectionsByPeriodAndRenderer[i][j] = new ArrayList<>(); immutableTrackSelectionsByPeriodAndRenderer[i][j] = Collections.unmodifiableList(trackSelectionsByPeriodAndRenderer[i][j]); } } trackGroupArrays = new TrackGroupArray[periodCount]; mappedTrackInfos = new MappedTrackInfo[periodCount]; for (int i = 0; i < periodCount; i++) { trackGroupArrays[i] = mediaPreparer.mediaPeriods[i].getTrackGroups(); TrackSelectorResult trackSelectorResult = runTrackSelection(/* periodIndex= */ i); trackSelector.onSelectionActivated(trackSelectorResult.info); mappedTrackInfos[i] = Assertions.checkNotNull(trackSelector.getCurrentMappedTrackInfo()); } setPreparedWithMedia(); Assertions.checkNotNull(callbackHandler) .post(() -> Assertions.checkNotNull(callback).onPrepared(this)); }
Example #13
Source File: LiveVideoPlayerActivity.java From LiveVideoBroadcaster with Apache License 2.0 | 5 votes |
@Override public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) { MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo(); if (mappedTrackInfo != null) { if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_VIDEO) == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) { showToast(R.string.error_unsupported_video); } if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_AUDIO) == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) { showToast(R.string.error_unsupported_audio); } } }
Example #14
Source File: PlayerActivity.java From ExoPlayer-Offline with Apache License 2.0 | 5 votes |
private void updateButtonVisibilities() { debugRootView.removeAllViews(); retryButton.setVisibility(playerNeedsSource ? View.VISIBLE : View.GONE); debugRootView.addView(retryButton); if (player == null) { return; } MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo(); if (mappedTrackInfo == null) { return; } for (int i = 0; i < mappedTrackInfo.length; i++) { TrackGroupArray trackGroups = mappedTrackInfo.getTrackGroups(i); if (trackGroups.length != 0) { Button button = new Button(this); int label; switch (player.getRendererType(i)) { case C.TRACK_TYPE_AUDIO: label = R.string.audio; break; case C.TRACK_TYPE_VIDEO: label = R.string.video; break; case C.TRACK_TYPE_TEXT: label = R.string.text; break; default: continue; } button.setText(label); button.setTag(i); button.setOnClickListener(this); debugRootView.addView(button, debugRootView.getChildCount() - 1); } } }
Example #15
Source File: PlayerActivity.java From ExoPlayer-Offline with Apache License 2.0 | 5 votes |
@Override public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) { updateButtonVisibilities(); MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo(); if (mappedTrackInfo != null) { if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_VIDEO) == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) { showToast(R.string.error_unsupported_video); } if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_AUDIO) == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) { showToast(R.string.error_unsupported_audio); } } }
Example #16
Source File: PlayerActivity.java From ExoPlayer-Offline with Apache License 2.0 | 5 votes |
@Override public void onClick(View view) { if (view == retryButton) { initializePlayer(); } else if (view.getParent() == debugRootView) { MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo(); if (mappedTrackInfo != null) { trackSelectionHelper.showSelectionDialog(this, ((Button) view).getText(), trackSelector.getCurrentMappedTrackInfo(), (int) view.getTag()); } } }
Example #17
Source File: MediaPlayerFragment.java From PowerFileExplorer with GNU General Public License v3.0 | 5 votes |
private void updateButtonVisibilities() { debugRootView.removeAllViews(); retryButton.setVisibility(needRetrySource ? View.VISIBLE : View.GONE); debugRootView.addView(retryButton); if (player == null) { return; } MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo(); if (mappedTrackInfo == null) { return; } for (int i = 0; i < mappedTrackInfo.length; i++) { TrackGroupArray trackGroups = mappedTrackInfo.getTrackGroups(i); if (trackGroups.length != 0) { Button button = new Button(fragActivity); int label; switch (player.getRendererType(i)) { case C.TRACK_TYPE_AUDIO: label = R.string.audio; break; case C.TRACK_TYPE_VIDEO: label = R.string.video; break; case C.TRACK_TYPE_TEXT: label = R.string.text; break; default: continue; } button.setText(label); button.setTag(i); button.setOnClickListener(this); debugRootView.addView(button, debugRootView.getChildCount() - 1); } } }
Example #18
Source File: MediaPlayerFragment.java From PowerFileExplorer with GNU General Public License v3.0 | 5 votes |
@Override public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) { updateButtonVisibilities(); MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo(); if (mappedTrackInfo != null) { if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_VIDEO) == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) { showToast(R.string.error_unsupported_video); } if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_AUDIO) == MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) { showToast(R.string.error_unsupported_audio); } } }
Example #19
Source File: MediaPlayerFragment.java From PowerFileExplorer with GNU General Public License v3.0 | 5 votes |
@Override public void onClick(View view) { if (view == retryButton) { initializePlayer(); } else if (view.getParent() == debugRootView) { MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo(); if (mappedTrackInfo != null) { trackSelectionHelper.showSelectionDialog(fragActivity, ((Button) view).getText(), trackSelector.getCurrentMappedTrackInfo(), (int) view.getTag()); } } }
Example #20
Source File: PlayerActivity.java From leafpicrevived with GNU General Public License v3.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(com.alienpants.leafpicrevived.R.menu.menu_video_player, menu); MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo(); if (player != null && mappedTrackInfo != null) { for (int i = 0; i < mappedTrackInfo.length; i++) { TrackGroupArray trackGroups = mappedTrackInfo.getTrackGroups(i); if (trackGroups.length != 0) { switch (player.getRendererType(i)) { case C.TRACK_TYPE_AUDIO: menu.findItem(R.id.audio_stuff).setVisible(true); audio = i; break; case C.TRACK_TYPE_VIDEO: menu.findItem(R.id.video_stuff).setVisible(true); video = i; break; case C.TRACK_TYPE_TEXT: menu.findItem(R.id.text_stuff).setVisible(true); text = i; break; } } } } MenuItem loop = menu.findItem(R.id.loop_video); loop.setChecked(Prefs.getLoopVideo()); return true; }
Example #21
Source File: DownloadHelper.java From MediaSDK with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private void onMediaPrepared() { Assertions.checkNotNull(mediaPreparer); Assertions.checkNotNull(mediaPreparer.mediaPeriods); Assertions.checkNotNull(mediaPreparer.timeline); int periodCount = mediaPreparer.mediaPeriods.length; int rendererCount = rendererCapabilities.length; trackSelectionsByPeriodAndRenderer = (List<TrackSelection>[][]) new List<?>[periodCount][rendererCount]; immutableTrackSelectionsByPeriodAndRenderer = (List<TrackSelection>[][]) new List<?>[periodCount][rendererCount]; for (int i = 0; i < periodCount; i++) { for (int j = 0; j < rendererCount; j++) { trackSelectionsByPeriodAndRenderer[i][j] = new ArrayList<>(); immutableTrackSelectionsByPeriodAndRenderer[i][j] = Collections.unmodifiableList(trackSelectionsByPeriodAndRenderer[i][j]); } } trackGroupArrays = new TrackGroupArray[periodCount]; mappedTrackInfos = new MappedTrackInfo[periodCount]; for (int i = 0; i < periodCount; i++) { trackGroupArrays[i] = mediaPreparer.mediaPeriods[i].getTrackGroups(); TrackSelectorResult trackSelectorResult = runTrackSelection(/* periodIndex= */ i); trackSelector.onSelectionActivated(trackSelectorResult.info); mappedTrackInfos[i] = Assertions.checkNotNull(trackSelector.getCurrentMappedTrackInfo()); } setPreparedWithMedia(); Assertions.checkNotNull(callbackHandler) .post(() -> Assertions.checkNotNull(callback).onPrepared(this)); }
Example #22
Source File: DownloadHelper.java From Telegram-FOSS with GNU General Public License v2.0 | 2 votes |
/** * Returns the mapped track info for the given period. Must not be called until after preparation * completes. * * @param periodIndex The period index. * @return The {@link MappedTrackInfo} for the period. */ public MappedTrackInfo getMappedTrackInfo(int periodIndex) { assertPreparedWithMedia(); return mappedTrackInfos[periodIndex]; }
Example #23
Source File: DownloadHelper.java From Telegram with GNU General Public License v2.0 | 2 votes |
/** * Returns the mapped track info for the given period. Must not be called until after preparation * completes. * * @param periodIndex The period index. * @return The {@link MappedTrackInfo} for the period. */ public MappedTrackInfo getMappedTrackInfo(int periodIndex) { assertPreparedWithMedia(); return mappedTrackInfos[periodIndex]; }
Example #24
Source File: DownloadHelper.java From MediaSDK with Apache License 2.0 | 2 votes |
/** * Returns the mapped track info for the given period. Must not be called until after preparation * completes. * * @param periodIndex The period index. * @return The {@link MappedTrackInfo} for the period. */ public MappedTrackInfo getMappedTrackInfo(int periodIndex) { assertPreparedWithMedia(); return mappedTrackInfos[periodIndex]; }