Skip to content

Commit

Permalink
Merge pull request #1212 from canalplus/misc/better-detect-hdr
Browse files Browse the repository at this point in the history
DASH: parse `transferCharacteristics` property to better detect hdr
  • Loading branch information
peaBerberian authored Feb 7, 2023
2 parents 1b2fbbc + ff9a9ce commit 494cb01
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/parsers/manifest/dash/common/parse_representations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,17 @@ function combineInbandEventStreams(
*/
function getHDRInformation(
{ adaptationProfiles,
essentialProperties,
supplementalProperties,
manifestProfiles,
codecs,
}: { adaptationProfiles?: string | undefined;
essentialProperties? : IScheme[] | undefined;
supplementalProperties? : IScheme[] | undefined;
manifestProfiles?: string | undefined;
codecs?: string | undefined; }
): undefined | IHDRInformation {
const profiles = (adaptationProfiles ?? "") + (manifestProfiles ?? "");
if (codecs === undefined) {
return undefined;
}
if (
profiles.indexOf(
"http://dashif.org/guidelines/dash-if-uhd#hevc-hdr-pq10") !== -1
Expand All @@ -87,7 +88,20 @@ function getHDRInformation(
colorSpace: "rec2020" };
}
}
if (/^vp(08|09|10)/.exec(codecs)) {
const transferCharacteristicScheme = arrayFind(
[...(essentialProperties ?? []), ...(supplementalProperties ?? [])],
(p) => p.schemeIdUri === "urn:mpeg:mpegB:cicp:TransferCharacteristics");
if (transferCharacteristicScheme !== undefined) {
switch (transferCharacteristicScheme.value) {
case "15":
return undefined; // SDR
case "16":
return { eotf: "pq" };
case "18":
return { eotf: "hlg" };
}
}
if (codecs !== undefined && /^vp(08|09|10)/.exec(codecs)) {
return getWEBMHDRInformation(codecs);
}
}
Expand Down Expand Up @@ -273,6 +287,9 @@ export default function parseRepresentations(

parsedRepresentation.hdrInfo =
getHDRInformation({ adaptationProfiles: adaptation.attributes.profiles,
supplementalProperties: adaptation.children
.supplementalProperties,
essentialProperties: adaptation.children.essentialProperties,
manifestProfiles: context.manifestProfiles,
codecs });

Expand Down

0 comments on commit 494cb01

Please sign in to comment.