本文整理匯總了Java中com.google.android.exoplayer2.RendererConfiguration類的典型用法代碼示例。如果您正苦於以下問題:Java RendererConfiguration類的具體用法?Java RendererConfiguration怎麽用?Java RendererConfiguration使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RendererConfiguration類屬於com.google.android.exoplayer2包,在下文中一共展示了RendererConfiguration類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testSelectTracksWithNoSampleRendererWithClearedNullOverride
import com.google.android.exoplayer2.RendererConfiguration; //導入依賴的package包/類
/**
* Tests that a null override can be cleared when there is no-sample renderer.
*/
@Test
public void testSelectTracksWithNoSampleRendererWithClearedNullOverride()
throws ExoPlaybackException {
TrackSelection[] expectedTrackSelection = TRACK_SELECTIONS_WITH_NO_SAMPLE_RENDERER;
FakeMappingTrackSelector trackSelector = new FakeMappingTrackSelector(expectedTrackSelection);
trackSelector.setSelectionOverride(0, new TrackGroupArray(VIDEO_TRACK_GROUP), null);
trackSelector.clearSelectionOverride(0, new TrackGroupArray(VIDEO_TRACK_GROUP));
TrackSelectorResult result = trackSelector.selectTracks(
RENDERER_CAPABILITIES_WITH_NO_SAMPLE_RENDERER, TRACK_GROUPS);
assertThat(result.selections.get(0)).isEqualTo(expectedTrackSelection[0]);
assertThat(result.selections.get(1)).isEqualTo(expectedTrackSelection[1]);
assertThat(result.selections.get(2)).isNull();
assertThat(new boolean[] {true, true, true}).isEqualTo(result.renderersEnabled);
assertThat(new RendererConfiguration[] {DEFAULT, DEFAULT, DEFAULT})
.isEqualTo(result.rendererConfigurations);
}
示例2: testSelectTracksWithNoSampleRendererWithNullOverrideForDifferentTracks
import com.google.android.exoplayer2.RendererConfiguration; //導入依賴的package包/類
/**
* Tests that an override is not applied for a different set of available track groups
* when there is no-sample renderer.
*/
@Test
public void testSelectTracksWithNoSampleRendererWithNullOverrideForDifferentTracks()
throws ExoPlaybackException {
TrackSelection[] expectedTrackSelection = TRACK_SELECTIONS_WITH_NO_SAMPLE_RENDERER;
FakeMappingTrackSelector trackSelector = new FakeMappingTrackSelector(expectedTrackSelection);
trackSelector.setSelectionOverride(0, new TrackGroupArray(VIDEO_TRACK_GROUP), null);
TrackSelectorResult result = trackSelector.selectTracks(
RENDERER_CAPABILITIES_WITH_NO_SAMPLE_RENDERER,
new TrackGroupArray(VIDEO_TRACK_GROUP, AUDIO_TRACK_GROUP, VIDEO_TRACK_GROUP));
assertThat(result.selections.get(0)).isEqualTo(expectedTrackSelection[0]);
assertThat(result.selections.get(1)).isEqualTo(expectedTrackSelection[1]);
assertThat(result.selections.get(2)).isNull();
assertThat(new boolean[] {true, true, true}).isEqualTo(result.renderersEnabled);
assertThat(new RendererConfiguration[] {DEFAULT, DEFAULT, DEFAULT})
.isEqualTo(result.rendererConfigurations);
}
示例3: testSelectTracksDisablingNormalRendererWithNoSampleRenderer
import com.google.android.exoplayer2.RendererConfiguration; //導入依賴的package包/類
/**
* Tests that disabling another renderer works when there is no-sample renderer.
*/
@Test
public void testSelectTracksDisablingNormalRendererWithNoSampleRenderer()
throws ExoPlaybackException {
TrackSelection[] expectedTrackSelection = TRACK_SELECTIONS_WITH_NO_SAMPLE_RENDERER;
FakeMappingTrackSelector trackSelector = new FakeMappingTrackSelector(expectedTrackSelection);
trackSelector.setRendererDisabled(0, true);
TrackSelectorResult result = trackSelector.selectTracks(
RENDERER_CAPABILITIES_WITH_NO_SAMPLE_RENDERER, TRACK_GROUPS);
assertThat(result.selections.get(0)).isNull();
assertThat(result.selections.get(1)).isEqualTo(expectedTrackSelection[1]);
assertThat(result.selections.get(2)).isNull();
assertThat(new boolean[] {false, true, true}).isEqualTo(result.renderersEnabled);
assertThat(new RendererConfiguration[] {null, DEFAULT, DEFAULT})
.isEqualTo(result.rendererConfigurations);
}
示例4: testSelectTracksDisablingNoSampleRenderer
import com.google.android.exoplayer2.RendererConfiguration; //導入依賴的package包/類
/**
* Tests that disabling no-sample renderer work.
*/
@Test
public void testSelectTracksDisablingNoSampleRenderer()
throws ExoPlaybackException {
TrackSelection[] expectedTrackSelection = TRACK_SELECTIONS_WITH_NO_SAMPLE_RENDERER;
FakeMappingTrackSelector trackSelector = new FakeMappingTrackSelector(expectedTrackSelection);
trackSelector.setRendererDisabled(2, true);
TrackSelectorResult result = trackSelector.selectTracks(
RENDERER_CAPABILITIES_WITH_NO_SAMPLE_RENDERER, TRACK_GROUPS);
assertThat(result.selections.get(0)).isEqualTo(expectedTrackSelection[0]);
assertThat(result.selections.get(1)).isEqualTo(expectedTrackSelection[1]);
assertThat(result.selections.get(2)).isNull();
assertThat(new boolean[] {true, true, false}).isEqualTo(result.renderersEnabled);
assertThat(new RendererConfiguration[] {DEFAULT, DEFAULT, null})
.isEqualTo(result.rendererConfigurations);
}
示例5: testSelectTracks
import com.google.android.exoplayer2.RendererConfiguration; //導入依賴的package包/類
/**
* Tests the result of {@link MappingTrackSelector#selectTracks(RendererCapabilities[],
* TrackGroupArray[], int[][][])} is propagated correctly to the result of
* {@link MappingTrackSelector#selectTracks(RendererCapabilities[], TrackGroupArray)}.
*/
@Test
public void testSelectTracks() throws ExoPlaybackException {
FakeMappingTrackSelector trackSelector = new FakeMappingTrackSelector(
TRACK_SELECTIONS);
TrackSelectorResult result = trackSelector.selectTracks(RENDERER_CAPABILITIES, TRACK_GROUPS);
assertThat(result.selections.get(0)).isEqualTo(TRACK_SELECTIONS[0]);
assertThat(result.selections.get(1)).isEqualTo(TRACK_SELECTIONS[1]);
assertThat(new boolean[] {true, true}).isEqualTo(result.renderersEnabled);
assertThat(new RendererConfiguration[] {DEFAULT, DEFAULT})
.isEqualTo(result.rendererConfigurations);
}
示例6: testSelectTracksWithNullOverride
import com.google.android.exoplayer2.RendererConfiguration; //導入依賴的package包/類
/**
* Tests that a null override clears a track selection.
*/
@Test
public void testSelectTracksWithNullOverride() throws ExoPlaybackException {
FakeMappingTrackSelector trackSelector = new FakeMappingTrackSelector(
TRACK_SELECTIONS);
trackSelector.setSelectionOverride(0, new TrackGroupArray(VIDEO_TRACK_GROUP), null);
TrackSelectorResult result = trackSelector.selectTracks(RENDERER_CAPABILITIES, TRACK_GROUPS);
assertThat(result.selections.get(0)).isNull();
assertThat(result.selections.get(1)).isEqualTo(TRACK_SELECTIONS[1]);
assertThat(new boolean[] {false, true}).isEqualTo(result.renderersEnabled);
assertThat(new RendererConfiguration[] {null, DEFAULT})
.isEqualTo(result.rendererConfigurations);
}
示例7: testSelectTracksWithClearedNullOverride
import com.google.android.exoplayer2.RendererConfiguration; //導入依賴的package包/類
/**
* Tests that a null override can be cleared.
*/
@Test
public void testSelectTracksWithClearedNullOverride() throws ExoPlaybackException {
FakeMappingTrackSelector trackSelector = new FakeMappingTrackSelector(
TRACK_SELECTIONS);
trackSelector.setSelectionOverride(0, new TrackGroupArray(VIDEO_TRACK_GROUP), null);
trackSelector.clearSelectionOverride(0, new TrackGroupArray(VIDEO_TRACK_GROUP));
TrackSelectorResult result = trackSelector.selectTracks(RENDERER_CAPABILITIES, TRACK_GROUPS);
assertThat(result.selections.get(0)).isEqualTo(TRACK_SELECTIONS[0]);
assertThat(result.selections.get(1)).isEqualTo(TRACK_SELECTIONS[1]);
assertThat(new boolean[] {true, true}).isEqualTo(result.renderersEnabled);
assertThat(new RendererConfiguration[] {DEFAULT, DEFAULT})
.isEqualTo(result.rendererConfigurations);
}
示例8: testSelectTracksWithNullOverrideForDifferentTracks
import com.google.android.exoplayer2.RendererConfiguration; //導入依賴的package包/類
/**
* Tests that an override is not applied for a different set of available track groups.
*/
@Test
public void testSelectTracksWithNullOverrideForDifferentTracks() throws ExoPlaybackException {
FakeMappingTrackSelector trackSelector = new FakeMappingTrackSelector(
TRACK_SELECTIONS);
trackSelector.setSelectionOverride(0, new TrackGroupArray(VIDEO_TRACK_GROUP), null);
TrackSelectorResult result = trackSelector.selectTracks(RENDERER_CAPABILITIES,
new TrackGroupArray(VIDEO_TRACK_GROUP, AUDIO_TRACK_GROUP, VIDEO_TRACK_GROUP));
assertThat(result.selections.get(0)).isEqualTo(TRACK_SELECTIONS[0]);
assertThat(result.selections.get(1)).isEqualTo(TRACK_SELECTIONS[1]);
assertThat(new boolean[] {true, true}).isEqualTo(result.renderersEnabled);
assertThat(new RendererConfiguration[] {DEFAULT, DEFAULT})
.isEqualTo(result.rendererConfigurations);
}
示例9: testSelectTracksWithNoSampleRenderer
import com.google.android.exoplayer2.RendererConfiguration; //導入依賴的package包/類
/**
* Tests the result of {@link MappingTrackSelector#selectTracks(RendererCapabilities[],
* TrackGroupArray[], int[][][])} is propagated correctly to the result of
* {@link MappingTrackSelector#selectTracks(RendererCapabilities[], TrackGroupArray)}
* when there is no-sample renderer.
*/
@Test
public void testSelectTracksWithNoSampleRenderer() throws ExoPlaybackException {
TrackSelection[] expectedTrackSelection = TRACK_SELECTIONS_WITH_NO_SAMPLE_RENDERER;
FakeMappingTrackSelector trackSelector = new FakeMappingTrackSelector(expectedTrackSelection);
TrackSelectorResult result = trackSelector.selectTracks(
RENDERER_CAPABILITIES_WITH_NO_SAMPLE_RENDERER, TRACK_GROUPS);
assertThat(result.selections.get(0)).isEqualTo(expectedTrackSelection[0]);
assertThat(result.selections.get(1)).isEqualTo(expectedTrackSelection[1]);
assertThat(result.selections.get(2)).isNull();
assertThat(new boolean[] {true, true, true}).isEqualTo(result.renderersEnabled);
assertThat(new RendererConfiguration[] {DEFAULT, DEFAULT, DEFAULT})
.isEqualTo(result.rendererConfigurations);
}
示例10: testSelectTracksWithNoSampleRendererWithNullOverride
import com.google.android.exoplayer2.RendererConfiguration; //導入依賴的package包/類
/**
* Tests that a null override clears a track selection when there is no-sample renderer.
*/
@Test
public void testSelectTracksWithNoSampleRendererWithNullOverride() throws ExoPlaybackException {
TrackSelection[] expectedTrackSelection = TRACK_SELECTIONS_WITH_NO_SAMPLE_RENDERER;
FakeMappingTrackSelector trackSelector = new FakeMappingTrackSelector(expectedTrackSelection);
trackSelector.setSelectionOverride(0, new TrackGroupArray(VIDEO_TRACK_GROUP), null);
TrackSelectorResult result = trackSelector.selectTracks(
RENDERER_CAPABILITIES_WITH_NO_SAMPLE_RENDERER, TRACK_GROUPS);
assertThat(result.selections.get(0)).isNull();
assertThat(result.selections.get(1)).isEqualTo(expectedTrackSelection[1]);
assertThat(result.selections.get(2)).isNull();
assertThat(new boolean[] {false, true, true}).isEqualTo(result.renderersEnabled);
assertThat(new RendererConfiguration[] {null, DEFAULT, DEFAULT})
.isEqualTo(result.rendererConfigurations);
}
示例11: testImmediatelyReadEndOfStreamPlaysAudioSinkToEndOfStream
import com.google.android.exoplayer2.RendererConfiguration; //導入依賴的package包/類
@Test
public void testImmediatelyReadEndOfStreamPlaysAudioSinkToEndOfStream() throws Exception {
audioRenderer.enable(RendererConfiguration.DEFAULT, new Format[] {FORMAT},
new FakeSampleStream(FORMAT), 0, false, 0);
audioRenderer.setCurrentStreamFinal();
when(mockAudioSink.isEnded()).thenReturn(true);
while (!audioRenderer.isEnded()) {
audioRenderer.render(0, 0);
}
verify(mockAudioSink, times(1)).playToEndOfStream();
audioRenderer.disable();
verify(mockAudioSink, times(1)).release();
}
示例12: maybeConfigureRenderersForTunneling
import com.google.android.exoplayer2.RendererConfiguration; //導入依賴的package包/類
/**
* Determines whether tunneling should be enabled, replacing {@link RendererConfiguration}s in
* {@code rendererConfigurations} with configurations that enable tunneling on the appropriate
* renderers if so.
*
* @param rendererCapabilities The {@link RendererCapabilities} of the renderers for which
* {@link TrackSelection}s are to be generated.
* @param rendererTrackGroupArrays An array of {@link TrackGroupArray}s where each entry
* corresponds to the renderer of equal index in {@code renderers}.
* @param rendererFormatSupports Maps every available track to a specific level of support as
* defined by the renderer {@code FORMAT_*} constants.
* @param rendererConfigurations The renderer configurations. Configurations may be replaced with
* ones that enable tunneling as a result of this call.
* @param trackSelections The renderer track selections.
* @param tunnelingAudioSessionId The audio session id to use when tunneling, or
* {@link C#AUDIO_SESSION_ID_UNSET} if tunneling should not be enabled.
*/
private static void maybeConfigureRenderersForTunneling(
RendererCapabilities[] rendererCapabilities, TrackGroupArray[] rendererTrackGroupArrays,
int[][][] rendererFormatSupports, RendererConfiguration[] rendererConfigurations,
TrackSelection[] trackSelections, int tunnelingAudioSessionId) {
if (tunnelingAudioSessionId == C.AUDIO_SESSION_ID_UNSET) {
return;
}
// Check whether we can enable tunneling. To enable tunneling we require exactly one audio and
// one video renderer to support tunneling and have a selection.
int tunnelingAudioRendererIndex = -1;
int tunnelingVideoRendererIndex = -1;
boolean enableTunneling = true;
for (int i = 0; i < rendererCapabilities.length; i++) {
int rendererType = rendererCapabilities[i].getTrackType();
TrackSelection trackSelection = trackSelections[i];
if ((rendererType == C.TRACK_TYPE_AUDIO || rendererType == C.TRACK_TYPE_VIDEO)
&& trackSelection != null) {
if (rendererSupportsTunneling(rendererFormatSupports[i], rendererTrackGroupArrays[i],
trackSelection)) {
if (rendererType == C.TRACK_TYPE_AUDIO) {
if (tunnelingAudioRendererIndex != -1) {
enableTunneling = false;
break;
} else {
tunnelingAudioRendererIndex = i;
}
} else {
if (tunnelingVideoRendererIndex != -1) {
enableTunneling = false;
break;
} else {
tunnelingVideoRendererIndex = i;
}
}
}
}
}
enableTunneling &= tunnelingAudioRendererIndex != -1 && tunnelingVideoRendererIndex != -1;
if (enableTunneling) {
RendererConfiguration tunnelingRendererConfiguration =
new RendererConfiguration(tunnelingAudioSessionId);
rendererConfigurations[tunnelingAudioRendererIndex] = tunnelingRendererConfiguration;
rendererConfigurations[tunnelingVideoRendererIndex] = tunnelingRendererConfiguration;
}
}
示例13: TrackSelectorResult
import com.google.android.exoplayer2.RendererConfiguration; //導入依賴的package包/類
/**
* @param groups The groups provided to the {@link TrackSelector}.
* @param selections A {@link TrackSelectionArray} containing the selection for each renderer.
* @param info An opaque object that will be returned to
* {@link TrackSelector#onSelectionActivated(Object)} should the selections be activated.
* @param rendererConfigurations A {@link RendererConfiguration} for each renderer, to be used
* with the selections.
*/
public TrackSelectorResult(TrackGroupArray groups, TrackSelectionArray selections, Object info,
RendererConfiguration[] rendererConfigurations) {
this.groups = groups;
this.selections = selections;
this.info = info;
this.rendererConfigurations = rendererConfigurations;
}
示例14: TrackSelectorResult
import com.google.android.exoplayer2.RendererConfiguration; //導入依賴的package包/類
/**
* @param groups The track groups provided to the {@link TrackSelector}.
* @param renderersEnabled An array containing whether each renderer is enabled after the track
* selection operation.
* @param selections A {@link TrackSelectionArray} containing the selection for each renderer.
* @param info An opaque object that will be returned to
* {@link TrackSelector#onSelectionActivated(Object)} should the selection be activated.
* @param rendererConfigurations A {@link RendererConfiguration} for each enabled renderer,
* to be used with the selections.
*/
public TrackSelectorResult(TrackGroupArray groups, boolean[] renderersEnabled,
TrackSelectionArray selections, Object info,
RendererConfiguration[] rendererConfigurations) {
this.groups = groups;
this.renderersEnabled = renderersEnabled;
this.selections = selections;
this.info = info;
this.rendererConfigurations = rendererConfigurations;
}