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

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

?? avreceive3.java

?? JMF related for RTP streaming
?? JAVA
字號:
/* * @(#)AVReceive3.java	1.2 01/03/13 * * Copyright (c) 1999-2001 Sun Microsystems, Inc. All Rights Reserved. * * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use, * modify and redistribute this software in source and binary code form, * provided that i) this copyright notice and license appear on all copies of * the software; and ii) Licensee does not utilize the software in a manner * which is disparaging to Sun. * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * * This software is not designed or intended for use in on-line control of * aircraft, air traffic, aircraft navigation or aircraft communications; or in * the design, construction, operation or maintenance of any nuclear * facility. Licensee represents and warrants that it will not use or * redistribute the Software for such purposes. */package avtran_rec;import java.io.*;import java.awt.*;import java.net.*;import java.awt.event.*;import java.util.Vector;import javax.media.*;import javax.media.rtp.*;import javax.media.rtp.event.*;import javax.media.rtp.rtcp.*;import javax.media.protocol.*;import javax.media.protocol.DataSource;import javax.media.format.AudioFormat;import javax.media.format.VideoFormat;import javax.media.Format;import javax.media.format.FormatChangeEvent;import javax.media.control.BufferControl;import javax.swing.AbstractButton;import javax.swing.JButton;import javax.swing.JPanel;import javax.swing.JFrame;import javax.swing.ImageIcon;/** * AVReceive3 to receive RTP transmission using the RTPConnector. */public class AVReceive3 implements ReceiveStreamListener, SessionListener, 	ControllerListener{    String sessions[] = null;    RTPManager mgrs[] = null;    Vector playerWindows = null;    boolean dataReceived = false;    Object dataSync = new Object();    JFrame frame;    public AVReceive3(String sessions[], JFrame f) {	this.sessions = sessions;        frame=f;    }    protected boolean initialize() {        try {	    mgrs = new RTPManager[sessions.length];	    playerWindows = new Vector();	    SessionLabel session;	    // Open the RTP sessions.	    for (int i = 0; i < sessions.length; i++) {	 	// Parse the session addresses.		try {		    session = new SessionLabel(sessions[i]);		} catch (IllegalArgumentException e) {		    System.err.println("Failed to parse the session address given: " + sessions[i]);		    return false;		}		System.err.println("  - Open RTP session for: addr: " + session.addr + " port: " + session.port + " ttl: " + session.ttl);		mgrs[i] = (RTPManager) RTPManager.newInstance();		mgrs[i].addSessionListener(this);		mgrs[i].addReceiveStreamListener(this);		// Initialize the RTPManager with the RTPSocketAdapter		mgrs[i].initialize(new RTPSocketAdapter(					InetAddress.getByName(session.addr), 					session.port, session.ttl));		// You can try out some other buffer size to see		// if you can get better smoothness.		BufferControl bc = (BufferControl)mgrs[i].getControl("javax.media.control.BufferControl");		if (bc != null)		    bc.setBufferLength(350);	    }        } catch (Exception e){            System.err.println("Cannot create the RTP Session: " + e.getMessage());            return false;        }	// Wait for data to arrive before moving on.	long then = System.currentTimeMillis();	long waitingPeriod = 30000;  // wait for a maximum of 30 secs.	try{	    synchronized (dataSync) {		while (!dataReceived && 			System.currentTimeMillis() - then < waitingPeriod) {		    if (!dataReceived)			System.err.println("  - Waiting for RTP data to arrive...");		    dataSync.wait(1000);		}	    }	} catch (Exception e) {}	if (!dataReceived) {	    System.err.println("No RTP data was received.");	    close();	    return false;	}        return true;    }    public boolean isDone() {	return playerWindows.size() == 0;    }    /**     * Close the players and the session managers.     */    protected void close() {	for (int i = 0; i < playerWindows.size(); i++) {	    try {	//	((PlayerWindow)playerWindows.elementAt(i)).close();	    } catch (Exception e) {}	}	playerWindows.removeAllElements();	// close the RTP session.	for (int i = 0; i < mgrs.length; i++) {	    if (mgrs[i] != null) {                mgrs[i].removeTargets( "Closing session from AVReceive3");                mgrs[i].dispose();		mgrs[i] = null;	    }	}    }    PlayerWindow find(Player p) {	for (int i = 0; i < playerWindows.size(); i++) {	    PlayerWindow pw = (PlayerWindow)playerWindows.elementAt(i);	    if (pw.player == p)		return pw;	}	return null;    }    PlayerWindow find(ReceiveStream strm) {	for (int i = 0; i < playerWindows.size(); i++) {	    PlayerWindow pw = (PlayerWindow)playerWindows.elementAt(i);	    if (pw.stream == strm)		return pw;	}	return null;    }    /**     * SessionListener.     */    public synchronized void update(SessionEvent evt) {	if (evt instanceof NewParticipantEvent) {	    Participant p = ((NewParticipantEvent)evt).getParticipant();	    System.err.println("  - A new participant had just joined: " + p.getCNAME());	}    }    /**     * ReceiveStreamListener     */    public synchronized void update( ReceiveStreamEvent evt) {	RTPManager mgr = (RTPManager)evt.getSource();	Participant participant = evt.getParticipant();	// could be null.	ReceiveStream stream = evt.getReceiveStream();  // could be null.	if (evt instanceof RemotePayloadChangeEvent) {     	    System.err.println("  - Received an RTP PayloadChangeEvent.");	    System.err.println("Sorry, cannot handle payload change.");	    System.exit(0);	}    	else if (evt instanceof NewReceiveStreamEvent) {	    try {		stream = ((NewReceiveStreamEvent)evt).getReceiveStream();		DataSource ds = stream.getDataSource();		// Find out the formats.		RTPControl ctl = (RTPControl)ds.getControl("javax.media.rtp.RTPControl");		if (ctl != null){		    System.err.println("  - Recevied new RTP stream: " + ctl.getFormat());		} else		    System.err.println("  - Recevied new RTP stream");		if (participant == null)		    System.err.println("      The sender of this stream had yet to be identified.");		else {		    System.err.println("      The stream comes from: " + participant.getCNAME()); 		}		// create a player by passing datasource to the Media Manager		Player p = javax.media.Manager.createPlayer(ds);		if (p == null)		    return;		p.addControllerListener(this);		p.realize();                // added by hang to check time base              //  p.prefetch();		PlayerWindow pw = new PlayerWindow(p, stream, frame);            	playerWindows.addElement(pw);		// Notify intialize() that a new stream had arrived.		synchronized (dataSync) {		    dataReceived = true;		    dataSync.notifyAll();		}	    } catch (Exception e) {		System.err.println("NewReceiveStreamEvent exception " + e.getMessage());		return;	    }        	}	else if (evt instanceof StreamMappedEvent) {	     if (stream != null && stream.getDataSource() != null) {		DataSource ds = stream.getDataSource();		// Find out the formats.		RTPControl ctl = (RTPControl)ds.getControl("javax.media.rtp.RTPControl");		System.err.println("  - The previously unidentified stream ");		if (ctl != null)		    System.err.println("      " + ctl.getFormat());		System.err.println("      had now been identified as sent by: " + participant.getCNAME());	     }	}	else if (evt instanceof ByeEvent) {	     System.err.println("  - Got \"bye\" from: " + participant.getCNAME());	     PlayerWindow pw = find(stream);	     if (pw != null) {	//	pw.close();		playerWindows.removeElement(pw);	     }	}    }    /**     * ControllerListener for the Players.     */    public synchronized void controllerUpdate(ControllerEvent ce) {	Player p = (Player)ce.getSourceController();        	if (p == null)	    return;	// Get this when the internal players are realized.	if (ce instanceof RealizeCompleteEvent) {	    PlayerWindow pw = find(p);	    if (pw == null) {		// Some strange happened.		System.err.println("Internal error!");		System.exit(-1);	    }	    pw.initialize();            frame.setVisible(true);            frame.repaint();            if (playerWindows.size()!=0) {                    try                    {                            PlayerWindow pw_temp = (PlayerWindow)playerWindows.elementAt(0);                               p.setTimeBase(pw_temp.getPlayer().getTimeBase());                    }                     catch (IncompatibleTimeBaseException e)                    {                   //error                        System.out.println("cannot get timebase");                     }            }	    p.start();                     frame.setVisible(true);            frame.repaint();	}	if (ce instanceof ControllerErrorEvent) {	    p.removeControllerListener(this);	    PlayerWindow pw = find(p);	    if (pw != null) {		//pw.close();			playerWindows.removeElement(pw);	    }	    System.err.println("AVReceive3 internal error: " + ce);	}    }    /**     * A utility class to parse the session addresses.     */    class SessionLabel {	public String addr = null;	public int port;	public int ttl = 1;	SessionLabel(String session) throws IllegalArgumentException {	    int off;	    String portStr = null, ttlStr = null;	    if (session != null && session.length() > 0) {		while (session.length() > 1 && session.charAt(0) == '/')		    session = session.substring(1);		// Now see if there's a addr specified.		off = session.indexOf('/');		if (off == -1) {		    if (!session.equals(""))			addr = session;		} else {		    addr = session.substring(0, off);		    session = session.substring(off + 1);		    // Now see if there's a port specified		    off = session.indexOf('/');		    if (off == -1) {			if (!session.equals(""))			    portStr = session;		    } else {			portStr = session.substring(0, off);			session = session.substring(off + 1);			// Now see if there's a ttl specified			off = session.indexOf('/');			if (off == -1) {			    if (!session.equals(""))				ttlStr = session;			} else {			    ttlStr = session.substring(0, off);			}		    }		}	    }	    if (addr == null)		throw new IllegalArgumentException();	    if (portStr != null) {		try {		    Integer integer = Integer.valueOf(portStr);		    if (integer != null)			port = integer.intValue();		} catch (Throwable t) {		    throw new IllegalArgumentException();		}	    } else		throw new IllegalArgumentException();	    if (ttlStr != null) {		try {		    Integer integer = Integer.valueOf(ttlStr);		    if (integer != null)			ttl = integer.intValue();		} catch (Throwable t) {		    throw new IllegalArgumentException();		}	    }	}    }    /**     * GUI classes for the Player.     */    class PlayerWindow {	Player player;	ReceiveStream stream;        JFrame frame;         boolean opened=false; // hang to add new panel	PlayerWindow(Player p, ReceiveStream strm, JFrame f) {	    player = p;	    stream = strm;            frame = f;	}        	public void initialize() {	    frame.add(new PlayerPanel(player));            frame.setVisible(true);            frame.repaint();	}                public Player getPlayer() {            return player;        }//	public void close() {	//    player.close();	//    setVisible(false);	//    dispose();      //      opened=false;   // hang opern	//}//	public void addNotify() {	//   frame.addNotify();     //      frame.setVisible(true);	//   frame.pack();	//}    }    /**     * GUI classes for the Player.     */    class PlayerPanel extends Panel {	Component vc, cc;	PlayerPanel(Player p) {	    setLayout(new FlowLayout());            if ((vc = p.getVisualComponent()) != null)		add(vc);	    if ((cc = p.getControlPanelComponent()) != null)		add(cc);	}	public Dimension getPreferredSize() {	    int w = 0, h = 0;	    if (vc != null) {		Dimension size = vc.getPreferredSize();		w = size.width;		h = size.height;	    }	    if (cc != null) {		Dimension size = cc.getPreferredSize();		if (w == 0)		    w = size.width;		h += size.height;	    }	    if (w < 160)		w = 160;	    return new Dimension(w, h);	}    }   // public static void main(String argv[]) {//	if (argv.length == 0)//	    prUsage();//	AVReceive3 avReceive = new AVReceive3(argv, frame);//	if (!avReceive.initialize()) {//	    System.err.println("Failed to initialize the sessions.");//	    System.exit(-1);//	}////	// Check to see if AVReceive3 is done.///	try {//	    while (!avReceive.isDone())//		Thread.sleep(1000);//	} catch (Exception e) {}//	System.err.println("Exiting AVReceive3"); //   }    static void prUsage() {	System.err.println("Usage: AVReceive3 <session> <session> ...");	System.err.println("     <session>: <address>/<port>/<ttl>");	System.exit(0);    }}// end of AVReceive3 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美成人欧美edvon| 91在线观看视频| 玉足女爽爽91| 国产精品成人一区二区艾草| 国产午夜精品一区二区| 久久久国际精品| 国产欧美一区二区精品秋霞影院| 久久久久88色偷偷免费| 国产偷v国产偷v亚洲高清| 国产亚洲精品超碰| 亚洲天堂网中文字| 中文字幕一区二区三区在线观看 | 国产精品99久久久| 国内久久精品视频| 成人午夜电影小说| 91亚洲精品久久久蜜桃网站| 色欧美片视频在线观看| 欧美日韩一区二区在线观看视频| 91精品国产91久久久久久最新毛片 | 毛片av中文字幕一区二区| 麻豆精品久久精品色综合| 国产一区中文字幕| 91女人视频在线观看| 欧美日韩久久久| 日韩免费一区二区三区在线播放| 久久久亚洲国产美女国产盗摄| 国产精品欧美一区二区三区| 一区二区三区日韩欧美| 美女视频免费一区| 成人av免费在线播放| 欧美日韩视频在线一区二区| 精品美女在线观看| 亚洲同性同志一二三专区| 免费一区二区视频| 成人看片黄a免费看在线| 欧美日韩国产片| 欧美经典一区二区| 日韩影院精彩在线| 成人av免费网站| 日韩三级电影网址| 亚洲蜜桃精久久久久久久| 麻豆国产精品777777在线| 99这里只有精品| 精品国产免费人成在线观看| 一区二区三区产品免费精品久久75| 免费人成黄页网站在线一区二区| 99国内精品久久| 欧美成人性战久久| 亚洲va欧美va国产va天堂影院| 国产精品77777| 欧美一区三区四区| 亚洲黄网站在线观看| 国产精品一区一区三区| 日韩无一区二区| 亚洲一区在线观看网站| 不卡一区二区三区四区| 精品美女一区二区三区| 午夜一区二区三区在线观看| 成人av在线资源| 久久久激情视频| 国产综合色精品一区二区三区| 3d动漫精品啪啪1区2区免费| 亚洲美女精品一区| 91在线小视频| 国产精品久久久久桃色tv| 国产成人av影院| 久久久久久久久久久久久久久99| 蜜桃久久久久久| 91精品国产美女浴室洗澡无遮挡| 香蕉加勒比综合久久| 欧洲视频一区二区| 亚洲综合精品久久| 欧美三级电影在线看| 亚洲中国最大av网站| 在线观看亚洲专区| 艳妇臀荡乳欲伦亚洲一区| 日本道色综合久久| 亚洲一线二线三线视频| 在线免费视频一区二区| 亚洲一区av在线| 欧美日韩国产乱码电影| 午夜精品福利一区二区三区蜜桃| 欧美日本一区二区在线观看| 无吗不卡中文字幕| 日韩欧美亚洲国产另类| 久久99热这里只有精品| 久久亚洲精品小早川怜子| 国产成人亚洲精品狼色在线| 中文子幕无线码一区tr| 91视频在线观看免费| 亚洲最大的成人av| 91精品国产全国免费观看| 激情久久久久久久久久久久久久久久| 26uuu色噜噜精品一区二区| 盗摄精品av一区二区三区| 亚洲三级电影全部在线观看高清| 色婷婷av一区二区三区大白胸| 亚洲福利视频三区| 1024国产精品| 欧美日韩视频不卡| 国产精一区二区三区| 中文字幕一区二区三区蜜月| 欧美日韩精品免费观看视频| 久久国产欧美日韩精品| 1区2区3区欧美| 欧美福利一区二区| 国产69精品一区二区亚洲孕妇| 亚洲色图丝袜美腿| 欧美一区二区高清| 成人激情午夜影院| 天堂影院一区二区| 国产情人综合久久777777| 欧洲一区在线观看| 国产精品99久久久| 日韩激情一区二区| √…a在线天堂一区| 日韩欧美的一区| 在线国产电影不卡| 国产成都精品91一区二区三| 亚洲高清免费观看| 国产精品国产自产拍在线| 91精品视频网| 91久久精品一区二区三区| 国内久久精品视频| 日日夜夜精品免费视频| 中文字幕亚洲视频| 久久丝袜美腿综合| 在线综合视频播放| 在线亚洲一区二区| 懂色av一区二区三区蜜臀| 麻豆一区二区在线| 亚洲一区二区三区在线播放| 中文字幕不卡的av| 精品国产一区a| 制服.丝袜.亚洲.另类.中文| 91麻豆精东视频| 9久草视频在线视频精品| 国产精品主播直播| 久久精品国产精品亚洲红杏| 丝袜美腿亚洲一区二区图片| 亚洲欧美经典视频| 1区2区3区精品视频| 亚洲激情图片一区| 国产精品欧美久久久久一区二区| 精品免费国产一区二区三区四区| 9191成人精品久久| 欧美亚洲高清一区| 91激情在线视频| 色先锋久久av资源部| 99久久99久久精品国产片果冻| 国产91对白在线观看九色| 国产九九视频一区二区三区| 国产另类ts人妖一区二区| 寂寞少妇一区二区三区| 激情五月婷婷综合| 国产美女主播视频一区| 国产精品综合在线视频| 国产一区二区三区免费| 国产精品自在在线| 国产91丝袜在线播放九色| 成人一级片网址| 99精品视频一区二区| 色哟哟精品一区| 欧美视频精品在线| 在线成人小视频| 精品理论电影在线观看| 国产日韩欧美亚洲| 亚洲色欲色欲www在线观看| 亚洲激情六月丁香| 青青草原综合久久大伊人精品| 裸体健美xxxx欧美裸体表演| 国产麻豆成人传媒免费观看| 成人精品电影在线观看| 日本福利一区二区| 日韩一区二区麻豆国产| 国产亚洲一二三区| 国产在线播放一区| jvid福利写真一区二区三区| 日本韩国一区二区三区| 91精品啪在线观看国产60岁| wwwwww.欧美系列| 亚洲品质自拍视频| 免费观看成人av| 国产精品一二三在| 欧美婷婷六月丁香综合色| 日韩精品一区在线| 综合久久国产九一剧情麻豆| 午夜精品久久久| 国产高清一区日本| 欧美午夜寂寞影院| 久久天天做天天爱综合色| 亚洲综合色区另类av| 国产麻豆精品一区二区| 欧美日韩中文字幕一区| 久久久www免费人成精品| 亚洲综合自拍偷拍| 国产aⅴ综合色| 91精品国产欧美一区二区成人 | 亚洲一区自拍偷拍| 国产精品1024|