Removed deprecated ColorInfo constructor call and fixed formatting

This commit is contained in:
microkatz 2023-09-07 11:56:42 +00:00
parent d206be74ef
commit 212e138bcf
3 changed files with 27 additions and 23 deletions

View file

@ -150,11 +150,12 @@ public class MediaFormatUtilTest {
.setAverageBitrate(1)
.setChannelCount(2)
.setColorInfo(
new ColorInfo(
/* colorSpace= */ C.COLOR_SPACE_BT601,
/* colorRange= */ C.COLOR_RANGE_FULL,
/* colorTransfer= */ C.COLOR_TRANSFER_HLG,
new byte[] {3}))
new ColorInfo.Builder()
.setColorSpace(C.COLOR_SPACE_BT601)
.setColorRange(C.COLOR_RANGE_FULL)
.setColorTransfer(C.COLOR_TRANSFER_HLG)
.setHdrStaticInfo(new byte[] {3})
.build())
.setSampleMimeType(MimeTypes.VIDEO_H264)
.setCodecs("avc.123")
.setFrameRate(4)

View file

@ -413,13 +413,14 @@ import com.google.common.collect.ImmutableMap;
formatBuilder.setPixelWidthHeightRatio(spsData.pixelWidthHeightRatio);
formatBuilder.setHeight(spsData.height);
formatBuilder.setWidth(spsData.width);
formatBuilder.setColorInfo(new ColorInfo.Builder()
.setColorSpace(spsData.colorSpace)
formatBuilder.setColorInfo(
new ColorInfo.Builder()
.setColorSpace(spsData.colorSpace)
.setColorRange(spsData.colorRange)
.setColorTransfer(spsData.colorTransfer)
.setLumaBitdepth(spsData.bitDepthLumaMinus8 + 8)
.setChromaBitdepth(spsData.bitDepthChromaMinus8 + 8)
.build());
.build());
@Nullable String profileLevel = fmtpAttributes.get(PARAMETER_PROFILE_LEVEL_ID);
if (profileLevel != null) {
@ -463,13 +464,14 @@ import com.google.common.collect.ImmutableMap;
spsNalDataWithStartCode, NAL_START_CODE.length, spsNalDataWithStartCode.length);
formatBuilder.setPixelWidthHeightRatio(spsData.pixelWidthHeightRatio);
formatBuilder.setHeight(spsData.height).setWidth(spsData.width);
formatBuilder.setColorInfo(new ColorInfo.Builder()
.setColorSpace(spsData.colorSpace)
.setColorRange(spsData.colorRange)
.setColorTransfer(spsData.colorTransfer)
.setLumaBitdepth(spsData.bitDepthLumaMinus8 + 8)
.setChromaBitdepth(spsData.bitDepthChromaMinus8 + 8)
.build());
formatBuilder.setColorInfo(
new ColorInfo.Builder()
.setColorSpace(spsData.colorSpace)
.setColorRange(spsData.colorRange)
.setColorTransfer(spsData.colorTransfer)
.setLumaBitdepth(spsData.bitDepthLumaMinus8 + 8)
.setChromaBitdepth(spsData.bitDepthChromaMinus8 + 8)
.build());
formatBuilder.setCodecs(
CodecSpecificDataUtil.buildHevcCodecString(

View file

@ -2295,14 +2295,15 @@ public class MatroskaExtractor implements Extractor {
@Nullable ColorInfo colorInfo = null;
if (hasColorInfo) {
@Nullable byte[] hdrStaticInfo = getHdrStaticInfo();
colorInfo = new ColorInfo.Builder()
.setColorSpace(colorSpace)
.setColorRange(colorRange)
.setColorTransfer(colorTransfer)
.setHdrStaticInfo(hdrStaticInfo)
.setLumaBitdepth(bitsPerChannel)
.setChromaBitdepth(bitsPerChannel)
.build();
colorInfo =
new ColorInfo.Builder()
.setColorSpace(colorSpace)
.setColorRange(colorRange)
.setColorTransfer(colorTransfer)
.setHdrStaticInfo(hdrStaticInfo)
.setLumaBitdepth(bitsPerChannel)
.setChromaBitdepth(bitsPerChannel)
.build();
}
int rotationDegrees = Format.NO_VALUE;