sdp-jingle-json
Advanced tools
Comparing version 0.3.7 to 1.0.0
@@ -176,26 +176,47 @@ exports.lines = function (sdp) { | ||
exports.ssrc = function (lines) { | ||
exports.sourceGroups = function (lines) { | ||
var parsed = []; | ||
for (var i = 0; i < lines.length; i++) { | ||
var parts = lines[i].substr(13).split(' '); | ||
parsed.push({ | ||
semantics: parts.shift(), | ||
sources: parts | ||
}); | ||
} | ||
return parsed; | ||
}; | ||
exports.sources = function (lines) { | ||
// http://tools.ietf.org/html/rfc5576 | ||
var parsed = []; | ||
var perssrc = {}; | ||
var parts; | ||
var ssrc; | ||
var sources = {}; | ||
for (var i = 0; i < lines.length; i++) { | ||
parts = lines[i].substr(7).split(' '); | ||
ssrc = parts.shift(); | ||
var parts = lines[i].substr(7).split(' '); | ||
var ssrc = parts.shift(); | ||
if (!sources[ssrc]) { | ||
var source = { | ||
ssrc: ssrc, | ||
parameters: [] | ||
}; | ||
parsed.push(source); | ||
// Keep an index | ||
sources[ssrc] = source; | ||
} | ||
parts = parts.join(' ').split(':'); | ||
var attribute = parts.shift(); | ||
var value = parts.join(':') || null; | ||
if (!perssrc[ssrc]) perssrc[ssrc] = {}; | ||
perssrc[ssrc][attribute] = value; | ||
sources[ssrc].parameters.push({ | ||
key: attribute, | ||
value: value | ||
}); | ||
} | ||
for (ssrc in perssrc) { | ||
var item = perssrc[ssrc]; | ||
item.ssrc = ssrc; | ||
parsed.push(item); | ||
} | ||
return parsed; | ||
}; | ||
exports.grouping = function (lines) { | ||
exports.groups = function (lines) { | ||
// http://tools.ietf.org/html/rfc5888 | ||
@@ -202,0 +223,0 @@ var parsed = []; |
@@ -29,3 +29,3 @@ var parsers = require('./parsers'); | ||
if (groupLines.length) { | ||
parsed.groupings = parsers.grouping(groupLines); | ||
parsed.groups = parsers.groups(groupLines); | ||
} | ||
@@ -129,6 +129,7 @@ | ||
var ssrcGroupLines = parsers.findLines('a=ssrc-group:', lines); | ||
desc.sourceGroups = parsers.sourceGroups(ssrcGroupLines || []); | ||
var ssrcLines = parsers.findLines('a=ssrc:', lines); | ||
if (ssrcLines.length) { | ||
desc.ssrcs = parsers.ssrc(ssrcLines); | ||
} | ||
desc.sources = parsers.sources(ssrcLines || []); | ||
@@ -135,0 +136,0 @@ var fingerprintLines = parsers.findLines('a=fingerprint:', lines, sessionLines); |
@@ -21,5 +21,5 @@ var senders = { | ||
var groupings = session.groupings || []; | ||
groupings.forEach(function (grouping) { | ||
sdp.push('a=group:' + grouping.semantics + ' ' + grouping.contents.join(' ')); | ||
var groups = session.groups || []; | ||
groups.forEach(function (group) { | ||
sdp.push('a=group:' + group.semantics + ' ' + group.contents.join(' ')); | ||
}); | ||
@@ -128,7 +128,12 @@ | ||
var ssrcs = desc.ssrcs || []; | ||
var ssrcGroups = desc.sourceGroups || []; | ||
ssrcGroups.forEach(function (ssrcGroup) { | ||
sdp.push('a=ssrc-group:' + ssrcGroup.semantics + ' ' + ssrcGroup.sources.join(' ')); | ||
}); | ||
var ssrcs = desc.sources || []; | ||
ssrcs.forEach(function (ssrc) { | ||
for (var attribute in ssrc) { | ||
if (attribute == 'ssrc') continue; | ||
sdp.push('a=ssrc:' + (ssrc.ssrc || desc.ssrc) + ' ' + attribute + (ssrc[attribute] ? (':' + ssrc[attribute]) : '')); | ||
for (var i = 0; i < ssrc.parameters.length; i++) { | ||
var param = ssrc.parameters[i]; | ||
sdp.push('a=ssrc:' + (ssrc.ssrc || desc.ssrc) + ' ' + param.key + (param.value ? (':' + param.value) : '')); | ||
} | ||
@@ -135,0 +140,0 @@ }); |
{ | ||
"name": "sdp-jingle-json", | ||
"version": "0.3.7", | ||
"version": "1.0.0", | ||
"description": "A parser/serializer for SDP to JSON. Useful for converting SDP to other formats like Jingle for WebRTC signalling", | ||
@@ -25,9 +25,9 @@ "main": "index.js", | ||
"devDependencies": { | ||
"browserify": "2.35.1", | ||
"grunt": "0.4.1", | ||
"browserify": "2.36.1", | ||
"grunt": "0.4.2", | ||
"grunt-browserify": "1.2.11", | ||
"grunt-contrib-jshint": "0.7.1", | ||
"grunt-contrib-jshint": "0.7.2", | ||
"grunt-contrib-uglify": "0.2.7", | ||
"precommit-hook": "0.3.8", | ||
"tape": "2.1.0" | ||
"tape": "2.3.0" | ||
}, | ||
@@ -34,0 +34,0 @@ "testling": { |
@@ -70,3 +70,3 @@ # SDP-Jingle-JSON | ||
// ---- Content payload | ||
"grouping": [ | ||
"groups": [ | ||
{ | ||
@@ -87,9 +87,19 @@ "semantics": "", | ||
"ssrc": "", | ||
"ssrcs": [ | ||
"sourceGroups": [ | ||
{ | ||
"semantics": "", | ||
"sources": [ | ||
"" //... | ||
] | ||
} //... | ||
], | ||
"sources": [ | ||
{ | ||
"ssrc": "", | ||
"cname": "", | ||
"msid": "", | ||
"mslabel": "", | ||
"label": "" | ||
"parameters: [ | ||
{ | ||
"key": "", | ||
"value": "" | ||
} //... | ||
] | ||
} //... | ||
@@ -96,0 +106,0 @@ ], |
@@ -105,9 +105,24 @@ module.exports = { | ||
"mux": true, | ||
"ssrcs": [ | ||
"sourceGroups": [], | ||
"sources": [ | ||
{ | ||
"cname": "RbR04HtIjW+Sa+yz", | ||
"msid": "uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgo uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgoa0", | ||
"mslabel": "uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgo", | ||
"label": "uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgoa0", | ||
"ssrc": "445948959" | ||
"ssrc": "445948959", | ||
"parameters": [ | ||
{ | ||
"key": "cname", | ||
"value": "RbR04HtIjW+Sa+yz" | ||
}, | ||
{ | ||
"key": "msid", | ||
"value": "uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgo uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgoa0" | ||
}, | ||
{ | ||
"key": "mslabel", | ||
"value": "uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgo" | ||
}, | ||
{ | ||
"key": "label", | ||
"value": "uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgoa0" | ||
} | ||
] | ||
} | ||
@@ -209,10 +224,51 @@ ] | ||
"mux": true, | ||
"ssrcs": [ | ||
"sourceGroups": [ | ||
{ | ||
"cname": "RbR04HtIjW+Sa+yz", | ||
"msid": "uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgo uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgov0", | ||
"mslabel": "uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgo", | ||
"label": "uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgov0", | ||
"ssrc": "797563643" | ||
"semantics": "FID", | ||
"sources": ["797563643", "193463643"] | ||
} | ||
], | ||
"sources": [ | ||
{ | ||
"ssrc": "797563643", | ||
"parameters": [ | ||
{ | ||
"key": "cname", | ||
"value": "RbR04HtIjW+Sa+yz" | ||
}, | ||
{ | ||
"key": "msid", | ||
"value": "uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgo uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgov0" | ||
}, | ||
{ | ||
"key": "mslabel", | ||
"value": "uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgo" | ||
}, | ||
{ | ||
"key": "label", | ||
"value": "uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgov0" | ||
} | ||
] | ||
}, | ||
{ | ||
"ssrc": "193463643", | ||
"parameters": [ | ||
{ | ||
"key": "cname", | ||
"value": "RbR04HtIjW+Sa+yz" | ||
}, | ||
{ | ||
"key": "msid", | ||
"value": "uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgo uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgov0" | ||
}, | ||
{ | ||
"key": "mslabel", | ||
"value": "uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgo" | ||
}, | ||
{ | ||
"key": "label", | ||
"value": "uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgov0" | ||
} | ||
] | ||
} | ||
] | ||
@@ -248,3 +304,3 @@ }, | ||
], | ||
"groupings": [ | ||
"groups": [ | ||
{ | ||
@@ -258,2 +314,2 @@ "semantics": "BUNDLE", | ||
] | ||
}; | ||
}; |
@@ -51,2 +51,3 @@ module.exports = [ | ||
"a=extmap:2/sendrecv urn:ietf:params:rtp-hdrext:toffset", | ||
"a=ssrc-group:FID 797563643 193463643", | ||
"a=ssrc:797563643 cname:RbR04HtIjW+Sa+yz", | ||
@@ -56,4 +57,8 @@ "a=ssrc:797563643 msid:uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgo uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgov0", | ||
"a=ssrc:797563643 label:uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgov0", | ||
"a=ssrc:193463643 cname:RbR04HtIjW+Sa+yz", | ||
"a=ssrc:193463643 msid:uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgo uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgov0", | ||
"a=ssrc:193463643 mslabel:uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgo", | ||
"a=ssrc:193463643 label:uwwsnlQmzOrjxCsin4Z5lQ5XVpUFHQgUYLgov0", | ||
"a=candidate:1529647030 1 udp 2113937151 192.12.211.22 63522 typ host generation 0", | ||
"" // So we end with a \r\n | ||
].join('\r\n'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
44750
932
1
189