-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add support for non-standard DASH label attribute #811
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -957,11 +957,14 @@ shaka.dash.DashParser.prototype.parseAdaptationSet_ = function(context, elem) { | |
var language = | ||
shaka.util.LanguageUtils.normalize(elem.getAttribute('lang') || 'und'); | ||
|
||
// non-standard attribute(yet) supported by Kaltura | ||
var label = elem.getAttribute('label'); | ||
|
||
// Parse Representations into Streams. | ||
var representations = XmlUtils.findChildren(elem, 'Representation'); | ||
var streams = representations | ||
.map(this.parseRepresentation_.bind( | ||
this, context, contentProtection, kind, language, main)) | ||
this, context, contentProtection, kind, language, label, main)) | ||
.filter(function(s) { return !!s; }); | ||
|
||
if (streams.length == 0) { | ||
|
@@ -1018,6 +1021,7 @@ shaka.dash.DashParser.prototype.parseAdaptationSet_ = function(context, elem) { | |
* @param {shaka.dash.ContentProtection.Context} contentProtection | ||
* @param {(string|undefined)} kind | ||
* @param {string} language | ||
* @param {string} label | ||
* @param {boolean} isPrimary | ||
* @param {!Element} node | ||
* @return {?shakaExtern.Stream} The Stream, or null when there is a | ||
|
@@ -1026,7 +1030,7 @@ shaka.dash.DashParser.prototype.parseAdaptationSet_ = function(context, elem) { | |
* @private | ||
*/ | ||
shaka.dash.DashParser.prototype.parseRepresentation_ = function( | ||
context, contentProtection, kind, language, isPrimary, node) { | ||
context, contentProtection, kind, language, label, isPrimary, node) { | ||
var XmlUtils = shaka.util.XmlUtils; | ||
var ContentType = shaka.util.ManifestParserUtils.ContentType; | ||
|
||
|
@@ -1105,6 +1109,7 @@ shaka.dash.DashParser.prototype.parseRepresentation_ = function( | |
encrypted: contentProtection.drmInfos.length > 0, | ||
keyId: keyId, | ||
language: language, | ||
label: label, | ||
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. Please add this new field to the definition of the |
||
type: context.adaptationSet.contentType, | ||
primary: isPrimary, | ||
trickModeVideo: null, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -480,6 +480,8 @@ shaka.hls.HlsParser.prototype.createStreamInfoFromMediaTag_ = | |
var LanguageUtils = shaka.util.LanguageUtils; | ||
var langAttr = tag.getAttribute('LANGUAGE'); | ||
var language = langAttr ? LanguageUtils.normalize(langAttr.value) : 'und'; | ||
var labelAttr = tag.getAttribute('NAME'); | ||
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. Thank you for adding HLS support in this PR as well! |
||
var label = labelAttr ? labelAttr.value : null; | ||
|
||
var defaultAttr = tag.getAttribute('DEFAULT'); | ||
var autoselectAttr = tag.getAttribute('AUTOSELECT'); | ||
|
@@ -491,7 +493,7 @@ shaka.hls.HlsParser.prototype.createStreamInfoFromMediaTag_ = | |
var uri = HlsParser.getRequiredAttributeValue_(tag, 'URI'); | ||
var primary = !!defaultAttr || !!autoselectAttr; | ||
return this.createStreamInfo_(uri, allCodecs, type, timeOffset, language, | ||
primary).then(function(streamInfo) { | ||
primary, label).then(function(streamInfo) { | ||
this.mediaTagsToStreamInfosMap_[tag.id] = streamInfo; | ||
return streamInfo; | ||
}.bind(this)); | ||
|
@@ -526,12 +528,13 @@ shaka.hls.HlsParser.prototype.createStreamInfoFromVariantTag_ = | |
* @param {?number} timeOffset | ||
* @param {!string} language | ||
* @param {boolean} primary | ||
* @param {?string=} opt_label | ||
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 probably doesn't need to be both optional and nullable. For an internal method like this, all the arguments should be required, I think. |
||
* @return {!Promise.<shaka.hls.HlsParser.StreamInfo>} | ||
* @throws shaka.util.Error | ||
* @private | ||
*/ | ||
shaka.hls.HlsParser.prototype.createStreamInfo_ = | ||
function(uri, allCodecs, type, timeOffset, language, primary) { | ||
function(uri, allCodecs, type, timeOffset, language, primary, opt_label) { | ||
var Utils = shaka.hls.Utils; | ||
var ContentType = shaka.util.ManifestParserUtils.ContentType; | ||
var HlsParser = shaka.hls.HlsParser; | ||
|
@@ -643,6 +646,7 @@ shaka.hls.HlsParser.prototype.createStreamInfo_ = | |
encrypted: encrypted, | ||
keyId: keyId, | ||
language: language, | ||
label: opt_label || null, | ||
type: type, | ||
primary: primary, | ||
// TODO: trick mode | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,7 @@ describe('DashParser Manifest', function() { | |
' <Representation bandwidth="50" width="576" height="432" />', | ||
' </AdaptationSet>', | ||
' <AdaptationSet mimeType="text/vtt"', | ||
' lang="es">', | ||
' lang="es" label="spanish">', | ||
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. Thank you for updating the tests! |
||
' <Role value="caption" />', | ||
' <Role value="main" />', | ||
' <Representation bandwidth="100" />', | ||
|
@@ -176,6 +176,7 @@ describe('DashParser Manifest', function() { | |
.primary() | ||
.addTextStream(jasmine.any(Number)) | ||
.language('es') | ||
.label('spanish') | ||
.primary() | ||
.anySegmentFunctions() | ||
.anyInitSegment() | ||
|
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.
I was unable to find any mention of this attribute in the DASH spec (2014) or the latest DASH-IF-IOP (v4.0). I don't object to you adding it, though.
Please add a comment that this is a non-standard attribute supported by Kaltura.