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

Side by Side Diff: media/formats/mp2t/ts_section_cat.cc

Issue 2783703002: Declare intent to use sample-aes later in the stream. (Closed)
Patch Set: tweak needed for flush Created 3 years, 2 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 unified diff | Download patch
« no previous file with comments | « media/formats/mp2t/ts_section_cat.h ('k') | media/test/data/README » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/formats/mp2t/ts_section_cat.h" 5 #include "media/formats/mp2t/ts_section_cat.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "media/base/bit_reader.h" 10 #include "media/base/bit_reader.h"
11 #include "media/base/encryption_scheme.h"
11 #include "media/formats/mp2t/descriptors.h" 12 #include "media/formats/mp2t/descriptors.h"
12 #include "media/formats/mp2t/mp2t_common.h" 13 #include "media/formats/mp2t/mp2t_common.h"
13 14
14 namespace media { 15 namespace media {
15 namespace mp2t { 16 namespace mp2t {
16 17
17 TsSectionCat::TsSectionCat(const RegisterCencPidsCb& register_cenc_ids_cb) 18 TsSectionCat::TsSectionCat(
18 : register_cenc_ids_cb_(register_cenc_ids_cb), version_number_(-1) {} 19 const RegisterCencPidsCb& register_cenc_ids_cb,
20 const RegisterEncryptionSchemeCb& register_encryption_scheme_cb)
21 : register_cenc_ids_cb_(register_cenc_ids_cb),
22 register_encryption_scheme_cb_(register_encryption_scheme_cb),
23 version_number_(-1) {}
19 24
20 TsSectionCat::~TsSectionCat() {} 25 TsSectionCat::~TsSectionCat() {}
21 26
22 bool TsSectionCat::ParsePsiSection(BitReader* bit_reader) { 27 bool TsSectionCat::ParsePsiSection(BitReader* bit_reader) {
23 DCHECK(bit_reader); 28 DCHECK(bit_reader);
24 // Read the fixed section length. 29 // Read the fixed section length.
25 int table_id; 30 int table_id;
26 int section_syntax_indicator; 31 int section_syntax_indicator;
27 int dummy_zero; 32 int dummy_zero;
28 int reserved; 33 int reserved;
(...skipping 18 matching lines...) Expand all
47 52
48 // Perform a few more verifications, including: 53 // Perform a few more verifications, including:
49 // - Table ID should be 1 for a CAT. 54 // - Table ID should be 1 for a CAT.
50 // - section_syntax_indicator should be one. 55 // - section_syntax_indicator should be one.
51 RCHECK(table_id == 0x1); 56 RCHECK(table_id == 0x1);
52 RCHECK(section_syntax_indicator); 57 RCHECK(section_syntax_indicator);
53 RCHECK(!dummy_zero); 58 RCHECK(!dummy_zero);
54 59
55 Descriptors descriptors; 60 Descriptors descriptors;
56 int ca_pid, pssh_pid; 61 int ca_pid, pssh_pid;
62 EncryptionScheme scheme;
57 RCHECK(descriptors.Read(bit_reader, section_length - 4)); 63 RCHECK(descriptors.Read(bit_reader, section_length - 4));
58 RCHECK(descriptors.HasCADescriptorCenc(&ca_pid, &pssh_pid)); 64 RCHECK(descriptors.HasCADescriptorCenc(&ca_pid, &pssh_pid, &scheme));
59 int crc32; 65 int crc32;
60 RCHECK(bit_reader->ReadBits(32, &crc32)); 66 RCHECK(bit_reader->ReadBits(32, &crc32));
61 67
62 // Just ignore the CAT if not applicable yet. 68 // Just ignore the CAT if not applicable yet.
63 if (!current_next_indicator) { 69 if (!current_next_indicator) {
64 DVLOG(1) << "Not supported: received a CAT not applicable yet"; 70 DVLOG(1) << "Not supported: received a CAT not applicable yet";
65 return true; 71 return true;
66 } 72 }
67 73
68 // Ignore the CAT if it hasn't changed. 74 // Ignore the CAT if it hasn't changed.
69 if (version_number == version_number_) 75 if (version_number == version_number_)
70 return true; 76 return true;
71 77
72 // Can now register the PIDs. 78 // Can now register the PIDs and scheme.
73 register_cenc_ids_cb_.Run(ca_pid, pssh_pid); 79 register_cenc_ids_cb_.Run(ca_pid, pssh_pid);
80 register_encryption_scheme_cb_.Run(scheme);
74 81
75 version_number_ = version_number; 82 version_number_ = version_number;
76 83
77 return true; 84 return true;
78 } 85 }
79 86
80 void TsSectionCat::ResetPsiSection() { 87 void TsSectionCat::ResetPsiSection() {
81 version_number_ = -1; 88 version_number_ = -1;
82 } 89 }
83 90
84 } // namespace mp2t 91 } // namespace mp2t
85 } // namespace media 92 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mp2t/ts_section_cat.h ('k') | media/test/data/README » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698