Noop consistency fixes for extension decoders

PiperOrigin-RevId: 317609986
This commit is contained in:
olly 2020-06-22 09:34:31 +01:00 committed by Andrew Lewis
parent aec5ff8be1
commit 6d9a1ed639
3 changed files with 23 additions and 21 deletions

View file

@ -84,15 +84,6 @@ import java.nio.ByteBuffer;
return "libgav1";
}
/**
* Sets the output mode for frames rendered by the decoder.
*
* @param outputMode The output mode.
*/
public void setOutputMode(@C.VideoOutputMode int outputMode) {
this.outputMode = outputMode;
}
@Override
protected VideoDecoderInputBuffer createInputBuffer() {
return new VideoDecoderInputBuffer(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DIRECT);
@ -156,6 +147,15 @@ import java.nio.ByteBuffer;
super.releaseOutputBuffer(buffer);
}
/**
* Sets the output mode for frames rendered by the decoder.
*
* @param outputMode The output mode.
*/
public void setOutputMode(@C.VideoOutputMode int outputMode) {
this.outputMode = outputMode;
}
/**
* Renders output buffer to the given surface. Must only be called when in {@link
* C#VIDEO_OUTPUT_MODE_SURFACE_YUV} mode.

View file

@ -87,15 +87,6 @@ import java.nio.ByteBuffer;
return "libvpx" + VpxLibrary.getVersion();
}
/**
* Sets the output mode for frames rendered by the decoder.
*
* @param outputMode The output mode.
*/
public void setOutputMode(@C.VideoOutputMode int outputMode) {
this.outputMode = outputMode;
}
@Override
protected VideoDecoderInputBuffer createInputBuffer() {
return new VideoDecoderInputBuffer(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DIRECT);
@ -183,6 +174,15 @@ import java.nio.ByteBuffer;
vpxClose(vpxDecContext);
}
/**
* Sets the output mode for frames rendered by the decoder.
*
* @param outputMode The output mode.
*/
public void setOutputMode(@C.VideoOutputMode int outputMode) {
this.outputMode = outputMode;
}
/** Renders the outputBuffer to the surface. Used with OUTPUT_MODE_SURFACE_YUV only. */
public void renderToSurface(VideoDecoderOutputBuffer outputBuffer, Surface surface)
throws VpxDecoderException {

View file

@ -65,9 +65,11 @@ static jfieldID dataField;
static jfieldID outputModeField;
static jfieldID decoderPrivateField;
// android.graphics.ImageFormat.YV12.
static const int kHalPixelFormatYV12 = 0x32315659;
// Android YUV format. See:
// https://developer.android.com/reference/android/graphics/ImageFormat.html#YV12.
static const int kImageFormatYV12 = 0x32315659;
static const int kDecoderPrivateBase = 0x100;
static int errorCode;
jint JNI_OnLoad(JavaVM* vm, void* reserved) {
@ -635,7 +637,7 @@ DECODER_FUNC(jint, vpxRenderFrame, jlong jContext, jobject jSurface,
}
if (context->width != srcBuffer->d_w || context->height != srcBuffer->d_h) {
ANativeWindow_setBuffersGeometry(context->native_window, srcBuffer->d_w,
srcBuffer->d_h, kHalPixelFormatYV12);
srcBuffer->d_h, kImageFormatYV12);
context->width = srcBuffer->d_w;
context->height = srcBuffer->d_h;
}