Commit 9a4ec54b by olly Committed by Oliver Woodman

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
parent 252bf43b
...@@ -128,7 +128,7 @@ import java.nio.ByteBuffer; ...@@ -128,7 +128,7 @@ import java.nio.ByteBuffer;
outputBuffer.addFlag(C.BUFFER_FLAG_DECODE_ONLY); outputBuffer.addFlag(C.BUFFER_FLAG_DECODE_ONLY);
} }
if (!decodeOnly) { if (!decodeOnly) {
outputBuffer.colorInfo = inputBuffer.colorInfo; outputBuffer.format = inputBuffer.format;
} }
return null; return null;
......
...@@ -170,7 +170,7 @@ import java.nio.ByteBuffer; ...@@ -170,7 +170,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; outputBuffer.format = inputBuffer.format;
} }
return null; return null;
} }
......
...@@ -758,7 +758,7 @@ public abstract class DecoderVideoRenderer extends BaseRenderer { ...@@ -758,7 +758,7 @@ public abstract class DecoderVideoRenderer extends BaseRenderer {
waitingForFirstSampleInFormat = false; waitingForFirstSampleInFormat = false;
} }
inputBuffer.flip(); inputBuffer.flip();
inputBuffer.colorInfo = inputFormat.colorInfo; inputBuffer.format = inputFormat;
onQueueInputBuffer(inputBuffer); onQueueInputBuffer(inputBuffer);
decoder.queueInputBuffer(inputBuffer); decoder.queueInputBuffer(inputBuffer);
buffersInCodecCount++; buffersInCodecCount++;
......
...@@ -16,12 +16,13 @@ ...@@ -16,12 +16,13 @@
package com.google.android.exoplayer2.video; package com.google.android.exoplayer2.video;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.decoder.DecoderInputBuffer; import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
/** Input buffer to a video decoder. */ /** Input buffer to a video decoder. */
public class VideoDecoderInputBuffer extends DecoderInputBuffer { public class VideoDecoderInputBuffer extends DecoderInputBuffer {
@Nullable public ColorInfo colorInfo; @Nullable public Format format;
public VideoDecoderInputBuffer() { public VideoDecoderInputBuffer() {
super(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DIRECT); super(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DIRECT);
......
...@@ -17,6 +17,7 @@ package com.google.android.exoplayer2.video; ...@@ -17,6 +17,7 @@ package com.google.android.exoplayer2.video;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.decoder.OutputBuffer; import com.google.android.exoplayer2.decoder.OutputBuffer;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
...@@ -43,7 +44,8 @@ public class VideoDecoderOutputBuffer extends OutputBuffer { ...@@ -43,7 +44,8 @@ public class VideoDecoderOutputBuffer extends OutputBuffer {
public int width; public int width;
public int height; 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. */ /** YUV planes for YUV mode. */
@Nullable public ByteBuffer[] yuvPlanes; @Nullable public ByteBuffer[] yuvPlanes;
......
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