Added owner information
This commit is contained in:
parent
2dbc169a0f
commit
23090d2bd5
5 changed files with 79 additions and 32 deletions
|
|
@ -88,10 +88,10 @@ public class SDPParser {
|
|||
public List<SessionDescription> parse() throws IOException {
|
||||
List<SessionDescription> sessions = new ArrayList<>();
|
||||
|
||||
String line;
|
||||
SessionDescription currentSession = null;
|
||||
TimingDescription currentTiming = null;
|
||||
MediaDescription currentMedia = null;
|
||||
String line;
|
||||
String[] tmpArr;
|
||||
|
||||
while ((line=IOUtil.readLine(in)) != null) {
|
||||
|
|
@ -115,7 +115,20 @@ public class SDPParser {
|
|||
currentSession.protocolVersion = Integer.parseInt(getValue(line));
|
||||
break;
|
||||
|
||||
// TODO: o=<owner username> <session id> <session version> <network type> <address type> <address>
|
||||
// o=<owner username> <session id> <session version> <network type> <address type> <address>
|
||||
case 'o':
|
||||
if (currentSession == null) throw new RuntimeException("Received session owner before session definition: '" + line + "'");
|
||||
|
||||
tmpArr = getValueArray(line);
|
||||
if (tmpArr.length != 6) throw new RuntimeException("Incorrect owner definition found: '" + line + "'");
|
||||
|
||||
currentSession.sessionOwner = tmpArr[0];
|
||||
currentSession.sessionId = Long.parseLong(tmpArr[1]);
|
||||
currentSession.sessionAnnouncementVersion = Long.parseLong(tmpArr[2]);
|
||||
currentSession.ownerNetworkType = tmpArr[3];
|
||||
currentSession.ownerAddressType = tmpArr[4];
|
||||
currentSession.ownerAddress = tmpArr[5];
|
||||
break;
|
||||
|
||||
// s=<session title>
|
||||
case 's':
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ public class SessionDescription {
|
|||
protected int protocolVersion;
|
||||
|
||||
protected String sessionOwner;
|
||||
protected String sessionId;
|
||||
protected String sessionVersion;
|
||||
protected String networkType;
|
||||
protected String addressType;
|
||||
protected String address;
|
||||
protected long sessionId;
|
||||
protected long sessionAnnouncementVersion;
|
||||
protected String ownerNetworkType = "IN";
|
||||
protected String ownerAddressType = "IP4"; // IP4 or IP6
|
||||
protected String ownerAddress;
|
||||
|
||||
protected String sessionTitle;
|
||||
protected String sessionDescription;
|
||||
|
|
@ -40,24 +40,24 @@ public class SessionDescription {
|
|||
return sessionOwner;
|
||||
}
|
||||
|
||||
public String getSessionId() {
|
||||
public long getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public String getSessionVersion() {
|
||||
return sessionVersion;
|
||||
public long getAnnouncementVersion() {
|
||||
return sessionAnnouncementVersion;
|
||||
}
|
||||
|
||||
public String getNetworkType() {
|
||||
return networkType;
|
||||
public String getOwnerNetworkType() {
|
||||
return ownerNetworkType;
|
||||
}
|
||||
|
||||
public String getAddressType() {
|
||||
return addressType;
|
||||
public String getOwnerAddressType() {
|
||||
return ownerAddressType;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
public String getOwnerAddress() {
|
||||
return ownerAddress;
|
||||
}
|
||||
|
||||
public String getSessionTitle() {
|
||||
|
|
@ -93,8 +93,9 @@ public class SessionDescription {
|
|||
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');;
|
||||
output.append("o=").append(sessionOwner).append(' ').append(sessionId).append(' ').append(sessionAnnouncementVersion)
|
||||
.append(' ').append(ownerNetworkType).append(' ').append(ownerAddressType).append(' ').append(ownerAddress).append('\n');
|
||||
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');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue