Repository: xbmc/xbmc
File: xbmc/utils/HevcSei.cpp (C++)

Code before:
  }

  return messages;
}

const std::vector<CHevcSei> CHevcSei::ParseSeiRbsp(const uint8_t* buf, const size_t len)
{
  return ParseSeiRbspInternal(buf, len);
}

const std::vector<CHevcSei> CHevcSei::ParseSeiRbspUnclearedEmulation(const uint8_t* in_data,
                                                                     const size_t in_data_len,
                                                                     std::vector<uint8_t>& buf)
{
  hevc_clear_start_code_emulation_prevention_3_byte(in_data, in_data_len, buf);
  return ParseSeiRbsp(buf.data(), buf.size());
}

const std::optional<const CHevcSei*> CHevcSei::FindHdr10PlusSeiMessage(
    const std::vector<uint8_t>& buf, const std::vector<CHevcSei>& messages)
{
  for (const CHevcSei& sei : messages)
  {
    if (sei.payload_type == 4 && sei.payload_size >= 7)
    {
      CBitstreamReader br(buf.data() + sei.payload_offset, sei.payload_size);
      auto itu_t_t35_country_code = br.ReadBits(8);
      auto itu_t_t35_terminal_provider_code = br.ReadBits(16);
      auto itu_t_t35_terminal_provider_oriented_code = br.ReadBits(16);

      if (itu_t_t35_country_code == 0xB5 && itu_t_t35_terminal_provider_code == 0x003C &&
          itu_t_t35_terminal_provider_oriented_code == 0x0001)
      {
        auto application_identifier = br.ReadBits(8);
        auto application_version = br.ReadBits(8);

        if (application_identifier == 4 && application_version <= 1)
          return &sei;
      }
    }
  }

  return {};
}

const std::pair<bool, const std::vector<uint8_t>> CHevcSei::RemoveHdr10PlusFromSeiNalu(
    const uint8_t* in_data, const size_t in_data_len)
{
  bool containsHdr10Plus = false;

  std::vector<uint8_t> buf;

Review comment (suggestion):
```suggestion
      const auto itu_t_t35_country_code = br.ReadBits(8);
```

This and others

Code after:

  return messages;
}

std::vector<CHevcSei> CHevcSei::ParseSeiRbsp(const uint8_t* buf, const size_t len)
{
  return ParseSeiRbspInternal(buf, len);
}

std::vector<CHevcSei> CHevcSei::ParseSeiRbspUnclearedEmulation(const uint8_t* inData,
                                                               const size_t inDataLen,
                                                               std::vector<uint8_t>& buf)
{
  HevcClearStartCodeEmulationPrevention3Byte(inData, inDataLen, buf);
  return ParseSeiRbsp(buf.data(), buf.size());
}

std::optional<const CHevcSei*> CHevcSei::FindHdr10PlusSeiMessage(
    const std::vector<uint8_t>& buf, const std::vector<CHevcSei>& messages)
{
  for (const CHevcSei& sei : messages)
  {
    // User Data Registered ITU-T T.35
    if (sei.m_payloadType == 4 && sei.m_payloadSize >= 7)
    {
      CBitstreamReader br(buf.data() + sei.m_payloadOffset, sei.m_payloadSize);
      const auto itu_t_t35_country_code = br.ReadBits(8);
      const auto itu_t_t35_terminal_provider_code = br.ReadBits(16);
      const auto itu_t_t35_terminal_provider_oriented_code = br.ReadBits(16);

      // United States, Samsung Electronics America, ST 2094-40
      if (itu_t_t35_country_code == 0xB5 && itu_t_t35_terminal_provider_code == 0x003C &&
          itu_t_t35_terminal_provider_oriented_code == 0x0001)
      {
        const auto application_identifier = br.ReadBits(8);
        const auto application_version = br.ReadBits(8);

        if (application_identifier == 4 && application_version <= 1)
          return &sei;
      }
    }
  }

  return {};
}

std::pair<bool, const std::vector<uint8_t>> CHevcSei::RemoveHdr10PlusFromSeiNalu(
    const uint8_t* inData, const size_t inDataLen)
{
  bool containsHdr10Plus{false};