DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerator
cenc.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_FORMATS_MP4_CENC_H_
6 #define MEDIA_FORMATS_MP4_CENC_H_
7 
8 #include <stdint.h>
9 
10 #include <vector>
11 
12 #include "packager/media/base/decrypt_config.h"
13 
14 namespace edash_packager {
15 namespace media {
16 
17 class BufferReader;
18 class BufferWriter;
19 
20 namespace mp4 {
21 
23  public:
24  FrameCENCInfo();
25  explicit FrameCENCInfo(const std::vector<uint8_t>& iv);
26  ~FrameCENCInfo();
27 
28  bool Parse(uint8_t iv_size, BufferReader* reader);
29  void Write(BufferWriter* writer) const;
30  size_t ComputeSize() const;
31  size_t GetTotalSizeOfSubsamples() const;
32 
33  void AddSubsample(const SubsampleEntry& subsample) {
34  subsamples_.push_back(subsample);
35  }
36 
37  const std::vector<uint8_t>& iv() const { return iv_; }
38  const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; }
39 
40  private:
41  std::vector<uint8_t> iv_;
42  std::vector<SubsampleEntry> subsamples_;
43 
44  // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
45  // generated copy constructor and assignment operator.
46 };
47 
48 } // namespace mp4
49 } // namespace media
50 } // namespace edash_packager
51 
52 #endif // MEDIA_FORMATS_MP4_CENC_H_