Make ImageOutput clearable

It's currently not possible to remove a previously set image output
on ExoPlayer, although the underlying renderer already supports
receiving null to clear the output. Marking the parameter as
nullable allows apps to clear it as well.

PiperOrigin-RevId: 642569081
This commit is contained in:
tonihei 2024-06-12 04:00:43 -07:00 committed by Copybara-Service
parent 20d56341fc
commit 27e6395dbc
5 changed files with 8 additions and 5 deletions

View File

@ -17,6 +17,9 @@
* Video:
* Text:
* Metadata:
* Image:
* Allow `null` as parameter for `ExoPlayer.setImageOutput` to clear a
previously set `ImageOutput`.
* DRM:
* Effect:
* Remove unused `OverlaySettings.useHdr` since dynamic range of overlay

View File

@ -1978,8 +1978,8 @@ public interface ExoPlayer extends Player {
/**
* Sets the {@link ImageOutput} where rendered images will be forwarded.
*
* @param imageOutput The {@link ImageOutput}.
* @param imageOutput The {@link ImageOutput}. May be null to clear a previously set image output.
*/
@UnstableApi
void setImageOutput(ImageOutput imageOutput);
void setImageOutput(@Nullable ImageOutput imageOutput);
}

View File

@ -1895,7 +1895,7 @@ import java.util.concurrent.TimeoutException;
}
@Override
public void setImageOutput(ImageOutput imageOutput) {
public void setImageOutput(@Nullable ImageOutput imageOutput) {
verifyApplicationThread();
sendRendererMessage(TRACK_TYPE_IMAGE, MSG_SET_IMAGE_OUTPUT, imageOutput);
}

View File

@ -1352,7 +1352,7 @@ public class SimpleExoPlayer extends BasePlayer
}
@Override
public void setImageOutput(ImageOutput imageOutput) {
public void setImageOutput(@Nullable ImageOutput imageOutput) {
blockUntilConstructorFinished();
player.setImageOutput(imageOutput);
}

View File

@ -434,7 +434,7 @@ public class StubExoPlayer extends StubPlayer implements ExoPlayer {
}
@Override
public void setImageOutput(ImageOutput imageOutput) {
public void setImageOutput(@Nullable ImageOutput imageOutput) {
throw new UnsupportedOperationException();
}
}