Skip to content

Commit

Permalink
Merge pull request sannies#85 from aldenml/encryption-box-fix
Browse files Browse the repository at this point in the history
Fixed write of entries count in AbstractSampleEncryptionBox. 
(your input file must be a bit broken - but this fixed doesn't hurt at all - thx)
  • Loading branch information
sannies committed Jun 18, 2015
2 parents 99f2882 + 584265b commit d6bd850
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ protected void getContent(ByteBuffer byteBuffer) {
IsoTypeWriter.writeUInt8(byteBuffer, ivSize);
byteBuffer.put(kid);
}
IsoTypeWriter.writeUInt32(byteBuffer, entries.size());
IsoTypeWriter.writeUInt32(byteBuffer, getNonEmptyEntriesNum());
for (CencSampleAuxiliaryDataFormat entry : entries) {
if (entry.getSize() > 0) {
if (entry.iv.length != 8 && entry.iv.length != 16) {
Expand All @@ -139,6 +139,17 @@ protected void getContent(ByteBuffer byteBuffer) {
}
}

private int getNonEmptyEntriesNum() {
int n = 0;
for (CencSampleAuxiliaryDataFormat entry : entries) {
if (entry.getSize() > 0) {
n++;
}
}

return n;
}

@Override
protected long getContentSize() {
long contentSize = 4;
Expand Down

0 comments on commit d6bd850

Please sign in to comment.