/** * Invoked with the results from a {@link RendererBuilder}. * * @param renderers Renderers indexed by {@link DemoPlayer} TYPE_* constants. An individual * element may be null if there do not exist tracks of the corresponding * type. * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be * null. */ /* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } } // Complete preparation. this.videoRenderer = renderers[TYPE_VIDEO]; this.audioRenderer = renderers[TYPE_AUDIO]; this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null; this.bandwidthMeter = bandwidthMeter; pushSurface(false); player.prepare(renderers); rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; }
/** * Invoked with the results from a {@link RendererBuilder}. * * @param renderers Renderers indexed by {@link VideoPlayer} TYPE_* constants. An * individual element may be null if there do not exist tracks of the * corresponding type. * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be * null. */ /* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } } // Complete preparation. this.videoRenderer = renderers[TYPE_VIDEO]; this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null; this.bandwidthMeter = bandwidthMeter; pushSurface(false); player.prepare(renderers); rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; }
/** * Invoked with the results from a {link RendererBuilder}. * * @param renderers Renderers indexed by {link DemoPlayer} TYPE_* constants. An individual * element may be null if there do not exist tracks of the corresponding type. * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null. */ /* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } } // Complete preparation. this.videoRenderer = renderers[TYPE_VIDEO]; this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null; this.bandwidthMeter = bandwidthMeter; pushSurface(false); player.prepare(renderers); rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; }
/** * Invoked with the results from a {@link RendererBuilder}. * * @param renderers Renderers indexed by {@link ExoPlayerHelper} TYPE_* constants. An individual * element may be null if there do not exist tracks of the corresponding type. * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null. */ /* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } } // Complete preparation. this.videoRenderer = renderers[TYPE_VIDEO]; this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null; this.bandwidthMeter = bandwidthMeter; pushSurface(false); player.prepare(renderers); rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; }
/** * Invoked with the results from a {@link RendererBuilder}. * * @param renderers Renderers indexed by {@link DemoPlayer} TYPE_* constants. An individual * element may be null if there do not exist tracks of the corresponding type. * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null. */ /* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } } // Complete preparation. this.videoRenderer = renderers[TYPE_VIDEO]; this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null; this.bandwidthMeter = bandwidthMeter; pushSurface(false); player.prepare(renderers); rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; }
private void onRenderers(TrackRenderer[] renderers) { mBuilderCallback = null; for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } } mVideoRenderer = renderers[TRACK_TYPE_VIDEO]; mAudioRenderer = renderers[TRACK_TYPE_AUDIO]; mTextRenderer = (Cea708TextTrackRenderer) renderers[TRACK_TYPE_TEXT]; mTextRenderer.setCcListener(mCcListener); mPlayer.sendMessage( mTextRenderer, Cea708TextTrackRenderer.MSG_SERVICE_NUMBER, mCaptionServiceNumber); mRendererBuildingState = RENDERER_BUILDING_STATE_BUILT; pushSurface(false); mPlayer.prepare(renderers); pushTrackSelection(TRACK_TYPE_VIDEO, true); pushTrackSelection(TRACK_TYPE_AUDIO, true); pushTrackSelection(TRACK_TYPE_TEXT, true); }
/** * Invoked with the results from a {@link RendererBuilder}. * * @param renderers Renderers indexed by {@link Player} TYPE_* constants. An individual * element may be null if there do not exist tracks of the corresponding type. * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null. */ /* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } } // Complete preparation. this.videoRenderer = renderers[TYPE_VIDEO]; this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null; this.bandwidthMeter = bandwidthMeter; pushSurface(false); player.prepare(renderers); rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; }
/** * Invoked with the results from a {@link RendererBuilder}. * * @param renderers Renderers indexed by {@link DemoPlayer} TYPE_* constants. An individual * element may be null if there do not exist tracks of the corresponding * type. * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null. */ /* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } } // Complete preparation. this.videoRenderer = renderers[TYPE_VIDEO]; this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null; this.bandwidthMeter = bandwidthMeter; pushSurface(false); player.prepare(renderers); rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; }
public void onRenderers(TrackRenderer[] renderers, @Nullable BandwidthMeter bandwidthMeter) { for (int i = 0; i < RENDER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } } // Complete preparation. this.videoRenderer = renderers[RENDER_VIDEO]; this.audioRenderer = renderers[RENDER_AUDIO]; pushSurface(false); player.prepare(renderers); rendererBuildingState = RenderBuildingState.BUILT; }
/** * Invoked with the results from a {@link RendererBuilder}. * * @param renderers Renderers indexed by {@link ExoPlayerWrapper} TYPE_* constants. An individual * element may be null if there do not exist tracks of the corresponding type. * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null. */ protected void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } } // Complete preparation. this.videoRenderer = renderers[TYPE_VIDEO]; this.audioRenderer = renderers[TYPE_AUDIO]; this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null; this.bandwidthMeter = bandwidthMeter; pushSurface(false); player.prepare(renderers); rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; }
/** * Invoked with the results from a {@link RendererBuilder}. * * @param renderers Renderers indexed by {@link FlyingPlayer} TYPE_* constants. An individual * element may be null if there do not exist tracks of the corresponding type. * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null. */ /* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } } // Complete preparation. this.videoRenderer = renderers[TYPE_VIDEO]; this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null; this.bandwidthMeter = bandwidthMeter; pushSurface(false); player.prepare(renderers); rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; }
/** * Invoked with the results from a {@link RendererBuilder}. * * @param renderers Renderers indexed by {@link DemoPlayer} TYPE_* constants. An individual * element may be null if there do not exist tracks of the corresponding type. * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null. */ /* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } } // Complete preparation. this.videoRenderer = renderers[TYPE_VIDEO]; this.audioRenderer = renderers[TYPE_AUDIO]; this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null; this.bandwidthMeter = bandwidthMeter; pushSurface(false); player.prepare(renderers); rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; }
public void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { //如果没有注入视频音频渲染器,则放入虚拟的渲染器(无作用) renderers[i] = new DummyTrackRenderer(); } } // 播放器准备完成 this.videoRenderer = renderers[TYPE_VIDEO]; this.audioRenderer = renderers[TYPE_AUDIO]; pushSurface(false); //注入渲染器 player.prepare(renderers); //改变渲染器状态 rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; }
/** * Invoked with the results from a {@link RendererBuilder}. * * @param renderers Renderers indexed by {@link ExoplayerWrapper} TYPE_* constants. An * individual element may be null if there do not exist tracks of the * corresponding type. * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null. */ public void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { // Normalize the results. if (trackNames == null) { trackNames = new String[RENDERER_COUNT][]; } for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } } // Complete preparation. this.videoRenderer = renderers[TYPE_VIDEO]; this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null; rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; this.bandwidthMeter = bandwidthMeter; maybeReportPlayerState(); pushSurfaceAndVideoTrack(false); player.prepare(renderers); }
public void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { for (int i = 0; i < renderers.length; i++) { if (renderers[i] == null) { renderers[i] = new DummyTrackRenderer(); } } // Complete preparation. this.videoRenderer = renderers[TYPE_VIDEO]; pushSurface(false); player.prepare(renderers); player.setPlayWhenReady(true); }
public void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { Log.e(TAG, "onRenderers dummy " + i); // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } } // Complete preparation. this.videoRenderer = renderers[TYPE_VIDEO]; pushSurface(false); player.prepare(renderers); }
/** * Invoked with the results from a {@link RendererBuilder}. * * @param trackNames The names of the available tracks, indexed by {@link VideoPlayer} TYPE_* * constants. May be null if the track names are unknown. An individual element may be null * if the track names are unknown for the corresponding type. * @param multiTrackSources Sources capable of switching between multiple available tracks, * indexed by {@link VideoPlayer} TYPE_* constants. May be null if there are no types with * multiple tracks. An individual element may be null if it does not have multiple tracks. * @param renderers Renderers indexed by {@link VideoPlayer} TYPE_* constants. An individual * element may be null if there do not exist tracks of the corresponding type. * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null. */ /* package */ void onRenderers(String[][] trackNames, MultiTrackChunkSource[] multiTrackSources, TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { // Normalize the results. if (trackNames == null) { trackNames = new String[RENDERER_COUNT][]; } if (multiTrackSources == null) { multiTrackSources = new MultiTrackChunkSource[RENDERER_COUNT]; } for (int rendererIndex = 0; rendererIndex < RENDERER_COUNT; rendererIndex++) { if (renderers[rendererIndex] == null) { // Convert a null renderer to a dummy renderer. renderers[rendererIndex] = new DummyTrackRenderer(); } if (trackNames[rendererIndex] == null) { // Convert a null trackNames to an array of suitable length. int trackCount = multiTrackSources[rendererIndex] != null ? multiTrackSources[rendererIndex].getTrackCount() : 1; trackNames[rendererIndex] = new String[trackCount]; } } // Complete preparation. this.trackNames = trackNames; this.videoRenderer = renderers[TYPE_VIDEO]; this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null; this.multiTrackSources = multiTrackSources; this.bandwidthMeter = bandwidthMeter; pushSurface(false); pushTrackSelection(TYPE_VIDEO, true); pushTrackSelection(TYPE_AUDIO, true); pushTrackSelection(TYPE_TEXT, true); player.prepare(renderers); rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; }
void onRenderers(String[][] trackNames, MultiTrackChunkSource[] multiTrackSources, TrackRenderer[] renderers) { builderCallback = null; // Normalize the results. if (trackNames == null) { trackNames = new String[RENDERER_COUNT][]; } if (multiTrackSources == null) { multiTrackSources = new MultiTrackChunkSource[RENDERER_COUNT]; } for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } else if (trackNames[i] == null) { // We have a renderer so we must have at least one track, but the names are unknown. // Initialize the correct number of null track names. int trackCount = multiTrackSources[i] == null ? 1 : multiTrackSources[i].getTrackCount(); trackNames[i] = new String[trackCount]; } } // Complete preparation. this.trackNames = trackNames; this.videoRenderer = renderers[TYPE_VIDEO]; this.multiTrackSources = multiTrackSources; pushSurface(false); pushTrackSelection(TYPE_VIDEO, true); pushTrackSelection(TYPE_AUDIO, true); pushTrackSelection(TYPE_TEXT, true); player.prepare(renderers); rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; }
/** * Invoked with the results from a {@link RendererBuilder}. * * @param renderers Renderers indexed by {@link Player} TYPE_* constants. An individual * element may be null if there do not exist tracks of the corresponding * type. * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be * null. */ void invokeOnRenderersBuilt(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } } // Complete preparation. this.videoRenderer = renderers[TYPE_VIDEO]; pushSurface(false); player.prepare(renderers); rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; }
void onRenderers(String[][] trackNames, MultiTrackChunkSource[] multiTrackSources, TrackRenderer[] renderers) { builderCallback = null; // Normalize the results. if (trackNames == null) { trackNames = new String[RENDERER_COUNT][]; } if (multiTrackSources == null) { multiTrackSources = new MultiTrackChunkSource[RENDERER_COUNT]; } for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } else if (trackNames[i] == null) { // We have a renderer so we must have at least one track, but the names are unknown. // Initialize the correct number of null track names. int trackCount = multiTrackSources[i] == null ? 1 : multiTrackSources[i].getTrackCount(); trackNames[i] = new String[trackCount]; } } // Complete preparation. this.videoRenderer = renderers[TYPE_VIDEO]; this.trackNames = trackNames; this.multiTrackSources = multiTrackSources; rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; pushSurfaceAndVideoTrack(false); pushTrackSelection(TYPE_AUDIO, true); pushTrackSelection(TYPE_TEXT, true); player.prepare(renderers); }
void onRenderers(String[][] trackNames, MultiTrackChunkSource[] multiTrackSources, TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { builderCallback = null; // Normalize the results. if (trackNames == null) { trackNames = new String[RENDERER_COUNT][]; } if (multiTrackSources == null) { multiTrackSources = new MultiTrackChunkSource[RENDERER_COUNT]; } for (int rendererIndex = 0; rendererIndex < RENDERER_COUNT; rendererIndex++) { if (renderers[rendererIndex] == null) { // Convert a null renderer to a dummy renderer. renderers[rendererIndex] = new DummyTrackRenderer(); } if (trackNames[rendererIndex] == null) { // Convert a null trackNames to an array of suitable length. int trackCount = multiTrackSources[rendererIndex] != null ? multiTrackSources[rendererIndex].getTrackCount() : 1; trackNames[rendererIndex] = new String[trackCount]; } } // Complete preparation. this.trackNames = trackNames; this.videoRenderer = renderers[TYPE_VIDEO]; this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null; this.bandwidthMeter = bandwidthMeter; pushSurface(false); player.prepare(renderers); rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; }
void onRenderers(String[][] trackNames, MultiTrackChunkSource[] multiTrackSources, TrackRenderer[] renderers) { builderCallback = null; // Normalize the results. if (trackNames == null) { trackNames = new String[RENDERER_COUNT][]; } if (multiTrackSources == null) { multiTrackSources = new MultiTrackChunkSource[RENDERER_COUNT]; } for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } else if (trackNames[i] == null) { // We have a renderer so we must have at least one track, but the names are unknown. // Initialize the correct number of null track names. int trackCount = multiTrackSources[i] == null ? 1 : multiTrackSources[i].getTrackCount(); trackNames[i] = new String[trackCount]; } } // Complete preparation. this.videoRenderer = renderers[TYPE_VIDEO]; this.trackNames = trackNames; this.multiTrackSources = multiTrackSources; rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; pushSurface(false); pushTrackSelection(TYPE_VIDEO, true); pushTrackSelection(TYPE_AUDIO, true); pushTrackSelection(TYPE_TEXT, true); player.prepare(renderers); }
/** * Invoked with the results from a {@link RendererBuilder}. * * @param trackNames The names of the available tracks, indexed by {@link DemoPlayer} TYPE_* * constants. May be null if the track names are unknown. An individual element may be null * if the track names are unknown for the corresponding type. * @param multiTrackSources Sources capable of switching between multiple available tracks, * indexed by {@link DemoPlayer} TYPE_* constants. May be null if there are no types with * multiple tracks. An individual element may be null if it does not have multiple tracks. * @param renderers Renderers indexed by {@link DemoPlayer} TYPE_* constants. An individual * element may be null if there do not exist tracks of the corresponding type. * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null. */ /* package */ void onRenderers(String[][] trackNames, MultiTrackChunkSource[] multiTrackSources, TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { // Normalize the results. if (trackNames == null) { trackNames = new String[RENDERER_COUNT][]; } if (multiTrackSources == null) { multiTrackSources = new MultiTrackChunkSource[RENDERER_COUNT]; } for (int rendererIndex = 0; rendererIndex < RENDERER_COUNT; rendererIndex++) { if (renderers[rendererIndex] == null) { // Convert a null renderer to a dummy renderer. renderers[rendererIndex] = new DummyTrackRenderer(); } if (trackNames[rendererIndex] == null) { // Convert a null trackNames to an array of suitable length. int trackCount = multiTrackSources[rendererIndex] != null ? multiTrackSources[rendererIndex].getTrackCount() : 1; trackNames[rendererIndex] = new String[trackCount]; } } // Complete preparation. this.trackNames = trackNames; this.videoRenderer = renderers[TYPE_VIDEO]; this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null; this.multiTrackSources = multiTrackSources; this.bandwidthMeter = bandwidthMeter; pushSurface(false); pushTrackSelection(TYPE_VIDEO, true); pushTrackSelection(TYPE_AUDIO, true); pushTrackSelection(TYPE_TEXT, true); player.prepare(renderers); rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; }
void onRenderers(String[][] trackNames, MultiTrackChunkSource[] multiTrackSources, TrackRenderer[] renderers) { builderCallback = null; // Normalize the results. if (trackNames == null) { trackNames = new String[RENDERER_COUNT][]; } if (multiTrackSources == null) { multiTrackSources = new MultiTrackChunkSource[RENDERER_COUNT]; } for (int i = 0; i < RENDERER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); } else if (trackNames[i] == null) { // We have a renderer so we must have at least one track, but the names are unknown. // Initialize the correct number of null track names. int trackCount = multiTrackSources[i] == null ? 1 : multiTrackSources[i].getTrackCount(); trackNames[i] = new String[trackCount]; } } // Complete preparation. this.videoRenderer = renderers[TYPE_VIDEO]; this.trackNames = trackNames; this.multiTrackSources = multiTrackSources; rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; maybeReportPlayerState(); pushSurfaceAndVideoTrack(false); pushTrackSelection(TYPE_AUDIO, true); // pushTrackSelection(TYPE_TEXT, true); player.prepare(renderers); }
/** * Invoked with the results from a {@link RendererBuilder}. * * @param trackNames The names of the available tracks, indexed by {@link MediaPlayer} TYPE_* * constants. May be null if the track names are unknown. An individual element may be * null * if the track names are unknown for the corresponding type. * @param multiTrackSources Sources capable of switching between multiple available tracks, * indexed by {@link MediaPlayer} TYPE_* constants. May be null if there are no types * with * multiple tracks. An individual element may be null if it does not have multiple * tracks. * @param renderers Renderers indexed by {@link MediaPlayer} TYPE_* constants. An individual * element may be null if there do not exist tracks of the corresponding type. * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null. */ /* package */ void onRenderers(String[][] trackNames, MultiTrackChunkSource[] multiTrackSources, TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) { // Normalize the results. if (trackNames == null) { trackNames = new String[RENDERER_COUNT][]; } if (multiTrackSources == null) { multiTrackSources = new MultiTrackChunkSource[RENDERER_COUNT]; } for (int rendererIndex = 0; rendererIndex < RENDERER_COUNT; rendererIndex++) { if (renderers[rendererIndex] == null) { // Convert a null renderer to a dummy renderer. renderers[rendererIndex] = new DummyTrackRenderer(); } if (trackNames[rendererIndex] == null) { // Convert a null trackNames to an array of suitable length. int trackCount = multiTrackSources[rendererIndex] != null ? multiTrackSources[rendererIndex].getTrackCount() : 1; trackNames[rendererIndex] = new String[trackCount]; } } // Complete preparation. this.trackNames = trackNames; this.videoRenderer = renderers[TYPE_VIDEO]; this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null; this.multiTrackSources = multiTrackSources; this.bandwidthMeter = bandwidthMeter; pushSurface(false); pushTrackSelection(TYPE_VIDEO, true); pushTrackSelection(TYPE_AUDIO, true); pushTrackSelection(TYPE_TEXT, true); player.prepare(renderers); rendererBuildingState = RENDERER_BUILDING_STATE_BUILT; }