Skip to content

Commit

Permalink
Add Dolby Vision four ccs and filter out levels with unknown codecs m…
Browse files Browse the repository at this point in the history
…ixed with levels where codecs are known

Related to #4744
  • Loading branch information
robwalch committed Sep 14, 2022
1 parent 4ddf764 commit 7a87693
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/loader/m3u8-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export default class M3U8Parser {

static parseMasterPlaylist(string: string, baseurl: string) {
const levels: Array<LevelParsed> = [];
const levelsWithKnownCodecs: Array<LevelParsed> = [];
const sessionData: Record<string, AttrList> = {};
let hasSessionData = false;
MASTER_PLAYLIST_REGEX.lastIndex = 0;
Expand Down Expand Up @@ -118,6 +119,10 @@ export default class M3U8Parser {
level.videoCodec = M3U8Parser.convertAVC1ToAVCOTI(level.videoCodec);
}

if (!level.unknownCodecs?.length) {
levelsWithKnownCodecs.push(level);
}

levels.push(level);
} else if (result[3]) {
// '#EXT-X-SESSION-DATA' is found, parse session data in group 3
Expand All @@ -128,8 +133,13 @@ export default class M3U8Parser {
}
}
}
// Filter out levels with unknown codecs if it does not remove all levels
const stripUnknownCodecLevels =
levelsWithKnownCodecs.length > 0 &&
levelsWithKnownCodecs.length < levels.length;

return {
levels,
levels: stripUnknownCodecLevels ? levelsWithKnownCodecs : levels,
sessionData: hasSessionData ? sessionData : null,
};
}
Expand Down
2 changes: 2 additions & 0 deletions src/utils/codecs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ const sampleEntryCodesISO = {
avcp: true,
av01: true,
drac: true,
dva1: true,
dvav: true,
dvh1: true,
dvhe: true,
encv: true,
hev1: true,
Expand Down

0 comments on commit 7a87693

Please sign in to comment.