Skip to content

Commit

Permalink
feat: parse FRAME-RATE as a number (videojs#150)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: parser changes an output type for 'FRAME-RATE'
attribute from a string to a number.
  • Loading branch information
gjanblaszczyk authored and gkatsev committed Aug 2, 2022
1 parent c2dfa4d commit d51e93f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 24 deletions.
3 changes: 3 additions & 0 deletions src/parse-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ export default class ParseStream extends Stream {
if (event.attributes.BANDWIDTH) {
event.attributes.BANDWIDTH = parseInt(event.attributes.BANDWIDTH, 10);
}
if (event.attributes['FRAME-RATE']) {
event.attributes['FRAME-RATE'] = parseFloat(event.attributes['FRAME-RATE']);
}
if (event.attributes['PROGRAM-ID']) {
event.attributes['PROGRAM-ID'] = parseInt(event.attributes['PROGRAM-ID'], 10);
}
Expand Down
48 changes: 24 additions & 24 deletions test/fixtures/integration/master-fmp4.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module.exports = {
width: 960,
height: 540
},
'FRAME-RATE': '59.940',
'FRAME-RATE': 59.940,
'CLOSED-CAPTIONS': 'cc1',
'AUDIO': 'aud1',
'SUBTITLES': 'sub1'
Expand All @@ -76,7 +76,7 @@ module.exports = {
'BANDWIDTH': 7976430,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.64002a,mp4a.40.2',
'FRAME-RATE': '59.940',
'FRAME-RATE': 59.940,
'RESOLUTION': {
height: 1080,
width: 1920
Expand All @@ -93,7 +93,7 @@ module.exports = {
'BANDWIDTH': 6181885,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.64002a,mp4a.40.2',
'FRAME-RATE': '59.940',
'FRAME-RATE': 59.940,
'RESOLUTION': {
height: 1080,
width: 1920
Expand All @@ -110,7 +110,7 @@ module.exports = {
'BANDWIDTH': 4682666,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.64002a,mp4a.40.2',
'FRAME-RATE': '59.940',
'FRAME-RATE': 59.940,
'RESOLUTION': {
height: 1080,
width: 1920
Expand All @@ -127,7 +127,7 @@ module.exports = {
'BANDWIDTH': 3170746,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.640020,mp4a.40.2',
'FRAME-RATE': '59.940',
'FRAME-RATE': 59.940,
'RESOLUTION': {
height: 720,
width: 1280
Expand All @@ -144,7 +144,7 @@ module.exports = {
'BANDWIDTH': 1276223,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.64001e,mp4a.40.2',
'FRAME-RATE': '29.970',
'FRAME-RATE': 29.970,
'RESOLUTION': {
height: 432,
width: 768
Expand All @@ -161,7 +161,7 @@ module.exports = {
'BANDWIDTH': 904744,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.64001e,mp4a.40.2',
'FRAME-RATE': '29.970',
'FRAME-RATE': 29.970,
'RESOLUTION': {
height: 360,
width: 640
Expand All @@ -178,7 +178,7 @@ module.exports = {
'BANDWIDTH': 538201,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.640015,mp4a.40.2',
'FRAME-RATE': '29.970',
'FRAME-RATE': 29.970,
'RESOLUTION': {
height: 270,
width: 480
Expand All @@ -195,7 +195,7 @@ module.exports = {
'BANDWIDTH': 2440329,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.640020,ac-3',
'FRAME-RATE': '59.940',
'FRAME-RATE': 59.940,
'RESOLUTION': {
height: 540,
width: 960
Expand All @@ -212,7 +212,7 @@ module.exports = {
'BANDWIDTH': 8201540,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.64002a,ac-3',
'FRAME-RATE': '59.940',
'FRAME-RATE': 59.940,
'RESOLUTION': {
height: 1080,
width: 1920
Expand All @@ -229,7 +229,7 @@ module.exports = {
'BANDWIDTH': 6406995,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.64002a,ac-3',
'FRAME-RATE': '59.940',
'FRAME-RATE': 59.940,
'RESOLUTION': {
height: 1080,
width: 1920
Expand All @@ -246,7 +246,7 @@ module.exports = {
'BANDWIDTH': 4907776,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.64002a,ac-3',
'FRAME-RATE': '59.940',
'FRAME-RATE': 59.940,
'RESOLUTION': {
height: 1080,
width: 1920
Expand All @@ -263,7 +263,7 @@ module.exports = {
'BANDWIDTH': 3395856,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.640020,ac-3',
'FRAME-RATE': '59.940',
'FRAME-RATE': 59.940,
'RESOLUTION': {
height: 720,
width: 1280
Expand All @@ -280,7 +280,7 @@ module.exports = {
'BANDWIDTH': 1501333,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.64001e,ac-3',
'FRAME-RATE': '29.970',
'FRAME-RATE': 29.970,
'RESOLUTION': {
height: 432,
width: 768
Expand All @@ -297,7 +297,7 @@ module.exports = {
'BANDWIDTH': 1129854,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.64001e,ac-3',
'FRAME-RATE': '29.970',
'FRAME-RATE': 29.970,
'RESOLUTION': {
height: 360,
width: 640
Expand All @@ -314,7 +314,7 @@ module.exports = {
'BANDWIDTH': 763311,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.640015,ac-3',
'FRAME-RATE': '29.970',
'FRAME-RATE': 29.970,
'RESOLUTION': {
height: 270,
width: 480
Expand All @@ -331,7 +331,7 @@ module.exports = {
'BANDWIDTH': 2248329,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.640020,ec-3',
'FRAME-RATE': '59.940',
'FRAME-RATE': 59.940,
'RESOLUTION': {
height: 540,
width: 960
Expand All @@ -348,7 +348,7 @@ module.exports = {
'BANDWIDTH': 8009540,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.64002a,ec-3',
'FRAME-RATE': '59.940',
'FRAME-RATE': 59.940,
'RESOLUTION': {
height: 1080,
width: 1920
Expand All @@ -365,7 +365,7 @@ module.exports = {
'BANDWIDTH': 6214995,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.64002a,ec-3',
'FRAME-RATE': '59.940',
'FRAME-RATE': 59.940,
'RESOLUTION': {
height: 1080,
width: 1920
Expand All @@ -382,7 +382,7 @@ module.exports = {
'BANDWIDTH': 4715776,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.64002a,ec-3',
'FRAME-RATE': '59.940',
'FRAME-RATE': 59.940,
'RESOLUTION': {
height: 1080,
width: 1920
Expand All @@ -399,7 +399,7 @@ module.exports = {
'BANDWIDTH': 3203856,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.640020,ec-3',
'FRAME-RATE': '59.940',
'FRAME-RATE': 59.940,
'RESOLUTION': {
height: 720,
width: 1280
Expand All @@ -416,7 +416,7 @@ module.exports = {
'BANDWIDTH': 1309333,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.64001e,ec-3',
'FRAME-RATE': '29.970',
'FRAME-RATE': 29.970,
'RESOLUTION': {
height: 432,
width: 768
Expand All @@ -433,7 +433,7 @@ module.exports = {
'BANDWIDTH': 937854,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.64001e,ec-3',
'FRAME-RATE': '29.970',
'FRAME-RATE': 29.970,
'RESOLUTION': {
height: 360,
width: 640
Expand All @@ -450,7 +450,7 @@ module.exports = {
'BANDWIDTH': 571311,
'CLOSED-CAPTIONS': 'cc1',
'CODECS': 'avc1.640015,ec-3',
'FRAME-RATE': '29.970',
'FRAME-RATE': 29.970,
'RESOLUTION': {
height: 270,
width: 480
Expand Down

0 comments on commit d51e93f

Please sign in to comment.