mirror of
https://github.com/samsonjs/media.git
synced 2026-03-28 09:55:48 +00:00
Expose the HDR ColorInfo in the VpxOutputBuffer so the renderer can use it.
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=157267699
This commit is contained in:
parent
12ef97fc34
commit
7d4eaa74f7
4 changed files with 43 additions and 7 deletions
|
|
@ -71,7 +71,7 @@ public final class LibvpxVideoRenderer extends BaseRenderer {
|
|||
private DecoderCounters decoderCounters;
|
||||
private Format format;
|
||||
private VpxDecoder decoder;
|
||||
private DecoderInputBuffer inputBuffer;
|
||||
private VpxInputBuffer inputBuffer;
|
||||
private VpxOutputBuffer outputBuffer;
|
||||
private VpxOutputBuffer nextOutputBuffer;
|
||||
private DrmSession<ExoMediaCrypto> drmSession;
|
||||
|
|
@ -394,6 +394,7 @@ public final class LibvpxVideoRenderer extends BaseRenderer {
|
|||
return false;
|
||||
}
|
||||
inputBuffer.flip();
|
||||
inputBuffer.colorInfo = formatHolder.format.colorInfo;
|
||||
decoder.queueInputBuffer(inputBuffer);
|
||||
decoderCounters.inputBufferCount++;
|
||||
inputBuffer = null;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ package com.google.android.exoplayer2.ext.vp9;
|
|||
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.decoder.CryptoInfo;
|
||||
import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
|
||||
import com.google.android.exoplayer2.decoder.SimpleDecoder;
|
||||
import com.google.android.exoplayer2.drm.DecryptionException;
|
||||
import com.google.android.exoplayer2.drm.ExoMediaCrypto;
|
||||
|
|
@ -27,7 +26,7 @@ import java.nio.ByteBuffer;
|
|||
* Vpx decoder.
|
||||
*/
|
||||
/* package */ final class VpxDecoder extends
|
||||
SimpleDecoder<DecoderInputBuffer, VpxOutputBuffer, VpxDecoderException> {
|
||||
SimpleDecoder<VpxInputBuffer, VpxOutputBuffer, VpxDecoderException> {
|
||||
|
||||
public static final int OUTPUT_MODE_NONE = -1;
|
||||
public static final int OUTPUT_MODE_YUV = 0;
|
||||
|
|
@ -54,7 +53,7 @@ import java.nio.ByteBuffer;
|
|||
*/
|
||||
public VpxDecoder(int numInputBuffers, int numOutputBuffers, int initialInputBufferSize,
|
||||
ExoMediaCrypto exoMediaCrypto) throws VpxDecoderException {
|
||||
super(new DecoderInputBuffer[numInputBuffers], new VpxOutputBuffer[numOutputBuffers]);
|
||||
super(new VpxInputBuffer[numInputBuffers], new VpxOutputBuffer[numOutputBuffers]);
|
||||
if (!VpxLibrary.isAvailable()) {
|
||||
throw new VpxDecoderException("Failed to load decoder native libraries.");
|
||||
}
|
||||
|
|
@ -85,8 +84,8 @@ import java.nio.ByteBuffer;
|
|||
}
|
||||
|
||||
@Override
|
||||
protected DecoderInputBuffer createInputBuffer() {
|
||||
return new DecoderInputBuffer(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DIRECT);
|
||||
protected VpxInputBuffer createInputBuffer() {
|
||||
return new VpxInputBuffer();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -100,7 +99,7 @@ import java.nio.ByteBuffer;
|
|||
}
|
||||
|
||||
@Override
|
||||
protected VpxDecoderException decode(DecoderInputBuffer inputBuffer, VpxOutputBuffer outputBuffer,
|
||||
protected VpxDecoderException decode(VpxInputBuffer inputBuffer, VpxOutputBuffer outputBuffer,
|
||||
boolean reset) {
|
||||
ByteBuffer inputData = inputBuffer.data;
|
||||
int inputSize = inputData.limit();
|
||||
|
|
@ -128,6 +127,7 @@ import java.nio.ByteBuffer;
|
|||
} else if (getFrameResult == -1) {
|
||||
return new VpxDecoderException("Buffer initialization failed.");
|
||||
}
|
||||
outputBuffer.colorInfo = inputBuffer.colorInfo;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (C) 2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer2.ext.vp9;
|
||||
|
||||
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 {
|
||||
|
||||
public ColorInfo colorInfo;
|
||||
|
||||
public VpxInputBuffer() {
|
||||
super(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DIRECT);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
package com.google.android.exoplayer2.ext.vp9;
|
||||
|
||||
import com.google.android.exoplayer2.decoder.OutputBuffer;
|
||||
import com.google.android.exoplayer2.video.ColorInfo;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
|
|
@ -37,6 +38,8 @@ import java.nio.ByteBuffer;
|
|||
public ByteBuffer data;
|
||||
public int width;
|
||||
public int height;
|
||||
public ColorInfo colorInfo;
|
||||
|
||||
/**
|
||||
* YUV planes for YUV mode.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue