DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs
webm_content_encodings.h
1 // Copyright 2014 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_WEBM_WEBM_CONTENT_ENCODINGS_H_
6 #define MEDIA_FORMATS_WEBM_WEBM_CONTENT_ENCODINGS_H_
7 
8 #include <stdint.h>
9 #include <string>
10 
11 #include "packager/base/memory/scoped_ptr.h"
12 
13 namespace edash_packager {
14 namespace media {
15 
17  public:
18  // The following enum definitions are based on the ContentEncoding element
19  // specified in the Matroska spec.
20 
21  static const int kOrderInvalid = -1;
22 
23  enum Scope {
24  kScopeInvalid = 0,
25  kScopeAllFrameContents = 1,
26  kScopeTrackPrivateData = 2,
27  kScopeNextContentEncodingData = 4,
28  kScopeMax = 7,
29  };
30 
31  enum Type {
32  kTypeInvalid = -1,
33  kTypeCompression = 0,
34  kTypeEncryption = 1,
35  };
36 
37  enum EncryptionAlgo {
38  kEncAlgoInvalid = -1,
39  kEncAlgoNotEncrypted = 0,
40  kEncAlgoDes = 1,
41  kEncAlgo3des = 2,
42  kEncAlgoTwofish = 3,
43  kEncAlgoBlowfish = 4,
44  kEncAlgoAes = 5,
45  };
46 
47  enum CipherMode {
48  kCipherModeInvalid = 0,
49  kCipherModeCtr = 1,
50  };
51 
53  ~ContentEncoding();
54 
55  int64_t order() const { return order_; }
56  void set_order(int64_t order) { order_ = order; }
57 
58  Scope scope() const { return scope_; }
59  void set_scope(Scope scope) { scope_ = scope; }
60 
61  Type type() const { return type_; }
62  void set_type(Type type) { type_ = type; }
63 
64  EncryptionAlgo encryption_algo() const { return encryption_algo_; }
65  void set_encryption_algo(EncryptionAlgo encryption_algo) {
66  encryption_algo_ = encryption_algo;
67  }
68 
69  const std::string& encryption_key_id() const { return encryption_key_id_; }
70  void SetEncryptionKeyId(const uint8_t* encryption_key_id, int size);
71 
72  CipherMode cipher_mode() const { return cipher_mode_; }
73  void set_cipher_mode(CipherMode mode) { cipher_mode_ = mode; }
74 
75  private:
76  int64_t order_;
77  Scope scope_;
78  Type type_;
79  EncryptionAlgo encryption_algo_;
80  std::string encryption_key_id_;
81  CipherMode cipher_mode_;
82 
83  DISALLOW_COPY_AND_ASSIGN(ContentEncoding);
84 };
85 
86 } // namespace media
87 } // namespace edash_packager
88 
89 #endif // MEDIA_FORMATS_WEBM_WEBM_CONTENT_ENCODINGS_H_