本文整理汇总了Java中gov.nist.javax.sdp.parser.SDPAnnounceParser类的典型用法代码示例。如果您正苦于以下问题:Java SDPAnnounceParser类的具体用法?Java SDPAnnounceParser怎么用?Java SDPAnnounceParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SDPAnnounceParser类属于gov.nist.javax.sdp.parser包,在下文中一共展示了SDPAnnounceParser类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testWebRtcSdpParser
import gov.nist.javax.sdp.parser.SDPAnnounceParser; //导入依赖的package包/类
public void testWebRtcSdpParser() throws Exception {
SDPAnnounceParser parser = new SDPAnnounceParser(rtcSdp);
SessionDescriptionImpl sessiondescription = parser.parse();
sessiondescription.getAttribute("crypto:1");
String nt = sessiondescription.getConnection()==null?null:sessiondescription.getConnection().getNetworkType();
MediaDescription md = (MediaDescription) sessiondescription.getMediaDescriptions(false).get(0);
nt = md.getConnection().getNetworkType();
assertNotNull(nt);
assertNotNull(md);
}
示例2: testSdpParser
import gov.nist.javax.sdp.parser.SDPAnnounceParser; //导入依赖的package包/类
public void testSdpParser() throws Exception {
for (String sdpdata : sdpData) {
SDPAnnounceParser parser = new SDPAnnounceParser(sdpdata);
SessionDescriptionImpl sessiondescription = parser.parse();
Vector attrs = sessiondescription.getAttributes(false);
if (attrs != null) {
Attribute attrib = (Attribute) attrs.get(0);
System.out.println("attrs = " + attrib.getName());
}
MediaDescription md = (MediaDescription) sessiondescription.getMediaDescriptions(
false).get(0);
System.out.println("md attributes " + md.getAttributes(false));
SessionDescriptionImpl sessiondescription1 = new SDPAnnounceParser(sessiondescription
.toString()).parse();
System.out.println("sessionDescription1 " + sessiondescription1);
assertNotNull(sessiondescription1);
// Unfortunately equals is not yet implemented.
// assertEquals("Equality check",
// sessiondescription,sessiondescription1);
// Check if SDP is serializable
File outFile = File.createTempFile("sdpObj",".dat");
outFile.deleteOnExit();
ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(outFile, false));
os.writeObject(sessiondescription1);
}
}
示例3: parseSDP
import gov.nist.javax.sdp.parser.SDPAnnounceParser; //导入依赖的package包/类
/**
* Llegada la respuesta a una petición de DESCRIBE, esta debe contener
* un SDP. Este método comprobará que el SDP viene y sacará los streams
* que éste contiene almacenandolos para poder luego realizar las peticiones
* SETUP/PLAY de estos streams.
* @param content
*/
private void parseSDP(ChannelBuffer content) {
if (content.readable()) {
try {
String str_content = content.toString(CharsetUtil.UTF_8);
SDPAnnounceParser parser = new SDPAnnounceParser(str_content);
SessionDescriptionImpl sdp = parser.parse();
//Meto en el Player el SDP
setSdp(sdp.toString());
@SuppressWarnings("unchecked")
Vector<MediaDescription> vec_md = sdp.getMediaDescriptions(false);
//Obtengo del SDP los nombres de los medias que contiene.
Iterator<MediaDescription> it = vec_md.iterator();
streamsSetup = new ArrayList<String>();
while(it.hasNext()) {
MediaDescription md = it.next();
String stream = md.getAttribute("control");
streamsSetup.add(stream);
}
} catch (ParseException e) {
createNotify("Parse SDP exception",false);
} catch(Exception ex) {
createNotify("Unhandled exception",false);
}
}
}
示例4: createSessionDescription
import gov.nist.javax.sdp.parser.SDPAnnounceParser; //导入依赖的package包/类
/**
* Creates a SessionDescription populated with the information contained within the string
* parameter. Note: unknown field types should not cause exceptions.
*
* @param s s - the sdp message that is to be parsed.
* @throws SdpParseException SdpParseException - if there is a problem parsing the String.
* @return a populated SessionDescription object.
*/
public SessionDescription createSessionDescription(String s) throws SdpParseException {
try {
SDPAnnounceParser sdpParser = new SDPAnnounceParser(s);
return sdpParser.parse();
} catch (ParseException e) {
e.printStackTrace();
throw new SdpParseException(0, 0, "Could not parse message");
}
}