Transformer: rename OpenGlFrameEditor to FrameEditor

PiperOrigin-RevId: 411751425
This commit is contained in:
kimvde 2021-11-23 09:54:35 +00:00 committed by tonihei
parent f5d3900b6d
commit 6adf41f03a
2 changed files with 15 additions and 15 deletions

View File

@ -29,26 +29,26 @@ import androidx.media3.common.util.GlUtil;
import java.io.IOException; import java.io.IOException;
/** /**
* OpenGlFrameEditor applies changes to individual video frames using OpenGL. Changes include just * FrameEditor applies changes to individual video frames. Changes include just resolution for now,
* resolution for now, but may later include brightness, cropping, rotation, etc. * but may later include brightness, cropping, rotation, etc.
*/ */
@RequiresApi(18) @RequiresApi(18)
/* package */ final class OpenGlFrameEditor { /* package */ final class FrameEditor {
static { static {
GlUtil.glAssertionsEnabled = true; GlUtil.glAssertionsEnabled = true;
} }
/** /**
* Returns a new OpenGlFrameEditor for applying changes to individual frames. * Returns a new {@code FrameEditor} for applying changes to individual frames.
* *
* @param context A {@link Context}. * @param context A {@link Context}.
* @param outputWidth The output width in pixels. * @param outputWidth The output width in pixels.
* @param outputHeight The output height in pixels. * @param outputHeight The output height in pixels.
* @param outputSurface The {@link Surface}. * @param outputSurface The {@link Surface}.
* @return A configured OpenGlFrameEditor. * @return A configured {@code FrameEditor}.
*/ */
public static OpenGlFrameEditor create( public static FrameEditor create(
Context context, int outputWidth, int outputHeight, Surface outputSurface) { Context context, int outputWidth, int outputHeight, Surface outputSurface) {
EGLDisplay eglDisplay = GlUtil.createEglDisplay(); EGLDisplay eglDisplay = GlUtil.createEglDisplay();
EGLContext eglContext; EGLContext eglContext;
@ -87,7 +87,7 @@ import java.io.IOException;
}, },
/* size= */ 4); /* size= */ 4);
copyProgram.setSamplerTexIdUniform("tex_sampler", textureId, /* unit= */ 0); copyProgram.setSamplerTexIdUniform("tex_sampler", textureId, /* unit= */ 0);
return new OpenGlFrameEditor(eglDisplay, eglContext, eglSurface, textureId, copyProgram); return new FrameEditor(eglDisplay, eglContext, eglSurface, textureId, copyProgram);
} }
// Predefined shader values. // Predefined shader values.
@ -107,7 +107,7 @@ import java.io.IOException;
private volatile boolean hasInputData; private volatile boolean hasInputData;
private OpenGlFrameEditor( private FrameEditor(
EGLDisplay eglDisplay, EGLDisplay eglDisplay,
EGLContext eglContext, EGLContext eglContext,
EGLSurface eglSurface, EGLSurface eglSurface,

View File

@ -44,7 +44,7 @@ import java.io.IOException;
private final DecoderInputBuffer decoderInputBuffer; private final DecoderInputBuffer decoderInputBuffer;
private final MediaCodecAdapterWrapper decoder; private final MediaCodecAdapterWrapper decoder;
private final OpenGlFrameEditor openGlFrameEditor; private final FrameEditor frameEditor;
private boolean waitingForPopulatedDecoderSurface; private boolean waitingForPopulatedDecoderSurface;
@ -84,8 +84,8 @@ import java.io.IOException;
throw createRendererException( throw createRendererException(
e, rendererIndex, decoderInputFormat, PlaybackException.ERROR_CODE_UNSPECIFIED); e, rendererIndex, decoderInputFormat, PlaybackException.ERROR_CODE_UNSPECIFIED);
} }
openGlFrameEditor = frameEditor =
OpenGlFrameEditor.create( FrameEditor.create(
context, context,
outputWidth, outputWidth,
outputHeight, outputHeight,
@ -93,7 +93,7 @@ import java.io.IOException;
try { try {
decoder = decoder =
MediaCodecAdapterWrapper.createForVideoDecoding( MediaCodecAdapterWrapper.createForVideoDecoding(
decoderInputFormat, openGlFrameEditor.getInputSurface()); decoderInputFormat, frameEditor.getInputSurface());
} catch (IOException e) { } catch (IOException e) {
throw createRendererException( throw createRendererException(
e, rendererIndex, decoderInputFormat, PlaybackException.ERROR_CODE_DECODER_INIT_FAILED); e, rendererIndex, decoderInputFormat, PlaybackException.ERROR_CODE_DECODER_INIT_FAILED);
@ -106,7 +106,7 @@ import java.io.IOException;
return false; return false;
} }
if (!openGlFrameEditor.hasInputData()) { if (!frameEditor.hasInputData()) {
if (!waitingForPopulatedDecoderSurface) { if (!waitingForPopulatedDecoderSurface) {
if (decoder.getOutputBufferInfo() != null) { if (decoder.getOutputBufferInfo() != null) {
decoder.releaseOutputBuffer(/* render= */ true); decoder.releaseOutputBuffer(/* render= */ true);
@ -120,7 +120,7 @@ import java.io.IOException;
} }
waitingForPopulatedDecoderSurface = false; waitingForPopulatedDecoderSurface = false;
openGlFrameEditor.processData(); frameEditor.processData();
return true; return true;
} }
@ -166,7 +166,7 @@ import java.io.IOException;
@Override @Override
public void release() { public void release() {
openGlFrameEditor.release(); frameEditor.release();
decoder.release(); decoder.release();
encoder.release(); encoder.release();
} }