Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
videojs-contrib-hls
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
0551eba5
authored
2013-12-16 14:22:10 -0500
by
Gary Katsevman
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
abstract some functionality into a shared function
1 parent
4b1e49f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
60 deletions
src/m3u8/m3u8.pegjs
src/m3u8/m3u8.pegjs
View file @
0551eba
/***** Start *****/
{
function reduce(rest, attr) {
return rest.reduce(function(prev, curr) {
var p,
currentItem = curr.pop();
for (p in currentItem) {
prev[p] = currentItem[p];
};
return prev;
}, attr);
}
}
start
= tags:lines+ .* {
var choices = {
...
...
@@ -135,16 +148,7 @@ mediaURL
/ ! tag file:[ -~]+ { return file.join(''); }
keyAttributes
= (attr:keyAttribute rest:(attrSeparator streamInfAttrs)*) {
return rest.reduce(function(prev, curr) {
var p,
currentItem = curr.pop();
for (p in currentItem) {
prev[p] = currentItem[p];
};
return prev;
}, attr);
}
= (attr:keyAttribute rest:(attrSeparator streamInfAttrs)*) { return reduce(rest, attr); }
/ attr:keyAttribute? { return [attr]; }
keyAttribute
...
...
@@ -160,16 +164,7 @@ keyMethod
/ "SAMPLE-AES"
mediaAttributes
= (attr:mediaAttribute rest:(attrSeparator mediaAttribute)*) {
return rest.reduce(function(prev, curr) {
var p,
currentItem = curr.pop();
for (p in currentItem) {
prev[p] = currentItem[p];
};
return prev;
}, attr);
}
= (attr:mediaAttribute rest:(attrSeparator mediaAttribute)*) { return reduce(rest, attr); }
/ attr:mediaAttribute? { return [attr] }
mediaAttribute
...
...
@@ -186,16 +181,7 @@ mediaAttribute
/ "CHARACTERISTICS" "=" characteristics:quotedString { return {characteristics: characteristics}; }
streamInfAttrs
= (attr:streamInfAttr rest:(attrSeparator streamInfAttr)*) {
return rest.reduce(function(prev, curr) {
var p,
currentItem = curr.pop();
for (p in currentItem) {
prev[p] = currentItem[p];
};
return prev;
}, attr);
}
= (attr:streamInfAttr rest:(attrSeparator streamInfAttr)*) { return reduce(rest, attr); }
/ attr:streamInfAttr?
streamInfAttr
...
...
@@ -213,16 +199,7 @@ streamInfSharedAttr
/ "VIDEO" "=" video:quotedString { return {video: video}; }
mapAttributes
= (attr:mapAttribute rest:(attrSeparator mapAttribute)*) {
return rest.reduce(function(prev, curr) {
var p,
currentItem = curr.pop();
for (p in currentItem) {
prev[p] = currentItem[p];
};
return prev;
}, attr);
}
= (attr:mapAttribute rest:(attrSeparator mapAttribute)*) { return reduce(rest, attr); }
/ attr:mapAttribute?
mapAttribute
...
...
@@ -230,16 +207,7 @@ mapAttribute
/ "BYTERANGE" "=" byteRange:quotedString { return {byterange: byterange}; }
iframeStreamAttrs
= (attr:iframeStreamAttr rest:(attrSeparator iframeStreamAttr)*) {
return rest.reduce(function(prev, curr) {
var p,
currentItem = curr.pop();
for (p in currentItem) {
prev[p] = currentItem[p];
};
return prev;
}, attr);
}
= (attr:iframeStreamAttr rest:(attrSeparator iframeStreamAttr)*) { return reduce(rest, attr); }
/ attr:iframeStreamAttr?
iframeStreamAttr
...
...
@@ -247,16 +215,7 @@ iframeStreamAttr
/ "URI" "=" uri:quotedString { return {uri: uri}; }
startAttributes
= (attr:startAttribute rest:(attrSeparator startAttribute)*) {
return rest.reduce(function(prev, curr) {
var p,
currentItem = curr.pop();
for (p in currentItem) {
prev[p] = currentItem[p];
};
return prev;
}, attr);
}
= (attr:startAttribute rest:(attrSeparator startAttribute)*) { return reduce(rest, attr); }
/ attr:startAttribute?
startAttribute
...
...
Please
register
or
sign in
to post a comment