mirror of
https://github.com/samsonjs/media.git
synced 2026-04-12 12:25:47 +00:00
Use ColorInfo.Builder in transformer and common.
Because the ColorInfo constructor is deprecated. PiperOrigin-RevId: 509468663
This commit is contained in:
parent
33d45c3c75
commit
efcb7683e5
5 changed files with 36 additions and 28 deletions
|
|
@ -228,7 +228,12 @@ public final class MediaFormatUtil {
|
|||
|| colorRange != Format.NO_VALUE
|
||||
|| colorTransfer != Format.NO_VALUE
|
||||
|| hdrStaticInfo != null) {
|
||||
return new ColorInfo(colorSpace, colorRange, colorTransfer, hdrStaticInfo);
|
||||
return new ColorInfo.Builder()
|
||||
.setColorSpace(colorSpace)
|
||||
.setColorRange(colorRange)
|
||||
.setColorTransfer(colorTransfer)
|
||||
.setHdrStaticInfo(hdrStaticInfo)
|
||||
.build();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -258,8 +258,11 @@ public final class GlEffectsFrameProcessor implements FrameProcessor {
|
|||
ImmutableList.Builder<RgbMatrix> rgbMatrixListBuilder = new ImmutableList.Builder<>();
|
||||
boolean sampleFromInputTexture = true;
|
||||
ColorInfo linearColorInfo =
|
||||
new ColorInfo(
|
||||
outputColorInfo.colorSpace, outputColorInfo.colorRange, C.COLOR_TRANSFER_LINEAR, null);
|
||||
outputColorInfo
|
||||
.buildUpon()
|
||||
.setColorTransfer(C.COLOR_TRANSFER_LINEAR)
|
||||
.setHdrStaticInfo(null)
|
||||
.build();
|
||||
for (int i = 0; i < effects.size(); i++) {
|
||||
Effect effect = effects.get(i);
|
||||
checkArgument(effect instanceof GlEffect, "GlEffectsFrameProcessor only supports GlEffects");
|
||||
|
|
|
|||
|
|
@ -103,11 +103,11 @@ public final class AndroidTestUtil {
|
|||
.setHeight(1080)
|
||||
.setFrameRate(30.000f)
|
||||
.setColorInfo(
|
||||
new ColorInfo(
|
||||
C.COLOR_SPACE_BT2020,
|
||||
C.COLOR_RANGE_LIMITED,
|
||||
C.COLOR_TRANSFER_HLG,
|
||||
/* hdrStaticInfo= */ null))
|
||||
new ColorInfo.Builder()
|
||||
.setColorSpace(C.COLOR_SPACE_BT2020)
|
||||
.setColorRange(C.COLOR_RANGE_LIMITED)
|
||||
.setColorTransfer(C.COLOR_TRANSFER_HLG)
|
||||
.build())
|
||||
.build();
|
||||
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 =
|
||||
|
|
@ -117,11 +117,11 @@ public final class AndroidTestUtil {
|
|||
.setHeight(1080)
|
||||
.setFrameRate(23.517f)
|
||||
.setColorInfo(
|
||||
new ColorInfo(
|
||||
C.COLOR_SPACE_BT2020,
|
||||
C.COLOR_RANGE_LIMITED,
|
||||
C.COLOR_TRANSFER_ST2084,
|
||||
/* hdrStaticInfo= */ null))
|
||||
new ColorInfo.Builder()
|
||||
.setColorSpace(C.COLOR_SPACE_BT2020)
|
||||
.setColorRange(C.COLOR_RANGE_LIMITED)
|
||||
.setColorTransfer(C.COLOR_TRANSFER_ST2084)
|
||||
.build())
|
||||
.build();
|
||||
public static final String MP4_ASSET_1080P_1_SECOND_HDR10_VIDEO_SDR_CONTAINER =
|
||||
"asset:///media/mp4/hdr10-video-with-sdr-container.mp4";
|
||||
|
|
|
|||
|
|
@ -56,17 +56,17 @@ import org.junit.runner.RunWith;
|
|||
public class HdrEditingTest {
|
||||
public static final String TAG = "HdrEditingTest";
|
||||
private static final ColorInfo HDR10_DEFAULT_COLOR_INFO =
|
||||
new ColorInfo(
|
||||
C.COLOR_SPACE_BT2020,
|
||||
C.COLOR_RANGE_LIMITED,
|
||||
C.COLOR_TRANSFER_ST2084,
|
||||
/* hdrStaticInfo= */ null);
|
||||
new ColorInfo.Builder()
|
||||
.setColorSpace(C.COLOR_SPACE_BT2020)
|
||||
.setColorRange(C.COLOR_RANGE_LIMITED)
|
||||
.setColorTransfer(C.COLOR_TRANSFER_ST2084)
|
||||
.build();
|
||||
private static final ColorInfo HLG10_DEFAULT_COLOR_INFO =
|
||||
new ColorInfo(
|
||||
C.COLOR_SPACE_BT2020,
|
||||
C.COLOR_RANGE_LIMITED,
|
||||
C.COLOR_TRANSFER_HLG,
|
||||
/* hdrStaticInfo= */ null);
|
||||
new ColorInfo.Builder()
|
||||
.setColorSpace(C.COLOR_SPACE_BT2020)
|
||||
.setColorRange(C.COLOR_RANGE_LIMITED)
|
||||
.setColorTransfer(C.COLOR_TRANSFER_HLG)
|
||||
.build();
|
||||
|
||||
@Test
|
||||
public void transform_noRequestedTranscode_hdr10File_transformsOrThrows() throws Exception {
|
||||
|
|
|
|||
|
|
@ -128,11 +128,11 @@ import org.checkerframework.dataflow.qual.Pure;
|
|||
// C.COLOR_TRANSFER_SDR to the encoder.
|
||||
ColorInfo frameProcessorOutputColor =
|
||||
isGlToneMapping
|
||||
? new ColorInfo(
|
||||
C.COLOR_SPACE_BT709,
|
||||
C.COLOR_RANGE_LIMITED,
|
||||
C.COLOR_TRANSFER_GAMMA_2_2,
|
||||
/* hdrStaticInfo= */ null)
|
||||
? new ColorInfo.Builder()
|
||||
.setColorSpace(C.COLOR_SPACE_BT709)
|
||||
.setColorRange(C.COLOR_RANGE_LIMITED)
|
||||
.setColorTransfer(C.COLOR_TRANSFER_GAMMA_2_2)
|
||||
.build()
|
||||
: encoderInputColor;
|
||||
try {
|
||||
frameProcessor =
|
||||
|
|
|
|||
Loading…
Reference in a new issue