Add EMMG to carry fingerprinting and service blocking info

This commit is contained in:
Lu Chen
2020-09-15 09:16:59 -07:00
parent 3d8f585313
commit 1ce468e5ba
143 changed files with 2316 additions and 17450 deletions

View File

@@ -17,3 +17,13 @@ cc_library(
"endian.h",
],
)
cc_test(
name = "endian_test",
srcs = ["endian_test.cc"],
deps = [
":endian",
"//testing:gunit_main",
"@abseil_repo//absl/strings",
],
)

View File

@@ -10,6 +10,7 @@
#define UTIL_ENDIAN_ENDIAN_H_
#include <netinet/in.h>
#include <cstdint>
@@ -19,7 +20,8 @@ namespace widevine {
// order and big-endian byte order (same as network byte order)
class BigEndian {
public:
static uint32_t Load32(const char* data) {
static uint32_t Load32(const char* indata) {
const uint8_t* data = reinterpret_cast<const uint8_t*>(indata);
return (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3];
}

View File

@@ -0,0 +1,21 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2020 Google LLC.
//
// This software is licensed under the terms defined in the Widevine Master
// License Agreement. For a copy of this agreement, please contact
// widevine-licensing@google.com.
////////////////////////////////////////////////////////////////////////////////
#include "util/endian/endian.h"
#include "testing/gmock.h"
#include "testing/gunit.h"
#include "absl/strings/escaping.h"
TEST(BigEndian, Load32) {
const char value[] = "000000c8";
EXPECT_EQ(static_cast<uint32_t>(0xC8),
widevine::BigEndian::Load32(
absl::HexStringToBytes(std::string(value)).data()));
}
namespace widevine {} // namespace widevine