亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mediamanager.java

?? It is Java for SIP phone
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/* * MediaManager.java * * Created on December 2, 2003, 8:56 AM */package gov.nist.applet.phone.media;import javax.sdp.SessionDescription;import javax.sdp.SdpFactory;import javax.sdp.SdpException;import javax.sdp.SdpParseException;import javax.sdp.Origin;import javax.sdp.Connection;import javax.sdp.SdpConstants;import javax.sdp.MediaDescription;import javax.sdp.Media;import javax.media.*;import javax.media.protocol.*;import javax.media.protocol.DataSource;import javax.media.format.*;import javax.media.control.TrackControl;import gov.nist.applet.phone.ua.MessageListener;import gov.nist.applet.phone.media.receiver.Receiver;import gov.nist.applet.phone.media.transmitter.Transmit;import gov.nist.applet.phone.media.transmitter.StateListener;import java.util.List;import java.util.Iterator;import java.util.Vector;import java.util.Random;import java.io.IOException;/** * This class will handle the media part of a call * Opening the receiver and transmitter, close them,... *  * @author Jean Deruelle <jean.deruelle@nist.gov> * * <a href="{@docRoot}/uncopyright.html">This code is in the public domain.</a> */public class MediaManager {	//Media transmitter	private Transmit transmit;	//Media receiver	private Receiver receiver;	//Codec supported by the user agent	public static List audioCodecSupportedList = null;	public static List videoCodecSupportedList = null;	//Remote Address to connect to	private String remoteAddress;	//Ports chosen	private int remoteAudioPort;	private int localAudioPort = -1;	private int remoteVideoPort;	private int localVideoPort = -1;	//Codecs chosen	private String negotiatedAudioCodec;	private String negotiatedVideoCodec;	//SdpFactory to create or parse Sdp Content 	private SdpFactory sdpFactory;	//callListener	private MessageListener callListener;	//flag to know if the session has been started	private boolean started;	//flag to know if the media session is going through the proxy	private boolean proxyEnabled;	/** 	 * Creates a new instance of MediaManager 	 * @param callListener - the sipListener of the application	 */	public MediaManager(MessageListener callListener) {		try {			sdpFactory = SdpFactory.getInstance();		} catch (SdpException se) {			se.printStackTrace();		}		this.callListener = callListener;		started = false;		proxyEnabled = false;	}	/**	 * get the supported audio codecs in the sdp format	 * @return array of the audio supported codecs	 */	public static String[] getSdpAudioSupportedCodecs() {		Vector sdpSupportedCodecsList = new Vector();		for (int i = 0; i < audioCodecSupportedList.size(); i++) {			String sdpFormat =				findCorrespondingSdpFormat(					((Format) audioCodecSupportedList.get(i)).getEncoding());			boolean redundant = false;			for (int j = 0; j < sdpSupportedCodecsList.size(); j++) {				if (sdpFormat == null){					redundant = true;					break;				}									else if (sdpFormat					.equalsIgnoreCase((String) sdpSupportedCodecsList.get(j))){					redundant = true;					break;				}								}			if (!redundant)				sdpSupportedCodecsList.addElement(sdpFormat);		}		for (int i = 0; i < sdpSupportedCodecsList.size(); i++)			System.out.println(sdpSupportedCodecsList.get(i));		return (String[]) sdpSupportedCodecsList.toArray(			new String[sdpSupportedCodecsList.size()]);	}	/**	 * get the supported video codecs in the sdp format	 * @return array of the video supported codecs	 */	public static String[] getSdpVideoSupportedCodecs() {		Vector sdpSupportedCodecsList = new Vector();		for (int i = 0; i < videoCodecSupportedList.size(); i++) {			String sdpFormat =				findCorrespondingSdpFormat(					((Format) videoCodecSupportedList.get(i)).getEncoding());			boolean redundant = false;			for (int j = 0; j < sdpSupportedCodecsList.size(); j++) {				if (sdpFormat == null){					redundant = true;					break;				}									else if (sdpFormat					.equalsIgnoreCase((String) sdpSupportedCodecsList.get(j))){					redundant = true;					break;				}								}			if (!redundant)				sdpSupportedCodecsList.addElement(sdpFormat);		}		return (String[]) sdpSupportedCodecsList.toArray(			new String[sdpSupportedCodecsList.size()]);	}	/**	 * Detects the supported codecs of the user agent depending of 	 * the devices connected to the computer	 */	public static void detectSupportedCodecs() {		audioCodecSupportedList = new Vector();		videoCodecSupportedList = new Vector();		MediaLocator audioLocator = null;		MediaLocator videoLocator = null;		CaptureDeviceInfo videoCDI = null;		CaptureDeviceInfo audioCDI = null;		Vector captureDevices = null;		captureDevices = CaptureDeviceManager.getDeviceList(null);		System.out.println(			"- number of capture devices: " + captureDevices.size());		CaptureDeviceInfo cdi = null;		for (int i = 0; i < captureDevices.size(); i++) {			cdi = (CaptureDeviceInfo) captureDevices.elementAt(i);			System.out.println(				"    - name of the capture device: " + cdi.getName());			Format[] formatArray = cdi.getFormats();			for (int j = 0; j < formatArray.length; j++) {				Format format = formatArray[j];				if (format instanceof VideoFormat) {					System.out.println(						"         - format accepted by this VIDEO device: "							+ format.toString().trim());					if (videoCDI == null) {						videoCDI = cdi;					}				} else if (format instanceof AudioFormat) {					System.out.println(						"         - format accepted by this AUDIO device: "							+ format.toString().trim());					if (audioCDI == null) {						audioCDI = cdi;					}				} else					System.out.println("         - format of type UNKNOWN");			}		}		if (videoCDI != null)			videoLocator = videoCDI.getLocator();		if (audioCDI != null)			audioLocator = audioCDI.getLocator();		DataSource audioDS = null;		DataSource videoDS = null;		DataSource mergeDS = null;		StateListener stateListener = new StateListener();		//create the DataSource		//it can be a 'video' DataSource, an 'audio' DataSource		//or a combination of audio and video by merging both		if (videoLocator == null && audioLocator == null)			return;		if (audioLocator != null) {			try {				//create the 'audio' DataSource				audioDS = javax.media.Manager.createDataSource(audioLocator);			} catch (Exception e) {				System.out.println(					"-> Couldn't connect to audio capture device");			}		}		if (videoLocator != null) {			try {				//create the 'video' DataSource				videoDS = javax.media.Manager.createDataSource(videoLocator);			} catch (Exception e) {				System.out.println(					"-> Couldn't connect to video capture device");			}		}		Processor processor = null;		if (videoDS != null && audioDS != null) {			try {				//create the 'audio' and 'video' DataSource				mergeDS =					javax.media.Manager.createMergingDataSource(						new DataSource[] { audioDS, videoDS });			} catch (Exception e) {				System.out.println(					"-> Couldn't connect to audio or video capture device");			}			try {				//Create the processor from the merging DataSource				processor = javax.media.Manager.createProcessor(mergeDS);			} catch (NoProcessorException npe) {				npe.printStackTrace();				return;			} catch (IOException ioe) {				ioe.printStackTrace();				return;			}		}		//if the processor has not been created from the merging DataSource		if (processor == null) {			try {				if (audioDS != null)					//Create the processor from the 'audio' DataSource					processor = javax.media.Manager.createProcessor(audioDS);				else					//Create the processor from the 'video' DataSource					processor = javax.media.Manager.createProcessor(videoDS);			} catch (NoProcessorException npe) {				npe.printStackTrace();				return;			} catch (IOException ioe) {				ioe.printStackTrace();				return;			}		}		// Wait for it to configure		boolean result =			stateListener.waitForState(processor, Processor.Configured);		if (result == false) {			System.out.println("Couldn't configure processor");			return;		}		// Get the tracks from the processor		TrackControl[] tracks = processor.getTrackControls();		// Do we have atleast one track?		if (tracks == null || tracks.length < 1) {			System.out.println("Couldn't find tracks in processor");			return;		}		// Set the output content descriptor to RAW_RTP		// This will limit the supported formats reported from		// Track.getSupportedFormats to only valid RTP formats.		ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP);		processor.setContentDescriptor(cd);		Format supported[];		Format chosen = null;		boolean atLeastOneTrack = false;		// Program the tracks.		for (int i = 0; i < tracks.length; i++) {			Format format = tracks[i].getFormat();			if (tracks[i].isEnabled()) {				supported = tracks[i].getSupportedFormats();				// We've set the output content to the RAW_RTP.				// So all the supported formats should work with RTP.            				if (supported.length > 0) {					for (int j = 0; j < supported.length; j++) {						System.out.println(							"Supported format : "								+ supported[j].toString().toLowerCase());						//Add to the list of video supported codec						if (supported[j] instanceof VideoFormat) {							videoCodecSupportedList.add(supported[j]);						}						//Add to the list of audio supported codec						else {							audioCodecSupportedList.add(supported[j]);						}					}				}			}		}		processor.stop();		processor.close();	}	/**	 * Start the media Session i.e. transmitting and receiving RTP stream	 * TODO : handle the sendonly, recvonly, sendrcv attributes of the SDP session	 */	public void startMediaSession(boolean transmitFirst) {		if (!started) {			startReceiving();			startTransmitting();			started = true;		}	}	/**	 * Stop the media Session i.e. transmitting and receiving RTP stream	 * TODO : handle the sendonly, recvonly, sendrcv attributes of the SDP session	 */	public void stopMediaSession() {		stopReceiving();		stopTransmitting();		started = false;	}	/**	 * Start receiving RTP stream	 */	protected void startReceiving() {		gov.nist.applet.phone.media.util.SessionDescription sessionDescription =			new gov.nist.applet.phone.media.util.SessionDescription();		sessionDescription.setAddress(remoteAddress);		sessionDescription.setDestinationPort(remoteAudioPort);		sessionDescription.setLocalPort(localAudioPort);		sessionDescription.setTransportProtocol("udp");		sessionDescription.setAudioFormat(negotiatedAudioCodec);		sessionDescription.setVideoFormat(negotiatedVideoCodec);		receiver = new Receiver(sessionDescription, transmit);		receiver.receive(callListener.getConfiguration().contactIPAddress);	}	/**	 * start transmitting RTP stream	 */	protected void startTransmitting() {		gov.nist.applet.phone.media.util.SessionDescription sessionDescription =			new gov.nist.applet.phone.media.util.SessionDescription();		sessionDescription.setAddress(remoteAddress);		sessionDescription.setLocalPort(remoteAudioPort);		sessionDescription.setDestinationPort(remoteAudioPort);		sessionDescription.setTransportProtocol("udp");		/*if(mediaTransport.equalsIgnoreCase("tcp"))		    sessionDescription.setAudioFormat("99");        		else*/		sessionDescription.setAudioFormat(negotiatedAudioCodec);		sessionDescription.setVideoFormat(negotiatedVideoCodec);		transmit = new Transmit(sessionDescription, receiver);		// Start the media transmission		String result =			transmit.start(callListener.getConfiguration().contactIPAddress);		System.out.println("Media Transmission started!!!");		// result will be non-null if there was an error. The return		// value is a String describing the possible error. Print it.		if (result != null) {			System.err.println("Error : " + result);			//System.exit(0);		}	}	/**	 * Stop transmitting RTP stream	 */	protected void stopTransmitting() {		if (transmit != null) {			System.out.println("Media Transmitter stopped!!!");			transmit.stop();		}	}	/**	 * Stop receiving RTP stream	 */	protected void stopReceiving() {		if (transmit != null) {			System.out.println("Media Receiver stopped!!!");			receiver.stop();		}	}	/**	 * Extracts from the sdp all the information to initiate the media session	 * @param incomingSdpBody - the sdp Body of the incoming call to negotiate the media session	 */	public void prepareMediaSession(String incomingSdpBody) {		SessionDescription sessionDescription = null;		try {			sessionDescription =				sdpFactory.createSessionDescription(incomingSdpBody);			//Get the remote address where the user agent has to connect to			Connection remoteConnection = sessionDescription.getConnection();			remoteAddress = remoteConnection.getAddress();		} catch (SdpParseException spe) {			spe.printStackTrace();		}		localAudioPort = getAudioPort();		localVideoPort = getVideoPort();		System.out.println("Local listening audio port : " + localAudioPort);		//Extract the codecs from the sdp session description		List audioCodecList = extractAudioCodecs(sessionDescription);		remoteAudioPort = getAudioPort(sessionDescription);		//printCodecs(audioCodecList);        		System.out.println("Remote listening audio port : " + remoteAudioPort);		List videoCodecList = extractVideoCodecs(sessionDescription);		remoteVideoPort = getVideoPort(sessionDescription);		//printCodecs(videoCodecList);		//System.out.println("Remote listening video port : "+remoteVideoPort);		negotiatedAudioCodec = negotiateAudioCodec(audioCodecList);		negotiatedVideoCodec = negotiateVideoCodec(videoCodecList);	}	/**	 * Getting the sdp body for creating the response to an incoming call	 * @param incomingSdpBody - the sdp Body of the incoming call to negotiate the media session	 * @return The sdp body that will present what codec has been chosen	 * and on which port every media will be received	 */	public Object getResponseSdpBody(String incomingSdpBody) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区三区免费看| 亚洲日本一区二区| 久久女同互慰一区二区三区| 国产午夜精品美女毛片视频| 亚洲欧美另类在线| 一二三区精品视频| 一区二区三区在线观看欧美| 奇米色一区二区| 国产自产2019最新不卡| 97久久超碰精品国产| 97精品久久久午夜一区二区三区| 欧美一区二区三区色| 久久麻豆一区二区| 亚洲黄色录像片| 日本不卡视频在线| 日本韩国欧美一区| 亚洲精品一区二区三区四区高清 | av一区二区久久| 欧美日韩久久久| 国产视频在线观看一区二区三区| 国产精品久久久久久久岛一牛影视 | 26uuu欧美| 亚洲视频一区在线观看| 一区二区三区日韩精品视频| 欧美aaa在线| 884aa四虎影成人精品一区| 国产日韩精品一区二区三区在线| 亚洲动漫第一页| 色偷偷一区二区三区| 国产亚洲一区二区三区| 日精品一区二区| 成人一区在线观看| 久久嫩草精品久久久精品| 日韩中文字幕麻豆| 91亚洲男人天堂| 亚洲欧洲日韩一区二区三区| 国产伦精品一区二区三区视频青涩| 欧美区在线观看| 亚洲国产中文字幕| 欧美日韩的一区二区| 一区二区三区四区在线| 99久久精品免费| 亚洲精品乱码久久久久| 波多野结衣91| 国产日韩高清在线| 免费精品视频最新在线| 在线综合视频播放| 亚洲福利一二三区| 欧美影院精品一区| 视频一区二区三区在线| 欧美日韩免费在线视频| 一区二区三区在线播放| 不卡av电影在线播放| 国产免费观看久久| 国产成人aaaa| 久久九九久精品国产免费直播| 不卡区在线中文字幕| 国产欧美日本一区二区三区| 成人午夜视频在线| 欧美国产亚洲另类动漫| 成人网在线免费视频| 久久久99精品免费观看不卡| 久久99精品久久久| 国产日产欧美精品一区二区三区| 国产成人在线看| 国产喷白浆一区二区三区| 日本乱人伦aⅴ精品| 亚洲乱码国产乱码精品精小说| 欧洲一区二区三区在线| 久久精品国产一区二区| 国产亚洲自拍一区| 粉嫩欧美一区二区三区高清影视| 国产精品久久看| 色先锋aa成人| 亚洲一二三专区| 日韩一区二区三区免费观看| 国产一区二区三区免费观看| 最新欧美精品一区二区三区| 精品视频在线视频| 美女尤物国产一区| 久久精品视频在线免费观看| 99久久免费视频.com| 综合电影一区二区三区| 欧美一区二区在线视频| 国产麻豆视频精品| 日韩久久一区二区| 欧美日韩电影在线播放| 久久99久久久久| 中文字幕一区二区三区乱码在线 | 久久伊人中文字幕| 一区二区三区中文字幕在线观看| 久久免费视频色| 欧美美女一区二区在线观看| 成人av网站在线观看| 精品无码三级在线观看视频| 亚洲一区二区精品视频| 国产欧美在线观看一区| 日韩丝袜情趣美女图片| 色乱码一区二区三区88| 国产乱色国产精品免费视频| 久久狠狠亚洲综合| 亚洲第一狼人社区| 一区二区三区四区视频精品免费| 中文字幕在线视频一区| 久久久99免费| 欧美成人r级一区二区三区| 欧美日韩一区二区三区高清| 91蝌蚪porny| av在线不卡免费看| youjizz久久| 国产aⅴ综合色| 国产在线视频一区二区三区| 久久99久久99精品免视看婷婷 | 亚洲欧洲成人精品av97| 精品88久久久久88久久久| 91精品国产综合久久香蕉麻豆| 欧美日韩专区在线| 91福利在线看| 91黄色激情网站| 色偷偷88欧美精品久久久| caoporm超碰国产精品| 99热精品国产| 91亚洲国产成人精品一区二三| 成人免费高清视频| 丁香网亚洲国际| 成人国产精品免费观看视频| www.亚洲在线| 色播五月激情综合网| 欧美日韩你懂的| 日韩美女一区二区三区四区| 久久久天堂av| 国产偷国产偷精品高清尤物| 日本一区二区电影| 国产精品理论片在线观看| 亚洲三级在线免费| 亚洲在线观看免费| 三级欧美韩日大片在线看| 美女一区二区视频| 国产一区在线精品| 成人永久aaa| 欧美在线你懂得| 欧美一区二区三区四区视频| 2023国产精华国产精品| 中文幕一区二区三区久久蜜桃| 亚洲综合视频网| 日韩av中文在线观看| 激情欧美日韩一区二区| 丁香婷婷综合激情五月色| 在线国产亚洲欧美| 91精品蜜臀在线一区尤物| 久久精品综合网| 亚洲国产综合在线| 美女视频免费一区| 国产传媒日韩欧美成人| 91蜜桃网址入口| 欧美一级久久久| 中文字幕一区二区在线播放| 日本一道高清亚洲日美韩| 国产99一区视频免费| 8v天堂国产在线一区二区| 中文字幕欧美国产| 偷拍亚洲欧洲综合| 成人av在线电影| 日韩视频在线永久播放| 国产精品国产三级国产普通话99 | 成人免费三级在线| 欧美性生活久久| 国产精品嫩草99a| 日韩国产欧美在线播放| 97精品国产露脸对白| 精品国产免费视频| 亚洲综合在线电影| 国产毛片一区二区| 在线播放视频一区| 亚洲欧洲精品一区二区三区不卡| 久久99久久99| 欧美一区二区三区精品| 一区二区三区.www| 成人app下载| 国产亚洲视频系列| 男女男精品网站| 欧美日韩久久久久久| 一区二区三区在线免费观看| 99久久久无码国产精品| 国产午夜三级一区二区三| 蜜臀av一级做a爰片久久| 欧美性xxxxxx少妇| 国产精品久久久久影院色老大| 韩国女主播成人在线| 欧美日韩激情一区二区| 亚洲裸体在线观看| 成人av在线网| 国产女人18毛片水真多成人如厕| 国产麻豆91精品| 久久久欧美精品sm网站 | 一区二区在线观看视频| 99在线精品免费| 国产精品麻豆网站| 成人福利视频网站| 国产精品女主播av|