1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CHROMECAST_MEDIA_CDM_INIT_DATA_H_
6 #define CHROMECAST_MEDIA_CDM_INIT_DATA_H_
7 
8 #include <stdint.h>
9 
10 #include <vector>
11 
12 namespace chromecast {
13 namespace media {
14 
15 enum class InitDataMessageType {
16   UNKNOWN = 0x0,
17   CUSTOM_DATA = 0x1,
18   ENABLE_SECURE_STOP = 0x2,
19   END
20 };
21 
22 // Structured data for EME initialization as parsed from an initData blob.
23 struct ChromecastInitData {
24   ChromecastInitData();
25   ~ChromecastInitData();
26 
27   InitDataMessageType type;
28   std::vector<uint8_t> data;
29 };
30 
31 // Searches for a ChromecastInitData blob inside a CENC |init_data| message of
32 // type |type|. If such a blob is found, returns true and fills
33 // |chromecast_init_data_out|. If not found, returns false.
34 bool FindChromecastInitData(const std::vector<uint8_t>& init_data,
35                             InitDataMessageType type,
36                             ChromecastInitData* chromecast_init_data_out);
37 
38 }  // namespace media
39 }  // namespace chromecast
40 
41 #endif  // CHROMECAST_MEDIA_CDM_INIT_DATA_H_
42