-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
55 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
// Cannot be fully parsed because Per_Sample_IV_Size needs to be known | ||
BoxParser.createFullBoxCtor("senc" /*, function(stream) { | ||
BoxParser.createFullBoxCtor("senc", function(stream) { | ||
this.parseFullHeader(stream); | ||
var sample_count = stream.readUint32(); | ||
this.samples = []; | ||
for (var i = 0; i < sample_count; i++) { | ||
var sample = {}; | ||
// tenc.default_Per_Sample_IV_Size or seig.Per_Sample_IV_Size | ||
sample.InitializationVector = this.readUint8Array(Per_Sample_IV_Size*8); | ||
if (this.flags & 0x2) { | ||
sample.subsamples = []; | ||
subsample_count = stream.readUint16(); | ||
for (var j = 0; j < subsample_count; j++) { | ||
var subsample = {}; | ||
subsample.BytesOfClearData = stream.readUint16(); | ||
subsample.BytesOfProtectedData = stream.readUint32(); | ||
sample.subsamples.push(subsample); | ||
} | ||
} | ||
// TODO | ||
this.samples.push(sample); | ||
} | ||
}*/); | ||
this.data = stream.readUint8Array(this.size - this.hdr_size - 4); | ||
// Cannot be fully parsed because Per_Sample_IV_Size needs to be known | ||
//this.samples = []; | ||
//for (var i = 0; i < sample_count; i++) { | ||
// var sample = {}; | ||
// // tenc.default_Per_Sample_IV_Size or seig.Per_Sample_IV_Size | ||
// sample.InitializationVector = this.readUint8Array(Per_Sample_IV_Size*8); | ||
// if (this.flags & 0x2) { | ||
// sample.subsamples = []; | ||
// subsample_count = stream.readUint16(); | ||
// for (var j = 0; j < subsample_count; j++) { | ||
// var subsample = {}; | ||
// subsample.BytesOfClearData = stream.readUint16(); | ||
// subsample.BytesOfProtectedData = stream.readUint32(); | ||
// sample.subsamples.push(subsample); | ||
// } | ||
// } | ||
// // TODO | ||
// this.samples.push(sample); | ||
//} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
BoxParser.sencBox.prototype.write = function(stream) { | ||
// Calculate the full box size. | ||
this.size = this.hdr_size + this.data.byteLength; | ||
|
||
// Write out the BMFF box header. | ||
stream.writeInt32(this.size); | ||
stream.writeString(this.type, null, 4); | ||
|
||
//// Write out the full box header. | ||
stream.writeUint8(this.version); | ||
stream.writeUint24(this.flags); | ||
|
||
//// Write out the pssh data. | ||
stream.writeUint32(this.data.byteLength); | ||
stream.writeUint8Array(this.data); | ||
} |