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;
/**
* OpenGlFrameEditor applies changes to individual video frames using OpenGL. Changes include just
* resolution for now, but may later include brightness, cropping, rotation, etc.
* FrameEditor applies changes to individual video frames. Changes include just resolution for now,
* but may later include brightness, cropping, rotation, etc.
*/
@RequiresApi(18)
/* package */ final class OpenGlFrameEditor {
/* package */ final class FrameEditor {
static {
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 outputWidth The output width in pixels.
* @param outputHeight The output height in pixels.
* @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) {
EGLDisplay eglDisplay = GlUtil.createEglDisplay();
EGLContext eglContext;
@ -87,7 +87,7 @@ import java.io.IOException;
},
/* size= */ 4);
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.
@ -107,7 +107,7 @@ import java.io.IOException;
private volatile boolean hasInputData;
private OpenGlFrameEditor(
private FrameEditor(
EGLDisplay eglDisplay,
EGLContext eglContext,
EGLSurface eglSurface,

View File

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