Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1019)

Unified Diff: media/formats/mp2t/descriptors.cc

Issue 2783703002: Declare intent to use sample-aes later in the stream. (Closed)
Patch Set: tweak needed for flush Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/formats/mp2t/descriptors.h ('k') | media/formats/mp2t/es_parser_adts.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/mp2t/descriptors.cc
diff --git a/media/formats/mp2t/descriptors.cc b/media/formats/mp2t/descriptors.cc
index ecfee57532f3dfac2a26669264fca4df38f28cc4..859ec84d4a9e04739a8f1d8737b9889aaaba6b3b 100644
--- a/media/formats/mp2t/descriptors.cc
+++ b/media/formats/mp2t/descriptors.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "media/base/bit_reader.h"
+#include "media/base/encryption_scheme.h"
#include "media/formats/mp2t/mp2t_common.h"
namespace media {
@@ -24,6 +25,7 @@ enum DescriptorTag {
};
const int kCASystemIdCenc = 0x6365; // 'ce'
+const uint32_t kFourccCbcs = 0x63626373; // 'cbcs'
class StringBitReader : public BitReader {
public:
@@ -110,7 +112,9 @@ bool Descriptors::HasCADescriptor(int* system_id,
return true;
}
-bool Descriptors::HasCADescriptorCenc(int* ca_pid, int* pssh_pid) const {
+bool Descriptors::HasCADescriptorCenc(int* ca_pid,
+ int* pssh_pid,
+ EncryptionScheme* scheme) const {
DCHECK(ca_pid);
DCHECK(pssh_pid);
int system_id;
@@ -125,10 +129,12 @@ bool Descriptors::HasCADescriptorCenc(int* ca_pid, int* pssh_pid) const {
int num_systems;
int encryption_algorithm;
char pssh_system_id[16];
- // TODO(dougsteed). Currently we don't check many of the following values.
+ // TODO(dougsteed). Currently we don't check many of the following values,
+ // and we only support the 'cbcs' scheme (which involves AES-CBC encryption).
// When we flesh out this implementation to cover all of ISO/IEC 23001-9 we
- // will need to use and check these values.
+ // will need to use and check these values more comprehensively.
RCHECK(reader.ReadBits(32, &scheme_type));
+ RCHECK(scheme_type == kFourccCbcs);
RCHECK(reader.ReadBits(32, &scheme_version));
RCHECK(reader.ReadBits(8, &num_systems));
RCHECK(num_systems == 1);
@@ -137,6 +143,10 @@ bool Descriptors::HasCADescriptorCenc(int* ca_pid, int* pssh_pid) const {
RCHECK(reader.ReadBits(8, &pssh_system_id[i]));
}
RCHECK(reader.ReadBits(13, pssh_pid));
+ // The pattern is actually set differently for audio and video, so OK not to
+ // set it here. Important thing is to set the cipher mode.
+ *scheme = EncryptionScheme(EncryptionScheme::CIPHER_MODE_AES_CBC,
+ EncryptionScheme::Pattern());
return true;
}
« no previous file with comments | « media/formats/mp2t/descriptors.h ('k') | media/formats/mp2t/es_parser_adts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698