Commit efcb7683 by claincly Committed by christosts

Use ColorInfo.Builder in transformer and common.

Because the ColorInfo constructor is deprecated.

PiperOrigin-RevId: 509468663
parent 33d45c3c
...@@ -228,7 +228,12 @@ public final class MediaFormatUtil { ...@@ -228,7 +228,12 @@ public final class MediaFormatUtil {
|| colorRange != Format.NO_VALUE || colorRange != Format.NO_VALUE
|| colorTransfer != Format.NO_VALUE || colorTransfer != Format.NO_VALUE
|| hdrStaticInfo != null) { || hdrStaticInfo != null) {
return new ColorInfo(colorSpace, colorRange, colorTransfer, hdrStaticInfo); return new ColorInfo.Builder()
.setColorSpace(colorSpace)
.setColorRange(colorRange)
.setColorTransfer(colorTransfer)
.setHdrStaticInfo(hdrStaticInfo)
.build();
} }
return null; return null;
} }
......
...@@ -258,8 +258,11 @@ public final class GlEffectsFrameProcessor implements FrameProcessor { ...@@ -258,8 +258,11 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
ImmutableList.Builder<RgbMatrix> rgbMatrixListBuilder = new ImmutableList.Builder<>(); ImmutableList.Builder<RgbMatrix> rgbMatrixListBuilder = new ImmutableList.Builder<>();
boolean sampleFromInputTexture = true; boolean sampleFromInputTexture = true;
ColorInfo linearColorInfo = ColorInfo linearColorInfo =
new ColorInfo( outputColorInfo
outputColorInfo.colorSpace, outputColorInfo.colorRange, C.COLOR_TRANSFER_LINEAR, null); .buildUpon()
.setColorTransfer(C.COLOR_TRANSFER_LINEAR)
.setHdrStaticInfo(null)
.build();
for (int i = 0; i < effects.size(); i++) { for (int i = 0; i < effects.size(); i++) {
Effect effect = effects.get(i); Effect effect = effects.get(i);
checkArgument(effect instanceof GlEffect, "GlEffectsFrameProcessor only supports GlEffects"); checkArgument(effect instanceof GlEffect, "GlEffectsFrameProcessor only supports GlEffects");
......
...@@ -103,11 +103,11 @@ public final class AndroidTestUtil { ...@@ -103,11 +103,11 @@ public final class AndroidTestUtil {
.setHeight(1080) .setHeight(1080)
.setFrameRate(30.000f) .setFrameRate(30.000f)
.setColorInfo( .setColorInfo(
new ColorInfo( new ColorInfo.Builder()
C.COLOR_SPACE_BT2020, .setColorSpace(C.COLOR_SPACE_BT2020)
C.COLOR_RANGE_LIMITED, .setColorRange(C.COLOR_RANGE_LIMITED)
C.COLOR_TRANSFER_HLG, .setColorTransfer(C.COLOR_TRANSFER_HLG)
/* hdrStaticInfo= */ null)) .build())
.build(); .build();
public static final String MP4_ASSET_1080P_4_SECOND_HDR10 = "asset:///media/mp4/hdr10-1080p.mp4"; public static final String MP4_ASSET_1080P_4_SECOND_HDR10 = "asset:///media/mp4/hdr10-1080p.mp4";
public static final Format MP4_ASSET_1080P_4_SECOND_HDR10_FORMAT = public static final Format MP4_ASSET_1080P_4_SECOND_HDR10_FORMAT =
...@@ -117,11 +117,11 @@ public final class AndroidTestUtil { ...@@ -117,11 +117,11 @@ public final class AndroidTestUtil {
.setHeight(1080) .setHeight(1080)
.setFrameRate(23.517f) .setFrameRate(23.517f)
.setColorInfo( .setColorInfo(
new ColorInfo( new ColorInfo.Builder()
C.COLOR_SPACE_BT2020, .setColorSpace(C.COLOR_SPACE_BT2020)
C.COLOR_RANGE_LIMITED, .setColorRange(C.COLOR_RANGE_LIMITED)
C.COLOR_TRANSFER_ST2084, .setColorTransfer(C.COLOR_TRANSFER_ST2084)
/* hdrStaticInfo= */ null)) .build())
.build(); .build();
public static final String MP4_ASSET_1080P_1_SECOND_HDR10_VIDEO_SDR_CONTAINER = public static final String MP4_ASSET_1080P_1_SECOND_HDR10_VIDEO_SDR_CONTAINER =
"asset:///media/mp4/hdr10-video-with-sdr-container.mp4"; "asset:///media/mp4/hdr10-video-with-sdr-container.mp4";
......
...@@ -56,17 +56,17 @@ import org.junit.runner.RunWith; ...@@ -56,17 +56,17 @@ import org.junit.runner.RunWith;
public class HdrEditingTest { public class HdrEditingTest {
public static final String TAG = "HdrEditingTest"; public static final String TAG = "HdrEditingTest";
private static final ColorInfo HDR10_DEFAULT_COLOR_INFO = private static final ColorInfo HDR10_DEFAULT_COLOR_INFO =
new ColorInfo( new ColorInfo.Builder()
C.COLOR_SPACE_BT2020, .setColorSpace(C.COLOR_SPACE_BT2020)
C.COLOR_RANGE_LIMITED, .setColorRange(C.COLOR_RANGE_LIMITED)
C.COLOR_TRANSFER_ST2084, .setColorTransfer(C.COLOR_TRANSFER_ST2084)
/* hdrStaticInfo= */ null); .build();
private static final ColorInfo HLG10_DEFAULT_COLOR_INFO = private static final ColorInfo HLG10_DEFAULT_COLOR_INFO =
new ColorInfo( new ColorInfo.Builder()
C.COLOR_SPACE_BT2020, .setColorSpace(C.COLOR_SPACE_BT2020)
C.COLOR_RANGE_LIMITED, .setColorRange(C.COLOR_RANGE_LIMITED)
C.COLOR_TRANSFER_HLG, .setColorTransfer(C.COLOR_TRANSFER_HLG)
/* hdrStaticInfo= */ null); .build();
@Test @Test
public void transform_noRequestedTranscode_hdr10File_transformsOrThrows() throws Exception { public void transform_noRequestedTranscode_hdr10File_transformsOrThrows() throws Exception {
......
...@@ -128,11 +128,11 @@ import org.checkerframework.dataflow.qual.Pure; ...@@ -128,11 +128,11 @@ import org.checkerframework.dataflow.qual.Pure;
// C.COLOR_TRANSFER_SDR to the encoder. // C.COLOR_TRANSFER_SDR to the encoder.
ColorInfo frameProcessorOutputColor = ColorInfo frameProcessorOutputColor =
isGlToneMapping isGlToneMapping
? new ColorInfo( ? new ColorInfo.Builder()
C.COLOR_SPACE_BT709, .setColorSpace(C.COLOR_SPACE_BT709)
C.COLOR_RANGE_LIMITED, .setColorRange(C.COLOR_RANGE_LIMITED)
C.COLOR_TRANSFER_GAMMA_2_2, .setColorTransfer(C.COLOR_TRANSFER_GAMMA_2_2)
/* hdrStaticInfo= */ null) .build()
: encoderInputColor; : encoderInputColor;
try { try {
frameProcessor = frameProcessor =
......
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