mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Implement/document trivial methods in DefaultVideoSink
PiperOrigin-RevId: 696047835
This commit is contained in:
parent
175dca41df
commit
8393c2e445
@ -15,8 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.exoplayer.video;
|
package androidx.media3.exoplayer.video;
|
||||||
|
|
||||||
|
import static androidx.media3.common.util.Assertions.checkStateNotNull;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.Effect;
|
import androidx.media3.common.Effect;
|
||||||
import androidx.media3.common.Format;
|
import androidx.media3.common.Format;
|
||||||
import androidx.media3.common.util.Size;
|
import androidx.media3.common.util.Size;
|
||||||
@ -27,13 +30,24 @@ import java.util.concurrent.Executor;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The default {@link VideoSink} implementation. This implementation renders video frames to an
|
* The default {@link VideoSink} implementation. This implementation renders video frames to an
|
||||||
* output surface. Applying {@linkplain Effect video effects} is unsupported.
|
* output surface.
|
||||||
|
*
|
||||||
|
* <p>The following operations are not supported:
|
||||||
|
*
|
||||||
|
* <ul>
|
||||||
|
* <li>Applying video effects
|
||||||
|
* <li>Inputting bitmaps
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* <p>The {@linkplain #getInputSurface() input} and {@linkplain #setOutputSurfaceInfo(Surface, Size)
|
||||||
|
* output} surfaces are the same.
|
||||||
*/
|
*/
|
||||||
/* package */ final class DefaultVideoSink implements VideoSink {
|
/* package */ final class DefaultVideoSink implements VideoSink {
|
||||||
|
|
||||||
private final VideoFrameReleaseControl videoFrameReleaseControl;
|
private final VideoFrameReleaseControl videoFrameReleaseControl;
|
||||||
private final VideoFrameRenderControl videoFrameRenderControl;
|
private final VideoFrameRenderControl videoFrameRenderControl;
|
||||||
|
|
||||||
|
@Nullable private Surface outputSurface;
|
||||||
private Format inputFormat;
|
private Format inputFormat;
|
||||||
|
|
||||||
public DefaultVideoSink(
|
public DefaultVideoSink(
|
||||||
@ -99,7 +113,7 @@ import java.util.concurrent.Executor;
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Surface getInputSurface() {
|
public Surface getInputSurface() {
|
||||||
throw new UnsupportedOperationException();
|
return checkStateNotNull(outputSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -112,11 +126,21 @@ import java.util.concurrent.Executor;
|
|||||||
videoFrameReleaseControl.setPlaybackSpeed(speed);
|
videoFrameReleaseControl.setPlaybackSpeed(speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*
|
||||||
|
* <p>This method will always throw an {@link UnsupportedOperationException}.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setVideoEffects(List<Effect> videoEffects) {
|
public void setVideoEffects(List<Effect> videoEffects) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*
|
||||||
|
* <p>This method will always throw an {@link UnsupportedOperationException}.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setPendingVideoEffects(List<Effect> videoEffects) {
|
public void setPendingVideoEffects(List<Effect> videoEffects) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
@ -130,11 +154,13 @@ import java.util.concurrent.Executor;
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOutputSurfaceInfo(Surface outputSurface, Size outputResolution) {
|
public void setOutputSurfaceInfo(Surface outputSurface, Size outputResolution) {
|
||||||
|
this.outputSurface = outputSurface;
|
||||||
videoFrameReleaseControl.setOutputSurface(outputSurface);
|
videoFrameReleaseControl.setOutputSurface(outputSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clearOutputSurfaceInfo() {
|
public void clearOutputSurfaceInfo() {
|
||||||
|
outputSurface = null;
|
||||||
videoFrameReleaseControl.setOutputSurface(/* outputSurface= */ null);
|
videoFrameReleaseControl.setOutputSurface(/* outputSurface= */ null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,6 +195,11 @@ import java.util.concurrent.Executor;
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*
|
||||||
|
* <p>This method will always throw an {@link UnsupportedOperationException}.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean handleInputBitmap(Bitmap inputBitmap, TimestampIterator timestampIterator) {
|
public boolean handleInputBitmap(Bitmap inputBitmap, TimestampIterator timestampIterator) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user