DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
encryptor.h
1 // Copyright 2015 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #ifndef MEDIA_FORMATS_WEBM_ENCRYPTOR_H_
8 #define MEDIA_FORMATS_WEBM_ENCRYPTOR_H_
9 
10 #include "packager/base/memory/ref_counted.h"
11 #include "packager/base/memory/scoped_ptr.h"
12 #include "packager/media/base/key_source.h"
13 #include "packager/media/base/status.h"
14 #include "packager/media/base/stream_info.h"
15 #include "packager/media/codecs/vpx_parser.h"
16 #include "packager/media/event/muxer_listener.h"
17 #include "packager/third_party/libwebm/src/mkvmuxer.hpp"
18 
19 namespace shaka {
20 namespace media {
21 
22 class AesCtrEncryptor;
23 class MediaSample;
24 
25 namespace webm {
26 
29 class Encryptor {
30  public:
31  Encryptor();
32  ~Encryptor();
33 
36  Status Initialize(MuxerListener* muxer_listener,
37  KeySource::TrackType track_type,
38  Codec codec,
39  KeySource* key_source,
40  bool webm_subsample_encryption);
41 
45  Status AddTrackInfo(mkvmuxer::Track* track);
46 
50  Status EncryptFrame(scoped_refptr<MediaSample> sample,
51  bool encrypt_frame);
52 
53  private:
54  // Create the encryptor for the internal encryption key.
55  Status CreateEncryptor(MuxerListener* muxer_listener,
56  KeySource::TrackType track_type,
57  Codec codec,
58  KeySource* key_source,
59  bool webm_subsample_encryption);
60 
61  private:
62  scoped_ptr<EncryptionKey> key_;
63  scoped_ptr<AesCtrEncryptor> encryptor_;
64  scoped_ptr<VPxParser> vpx_parser_;
65 };
66 
67 } // namespace webm
68 } // namespace media
69 } // namespace shaka
70 
71 #endif // MEDIA_FORMATS_WEBM_ENCRYPTOR_H_
Status AddTrackInfo(mkvmuxer::Track *track)
Definition: encryptor.cc:71
Status Initialize(MuxerListener *muxer_listener, KeySource::TrackType track_type, Codec codec, KeySource *key_source, bool webm_subsample_encryption)
Definition: encryptor.cc:61
Status EncryptFrame(scoped_refptr< MediaSample > sample, bool encrypt_frame)
Definition: encryptor.cc:76
KeySource is responsible for encryption key acquisition.
Definition: key_source.h:31