DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerator
decrypt_config.h
1 // Copyright (c) 2012 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 MEDIA_BASE_DECRYPT_CONFIG_H_
6 #define MEDIA_BASE_DECRYPT_CONFIG_H_
7 
8 #include <stdint.h>
9 
10 #include <string>
11 #include <vector>
12 
13 #include "packager/base/memory/scoped_ptr.h"
14 #include "packager/media/base/fourccs.h"
15 
16 namespace edash_packager {
17 namespace media {
18 
30  : clear_bytes(0), cipher_bytes(0) {}
31  SubsampleEntry(uint16_t clear_bytes, uint32_t cipher_bytes)
32  : clear_bytes(clear_bytes), cipher_bytes(cipher_bytes) {}
33 
34  uint16_t clear_bytes;
35  uint32_t cipher_bytes;
36 };
37 
41  public:
43  static const size_t kDecryptionKeySize = 16;
44 
51  DecryptConfig(const std::vector<uint8_t>& key_id,
52  const std::vector<uint8_t>& iv,
53  const std::vector<SubsampleEntry>& subsamples);
54 
63  DecryptConfig(const std::vector<uint8_t>& key_id,
64  const std::vector<uint8_t>& iv,
65  const std::vector<SubsampleEntry>& subsamples,
66  FourCC protection_scheme);
67 
68  ~DecryptConfig();
69 
70  const std::vector<uint8_t>& key_id() const { return key_id_; }
71  const std::vector<uint8_t>& iv() const { return iv_; }
72  const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; }
73  FourCC protection_scheme() const { return protection_scheme_; }
74 
75  private:
76  const std::vector<uint8_t> key_id_;
77 
78  // Initialization vector.
79  const std::vector<uint8_t> iv_;
80 
81  // Subsample information. May be empty for some formats, meaning entire frame
82  // (less data ignored by data_offset_) is encrypted.
83  const std::vector<SubsampleEntry> subsamples_;
84 
85  const FourCC protection_scheme_;
86 
87  DISALLOW_COPY_AND_ASSIGN(DecryptConfig);
88 };
89 
90 } // namespace media
91 } // namespace edash_packager
92 
93 #endif // MEDIA_BASE_DECRYPT_CONFIG_H_
static const size_t kDecryptionKeySize
Keys are always 128 bits.
DecryptConfig(const std::vector< uint8_t > &key_id, const std::vector< uint8_t > &iv, const std::vector< SubsampleEntry > &subsamples)