diff --git a/libraries/common/src/main/java/androidx/media3/common/Format.java b/libraries/common/src/main/java/androidx/media3/common/Format.java index 4ff1e36876..72c9f47b2d 100644 --- a/libraries/common/src/main/java/androidx/media3/common/Format.java +++ b/libraries/common/src/main/java/androidx/media3/common/Format.java @@ -62,8 +62,6 @@ import java.util.UUID; *
  • {@link #averageBitrate} *
  • {@link #peakBitrate} *
  • {@link #codecs} - *
  • {@link #supplementalCodecs} - *
  • {@link #supplementalProfiles} *
  • {@link #metadata} * * @@ -104,7 +102,6 @@ import java.util.UUID; *
  • {@link #projectionData} *
  • {@link #stereoMode} *
  • {@link #colorInfo} - *
  • {@link #videoRange} * * *

    Fields relevant to audio formats

    @@ -154,8 +151,6 @@ public final class Format { private int averageBitrate; private int peakBitrate; @Nullable private String codecs; - @Nullable private String supplementalCodecs; - @Nullable private String supplementalProfiles; @Nullable private Metadata metadata; @Nullable private Object customData; @@ -183,7 +178,6 @@ public final class Format { @Nullable private byte[] projectionData; private @C.StereoMode int stereoMode; @Nullable private ColorInfo colorInfo; - @Nullable private String videoRange; // Audio specific. @@ -252,8 +246,6 @@ public final class Format { this.averageBitrate = format.averageBitrate; this.peakBitrate = format.peakBitrate; this.codecs = format.codecs; - this.supplementalCodecs = format.supplementalCodecs; - this.supplementalProfiles = format.supplementalProfiles; this.metadata = format.metadata; this.customData = format.customData; // Container specific. @@ -275,7 +267,6 @@ public final class Format { this.projectionData = format.projectionData; this.stereoMode = format.stereoMode; this.colorInfo = format.colorInfo; - this.videoRange = format.videoRange; // Audio specific. this.channelCount = format.channelCount; this.sampleRate = format.sampleRate; @@ -438,28 +429,6 @@ public final class Format { return this; } - /** - * Sets {@link Format#supplementalCodecs}. The default value is {@code null}. - * - * @param supplementalCodecs The {@link Format#supplementalCodecs}. - * @return The builder. - */ - public Builder setSupplementalCodecs(@Nullable String supplementalCodecs) { - this.supplementalCodecs = supplementalCodecs; - return this; - } - - /** - * Sets {@link Format#supplementalProfiles}. The default value is {@code null}. - * - * @param supplementalProfiles The {@link Format#supplementalProfiles}. - * @return The builder. - */ - public Builder setSupplementalProfiles(@Nullable String supplementalProfiles) { - this.supplementalProfiles = supplementalProfiles; - return this; - } - /** * Sets {@link Format#metadata}. The default value is {@code null}. * @@ -686,17 +655,6 @@ public final class Format { return this; } - /** - * Sets {@link Format#videoRange}. The default value is {@code null}. - * - * @param videoRange The {@link Format#videoRange}. - * @return The builder. - */ - public Builder setVideoRange(@Nullable String videoRange) { - this.videoRange = videoRange; - return this; - } - // Audio specific. /** @@ -958,12 +916,6 @@ public final class Format { /** Codecs of the format as described in RFC 6381, or null if unknown or not applicable. */ @Nullable public final String codecs; - /** The supplemental codecs for compatibility playback, or null if not applicable. */ - @Nullable public final String supplementalCodecs; - - /** The supplemental profiles for compatibility playback, or null if not applicable. */ - @Nullable public final String supplementalProfiles; - /** Metadata, or null if unknown or not applicable. */ @UnstableApi @Nullable public final Metadata metadata; @@ -1056,9 +1008,6 @@ public final class Format { /** The color metadata associated with the video, or null if not applicable. */ @UnstableApi @Nullable public final ColorInfo colorInfo; - /** The reference opto-electronic transfer characteristic functions, or null if not applicable. */ - @Nullable public final String videoRange; - // Audio specific. /** The number of audio channels, or {@link #NO_VALUE} if unknown or not applicable. */ @@ -1154,8 +1103,6 @@ public final class Format { peakBitrate = builder.peakBitrate; bitrate = peakBitrate != NO_VALUE ? peakBitrate : averageBitrate; codecs = builder.codecs; - supplementalCodecs = builder.supplementalCodecs; - supplementalProfiles = builder.supplementalProfiles; metadata = builder.metadata; customData = builder.customData; // Container specific. @@ -1179,7 +1126,6 @@ public final class Format { projectionData = builder.projectionData; stereoMode = builder.stereoMode; colorInfo = builder.colorInfo; - videoRange = builder.videoRange; // Audio specific. channelCount = builder.channelCount; sampleRate = builder.sampleRate; @@ -1244,9 +1190,8 @@ public final class Format { codecs = codecsOfType; } } - if (MimeTypes.VIDEO_DOLBY_VISION.equals(sampleMimeType) && - manifestFormat.supplementalCodecs != null) { - codecs = manifestFormat.supplementalCodecs; + if (MimeTypes.VIDEO_DOLBY_VISION.equals(sampleMimeType)) { + codecs = manifestFormat.codecs; } @Nullable diff --git a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsMediaPeriod.java b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsMediaPeriod.java index 8ef3bb7629..2832442c7f 100644 --- a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsMediaPeriod.java +++ b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsMediaPeriod.java @@ -847,59 +847,16 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; return drmInitDataBySchemeType; } - private static boolean isDolbyVisionFormat( - @Nullable String videoRange, - @Nullable String codecs, - @Nullable String supplementalCodecs, - @Nullable String supplementalProfiles) { - if (codecs == null) { - return false; - } - if (codecs.startsWith("dvhe") || codecs.startsWith("dvh1")) { - // profile 5 - return true; - } - - if (supplementalCodecs == null) { - return false; - } - // For Dolby Vision, the compatibility brand (i.e. supplemental profiles) and the VIDEO-RANGE - // attribute act as cross-checks. Leaving out either one is incorrect. - if (videoRange == null || supplementalProfiles == null) { - return false; - } - if ((videoRange.equals("PQ") && !supplementalProfiles.equals("db1p")) || - (videoRange.equals("SDR") && !supplementalProfiles.equals("db2g")) || - (videoRange.equals("HLG") && !supplementalProfiles.startsWith("db4"))) { // db4g or db4h - return false; - } - - return (supplementalCodecs.startsWith("dvhe") && codecs.startsWith("hev1")) || // profile 8 - (supplementalCodecs.startsWith("dvh1") && codecs.startsWith("hvc1")) || // profile 8 - (supplementalCodecs.startsWith("dvav") && codecs.startsWith("avc3")) || // profile 9 - (supplementalCodecs.startsWith("dva1") && codecs.startsWith("avc1")) || // profile 9 - (supplementalCodecs.startsWith("dav1") && codecs.startsWith("av01")); // profile 10 - } - private static Format deriveVideoFormat(Format variantFormat) { - @Nullable String videoRange = variantFormat.videoRange; @Nullable String codecs = Util.getCodecsOfType(variantFormat.codecs, C.TRACK_TYPE_VIDEO); - @Nullable String supplementalCodecs = variantFormat.supplementalCodecs; - @Nullable String supplementalProfiles = variantFormat.supplementalProfiles; @Nullable String sampleMimeType = MimeTypes.getMediaMimeType(codecs); - if (isDolbyVisionFormat(videoRange, codecs, supplementalCodecs, supplementalProfiles)) { - sampleMimeType = MimeTypes.VIDEO_DOLBY_VISION; - codecs = supplementalCodecs != null ? supplementalCodecs : codecs; - } - return new Format.Builder() .setId(variantFormat.id) .setLabel(variantFormat.label) .setLabels(variantFormat.labels) .setContainerMimeType(variantFormat.containerMimeType) .setSampleMimeType(sampleMimeType) - .setVideoRange(videoRange) .setCodecs(codecs) .setMetadata(variantFormat.metadata) .setAverageBitrate(variantFormat.averageBitrate) diff --git a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsPlaylistParser.java b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsPlaylistParser.java index 95cdcc212f..7b8e29384e 100644 --- a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsPlaylistParser.java +++ b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/playlist/HlsPlaylistParser.java @@ -326,6 +326,40 @@ public final class HlsPlaylistParser implements ParsingLoadable.Parser> urlToVariantInfos = new HashMap<>(); @@ -394,6 +428,10 @@ public final class HlsPlaylistParser implements ParsingLoadable.Parser