Commit b2c71e8b by sofijajvc Committed by Oliver Woodman

Extract VpxInputBuffer to a common class

This class will be shared by both vp9 and av1 extension.

PiperOrigin-RevId: 261089225
parent b57aa34b
...@@ -42,6 +42,7 @@ import com.google.android.exoplayer2.util.MimeTypes; ...@@ -42,6 +42,7 @@ import com.google.android.exoplayer2.util.MimeTypes;
import com.google.android.exoplayer2.util.TimedValueQueue; import com.google.android.exoplayer2.util.TimedValueQueue;
import com.google.android.exoplayer2.util.TraceUtil; import com.google.android.exoplayer2.util.TraceUtil;
import com.google.android.exoplayer2.util.Util; import com.google.android.exoplayer2.util.Util;
import com.google.android.exoplayer2.video.VideoDecoderInputBuffer;
import com.google.android.exoplayer2.video.VideoFrameMetadataListener; import com.google.android.exoplayer2.video.VideoFrameMetadataListener;
import com.google.android.exoplayer2.video.VideoRendererEventListener; import com.google.android.exoplayer2.video.VideoRendererEventListener;
import com.google.android.exoplayer2.video.VideoRendererEventListener.EventDispatcher; import com.google.android.exoplayer2.video.VideoRendererEventListener.EventDispatcher;
...@@ -123,7 +124,7 @@ public class LibvpxVideoRenderer extends BaseRenderer { ...@@ -123,7 +124,7 @@ public class LibvpxVideoRenderer extends BaseRenderer {
private Format pendingFormat; private Format pendingFormat;
private Format outputFormat; private Format outputFormat;
private VpxDecoder decoder; private VpxDecoder decoder;
private VpxInputBuffer inputBuffer; private VideoDecoderInputBuffer inputBuffer;
private VpxOutputBuffer outputBuffer; private VpxOutputBuffer outputBuffer;
@Nullable private DrmSession<ExoMediaCrypto> decoderDrmSession; @Nullable private DrmSession<ExoMediaCrypto> decoderDrmSession;
@Nullable private DrmSession<ExoMediaCrypto> sourceDrmSession; @Nullable private DrmSession<ExoMediaCrypto> sourceDrmSession;
...@@ -545,7 +546,7 @@ public class LibvpxVideoRenderer extends BaseRenderer { ...@@ -545,7 +546,7 @@ public class LibvpxVideoRenderer extends BaseRenderer {
* *
* @param buffer The buffer that will be queued. * @param buffer The buffer that will be queued.
*/ */
protected void onQueueInputBuffer(VpxInputBuffer buffer) { protected void onQueueInputBuffer(VideoDecoderInputBuffer buffer) {
// Do nothing. // Do nothing.
} }
......
...@@ -22,13 +22,12 @@ import com.google.android.exoplayer2.decoder.CryptoInfo; ...@@ -22,13 +22,12 @@ import com.google.android.exoplayer2.decoder.CryptoInfo;
import com.google.android.exoplayer2.decoder.SimpleDecoder; import com.google.android.exoplayer2.decoder.SimpleDecoder;
import com.google.android.exoplayer2.drm.DecryptionException; import com.google.android.exoplayer2.drm.DecryptionException;
import com.google.android.exoplayer2.drm.ExoMediaCrypto; import com.google.android.exoplayer2.drm.ExoMediaCrypto;
import com.google.android.exoplayer2.video.VideoDecoderInputBuffer;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
/** /** Vpx decoder. */
* Vpx decoder. /* package */ final class VpxDecoder
*/ extends SimpleDecoder<VideoDecoderInputBuffer, VpxOutputBuffer, VpxDecoderException> {
/* package */ final class VpxDecoder extends
SimpleDecoder<VpxInputBuffer, VpxOutputBuffer, VpxDecoderException> {
public static final int OUTPUT_MODE_NONE = -1; public static final int OUTPUT_MODE_NONE = -1;
public static final int OUTPUT_MODE_YUV = 0; public static final int OUTPUT_MODE_YUV = 0;
...@@ -65,7 +64,7 @@ import java.nio.ByteBuffer; ...@@ -65,7 +64,7 @@ import java.nio.ByteBuffer;
boolean enableRowMultiThreadMode, boolean enableRowMultiThreadMode,
int threads) int threads)
throws VpxDecoderException { throws VpxDecoderException {
super(new VpxInputBuffer[numInputBuffers], new VpxOutputBuffer[numOutputBuffers]); super(new VideoDecoderInputBuffer[numInputBuffers], new VpxOutputBuffer[numOutputBuffers]);
if (!VpxLibrary.isAvailable()) { if (!VpxLibrary.isAvailable()) {
throw new VpxDecoderException("Failed to load decoder native libraries."); throw new VpxDecoderException("Failed to load decoder native libraries.");
} }
...@@ -96,8 +95,8 @@ import java.nio.ByteBuffer; ...@@ -96,8 +95,8 @@ import java.nio.ByteBuffer;
} }
@Override @Override
protected VpxInputBuffer createInputBuffer() { protected VideoDecoderInputBuffer createInputBuffer() {
return new VpxInputBuffer(); return new VideoDecoderInputBuffer();
} }
@Override @Override
...@@ -123,7 +122,7 @@ import java.nio.ByteBuffer; ...@@ -123,7 +122,7 @@ import java.nio.ByteBuffer;
@Override @Override
@Nullable @Nullable
protected VpxDecoderException decode( protected VpxDecoderException decode(
VpxInputBuffer inputBuffer, VpxOutputBuffer outputBuffer, boolean reset) { VideoDecoderInputBuffer inputBuffer, VpxOutputBuffer outputBuffer, boolean reset) {
ByteBuffer inputData = inputBuffer.data; ByteBuffer inputData = inputBuffer.data;
int inputSize = inputData.limit(); int inputSize = inputData.limit();
CryptoInfo cryptoInfo = inputBuffer.cryptoInfo; CryptoInfo cryptoInfo = inputBuffer.cryptoInfo;
......
/* /*
* Copyright (C) 2017 The Android Open Source Project * Copyright (C) 2019 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -13,19 +13,16 @@ ...@@ -13,19 +13,16 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.android.exoplayer2.ext.vp9; package com.google.android.exoplayer2.video;
import com.google.android.exoplayer2.decoder.DecoderInputBuffer; import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
import com.google.android.exoplayer2.video.ColorInfo;
/** /** Input buffer to a video decoder. */
* Input buffer to a {@link VpxDecoder}. public class VideoDecoderInputBuffer extends DecoderInputBuffer {
*/
/* package */ final class VpxInputBuffer extends DecoderInputBuffer {
public ColorInfo colorInfo; public ColorInfo colorInfo;
public VpxInputBuffer() { public VideoDecoderInputBuffer() {
super(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DIRECT); super(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DIRECT);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment