Modify protos to support HLS

[ Merge of http://go/wvgerrit/16769 ]

Protos have been updated to match the google3 copy. This introduces
protection scheme to support HLS and MetricData to assist
in reporting. Changes have been made to set or consume data
from appropriate fields.

b/27146600

Change-Id: Ic928a406efb8fbb959b95a77dda6848e839b1948
This commit is contained in:
Rahul Frias
2016-02-11 12:02:22 -08:00
parent 4838979f07
commit 9c82455e8f
3 changed files with 62 additions and 6 deletions

View File

@@ -2,6 +2,7 @@
#include "initialization_data.h"
#include <arpa/inet.h>
#include <string.h>
#include "buffer_reader.h"
@@ -19,6 +20,7 @@ const char kDoubleQuote = '\"';
const char kLeftBracket = '[';
const char kRightBracket = ']';
const std::string kBase64String = "base64,";
const uint32_t kFourCcCbcs = 0x63626373;
// json init data key values
const std::string kProvider = "provider";
@@ -455,12 +457,15 @@ bool InitializationData::ConstructWidevineInitData(
// Now format as Widevine init data protobuf
WidevineCencHeader cenc_header;
// TODO(rfrias): The algorithm is a deprecated field, but proto changes
// have not yet been pushed to production. Set until then.
cenc_header.set_algorithm(WidevineCencHeader_Algorithm_AESCTR);
for (size_t i = 0; i < key_ids.size(); ++i) {
cenc_header.add_key_id(key_ids[i]);
}
cenc_header.set_provider(provider);
cenc_header.set_content_id(content_id);
cenc_header.set_protection_scheme(htonl(kFourCcCbcs));
cenc_header.SerializeToString(init_data_proto);
return true;
}