mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +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 DecoderCounters decoderCounters;
|
||||||
private Format format;
|
private Format format;
|
||||||
private VpxDecoder decoder;
|
private VpxDecoder decoder;
|
||||||
private DecoderInputBuffer inputBuffer;
|
private VpxInputBuffer inputBuffer;
|
||||||
private VpxOutputBuffer outputBuffer;
|
private VpxOutputBuffer outputBuffer;
|
||||||
private VpxOutputBuffer nextOutputBuffer;
|
private VpxOutputBuffer nextOutputBuffer;
|
||||||
private DrmSession<ExoMediaCrypto> drmSession;
|
private DrmSession<ExoMediaCrypto> drmSession;
|
||||||
|
|
@ -394,6 +394,7 @@ public final class LibvpxVideoRenderer extends BaseRenderer {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
inputBuffer.flip();
|
inputBuffer.flip();
|
||||||
|
inputBuffer.colorInfo = formatHolder.format.colorInfo;
|
||||||
decoder.queueInputBuffer(inputBuffer);
|
decoder.queueInputBuffer(inputBuffer);
|
||||||
decoderCounters.inputBufferCount++;
|
decoderCounters.inputBufferCount++;
|
||||||
inputBuffer = null;
|
inputBuffer = null;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ package com.google.android.exoplayer2.ext.vp9;
|
||||||
|
|
||||||
import com.google.android.exoplayer2.C;
|
import com.google.android.exoplayer2.C;
|
||||||
import com.google.android.exoplayer2.decoder.CryptoInfo;
|
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.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;
|
||||||
|
|
@ -27,7 +26,7 @@ import java.nio.ByteBuffer;
|
||||||
* Vpx decoder.
|
* Vpx decoder.
|
||||||
*/
|
*/
|
||||||
/* package */ final class VpxDecoder extends
|
/* 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_NONE = -1;
|
||||||
public static final int OUTPUT_MODE_YUV = 0;
|
public static final int OUTPUT_MODE_YUV = 0;
|
||||||
|
|
@ -54,7 +53,7 @@ import java.nio.ByteBuffer;
|
||||||
*/
|
*/
|
||||||
public VpxDecoder(int numInputBuffers, int numOutputBuffers, int initialInputBufferSize,
|
public VpxDecoder(int numInputBuffers, int numOutputBuffers, int initialInputBufferSize,
|
||||||
ExoMediaCrypto exoMediaCrypto) throws VpxDecoderException {
|
ExoMediaCrypto exoMediaCrypto) throws VpxDecoderException {
|
||||||
super(new DecoderInputBuffer[numInputBuffers], new VpxOutputBuffer[numOutputBuffers]);
|
super(new VpxInputBuffer[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.");
|
||||||
}
|
}
|
||||||
|
|
@ -85,8 +84,8 @@ import java.nio.ByteBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DecoderInputBuffer createInputBuffer() {
|
protected VpxInputBuffer createInputBuffer() {
|
||||||
return new DecoderInputBuffer(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DIRECT);
|
return new VpxInputBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -100,7 +99,7 @@ import java.nio.ByteBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected VpxDecoderException decode(DecoderInputBuffer inputBuffer, VpxOutputBuffer outputBuffer,
|
protected VpxDecoderException decode(VpxInputBuffer inputBuffer, VpxOutputBuffer outputBuffer,
|
||||||
boolean reset) {
|
boolean reset) {
|
||||||
ByteBuffer inputData = inputBuffer.data;
|
ByteBuffer inputData = inputBuffer.data;
|
||||||
int inputSize = inputData.limit();
|
int inputSize = inputData.limit();
|
||||||
|
|
@ -128,6 +127,7 @@ import java.nio.ByteBuffer;
|
||||||
} else if (getFrameResult == -1) {
|
} else if (getFrameResult == -1) {
|
||||||
return new VpxDecoderException("Buffer initialization failed.");
|
return new VpxDecoderException("Buffer initialization failed.");
|
||||||
}
|
}
|
||||||
|
outputBuffer.colorInfo = inputBuffer.colorInfo;
|
||||||
return null;
|
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;
|
package com.google.android.exoplayer2.ext.vp9;
|
||||||
|
|
||||||
import com.google.android.exoplayer2.decoder.OutputBuffer;
|
import com.google.android.exoplayer2.decoder.OutputBuffer;
|
||||||
|
import com.google.android.exoplayer2.video.ColorInfo;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -37,6 +38,8 @@ import java.nio.ByteBuffer;
|
||||||
public ByteBuffer data;
|
public ByteBuffer data;
|
||||||
public int width;
|
public int width;
|
||||||
public int height;
|
public int height;
|
||||||
|
public ColorInfo colorInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* YUV planes for YUV mode.
|
* YUV planes for YUV mode.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue