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

Side by Side Diff: media/formats/mp4/box_definitions.cc

Issue 1998333002: MP4 support for Common Encryption 'cbcs' scheme. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ddorwin more detailed comments Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/mp4/box_definitions.h" 5 #include "media/formats/mp4/box_definitions.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "media/base/media_switches.h" 13 #include "media/base/media_switches.h"
14 #include "media/base/video_types.h" 14 #include "media/base/video_types.h"
15 #include "media/base/video_util.h" 15 #include "media/base/video_util.h"
16 #include "media/filters/h264_parser.h" 16 #include "media/filters/h264_parser.h"
17 #include "media/formats/mp4/avc.h" 17 #include "media/formats/mp4/avc.h"
18 #include "media/formats/mp4/es_descriptor.h" 18 #include "media/formats/mp4/es_descriptor.h"
19 #include "media/formats/mp4/rcheck.h" 19 #include "media/formats/mp4/rcheck.h"
20 #include "media/media_features.h" 20 #include "media/media_features.h"
21 21
22 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) 22 #if BUILDFLAG(ENABLE_HEVC_DEMUXING)
23 #include "media/formats/mp4/hevc.h" 23 #include "media/formats/mp4/hevc.h"
24 #endif 24 #endif
25 25
26 namespace media { 26 namespace media {
27 namespace mp4 { 27 namespace mp4 {
28 28
29 namespace {
30
31 const size_t kKeyIdSize = 16;
32
33 } // namespace
34
29 FileType::FileType() {} 35 FileType::FileType() {}
30 FileType::FileType(const FileType& other) = default; 36 FileType::FileType(const FileType& other) = default;
31 FileType::~FileType() {} 37 FileType::~FileType() {}
32 FourCC FileType::BoxType() const { return FOURCC_FTYP; } 38 FourCC FileType::BoxType() const { return FOURCC_FTYP; }
33 39
34 bool FileType::Parse(BoxReader* reader) { 40 bool FileType::Parse(BoxReader* reader) {
35 RCHECK(reader->ReadFourCC(&major_brand) && reader->Read4(&minor_version)); 41 RCHECK(reader->ReadFourCC(&major_brand) && reader->Read4(&minor_version));
36 size_t num_brands = (reader->size() - reader->pos()) / sizeof(FourCC); 42 size_t num_brands = (reader->size() - reader->pos()) / sizeof(FourCC);
37 return reader->SkipBytes(sizeof(FourCC) * num_brands); // compatible_brands 43 return reader->SkipBytes(sizeof(FourCC) * num_brands); // compatible_brands
38 } 44 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 159
154 SampleEncryptionEntry::SampleEncryptionEntry() {} 160 SampleEncryptionEntry::SampleEncryptionEntry() {}
155 SampleEncryptionEntry::SampleEncryptionEntry( 161 SampleEncryptionEntry::SampleEncryptionEntry(
156 const SampleEncryptionEntry& other) = default; 162 const SampleEncryptionEntry& other) = default;
157 SampleEncryptionEntry::~SampleEncryptionEntry() {} 163 SampleEncryptionEntry::~SampleEncryptionEntry() {}
158 164
159 bool SampleEncryptionEntry::Parse(BufferReader* reader, 165 bool SampleEncryptionEntry::Parse(BufferReader* reader,
160 uint8_t iv_size, 166 uint8_t iv_size,
161 bool has_subsamples) { 167 bool has_subsamples) {
162 // According to ISO/IEC FDIS 23001-7: CENC spec, IV should be either 168 // According to ISO/IEC FDIS 23001-7: CENC spec, IV should be either
163 // 64-bit (8-byte) or 128-bit (16-byte). 169 // 64-bit (8-byte) or 128-bit (16-byte). The 3rd Edition allows |iv_size|
164 RCHECK(iv_size == 8 || iv_size == 16); 170 // to be 0, for the case of a "constant IV". In this case, the existence of
171 // the constant IV must be ensured by the caller.
172 RCHECK(iv_size == 0 || iv_size == 8 || iv_size == 16);
165 173
166 memset(initialization_vector, 0, sizeof(initialization_vector)); 174 memset(initialization_vector, 0, sizeof(initialization_vector));
167 for (uint8_t i = 0; i < iv_size; i++) 175 for (uint8_t i = 0; i < iv_size; i++)
168 RCHECK(reader->Read1(initialization_vector + i)); 176 RCHECK(reader->Read1(initialization_vector + i));
169 177
170 if (!has_subsamples) { 178 if (!has_subsamples) {
171 subsamples.clear(); 179 subsamples.clear();
172 return true; 180 return true;
173 } 181 }
174 182
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 FourCC SchemeType::BoxType() const { return FOURCC_SCHM; } 236 FourCC SchemeType::BoxType() const { return FOURCC_SCHM; }
229 237
230 bool SchemeType::Parse(BoxReader* reader) { 238 bool SchemeType::Parse(BoxReader* reader) {
231 RCHECK(reader->ReadFullBoxHeader() && 239 RCHECK(reader->ReadFullBoxHeader() &&
232 reader->ReadFourCC(&type) && 240 reader->ReadFourCC(&type) &&
233 reader->Read4(&version)); 241 reader->Read4(&version));
234 return true; 242 return true;
235 } 243 }
236 244
237 TrackEncryption::TrackEncryption() 245 TrackEncryption::TrackEncryption()
238 : is_encrypted(false), default_iv_size(0) { 246 : is_encrypted(false),
247 default_iv_size(0)
248 #if BUILDFLAG(ENABLE_CBCS_ENCRYPTION_SCHEME)
249 ,
250 default_crypt_byte_block(0),
251 default_skip_byte_block(0),
252 default_constant_iv_size(0)
253 #endif
254 {
239 } 255 }
240 TrackEncryption::TrackEncryption(const TrackEncryption& other) = default; 256 TrackEncryption::TrackEncryption(const TrackEncryption& other) = default;
241 TrackEncryption::~TrackEncryption() {} 257 TrackEncryption::~TrackEncryption() {}
242 FourCC TrackEncryption::BoxType() const { return FOURCC_TENC; } 258 FourCC TrackEncryption::BoxType() const { return FOURCC_TENC; }
243 259
244 bool TrackEncryption::Parse(BoxReader* reader) { 260 bool TrackEncryption::Parse(BoxReader* reader) {
245 uint8_t flag; 261 uint8_t flag;
246 RCHECK(reader->ReadFullBoxHeader() && 262 uint8_t possible_pattern_info;
247 reader->SkipBytes(2) && 263 RCHECK(reader->ReadFullBoxHeader() && reader->SkipBytes(1) &&
248 reader->Read1(&flag) && 264 reader->Read1(&possible_pattern_info) && reader->Read1(&flag) &&
249 reader->Read1(&default_iv_size) && 265 reader->Read1(&default_iv_size) &&
250 reader->ReadVec(&default_kid, 16)); 266 reader->ReadVec(&default_kid, kKeyIdSize));
251 is_encrypted = (flag != 0); 267 is_encrypted = (flag != 0);
252 if (is_encrypted) { 268 if (is_encrypted) {
253 RCHECK(default_iv_size == 8 || default_iv_size == 16); 269 #if BUILDFLAG(ENABLE_CBCS_ENCRYPTION_SCHEME)
270 if (reader->version() > 0) {
271 default_crypt_byte_block = (possible_pattern_info >> 4) & 0x0f;
272 default_skip_byte_block = possible_pattern_info & 0x0f;
273 }
274 if (default_iv_size == 0) {
275 RCHECK(reader->Read1(&default_constant_iv_size) &&
276 (default_constant_iv_size == 8 || default_constant_iv_size == 16));
kqyang 2016/10/12 22:16:52 nit: prefer a separate RCHECK for this line Same
dougsteed 2016/10/14 21:24:35 Done.
277 memset(default_constant_iv, 0, sizeof(default_constant_iv));
278 for (uint8_t i = 0; i < default_constant_iv_size; i++)
279 RCHECK(reader->Read1(default_constant_iv + i));
280 } else
281 #endif
282 RCHECK(default_iv_size == 8 || default_iv_size == 16);
kqyang 2016/10/12 22:16:52 Prefer duplicate this line in #if block, something
dougsteed 2016/10/14 21:24:35 Done.
254 } else { 283 } else {
255 RCHECK(default_iv_size == 0); 284 RCHECK(default_iv_size == 0);
256 } 285 }
257 return true; 286 return true;
258 } 287 }
259 288
260 SchemeInfo::SchemeInfo() {} 289 SchemeInfo::SchemeInfo() {}
261 SchemeInfo::SchemeInfo(const SchemeInfo& other) = default; 290 SchemeInfo::SchemeInfo(const SchemeInfo& other) = default;
262 SchemeInfo::~SchemeInfo() {} 291 SchemeInfo::~SchemeInfo() {}
263 FourCC SchemeInfo::BoxType() const { return FOURCC_SCHI; } 292 FourCC SchemeInfo::BoxType() const { return FOURCC_SCHI; }
264 293
265 bool SchemeInfo::Parse(BoxReader* reader) { 294 bool SchemeInfo::Parse(BoxReader* reader) {
266 return reader->ScanChildren() && reader->ReadChild(&track_encryption); 295 return reader->ScanChildren() && reader->ReadChild(&track_encryption);
267 } 296 }
268 297
269 ProtectionSchemeInfo::ProtectionSchemeInfo() {} 298 ProtectionSchemeInfo::ProtectionSchemeInfo() {}
270 ProtectionSchemeInfo::ProtectionSchemeInfo(const ProtectionSchemeInfo& other) = 299 ProtectionSchemeInfo::ProtectionSchemeInfo(const ProtectionSchemeInfo& other) =
271 default; 300 default;
272 ProtectionSchemeInfo::~ProtectionSchemeInfo() {} 301 ProtectionSchemeInfo::~ProtectionSchemeInfo() {}
273 FourCC ProtectionSchemeInfo::BoxType() const { return FOURCC_SINF; } 302 FourCC ProtectionSchemeInfo::BoxType() const { return FOURCC_SINF; }
274 303
275 bool ProtectionSchemeInfo::Parse(BoxReader* reader) { 304 bool ProtectionSchemeInfo::Parse(BoxReader* reader) {
276 RCHECK(reader->ScanChildren() && 305 RCHECK(reader->ScanChildren() &&
277 reader->ReadChild(&format) && 306 reader->ReadChild(&format) &&
278 reader->ReadChild(&type)); 307 reader->ReadChild(&type));
279 if (type.type == FOURCC_CENC) 308 if (HasSupportedScheme())
280 RCHECK(reader->ReadChild(&info)); 309 RCHECK(reader->ReadChild(&info));
281 // Other protection schemes are silently ignored. Since the protection scheme 310 // Other protection schemes are silently ignored. Since the protection scheme
282 // type can't be determined until this box is opened, we return 'true' for 311 // type can't be determined until this box is opened, we return 'true' for
283 // non-CENC protection scheme types. It is the parent box's responsibility to 312 // non-CENC protection scheme types. It is the parent box's responsibility to
284 // ensure that this scheme type is a supported one. 313 // ensure that this scheme type is a supported one.
285 return true; 314 return true;
286 } 315 }
287 316
317 bool ProtectionSchemeInfo::HasSupportedScheme() const {
318 FourCC fourCC = type.type;
319 if (fourCC == FOURCC_CENC)
320 return true;
321 #if BUILDFLAG(ENABLE_CBCS_ENCRYPTION_SCHEME)
322 if (fourCC == FOURCC_CBCS)
323 return true;
324 #endif
325 return false;
326 }
327
288 MovieHeader::MovieHeader() 328 MovieHeader::MovieHeader()
289 : version(0), 329 : version(0),
290 creation_time(0), 330 creation_time(0),
291 modification_time(0), 331 modification_time(0),
292 timescale(0), 332 timescale(0),
293 duration(0), 333 duration(0),
294 rate(-1), 334 rate(-1),
295 volume(-1), 335 volume(-1),
296 next_track_id(0) {} 336 next_track_id(0) {}
297 MovieHeader::MovieHeader(const MovieHeader& other) = default; 337 MovieHeader::MovieHeader(const MovieHeader& other) = default;
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 reader->Read2(&width) && 685 reader->Read2(&width) &&
646 reader->Read2(&height) && 686 reader->Read2(&height) &&
647 reader->SkipBytes(50)); 687 reader->SkipBytes(50));
648 688
649 RCHECK(reader->ScanChildren() && 689 RCHECK(reader->ScanChildren() &&
650 reader->MaybeReadChild(&pixel_aspect)); 690 reader->MaybeReadChild(&pixel_aspect));
651 691
652 if (format == FOURCC_ENCV) { 692 if (format == FOURCC_ENCV) {
653 // Continue scanning until a recognized protection scheme is found, or until 693 // Continue scanning until a recognized protection scheme is found, or until
654 // we run out of protection schemes. 694 // we run out of protection schemes.
655 while (sinf.type.type != FOURCC_CENC) { 695 while (!sinf.HasSupportedScheme()) {
656 if (!reader->ReadChild(&sinf)) 696 if (!reader->ReadChild(&sinf))
657 return false; 697 return false;
658 } 698 }
659 } 699 }
660 700
661 const FourCC actual_format = 701 const FourCC actual_format =
662 format == FOURCC_ENCV ? sinf.format.format : format; 702 format == FOURCC_ENCV ? sinf.format.format : format;
663 switch (actual_format) { 703 switch (actual_format) {
664 case FOURCC_AVC1: 704 case FOURCC_AVC1:
665 case FOURCC_AVC3: { 705 case FOURCC_AVC3: {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 reader->Read2(&samplesize) && 835 reader->Read2(&samplesize) &&
796 reader->SkipBytes(4) && 836 reader->SkipBytes(4) &&
797 reader->Read4(&samplerate)); 837 reader->Read4(&samplerate));
798 // Convert from 16.16 fixed point to integer 838 // Convert from 16.16 fixed point to integer
799 samplerate >>= 16; 839 samplerate >>= 16;
800 840
801 RCHECK(reader->ScanChildren()); 841 RCHECK(reader->ScanChildren());
802 if (format == FOURCC_ENCA) { 842 if (format == FOURCC_ENCA) {
803 // Continue scanning until a recognized protection scheme is found, or until 843 // Continue scanning until a recognized protection scheme is found, or until
804 // we run out of protection schemes. 844 // we run out of protection schemes.
805 while (sinf.type.type != FOURCC_CENC) { 845 while (!sinf.HasSupportedScheme()) {
806 if (!reader->ReadChild(&sinf)) 846 if (!reader->ReadChild(&sinf))
807 return false; 847 return false;
808 } 848 }
809 } 849 }
810 850
811 // ESDS is not valid in case of EAC3. 851 // ESDS is not valid in case of EAC3.
812 RCHECK(reader->MaybeReadChild(&esds)); 852 RCHECK(reader->MaybeReadChild(&esds));
813 return true; 853 return true;
814 } 854 }
815 855
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 RCHECK(reader->Read4(&count)); 1175 RCHECK(reader->Read4(&count));
1136 entries.resize(count); 1176 entries.resize(count);
1137 for (uint32_t i = 0; i < count; ++i) { 1177 for (uint32_t i = 0; i < count; ++i) {
1138 RCHECK(reader->Read4(&entries[i].sample_count) && 1178 RCHECK(reader->Read4(&entries[i].sample_count) &&
1139 reader->Read4(&entries[i].group_description_index)); 1179 reader->Read4(&entries[i].group_description_index));
1140 } 1180 }
1141 return true; 1181 return true;
1142 } 1182 }
1143 1183
1144 CencSampleEncryptionInfoEntry::CencSampleEncryptionInfoEntry() 1184 CencSampleEncryptionInfoEntry::CencSampleEncryptionInfoEntry()
1145 : is_encrypted(false), iv_size(0) {} 1185 : is_encrypted(false),
1186 iv_size(0)
1187 #if BUILDFLAG(ENABLE_CBCS_ENCRYPTION_SCHEME)
1188 ,
1189 crypt_byte_block(0),
1190 skip_byte_block(0),
1191 constant_iv_size(0)
1192 #endif
1193 {
1194 }
1146 CencSampleEncryptionInfoEntry::CencSampleEncryptionInfoEntry( 1195 CencSampleEncryptionInfoEntry::CencSampleEncryptionInfoEntry(
1147 const CencSampleEncryptionInfoEntry& other) = default; 1196 const CencSampleEncryptionInfoEntry& other) = default;
1148 CencSampleEncryptionInfoEntry::~CencSampleEncryptionInfoEntry() {} 1197 CencSampleEncryptionInfoEntry::~CencSampleEncryptionInfoEntry() {}
1149 1198
1199 bool CencSampleEncryptionInfoEntry::Parse(BoxReader* reader) {
1200 uint8_t flag;
1201 uint8_t possible_pattern_info;
1202 RCHECK(reader->SkipBytes(1) && // reserved.
1203 reader->Read1(&possible_pattern_info) && reader->Read1(&flag) &&
1204 reader->Read1(&iv_size) && reader->ReadVec(&key_id, kKeyIdSize));
1205
1206 is_encrypted = (flag != 0);
1207 if (is_encrypted) {
1208 #if BUILDFLAG(ENABLE_CBCS_ENCRYPTION_SCHEME)
1209 crypt_byte_block = (possible_pattern_info >> 4) & 0x0f;
1210 skip_byte_block = possible_pattern_info & 0x0f;
1211 if (iv_size == 0) {
1212 RCHECK(reader->Read1(&constant_iv_size) &&
1213 (constant_iv_size == 8 || constant_iv_size == 16));
1214 memset(constant_iv, 0, sizeof(constant_iv));
1215 for (uint8_t i = 0; i < constant_iv_size; i++)
1216 RCHECK(reader->Read1(constant_iv + i));
1217 } else
1218 #endif
1219 RCHECK(iv_size == 8 || iv_size == 16);
1220 } else {
1221 RCHECK(iv_size == 0);
1222 }
1223 return true;
1224 }
1225
1150 SampleGroupDescription::SampleGroupDescription() : grouping_type(0) {} 1226 SampleGroupDescription::SampleGroupDescription() : grouping_type(0) {}
1151 SampleGroupDescription::SampleGroupDescription( 1227 SampleGroupDescription::SampleGroupDescription(
1152 const SampleGroupDescription& other) = default; 1228 const SampleGroupDescription& other) = default;
1153 SampleGroupDescription::~SampleGroupDescription() {} 1229 SampleGroupDescription::~SampleGroupDescription() {}
1154 FourCC SampleGroupDescription::BoxType() const { return FOURCC_SGPD; } 1230 FourCC SampleGroupDescription::BoxType() const { return FOURCC_SGPD; }
1155 1231
1156 bool SampleGroupDescription::Parse(BoxReader* reader) { 1232 bool SampleGroupDescription::Parse(BoxReader* reader) {
1157 RCHECK(reader->ReadFullBoxHeader() && 1233 RCHECK(reader->ReadFullBoxHeader() &&
1158 reader->Read4(&grouping_type)); 1234 reader->Read4(&grouping_type));
1159 1235
1160 if (grouping_type != FOURCC_SEIG) { 1236 if (grouping_type != FOURCC_SEIG) {
1161 DLOG(WARNING) << "SampleGroupDescription box with grouping_type '" 1237 DLOG(WARNING) << "SampleGroupDescription box with grouping_type '"
1162 << grouping_type << "' is not supported."; 1238 << grouping_type << "' is not supported.";
1163 return true; 1239 return true;
1164 } 1240 }
1165 1241
1166 const uint8_t version = reader->version(); 1242 const uint8_t version = reader->version();
1167 1243
1168 const size_t kKeyIdSize = 16;
1169 const size_t kEntrySize = sizeof(uint32_t) + kKeyIdSize; 1244 const size_t kEntrySize = sizeof(uint32_t) + kKeyIdSize;
1170 uint32_t default_length = 0; 1245 uint32_t default_length = 0;
1171 if (version == 1) { 1246 if (version == 1) {
1172 RCHECK(reader->Read4(&default_length)); 1247 RCHECK(reader->Read4(&default_length));
1173 RCHECK(default_length == 0 || default_length >= kEntrySize); 1248 RCHECK(default_length == 0 || default_length >= kEntrySize);
1174 } 1249 }
1175 1250
1176 uint32_t count; 1251 uint32_t count;
1177 RCHECK(reader->Read4(&count)); 1252 RCHECK(reader->Read4(&count));
1178 entries.resize(count); 1253 entries.resize(count);
1179 for (uint32_t i = 0; i < count; ++i) { 1254 for (uint32_t i = 0; i < count; ++i) {
1180 if (version == 1) { 1255 if (version == 1) {
1181 if (default_length == 0) { 1256 if (default_length == 0) {
1182 uint32_t description_length = 0; 1257 uint32_t description_length = 0;
1183 RCHECK(reader->Read4(&description_length)); 1258 RCHECK(reader->Read4(&description_length));
1184 RCHECK(description_length >= kEntrySize); 1259 RCHECK(description_length >= kEntrySize);
1185 } 1260 }
1186 } 1261 }
1187 1262 RCHECK(entries[i].Parse(reader));
1188 uint8_t flag;
1189 RCHECK(reader->SkipBytes(2) && // reserved.
1190 reader->Read1(&flag) &&
1191 reader->Read1(&entries[i].iv_size) &&
1192 reader->ReadVec(&entries[i].key_id, kKeyIdSize));
1193
1194 entries[i].is_encrypted = (flag != 0);
1195 if (entries[i].is_encrypted) {
1196 RCHECK(entries[i].iv_size == 8 || entries[i].iv_size == 16);
1197 } else {
1198 RCHECK(entries[i].iv_size == 0);
1199 }
1200 } 1263 }
1201 return true; 1264 return true;
1202 } 1265 }
1203 1266
1204 TrackFragment::TrackFragment() {} 1267 TrackFragment::TrackFragment() {}
1205 TrackFragment::TrackFragment(const TrackFragment& other) = default; 1268 TrackFragment::TrackFragment(const TrackFragment& other) = default;
1206 TrackFragment::~TrackFragment() {} 1269 TrackFragment::~TrackFragment() {}
1207 FourCC TrackFragment::BoxType() const { return FOURCC_TRAF; } 1270 FourCC TrackFragment::BoxType() const { return FOURCC_TRAF; }
1208 1271
1209 bool TrackFragment::Parse(BoxReader* reader) { 1272 bool TrackFragment::Parse(BoxReader* reader) {
1210 RCHECK(reader->ScanChildren() && 1273 RCHECK(reader->ScanChildren() && reader->ReadChild(&header) &&
1211 reader->ReadChild(&header) &&
1212 // Media Source specific: 'tfdt' required 1274 // Media Source specific: 'tfdt' required
1213 reader->ReadChild(&decode_time) && 1275 reader->ReadChild(&decode_time) && reader->MaybeReadChildren(&runs) &&
1214 reader->MaybeReadChildren(&runs) &&
1215 reader->MaybeReadChild(&auxiliary_offset) && 1276 reader->MaybeReadChild(&auxiliary_offset) &&
1216 reader->MaybeReadChild(&auxiliary_size) && 1277 reader->MaybeReadChild(&auxiliary_size) &&
1217 reader->MaybeReadChild(&sdtp)); 1278 reader->MaybeReadChild(&sdtp) &&
1279 reader->MaybeReadChild(&sample_encryption));
1218 1280
1219 // There could be multiple SampleGroupDescription and SampleToGroup boxes with 1281 // There could be multiple SampleGroupDescription and SampleToGroup boxes with
1220 // different grouping types. For common encryption, the relevant grouping type 1282 // different grouping types. For common encryption, the relevant grouping type
1221 // is 'seig'. Continue reading until 'seig' is found, or until running out of 1283 // is 'seig'. Continue reading until 'seig' is found, or until running out of
1222 // child boxes. 1284 // child boxes.
1223 while (reader->HasChild(&sample_group_description)) { 1285 while (reader->HasChild(&sample_group_description)) {
1224 RCHECK(reader->ReadChild(&sample_group_description)); 1286 RCHECK(reader->ReadChild(&sample_group_description));
1225 if (sample_group_description.grouping_type == FOURCC_SEIG) 1287 if (sample_group_description.grouping_type == FOURCC_SEIG)
1226 break; 1288 break;
1227 sample_group_description.entries.clear(); 1289 sample_group_description.entries.clear();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 SampleDependsOn IndependentAndDisposableSamples::sample_depends_on( 1339 SampleDependsOn IndependentAndDisposableSamples::sample_depends_on(
1278 size_t i) const { 1340 size_t i) const {
1279 if (i >= sample_depends_on_.size()) 1341 if (i >= sample_depends_on_.size())
1280 return kSampleDependsOnUnknown; 1342 return kSampleDependsOnUnknown;
1281 1343
1282 return sample_depends_on_[i]; 1344 return sample_depends_on_[i];
1283 } 1345 }
1284 1346
1285 } // namespace mp4 1347 } // namespace mp4
1286 } // namespace media 1348 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698