當前位置: 首頁>>代碼示例>>Java>>正文


Java SDPAnnounceParser類代碼示例

本文整理匯總了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);

}
 
開發者ID:YunlongYang,項目名稱:LightSIP,代碼行數:12,代碼來源:SdpParserTest.java

示例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);
    }

}
 
開發者ID:YunlongYang,項目名稱:LightSIP,代碼行數:36,代碼來源:SdpParserTest.java

示例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);
		}

	}
}
 
開發者ID:laggc,項目名稱:rtsp_multicast_pfc,代碼行數:45,代碼來源:ClientRTSP.java

示例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");
  }
}
 
開發者ID:darkmi,項目名稱:rtspproxy,代碼行數:19,代碼來源:SdpFactory.java


注:本文中的gov.nist.javax.sdp.parser.SDPAnnounceParser類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。