Skip to content

Commit

Permalink
Merge pull request #1651 from CastagnaIT/fix_pr_parser_omega
Browse files Browse the repository at this point in the history
[PRProtectionParser] Fix KID parsing
  • Loading branch information
CastagnaIT authored Aug 22, 2024
2 parents 5443be5 + 818faad commit 6c7de38
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/parser/PRProtectionParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,30 @@ bool adaptive::PRProtectionParser::ParseHeader(std::string_view prHeader)
}
else
{
// Versions > 4.0 can contains one or more optionals KID's within DATA/PROTECTINFO/KIDS tag
// Versions > 4.0 can contains:
// DATA/PROTECTINFO/KID tag or multiple KID tags on DATA/PROTECTINFO/KIDS
xml_node nodePROTECTINFO = nodeDATA.child("PROTECTINFO");
if (nodePROTECTINFO)
{
xml_node nodeKIDS = nodePROTECTINFO.child("KIDS");
if (nodeKIDS)
xml_node nodeKID = nodePROTECTINFO.child("KID");
if (nodeKID)
{
LOG::Log(LOGDEBUG, "Playready header contains %zu KID's.",
XML::CountChilds(nodeKIDS, "KID"));
// We get the first KID
xml_node nodeKID = nodeKIDS.child("KID");
kidBase64 = nodeKID.child_value();
kidBase64 = nodeKID.attribute("VALUE").as_string();
}
else
{
xml_node nodeKIDS = nodePROTECTINFO.child("KIDS");
if (nodeKIDS)
{
LOG::Log(LOGDEBUG, "Playready header contains %zu KID's.",
XML::CountChilds(nodeKIDS, "KID"));
// We get the first KID
xml_node nodeKID = nodeKIDS.child("KID");
if (nodeKID)
{
kidBase64 = nodeKID.attribute("VALUE").as_string();
}
}
}
}
}
Expand Down

0 comments on commit 6c7de38

Please sign in to comment.