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/event/muxer_listener.h"
15 #include "packager/third_party/libwebm/src/mkvmuxer.hpp"
16 
17 namespace shaka {
18 namespace media {
19 
20 class AesCtrEncryptor;
21 class MediaSample;
22 
23 namespace webm {
24 
27 class Encryptor {
28  public:
29  Encryptor();
30  ~Encryptor();
31 
34  Status Initialize(MuxerListener* muxer_listener,
35  KeySource::TrackType track_type,
36  KeySource* key_source);
37 
41  Status AddTrackInfo(mkvmuxer::Track* track);
42 
46  Status EncryptFrame(scoped_refptr<MediaSample> sample,
47  bool encrypt_frame);
48 
49  private:
50  // Create the encryptor for the internal encryption key.
51  Status CreateEncryptor(MuxerListener* muxer_listener,
52  KeySource::TrackType track_type,
53  KeySource* key_source);
54 
55  private:
56  scoped_ptr<EncryptionKey> key_;
57  scoped_ptr<AesCtrEncryptor> encryptor_;
58 };
59 
60 } // namespace webm
61 } // namespace media
62 } // namespace shaka
63 
64 #endif // MEDIA_FORMATS_WEBM_ENCRYPTOR_H_
Status AddTrackInfo(mkvmuxer::Track *track)
Definition: encryptor.cc:62
Status EncryptFrame(scoped_refptr< MediaSample > sample, bool encrypt_frame)
Definition: encryptor.cc:67
Status Initialize(MuxerListener *muxer_listener, KeySource::TrackType track_type, KeySource *key_source)
Definition: encryptor.cc:55
KeySource is responsible for encryption key acquisition.
Definition: key_source.h:31