public void excludeAttribute(String id, MediaDescription m) throws SdpParseException { Vector<Attribute> attributes = m.getAttributes(false); int count = 0; for (Attribute a : attributes) { if (a.getName().equalsIgnoreCase("rtpmap")) { String[] tokens = a.getValue().split(" "); if (tokens[0].trim().equalsIgnoreCase(id)) { break; } } count++; } if (count < attributes.size()) { attributes.remove(count); } }
public boolean containsFormat(String format, SessionDescription sdp) throws SdpException { Vector<MediaDescription> mds = sdp.getMediaDescriptions(false); for (MediaDescription m : mds) { Vector<Attribute> attributes = m.getAttributes(false); for (Attribute a : attributes) { if (a.getName().equalsIgnoreCase("rtpmap") && a.getValue().toLowerCase().contains(format.toLowerCase())) { return true; } } } return false; }
public void excludeAttribute(String id, MediaDescription m) throws SdpParseException { Vector<Attribute> attributes = m.getAttributes(false); int count = 0; for (Attribute a : attributes) { if (a.getName().equalsIgnoreCase("rtpmap")) { String[] tokens = a.getValue().split(" "); if (tokens[0].trim().equalsIgnoreCase(id)) { break; } } count++; } if (count < attributes.size()) { attributes.remove(count); } }
public boolean containsFormat(String format, SessionDescription sdp) throws SdpException { Vector<MediaDescription> mds = sdp.getMediaDescriptions(false); for (MediaDescription m : mds) { Vector<Attribute> attributes = m.getAttributes(false); for (Attribute a : attributes) { if (a.getName().equalsIgnoreCase("rtpmap") && a.getValue().toLowerCase().contains(format.toLowerCase())) { return true; } } } return false; }
private static HashMap<Integer, Format> getVideoFormats(MediaDescription md) throws SdpParseException, SdpException { HashMap<Integer, Format> formats = new HashMap<Integer, Format>(); Media media = md.getMedia(); Enumeration<String> payloads = media.getMediaFormats(false).elements(); while (payloads.hasMoreElements()) { int payload = Integer.parseInt((String) payloads.nextElement()); Format fmt = AVProfile.getVideoFormat(payload); if (fmt != null) { formats.put(new Integer(payload), fmt); } } Enumeration attributes = md.getAttributes(false).elements(); while (attributes.hasMoreElements()) { Attribute attribute = (Attribute) attributes.nextElement(); if (attribute.getName().equals("rtpmap")) { RTPVideoFormat fmt = RTPVideoFormat.parseFormat(attribute.getValue()); formats.put(new Integer(fmt.getPayloadType()), fmt); } } return formats; }
private static HashMap<Integer, Format> getVideoFormats(MediaDescription md) throws SdpParseException, SdpException { HashMap<Integer, Format> formats = new HashMap<Integer, Format>(); Media media = md.getMedia(); Enumeration<String> payloads = media.getMediaFormats(false).elements(); while (payloads.hasMoreElements()) { int payload = Integer.parseInt((String) payloads.nextElement()); Format fmt = AVProfile.getVideoFormat(payload); if (fmt != null) { formats.put(new Integer(payload), fmt); } } Enumeration attributes = md.getAttributes(false).elements(); while (attributes.hasMoreElements()) { Attribute attribute = (Attribute) attributes.nextElement(); if (attribute.getName().equals("rtpmap")) { RTPVideoFormat fmt = RTPVideoFormat.parseFormat(attribute.getValue()); formats.put(new Integer(fmt.getPayloadType()), fmt); } } return formats; }
private static HashMap<Integer, Format> getAudioFormats(MediaDescription md) throws SdpParseException, SdpException { HashMap<Integer, Format> formats = new HashMap<Integer, Format>(); Media media = md.getMedia(); Enumeration payloads = media.getMediaFormats(false).elements(); while (payloads.hasMoreElements()) { int payload = Integer.parseInt((String) payloads.nextElement()); Format fmt = AVProfile.getAudioFormat(payload); if (fmt != null) { formats.put(new Integer(payload), fmt); } } Enumeration attributes = md.getAttributes(false).elements(); while (attributes.hasMoreElements()) { Attribute attribute = (Attribute) attributes.nextElement(); if (attribute.getName().equals("rtpmap")) { RTPAudioFormat fmt = RTPAudioFormat.parseRtpmapFormat(attribute.getValue()); if (fmt != null) { formats.put(new Integer(fmt.getPayloadType()), fmt); } } } return formats; }
private static HashMap<Integer, Format> getAudioFormats(MediaDescription md) throws SdpParseException, SdpException { HashMap<Integer, Format> formats = new HashMap<Integer, Format>(); Media media = md.getMedia(); Enumeration payloads = media.getMediaFormats(false).elements(); while (payloads.hasMoreElements()) { int payload = Integer.parseInt((String) payloads.nextElement()); Format fmt = AVProfile.getAudioFormat(payload); if (fmt != null) { formats.put(new Integer(payload), fmt); } } Enumeration attributes = md.getAttributes(false).elements(); while (attributes.hasMoreElements()) { Attribute attribute = (Attribute) attributes.nextElement(); if (attribute.getName().equals("rtpmap")) { RTPAudioFormat fmt = RTPAudioFormat.parseRtpmapFormat(attribute.getValue()); if (fmt != null) { formats.put(new Integer(fmt.getPayloadType()), fmt); } } } return formats; }
String[] tokens = a.getValue().split(" ");
String[] tokens = a.getValue().split(" ");
for (String excludeCodec : excludedCodecs) { if (RTPMAP.equals(a.getName())) { String tokens[] = a.getValue().split(" "); String[] tokens1 = tokens[1].split("/"); String encodingName = tokens1[0]; for (String f : excludeFormats) { if (FMTP.equals(a.getName())) { String tokens[] = a.getValue().split(" "); if (tokens[0].equals(f)) { attributes.remove();
for (String excludeCodec : excludedCodecs) { if (RTPMAP.equals(a.getName())) { String tokens[] = a.getValue().split(" "); String[] tokens1 = tokens[1].split("/"); String encodingName = tokens1[0]; for (String f : excludeFormats) { if (FMTP.equals(a.getName())) { String tokens[] = a.getValue().split(" "); if (tokens[0].equals(f)) { attributes.remove();
private String convertSDP(String sdpString) throws SdpException { SdpFactory factory = javax.sdp.SdpFactory.getInstance(); SessionDescription sd = factory.createSessionDescription(sdpString); Vector<?> mediaDescriptions = sd.getMediaDescriptions(false); for (Object object : mediaDescriptions) { MediaDescription md = (MediaDescription) object; Vector<?> attributes = md.getAttributes(false); for (Object object2 : attributes) { Attribute attribute = (Attribute) object2; if (attribute.getName().compareToIgnoreCase("rtpmap") == 0) { attribute.setValue(attribute.getValue().toUpperCase()); } } } return sd.toString(); }
private String convertSDP(String sdpString) throws SdpException { SdpFactory factory = javax.sdp.SdpFactory.getInstance(); SessionDescription sd = factory.createSessionDescription(sdpString); Vector<?> mediaDescriptions = sd.getMediaDescriptions(false); for (Object object : mediaDescriptions) { MediaDescription md = (MediaDescription) object; Vector<?> attributes = md.getAttributes(false); for (Object object2 : attributes) { Attribute attribute = (Attribute) object2; if (attribute.getName().compareToIgnoreCase("rtpmap") == 0) { attribute.setValue(attribute.getValue().toUpperCase()); } } } return sd.toString(); }