mirror of
https://github.com/samsonjs/media.git
synced 2026-04-07 11:35:46 +00:00
Extract VpxInputBuffer to a common class
This class will be shared by both vp9 and av1 extension. PiperOrigin-RevId: 261089225
This commit is contained in:
parent
b57aa34b66
commit
b2c71e8b3f
3 changed files with 16 additions and 19 deletions
|
|
@ -42,6 +42,7 @@ import com.google.android.exoplayer2.util.MimeTypes;
|
|||
import com.google.android.exoplayer2.util.TimedValueQueue;
|
||||
import com.google.android.exoplayer2.util.TraceUtil;
|
||||
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.VideoRendererEventListener;
|
||||
import com.google.android.exoplayer2.video.VideoRendererEventListener.EventDispatcher;
|
||||
|
|
@ -123,7 +124,7 @@ public class LibvpxVideoRenderer extends BaseRenderer {
|
|||
private Format pendingFormat;
|
||||
private Format outputFormat;
|
||||
private VpxDecoder decoder;
|
||||
private VpxInputBuffer inputBuffer;
|
||||
private VideoDecoderInputBuffer inputBuffer;
|
||||
private VpxOutputBuffer outputBuffer;
|
||||
@Nullable private DrmSession<ExoMediaCrypto> decoderDrmSession;
|
||||
@Nullable private DrmSession<ExoMediaCrypto> sourceDrmSession;
|
||||
|
|
@ -545,7 +546,7 @@ public class LibvpxVideoRenderer extends BaseRenderer {
|
|||
*
|
||||
* @param buffer The buffer that will be queued.
|
||||
*/
|
||||
protected void onQueueInputBuffer(VpxInputBuffer buffer) {
|
||||
protected void onQueueInputBuffer(VideoDecoderInputBuffer buffer) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,13 +22,12 @@ import com.google.android.exoplayer2.decoder.CryptoInfo;
|
|||
import com.google.android.exoplayer2.decoder.SimpleDecoder;
|
||||
import com.google.android.exoplayer2.drm.DecryptionException;
|
||||
import com.google.android.exoplayer2.drm.ExoMediaCrypto;
|
||||
import com.google.android.exoplayer2.video.VideoDecoderInputBuffer;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* Vpx decoder.
|
||||
*/
|
||||
/* package */ final class VpxDecoder extends
|
||||
SimpleDecoder<VpxInputBuffer, VpxOutputBuffer, VpxDecoderException> {
|
||||
/** Vpx decoder. */
|
||||
/* package */ final class VpxDecoder
|
||||
extends SimpleDecoder<VideoDecoderInputBuffer, VpxOutputBuffer, VpxDecoderException> {
|
||||
|
||||
public static final int OUTPUT_MODE_NONE = -1;
|
||||
public static final int OUTPUT_MODE_YUV = 0;
|
||||
|
|
@ -65,7 +64,7 @@ import java.nio.ByteBuffer;
|
|||
boolean enableRowMultiThreadMode,
|
||||
int threads)
|
||||
throws VpxDecoderException {
|
||||
super(new VpxInputBuffer[numInputBuffers], new VpxOutputBuffer[numOutputBuffers]);
|
||||
super(new VideoDecoderInputBuffer[numInputBuffers], new VpxOutputBuffer[numOutputBuffers]);
|
||||
if (!VpxLibrary.isAvailable()) {
|
||||
throw new VpxDecoderException("Failed to load decoder native libraries.");
|
||||
}
|
||||
|
|
@ -96,8 +95,8 @@ import java.nio.ByteBuffer;
|
|||
}
|
||||
|
||||
@Override
|
||||
protected VpxInputBuffer createInputBuffer() {
|
||||
return new VpxInputBuffer();
|
||||
protected VideoDecoderInputBuffer createInputBuffer() {
|
||||
return new VideoDecoderInputBuffer();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -123,7 +122,7 @@ import java.nio.ByteBuffer;
|
|||
@Override
|
||||
@Nullable
|
||||
protected VpxDecoderException decode(
|
||||
VpxInputBuffer inputBuffer, VpxOutputBuffer outputBuffer, boolean reset) {
|
||||
VideoDecoderInputBuffer inputBuffer, VpxOutputBuffer outputBuffer, boolean reset) {
|
||||
ByteBuffer inputData = inputBuffer.data;
|
||||
int inputSize = inputData.limit();
|
||||
CryptoInfo cryptoInfo = inputBuffer.cryptoInfo;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* 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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -13,19 +13,16 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* 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.video.ColorInfo;
|
||||
|
||||
/**
|
||||
* Input buffer to a {@link VpxDecoder}.
|
||||
*/
|
||||
/* package */ final class VpxInputBuffer extends DecoderInputBuffer {
|
||||
/** Input buffer to a video decoder. */
|
||||
public class VideoDecoderInputBuffer extends DecoderInputBuffer {
|
||||
|
||||
public ColorInfo colorInfo;
|
||||
|
||||
public VpxInputBuffer() {
|
||||
public VideoDecoderInputBuffer() {
|
||||
super(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DIRECT);
|
||||
}
|
||||
|
||||
Loading…
Reference in a new issue