2015-10-08 21:48:07 +00:00
|
|
|
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef MEDIA_FORMATS_WEBM_WEBM_CONTENT_ENCODINGS_H_
|
|
|
|
#define MEDIA_FORMATS_WEBM_WEBM_CONTENT_ENCODINGS_H_
|
|
|
|
|
2015-10-14 22:46:23 +00:00
|
|
|
#include <stdint.h>
|
2016-08-17 17:41:40 +00:00
|
|
|
#include <memory>
|
2015-10-08 21:48:07 +00:00
|
|
|
#include <string>
|
|
|
|
|
2016-05-20 21:19:33 +00:00
|
|
|
namespace shaka {
|
2015-10-08 21:48:07 +00:00
|
|
|
namespace media {
|
|
|
|
|
2015-10-14 22:46:23 +00:00
|
|
|
class ContentEncoding {
|
2015-10-08 21:48:07 +00:00
|
|
|
public:
|
2015-10-15 22:39:16 +00:00
|
|
|
/// The following enum definitions are based on the ContentEncoding element
|
|
|
|
/// specified in the Matroska spec.
|
2015-10-08 21:48:07 +00:00
|
|
|
|
|
|
|
static const int kOrderInvalid = -1;
|
|
|
|
|
|
|
|
enum Scope {
|
|
|
|
kScopeInvalid = 0,
|
|
|
|
kScopeAllFrameContents = 1,
|
|
|
|
kScopeTrackPrivateData = 2,
|
|
|
|
kScopeNextContentEncodingData = 4,
|
|
|
|
kScopeMax = 7,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Type {
|
|
|
|
kTypeInvalid = -1,
|
|
|
|
kTypeCompression = 0,
|
|
|
|
kTypeEncryption = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum EncryptionAlgo {
|
|
|
|
kEncAlgoInvalid = -1,
|
|
|
|
kEncAlgoNotEncrypted = 0,
|
|
|
|
kEncAlgoDes = 1,
|
|
|
|
kEncAlgo3des = 2,
|
|
|
|
kEncAlgoTwofish = 3,
|
|
|
|
kEncAlgoBlowfish = 4,
|
|
|
|
kEncAlgoAes = 5,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum CipherMode {
|
|
|
|
kCipherModeInvalid = 0,
|
|
|
|
kCipherModeCtr = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
ContentEncoding();
|
|
|
|
~ContentEncoding();
|
|
|
|
|
2015-10-14 22:46:23 +00:00
|
|
|
int64_t order() const { return order_; }
|
|
|
|
void set_order(int64_t order) { order_ = order; }
|
2015-10-08 21:48:07 +00:00
|
|
|
|
|
|
|
Scope scope() const { return scope_; }
|
|
|
|
void set_scope(Scope scope) { scope_ = scope; }
|
|
|
|
|
|
|
|
Type type() const { return type_; }
|
|
|
|
void set_type(Type type) { type_ = type; }
|
|
|
|
|
|
|
|
EncryptionAlgo encryption_algo() const { return encryption_algo_; }
|
|
|
|
void set_encryption_algo(EncryptionAlgo encryption_algo) {
|
|
|
|
encryption_algo_ = encryption_algo;
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::string& encryption_key_id() const { return encryption_key_id_; }
|
2015-10-14 22:46:23 +00:00
|
|
|
void SetEncryptionKeyId(const uint8_t* encryption_key_id, int size);
|
2015-10-08 21:48:07 +00:00
|
|
|
|
|
|
|
CipherMode cipher_mode() const { return cipher_mode_; }
|
|
|
|
void set_cipher_mode(CipherMode mode) { cipher_mode_ = mode; }
|
|
|
|
|
|
|
|
private:
|
2017-04-28 23:29:02 +00:00
|
|
|
ContentEncoding(const ContentEncoding&) = delete;
|
|
|
|
ContentEncoding& operator=(const ContentEncoding&) = delete;
|
|
|
|
|
2015-10-14 22:46:23 +00:00
|
|
|
int64_t order_;
|
2015-10-08 21:48:07 +00:00
|
|
|
Scope scope_;
|
|
|
|
Type type_;
|
|
|
|
EncryptionAlgo encryption_algo_;
|
|
|
|
std::string encryption_key_id_;
|
|
|
|
CipherMode cipher_mode_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace media
|
2016-05-20 21:19:33 +00:00
|
|
|
} // namespace shaka
|
2015-10-08 21:48:07 +00:00
|
|
|
|
|
|
|
#endif // MEDIA_FORMATS_WEBM_WEBM_CONTENT_ENCODINGS_H_
|