Rename VideoSink methods
This is following a renaming of registerInputFrame to handleInputFrame. - queueInputBitmap is renamed to handleInputBitmap for consistency with handleInputFrame. - registerInputStream is renamed to onInputStreamChanged for consistency with media3 method names. PiperOrigin-RevId: 655529699
This commit is contained in:
parent
a1f20de3a9
commit
da4c962e09
@ -580,7 +580,7 @@ public final class CompositingVideoSinkProvider implements VideoSinkProvider, Vi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerInputStream(@InputType int inputType, Format format) {
|
||||
public void onInputStreamChanged(@InputType int inputType, Format format) {
|
||||
checkState(isInitialized());
|
||||
switch (inputType) {
|
||||
case INPUT_TYPE_SURFACE:
|
||||
@ -764,7 +764,7 @@ public final class CompositingVideoSinkProvider implements VideoSinkProvider, Vi
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean queueBitmap(Bitmap inputBitmap, TimestampIterator timestampIterator) {
|
||||
public boolean handleInputBitmap(Bitmap inputBitmap, TimestampIterator timestampIterator) {
|
||||
checkState(isInitialized());
|
||||
|
||||
if (!maybeRegisterPendingInputStream()) {
|
||||
|
@ -186,7 +186,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||
@Nullable private VideoFrameMetadataListener frameMetadataListener;
|
||||
private long startPositionUs;
|
||||
private long periodDurationUs;
|
||||
private boolean videoSinkNeedsRegisterInputStream;
|
||||
private boolean pendingVideoSinkInputStreamChange;
|
||||
|
||||
/**
|
||||
* @param context A context.
|
||||
@ -789,7 +789,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||
getOutputStreamOffsetUs(),
|
||||
getBufferTimestampAdjustmentUs(),
|
||||
getLastResetPositionUs());
|
||||
videoSinkNeedsRegisterInputStream = true;
|
||||
pendingVideoSinkInputStreamChange = true;
|
||||
}
|
||||
super.onPositionReset(positionUs, joining);
|
||||
if (videoSink == null) {
|
||||
@ -1354,9 +1354,9 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||
}
|
||||
decodedVideoSize = new VideoSize(width, height, pixelWidthHeightRatio);
|
||||
|
||||
if (videoSink != null && videoSinkNeedsRegisterInputStream) {
|
||||
onReadyToRegisterVideoSinkInputStream();
|
||||
videoSink.registerInputStream(
|
||||
if (videoSink != null && pendingVideoSinkInputStreamChange) {
|
||||
onReadyToChangeVideoSinkInputStream();
|
||||
videoSink.onInputStreamChanged(
|
||||
/* inputType= */ VideoSink.INPUT_TYPE_SURFACE,
|
||||
format
|
||||
.buildUpon()
|
||||
@ -1367,16 +1367,16 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||
} else {
|
||||
videoFrameReleaseControl.setFrameRate(format.frameRate);
|
||||
}
|
||||
videoSinkNeedsRegisterInputStream = false;
|
||||
pendingVideoSinkInputStreamChange = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when ready to {@linkplain VideoSink#registerInputStream(int, Format) register} an input
|
||||
* Called when ready to {@linkplain VideoSink#onInputStreamChanged(int, Format) change} the input
|
||||
* stream when {@linkplain #setVideoEffects video effects} are enabled.
|
||||
*
|
||||
* <p>The default implementation is a no-op.
|
||||
*/
|
||||
protected void onReadyToRegisterVideoSinkInputStream() {
|
||||
protected void onReadyToChangeVideoSinkInputStream() {
|
||||
// do nothing.
|
||||
}
|
||||
|
||||
@ -1584,7 +1584,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||
} else {
|
||||
videoFrameReleaseControl.onProcessedStreamChange();
|
||||
}
|
||||
videoSinkNeedsRegisterInputStream = true;
|
||||
pendingVideoSinkInputStreamChange = true;
|
||||
maybeSetupTunnelingForFirstFrame();
|
||||
}
|
||||
|
||||
|
@ -203,8 +203,8 @@ public interface VideoSink {
|
||||
void setVideoEffects(List<Effect> videoEffects);
|
||||
|
||||
/**
|
||||
* Sets {@linkplain Effect video effects} to apply after the next stream is {@linkplain
|
||||
* VideoSink#registerInputStream(int, Format) registered}.
|
||||
* Sets {@linkplain Effect video effects} to apply after the next stream {@linkplain
|
||||
* VideoSink#onInputStreamChanged(int, Format) change}.
|
||||
*/
|
||||
void setPendingVideoEffects(List<Effect> videoEffects);
|
||||
|
||||
@ -256,13 +256,13 @@ public interface VideoSink {
|
||||
* @param inputType The {@link InputType} of the stream.
|
||||
* @param format The {@link Format} of the stream.
|
||||
*/
|
||||
void registerInputStream(@InputType int inputType, Format format);
|
||||
void onInputStreamChanged(@InputType int inputType, Format format);
|
||||
|
||||
/**
|
||||
* Handles a video input frame.
|
||||
*
|
||||
* <p>Must be called after the corresponding stream is {@linkplain #registerInputStream(int,
|
||||
* Format) registered}.
|
||||
* <p>Must be called after the corresponding stream is {@linkplain #onInputStreamChanged(int,
|
||||
* Format) signalled}.
|
||||
*
|
||||
* @param framePresentationTimeUs The frame's presentation time, in microseconds.
|
||||
* @param isLastFrame Whether this is the last frame of the video stream.
|
||||
@ -282,18 +282,18 @@ public interface VideoSink {
|
||||
throws VideoSinkException;
|
||||
|
||||
/**
|
||||
* Provides an input {@link Bitmap} to the video sink.
|
||||
* Handles an input {@link Bitmap}.
|
||||
*
|
||||
* <p>Must be called after the corresponding stream is {@linkplain #registerInputStream(int,
|
||||
* Format) registered}.
|
||||
* <p>Must be called after the corresponding stream is {@linkplain #onInputStreamChanged(int,
|
||||
* Format) signalled}.
|
||||
*
|
||||
* @param inputBitmap The {@link Bitmap} queued to the video sink.
|
||||
* @param inputBitmap The {@link Bitmap} to queue to the video sink.
|
||||
* @param timestampIterator The times within the current stream that the bitmap should be shown
|
||||
* at. The timestamps should be monotonically increasing.
|
||||
* @return Whether the bitmap was queued successfully. If {@code false}, the caller can try again
|
||||
* later.
|
||||
*/
|
||||
boolean queueBitmap(Bitmap inputBitmap, TimestampIterator timestampIterator);
|
||||
boolean handleInputBitmap(Bitmap inputBitmap, TimestampIterator timestampIterator);
|
||||
|
||||
/**
|
||||
* Incrementally renders processed video frames to the output surface.
|
||||
|
@ -281,7 +281,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onReadyToRegisterVideoSinkInputStream() {
|
||||
protected void onReadyToChangeVideoSinkInputStream() {
|
||||
@Nullable ImmutableList<Effect> pendingEffect = this.pendingEffect;
|
||||
if (pendingEffect != null) {
|
||||
videoSink.setPendingVideoEffects(pendingEffect);
|
||||
@ -298,7 +298,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
private @MonotonicNonNull ConstantRateTimestampIterator timestampIterator;
|
||||
private @MonotonicNonNull EditedMediaItem editedMediaItem;
|
||||
@Nullable private ExoPlaybackException pendingExoPlaybackException;
|
||||
private boolean inputStreamPendingRegistration;
|
||||
private boolean inputStreamPending;
|
||||
private long streamStartPositionUs;
|
||||
private long streamOffsetUs;
|
||||
private boolean mayRenderStartOfStream;
|
||||
@ -405,7 +405,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
sequencePlayerRenderersWrapper.getOffsetToCompositionTimeUs(mediaItemIndex, offsetUs);
|
||||
timestampIterator = createTimestampIterator(/* positionUs= */ startPositionUs);
|
||||
videoEffects = editedMediaItem.effects.videoEffects;
|
||||
inputStreamPendingRegistration = true;
|
||||
inputStreamPending = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -427,7 +427,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
@Override
|
||||
protected boolean processOutputBuffer(
|
||||
long positionUs, long elapsedRealtimeUs, Bitmap outputImage, long timeUs) {
|
||||
if (inputStreamPendingRegistration) {
|
||||
if (inputStreamPending) {
|
||||
checkState(streamStartPositionUs != C.TIME_UNSET);
|
||||
checkState(streamOffsetUs != C.TIME_UNSET);
|
||||
videoSink.setPendingVideoEffects(videoEffects);
|
||||
@ -436,7 +436,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
streamOffsetUs,
|
||||
/* bufferTimestampAdjustmentUs= */ offsetToCompositionTimeUs,
|
||||
getLastResetPositionUs());
|
||||
videoSink.registerInputStream(
|
||||
videoSink.onInputStreamChanged(
|
||||
VideoSink.INPUT_TYPE_BITMAP,
|
||||
new Format.Builder()
|
||||
.setSampleMimeType(MimeTypes.IMAGE_RAW)
|
||||
@ -445,9 +445,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
.setColorInfo(ColorInfo.SRGB_BT709_FULL)
|
||||
.setFrameRate(/* frameRate= */ DEFAULT_FRAME_RATE)
|
||||
.build());
|
||||
inputStreamPendingRegistration = false;
|
||||
inputStreamPending = false;
|
||||
}
|
||||
return videoSink.queueBitmap(outputImage, checkStateNotNull(timestampIterator));
|
||||
return videoSink.handleInputBitmap(outputImage, checkStateNotNull(timestampIterator));
|
||||
}
|
||||
|
||||
private ConstantRateTimestampIterator createTimestampIterator(long positionUs) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user