Added SDP printout also
This commit is contained in:
parent
7d683e44ab
commit
e8f055971e
4 changed files with 60 additions and 4 deletions
|
|
@ -55,4 +55,21 @@ public class MediaDescription {
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
StringBuffer output = new StringBuffer();
|
||||||
|
|
||||||
|
output.append("m=").append(type).append(' ').append(transportPort).append(' ').append(transport).append('\n'); // TODO: media formats
|
||||||
|
|
||||||
|
if (label != null) output.append("i=").append(label).append('\n');
|
||||||
|
// TODO: [optional] c=<network type> <address type> <connection address> // Media specific connection information
|
||||||
|
// TODO: [optional] b=(bandwidth information)
|
||||||
|
// TODO: [optional] k=(encryption key)
|
||||||
|
|
||||||
|
// TODO: [optional] a=<media attribute>:<value>
|
||||||
|
// TODO: [optional] a=rtpmap:<attribute>:<value>
|
||||||
|
|
||||||
|
return output.toString().trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -162,7 +162,7 @@ public class SDPParser {
|
||||||
if (currentSession == null) throw new RuntimeException("Time description received before a session has been defined: '" + line + "'");
|
if (currentSession == null) throw new RuntimeException("Time description received before a session has been defined: '" + line + "'");
|
||||||
|
|
||||||
currentTiming = new TimingDescription();
|
currentTiming = new TimingDescription();
|
||||||
currentSession.timing.add(currentTiming);
|
currentSession.timings.add(currentTiming);
|
||||||
|
|
||||||
tmpArr = getValueArray(line);
|
tmpArr = getValueArray(line);
|
||||||
if (tmpArr.length != 2) throw new RuntimeException("Incorrect time definition found: '" + line + "'");
|
if (tmpArr.length != 2) throw new RuntimeException("Incorrect time definition found: '" + line + "'");
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ public class SessionDescription {
|
||||||
protected String organizerEmail;
|
protected String organizerEmail;
|
||||||
protected String organizerPhoneNumber;
|
protected String organizerPhoneNumber;
|
||||||
|
|
||||||
protected List<TimingDescription> timing = new ArrayList<>();
|
protected List<TimingDescription> timings = new ArrayList<>();
|
||||||
|
|
||||||
protected List<MediaDescription> media = new ArrayList<>();
|
protected List<MediaDescription> media = new ArrayList<>();
|
||||||
|
|
||||||
|
|
@ -80,13 +80,41 @@ public class SessionDescription {
|
||||||
return organizerPhoneNumber;
|
return organizerPhoneNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TimingDescription> getTiming() {
|
public List<TimingDescription> getTimings() {
|
||||||
return timing;
|
return timings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MediaDescription> getMedia() {
|
public List<MediaDescription> getMedia() {
|
||||||
return media;
|
return media;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
StringBuffer output = new StringBuffer();
|
||||||
|
|
||||||
|
output.append("v=").append(protocolVersion).append('\n');
|
||||||
|
// TODO: o=<owner username> <session id> <session version> <network type> <address type> <address>
|
||||||
|
output.append("s=").append(sessionTitle).append('\n');;
|
||||||
|
|
||||||
|
if (sessionDescription != null) output.append("i=").append(sessionDescription).append('\n');
|
||||||
|
if (sessionURI != null) output.append("u=").append(sessionURI).append('\n');
|
||||||
|
if (organizerEmail != null) output.append("e=").append(organizerEmail).append('\n');
|
||||||
|
if (organizerPhoneNumber != null) output.append("p=").append(organizerPhoneNumber).append('\n');
|
||||||
|
// TODO: [optional] c=<network type> <address type> <connection address> // Session overall connection information
|
||||||
|
|
||||||
|
// Time description
|
||||||
|
for (TimingDescription t : timings) output.append(t.toString()).append('\n');
|
||||||
|
|
||||||
|
// TODO: [optional] b=<modifier>:<bandwidth kilobits per second>
|
||||||
|
// TODO: [optional] z=<adjustment time> <offset> <adjustment time> <offset> .... // Time zone adjustments
|
||||||
|
// TODO: [optional] k=<method=clear|base64|uri|prompt>:<encryption key> // Encryption information
|
||||||
|
// TODO: [optional] a=<session attribute>:<value>
|
||||||
|
|
||||||
|
// Media description
|
||||||
|
for (MediaDescription m : media) output.append(m.toString()).append('\n');
|
||||||
|
|
||||||
|
return output.toString().trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,4 +41,15 @@ public class TimingDescription {
|
||||||
public long getEndTime() {
|
public long getEndTime() {
|
||||||
return endTime;
|
return endTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
StringBuffer output = new StringBuffer();
|
||||||
|
|
||||||
|
output.append("t=").append(startTime).append(' ').append(endTime).append('\n');
|
||||||
|
|
||||||
|
// TODO: [optional] r=<repeat interval> <active duration> <list of offsets from start-time> // Repeat information
|
||||||
|
|
||||||
|
return output.toString().trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue