-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parse x-timestamp-map #4
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -1138,16 +1138,51 @@ | |
} | ||
} | ||
|
||
// 3.2 WebVTT metadata header syntax | ||
function parseHeader(input) { | ||
parseOptions(input, function (k, v) { | ||
switch (k) { | ||
case "Region": | ||
// 3.3 WebVTT region metadata header syntax | ||
parseRegion(v); | ||
// draft-pantos-http-live-streaming-20 | ||
// https://tools.ietf.org/html/draft-pantos-http-live-streaming-20#section-3.5 | ||
// 3.5 WebVTT | ||
function parseTimestampMap(input) { | ||
var settings = new Settings(); | ||
|
||
parseOptions(input, function(k, v) { | ||
switch(k) { | ||
case "MPEGT": | ||
settings.integer(k + 'S', v); | ||
break; | ||
case "LOCA": | ||
settings.set(k + 'L', parseTimeStamp(v)); | ||
break; | ||
} | ||
}, /:/); | ||
}, /[^\d]:/, /,/); | ||
|
||
self.ontimestampmap && self.ontimestampmap({ | ||
"MPEGTS": settings.get("MPEGTS"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is hilarious. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And by this, I mean |
||
"LOCAL": settings.get("LOCAL") | ||
}); | ||
} | ||
|
||
// 3.2 WebVTT metadata header syntax | ||
function parseHeader(input) { | ||
if (input.match(/X-TIMESTAMP-MAP/)) { | ||
// This line contains HLS X-TIMESTAMP-MAP metadata | ||
parseOptions(input, function(k, v) { | ||
switch(k) { | ||
case "X-TIMESTAMP-MAP": | ||
parseTimestampMap(v); | ||
break; | ||
} | ||
}, /=/); | ||
} else { | ||
parseOptions(input, function (k, v) { | ||
switch (k) { | ||
case "Region": | ||
// 3.3 WebVTT region metadata header syntax | ||
parseRegion(v); | ||
break; | ||
} | ||
}, /:/); | ||
} | ||
|
||
} | ||
|
||
// 5.1 WebVTT file parsing. | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so,
ontimestampmap
is a method on the parser that will be called with the MPEGTS and LOCAL times? Does it mean that the user still needs to manually shift all the timestamps by this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the user would have to manually shift the timestamps. The timestamp map tag only gives a mapping from cue time to TS time, but the mapping from TS to display time is still needed for the shift. I think this approach is the easiest instead of storing state on the parse for the extra mapping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm... maybe it's the best option; it just seems to be only half complete this way.