Skip to content

Commit

Permalink
Add support for prft box (Producer Reference Time)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbert committed Jan 3, 2023
1 parent 7dd4434 commit ee70408
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/processors/prft.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// ISO/IEC 14496-12:2012 - 8.16.5 Producer Reference Time
ISOBox.prototype._boxProcessors['prft'] = function() {
this._procFullBox();
this._procField('reference_track_ID', 'uint', 32);
this._procField('ntp_timestamp', 'uint', 64);
this._procField('media_time', 'uint', (this.version == 1) ? 64 : 32);
};
Binary file added test/fixtures/dash-chunks-prft.m4s
Binary file not shown.
12 changes: 12 additions & 0 deletions test/spec/boxes_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,4 +334,16 @@ describe('Text samples', function() {
expect(boxes[0].entries[0].location).toEqual('');
});
});

describe('prft box', function() {
it('should correctly parse the box from sample data', function() {
var parsedFile = loadParsedFixture('./test/fixtures/dash-chunks-prft.m4s');
var boxes = parsedFile.fetchAll('prft');
expect(boxes.length).toEqual(60);
expect(boxes[0].type).toEqual('prft');
expect(boxes[0].reference_track_ID).toEqual(1);
expect(boxes[0].ntp_timestamp).toEqual(16662305022071450000);
expect(boxes[0].media_time).toEqual(1355974620);
});
});
});

0 comments on commit ee70408

Please sign in to comment.