mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Add default impl for some InputHandler methods.
And minor fixes. PiperOrigin-RevId: 526717927
This commit is contained in:
parent
67639cafd7
commit
c539cb8575
@ -208,7 +208,7 @@ public interface VideoFrameProcessor {
|
||||
void registerInputFrame();
|
||||
|
||||
/**
|
||||
* returns the number of input frames that have been made available to the {@code
|
||||
* Returns the number of input frames that have been made available to the {@code
|
||||
* VideoFrameProcessor} but have not been processed yet.
|
||||
*
|
||||
* <p>Can be called on any thread.
|
||||
|
@ -21,10 +21,8 @@ import static java.lang.Math.round;
|
||||
import android.graphics.Bitmap;
|
||||
import android.opengl.GLES20;
|
||||
import android.opengl.GLUtils;
|
||||
import android.view.Surface;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.media3.common.C;
|
||||
import androidx.media3.common.FrameInfo;
|
||||
import androidx.media3.common.GlTextureInfo;
|
||||
import androidx.media3.common.VideoFrameProcessingException;
|
||||
import androidx.media3.common.util.GlUtil;
|
||||
@ -79,11 +77,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefaultBufferSize(int width, int height) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queueInputBitmap(
|
||||
Bitmap inputBitmap, long durationUs, float frameRate, boolean useHdr) {
|
||||
@ -91,16 +84,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
() -> setupBitmap(inputBitmap, durationUs, frameRate, useHdr));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Surface getInputSurface() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerInputFrame(FrameInfo frameInfo) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPendingFrameCount() {
|
||||
// Always treat all queued bitmaps as immediately processed.
|
||||
|
@ -17,7 +17,6 @@ package androidx.media3.effect;
|
||||
|
||||
import static androidx.media3.common.util.Assertions.checkStateNotNull;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.SurfaceTexture;
|
||||
import android.view.Surface;
|
||||
import androidx.annotation.Nullable;
|
||||
@ -110,12 +109,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
surfaceTexture.setDefaultBufferSize(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queueInputBitmap(
|
||||
Bitmap inputBitmap, long durationUs, float frameRate, boolean useHdr) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Surface getInputSurface() {
|
||||
return surface;
|
||||
|
@ -32,24 +32,33 @@ import androidx.media3.common.VideoFrameProcessor;
|
||||
*
|
||||
* <p>Only works when the input is received on a {@link SurfaceTexture}.
|
||||
*/
|
||||
void setDefaultBufferSize(int width, int height);
|
||||
default void setDefaultBufferSize(int width, int height) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides an input {@link Bitmap} to put into the video frames.
|
||||
*
|
||||
* @see VideoFrameProcessor#queueInputBitmap
|
||||
*/
|
||||
void queueInputBitmap(Bitmap inputBitmap, long durationUs, float frameRate, boolean useHdr);
|
||||
default void queueInputBitmap(
|
||||
Bitmap inputBitmap, long durationUs, float frameRate, boolean useHdr) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* See {@link VideoFrameProcessor#getInputSurface}.
|
||||
*
|
||||
* <p>Only works when the input is received on a {@link SurfaceTexture}.
|
||||
*/
|
||||
Surface getInputSurface();
|
||||
default Surface getInputSurface() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** Informs the {@code InputHandler} that a frame will be queued. */
|
||||
void registerInputFrame(FrameInfo frameInfo);
|
||||
default void registerInputFrame(FrameInfo frameInfo) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** See {@link VideoFrameProcessor#getPendingInputFrameCount}. */
|
||||
int getPendingFrameCount();
|
||||
|
Loading…
x
Reference in New Issue
Block a user