Propagate Format through extension video decoders

We currently propagate only ColorInfo, but propagating the whole Format
is generally useful (e.g., to get the frame-rate on the output side of
the decoder).

PiperOrigin-RevId: 310359650
This commit is contained in:
olly 2020-05-07 16:10:32 +01:00 committed by Oliver Woodman
parent 252bf43bf4
commit 9a4ec54bdf
5 changed files with 8 additions and 5 deletions

View file

@ -128,7 +128,7 @@ import java.nio.ByteBuffer;
outputBuffer.addFlag(C.BUFFER_FLAG_DECODE_ONLY);
}
if (!decodeOnly) {
outputBuffer.colorInfo = inputBuffer.colorInfo;
outputBuffer.format = inputBuffer.format;
}
return null;

View file

@ -170,7 +170,7 @@ import java.nio.ByteBuffer;
} else if (getFrameResult == -1) {
return new VpxDecoderException("Buffer initialization failed.");
}
outputBuffer.colorInfo = inputBuffer.colorInfo;
outputBuffer.format = inputBuffer.format;
}
return null;
}

View file

@ -758,7 +758,7 @@ public abstract class DecoderVideoRenderer extends BaseRenderer {
waitingForFirstSampleInFormat = false;
}
inputBuffer.flip();
inputBuffer.colorInfo = inputFormat.colorInfo;
inputBuffer.format = inputFormat;
onQueueInputBuffer(inputBuffer);
decoder.queueInputBuffer(inputBuffer);
buffersInCodecCount++;

View file

@ -16,12 +16,13 @@
package com.google.android.exoplayer2.video;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
/** Input buffer to a video decoder. */
public class VideoDecoderInputBuffer extends DecoderInputBuffer {
@Nullable public ColorInfo colorInfo;
@Nullable public Format format;
public VideoDecoderInputBuffer() {
super(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DIRECT);

View file

@ -17,6 +17,7 @@ package com.google.android.exoplayer2.video;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.decoder.OutputBuffer;
import java.nio.ByteBuffer;
@ -43,7 +44,8 @@ public class VideoDecoderOutputBuffer extends OutputBuffer {
public int width;
public int height;
@Nullable public ColorInfo colorInfo;
/** The format of the input from which this output buffer was decoded. */
@Nullable public Format format;
/** YUV planes for YUV mode. */
@Nullable public ByteBuffer[] yuvPlanes;