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) .setAverageBitrate(1)
.setChannelCount(2) .setChannelCount(2)
.setColorInfo( .setColorInfo(
new ColorInfo( new ColorInfo.Builder()
/* colorSpace= */ C.COLOR_SPACE_BT601, .setColorSpace(C.COLOR_SPACE_BT601)
/* colorRange= */ C.COLOR_RANGE_FULL, .setColorRange(C.COLOR_RANGE_FULL)
/* colorTransfer= */ C.COLOR_TRANSFER_HLG, .setColorTransfer(C.COLOR_TRANSFER_HLG)
new byte[] {3})) .setHdrStaticInfo(new byte[] {3})
.build())
.setSampleMimeType(MimeTypes.VIDEO_H264) .setSampleMimeType(MimeTypes.VIDEO_H264)
.setCodecs("avc.123") .setCodecs("avc.123")
.setFrameRate(4) .setFrameRate(4)

View file

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

View file

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