mirror of
https://github.com/androidx/media.git
synced 2025-05-12 10:09:55 +08:00
Add ColorInfo to TransformationResult.
TESTED: Manually verified the ColorInfo is propagated when VSP is used. PiperOrigin-RevId: 502843773
This commit is contained in:
parent
8fcd6bbffc
commit
a44032c59b
@ -184,6 +184,7 @@ public class TransformationTestResult {
|
|||||||
.putOpt(
|
.putOpt(
|
||||||
"fallbackDetails", fallbackDetails != null ? fallbackDetails.asJsonObject() : null)
|
"fallbackDetails", fallbackDetails != null ? fallbackDetails.asJsonObject() : null)
|
||||||
.putOpt("filePath", filePath)
|
.putOpt("filePath", filePath)
|
||||||
|
.putOpt("colorInfo", transformationResult.colorInfo)
|
||||||
.putOpt("videoDecoderName", transformationResult.videoDecoderName)
|
.putOpt("videoDecoderName", transformationResult.videoDecoderName)
|
||||||
.putOpt("videoEncoderName", transformationResult.videoEncoderName)
|
.putOpt("videoEncoderName", transformationResult.videoEncoderName)
|
||||||
.putOpt("testException", exceptionAsJsonObject(testException))
|
.putOpt("testException", exceptionAsJsonObject(testException))
|
||||||
|
@ -20,6 +20,7 @@ import static com.google.android.exoplayer2.util.Assertions.checkArgument;
|
|||||||
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.Format;
|
||||||
|
import com.google.android.exoplayer2.video.ColorInfo;
|
||||||
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@ -36,6 +37,7 @@ public final class TransformationResult {
|
|||||||
@Nullable private String audioDecoderName;
|
@Nullable private String audioDecoderName;
|
||||||
@Nullable private String audioEncoderName;
|
@Nullable private String audioEncoderName;
|
||||||
private int averageVideoBitrate;
|
private int averageVideoBitrate;
|
||||||
|
@Nullable ColorInfo colorInfo;
|
||||||
private int height;
|
private int height;
|
||||||
private int width;
|
private int width;
|
||||||
private int videoFrameCount;
|
private int videoFrameCount;
|
||||||
@ -148,6 +150,13 @@ public final class TransformationResult {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Sets the {@link ColorInfo}. */
|
||||||
|
@CanIgnoreReturnValue
|
||||||
|
public Builder setColorInfo(@Nullable ColorInfo colorInfo) {
|
||||||
|
this.colorInfo = colorInfo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the height.
|
* Sets the height.
|
||||||
*
|
*
|
||||||
@ -217,6 +226,7 @@ public final class TransformationResult {
|
|||||||
audioDecoderName,
|
audioDecoderName,
|
||||||
audioEncoderName,
|
audioEncoderName,
|
||||||
averageVideoBitrate,
|
averageVideoBitrate,
|
||||||
|
colorInfo,
|
||||||
height,
|
height,
|
||||||
width,
|
width,
|
||||||
videoFrameCount,
|
videoFrameCount,
|
||||||
@ -250,6 +260,8 @@ public final class TransformationResult {
|
|||||||
* The average bitrate of the video track data, or {@link C#RATE_UNSET_INT} if unset or unknown.
|
* The average bitrate of the video track data, or {@link C#RATE_UNSET_INT} if unset or unknown.
|
||||||
*/
|
*/
|
||||||
public final int averageVideoBitrate;
|
public final int averageVideoBitrate;
|
||||||
|
/** The {@link ColorInfo} of the video, or {@code null} if unset or unknown. */
|
||||||
|
@Nullable public final ColorInfo colorInfo;
|
||||||
/** The height of the video, or {@link C#LENGTH_UNSET} if unset or unknown. */
|
/** The height of the video, or {@link C#LENGTH_UNSET} if unset or unknown. */
|
||||||
public final int height;
|
public final int height;
|
||||||
/** The width of the video, or {@link C#LENGTH_UNSET} if unset or unknown. */
|
/** The width of the video, or {@link C#LENGTH_UNSET} if unset or unknown. */
|
||||||
@ -277,6 +289,7 @@ public final class TransformationResult {
|
|||||||
@Nullable String audioDecoderName,
|
@Nullable String audioDecoderName,
|
||||||
@Nullable String audioEncoderName,
|
@Nullable String audioEncoderName,
|
||||||
int averageVideoBitrate,
|
int averageVideoBitrate,
|
||||||
|
@Nullable ColorInfo colorInfo,
|
||||||
int height,
|
int height,
|
||||||
int width,
|
int width,
|
||||||
int videoFrameCount,
|
int videoFrameCount,
|
||||||
@ -292,6 +305,7 @@ public final class TransformationResult {
|
|||||||
this.audioDecoderName = audioDecoderName;
|
this.audioDecoderName = audioDecoderName;
|
||||||
this.audioEncoderName = audioEncoderName;
|
this.audioEncoderName = audioEncoderName;
|
||||||
this.averageVideoBitrate = averageVideoBitrate;
|
this.averageVideoBitrate = averageVideoBitrate;
|
||||||
|
this.colorInfo = colorInfo;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.videoFrameCount = videoFrameCount;
|
this.videoFrameCount = videoFrameCount;
|
||||||
@ -311,6 +325,7 @@ public final class TransformationResult {
|
|||||||
.setAudioDecoderName(audioDecoderName)
|
.setAudioDecoderName(audioDecoderName)
|
||||||
.setAudioEncoderName(audioEncoderName)
|
.setAudioEncoderName(audioEncoderName)
|
||||||
.setAverageVideoBitrate(averageVideoBitrate)
|
.setAverageVideoBitrate(averageVideoBitrate)
|
||||||
|
.setColorInfo(colorInfo)
|
||||||
.setHeight(height)
|
.setHeight(height)
|
||||||
.setWidth(width)
|
.setWidth(width)
|
||||||
.setVideoFrameCount(videoFrameCount)
|
.setVideoFrameCount(videoFrameCount)
|
||||||
@ -337,6 +352,7 @@ public final class TransformationResult {
|
|||||||
&& Objects.equals(audioDecoderName, result.audioDecoderName)
|
&& Objects.equals(audioDecoderName, result.audioDecoderName)
|
||||||
&& Objects.equals(audioEncoderName, result.audioEncoderName)
|
&& Objects.equals(audioEncoderName, result.audioEncoderName)
|
||||||
&& averageVideoBitrate == result.averageVideoBitrate
|
&& averageVideoBitrate == result.averageVideoBitrate
|
||||||
|
&& Objects.equals(colorInfo, result.colorInfo)
|
||||||
&& height == result.height
|
&& height == result.height
|
||||||
&& width == result.width
|
&& width == result.width
|
||||||
&& videoFrameCount == result.videoFrameCount
|
&& videoFrameCount == result.videoFrameCount
|
||||||
@ -356,6 +372,7 @@ public final class TransformationResult {
|
|||||||
result = 31 * result + Objects.hashCode(audioDecoderName);
|
result = 31 * result + Objects.hashCode(audioDecoderName);
|
||||||
result = 31 * result + Objects.hashCode(audioEncoderName);
|
result = 31 * result + Objects.hashCode(audioEncoderName);
|
||||||
result = 31 * result + averageVideoBitrate;
|
result = 31 * result + averageVideoBitrate;
|
||||||
|
result = 31 * result + Objects.hashCode(colorInfo);
|
||||||
result = 31 * result + height;
|
result = 31 * result + height;
|
||||||
result = 31 * result + width;
|
result = 31 * result + width;
|
||||||
result = 31 * result + videoFrameCount;
|
result = 31 * result + videoFrameCount;
|
||||||
|
@ -441,6 +441,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
} else if (trackType == C.TRACK_TYPE_VIDEO) {
|
} else if (trackType == C.TRACK_TYPE_VIDEO) {
|
||||||
transformationResultBuilder
|
transformationResultBuilder
|
||||||
.setAverageVideoBitrate(averageBitrate)
|
.setAverageVideoBitrate(averageBitrate)
|
||||||
|
.setColorInfo(format.colorInfo)
|
||||||
.setVideoFrameCount(sampleCount);
|
.setVideoFrameCount(sampleCount);
|
||||||
if (format.height != Format.NO_VALUE) {
|
if (format.height != Format.NO_VALUE) {
|
||||||
transformationResultBuilder.setHeight(format.height);
|
transformationResultBuilder.setHeight(format.height);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user