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

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

?? transmit.java

?? 是一個用java實現的
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * Transmit.java
 *
 * Created on November 19, 2003, 10:38 AM
 */
package gov.nist.applet.phone.media.transmitter;

import java.awt.*;
import java.io.*;
import java.net.InetAddress;
import java.net.Socket;
import javax.media.*;
import java.util.*;
import javax.media.protocol.*;
import javax.media.protocol.DataSource;
import javax.media.format.*;
import javax.media.control.TrackControl;
import javax.media.control.QualityControl;
import javax.media.rtp.*;
import javax.media.rtp.rtcp.*;
import gov.nist.applet.phone.media.util.*;
import gov.nist.applet.phone.media.receiver.*;
import gov.nist.applet.phone.media.protocol.transport.*;

/**
 * Class to send RTP using the JMF RTP API.
 * @author DERUELLE Jean
 */
public class Transmit {
    private Processor processor = null;
    private RTPManager rtpMgrs[] = null;
    private DataSource dataOutput = null;
    private StateListener stateListener=null;
    private SessionDescription sessionDescription =null;
    private String session=null;
    private MediaLocator videoLocator=null;
    private MediaLocator audioLocator=null;
    private RTPManager rtpManager = null;
    private SessionAddress remoteAddress =null;
    private Receiver receiver=null;
    private Socket socketRTPTransmit=null;
    private Socket socketRTCPTransmit=null;
    /**
     * Constructor for Transmitter 
     * @param session - the concatened parameters of the session stored in a string
     */
    public Transmit(String session) throws IllegalArgumentException{
        this.session=session;
        stateListener=new StateListener();
        //the session Label containing the address, the port and the Time To Live
        try {
            //create a session label on the session given in argument
            // and parse the session address.
            sessionDescription =new SessionDescription(session);
            sessionDescription.setAudioFormat("6");
            sessionDescription.setVideoFormat("h263/rtp");
            sessionDescription.setTransportProtocol("udp");
        } catch (IllegalArgumentException e) {
            System.err.println("Failed to parse the session address given: " + session);
            throw e;
        }
        if(!initialize()){
            System.out.println("Bad Session intialization");
            //System.exit(0);
        }
    }

    /**
     * Constructor for Transmitter 
     * @param session - the session Description containing the address, the port, the Time To Live
     * the video format, the audio format and the transport protocol
     */
    public Transmit(SessionDescription session,Receiver receiver) {
        this.receiver=receiver;
        this.sessionDescription=session;
        stateListener=new StateListener();

        if(!initialize()){
            System.out.println("Bad Session intialization");
            //System.exit(0);
        }
    }

    /**
     * get the devices for the capture and print their formats
     * @return true if all has been initialized correctly
     */
    protected boolean initialize() {
        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();

        return true;
    }

    /**
     * Starts the transmission. Returns null if transmission started ok.
     * Otherwise it returns a string with the reason why the setup failed.
     */
    public synchronized String start(String localIpAddress) {
        String result;

        // Create a processor for the specified media locator
        // and program it to output JPEG/RTP
        result = createProcessor();
        if (result != null)
            return result;

        // Create an RTP session to transmit the output of the
        // processor to the specified IP address and port no.
        result = createTransmitter(localIpAddress);
        if (result != null) {
            processor.close();
            processor = null;
            return result;
        }

        // Start the transmission
        processor.start();

        return null;
    }

    /**
     * Stops the transmission if already started
     */
    public void stop() {
        synchronized (this) {
            if (processor != null) {
                processor.stop();
                processor.close();
                processor = null;                
            }
            if(rtpMgrs!=null){            
				for (int i = 0; i < rtpMgrs.length; i++) {
					if(rtpMgrs[i]!=null){
						rtpMgrs[i].removeTargets( "Session ended.");
						rtpMgrs[i].dispose();
						rtpMgrs[i]=null;
					}				
				}
            }
        }
    }

    /**
     * Creates the processor
     */
    private String createProcessor() {
        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 "Locator is null";
        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");
            }
        }
        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) {
                return "Couldn't create processor";
            } catch (IOException ioe) {
                return "IOException creating processor";
            } 
        }
        //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) {
                return "Couldn't create processor";
            } catch (IOException ioe) {
                return "IOException creating processor";
            } 
        }

        // Wait for it to configure
        boolean result = stateListener.waitForState(processor, Processor.Configured);
        if (result == false)
            return "Couldn't configure processor";

        // Get the tracks from the processor
        TrackControl [] tracks = processor.getTrackControls();

        // Do we have atleast one track?
        if (tracks == null || tracks.length < 1)
            return "Couldn't find tracks in processor";

        // 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()) {
                /*if (tracks[i] instanceof VideoFormat) 
                    System.out.println("Supported Video Formats :");
                else
                    System.out.println("Supported Audio Formats :");*/
                supported = tracks[i].getSupportedFormats();
                /*System.out.println("track : "+ i);
                for(int j=0;j<supported.length;j++)
                System.out.println("Supported format : "+supported[j].getEncoding());*/
                // 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());
                        if (supported[j] instanceof VideoFormat) {
                            // For video formats, we should double check the
                            // sizes since not all formats work in all sizes.
                            if(sessionDescription.getVideoFormat()!=null)
                                if(supported[j].toString().toLowerCase().indexOf(
                                    sessionDescription.getVideoFormat().toLowerCase())!=-1)
                                    chosen = checkForVideoSizes(tracks[i].getFormat(), 
                                                                supported[j]);
                        } else {
                            if(sessionDescription.getAudioFormat()!=null)
                                if(supported[j].toString().toLowerCase().indexOf(
                                sessionDescription.getAudioFormat().toLowerCase())!=-1)
                                    chosen = supported[j];  

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人手机电影网| 欧美精品一区二区高清在线观看| 精品国产伦一区二区三区观看体验| 五月综合激情婷婷六月色窝| 欧美日本在线一区| 捆绑调教一区二区三区| 欧美成人aa大片| 国产精品一二三区| 亚洲欧洲日本在线| 色狠狠av一区二区三区| 亚洲一区二区欧美| 正在播放亚洲一区| 国产精品亚洲人在线观看| 日韩一区日韩二区| 欧美日韩你懂得| 麻豆精品久久久| 国产精品久久久久久久久动漫| 色拍拍在线精品视频8848| 天堂在线亚洲视频| 欧美国产日韩a欧美在线观看| 一本一道久久a久久精品| 日av在线不卡| 亚洲人成伊人成综合网小说| 欧美综合亚洲图片综合区| 麻豆91小视频| 一区二区免费看| 久久影视一区二区| 欧美视频一二三区| 成人福利视频在线看| 日本中文字幕一区二区视频| 日韩理论片中文av| 中文一区二区完整视频在线观看| 欧美精品在欧美一区二区少妇| 国产精品一区一区| 日韩精品亚洲一区二区三区免费| 欧美激情一区不卡| 欧美精品一区二区三区在线 | 国产在线一区二区综合免费视频| 亚洲欧美日韩中文字幕一区二区三区| 日韩欧美的一区二区| 日本道免费精品一区二区三区| 成人综合在线视频| 国产精品一线二线三线| 精品亚洲国产成人av制服丝袜| 日韩高清不卡在线| 日韩电影在线观看网站| 亚洲二区在线观看| 日韩一区精品字幕| 国产成人在线免费| 蜜桃精品视频在线| 韩国一区二区三区| 国内精品伊人久久久久av影院 | 亚洲色欲色欲www| 国产精品美女久久久久久久网站| 久久亚洲捆绑美女| 欧美激情一区二区三区四区| 中文字幕 久热精品 视频在线| 亚洲国产精品二十页| 国产精品成人免费在线| 一区二区三区四区不卡在线| 亚洲精品免费在线| 亚洲成人av福利| 国产美女精品人人做人人爽| 99久久精品免费看国产免费软件| 欧美tickle裸体挠脚心vk| 日韩午夜av一区| 国产精品久久久久久久蜜臀 | 天天综合色天天综合色h| 久久精品国产第一区二区三区| 激情偷乱视频一区二区三区| 在线中文字幕不卡| 久久久精品中文字幕麻豆发布| 久久精品久久精品| 在线视频中文字幕一区二区| 精品欧美一区二区三区精品久久| 亚洲特黄一级片| 精品制服美女久久| 91国偷自产一区二区三区观看| 日韩精品一区二区三区四区视频| 亚洲视频你懂的| 国产成人av影院| 日韩精品在线一区| 午夜精品视频一区| 日本精品一级二级| 中文字幕欧美区| 国产乱码精品1区2区3区| 欧美高清一级片在线| 亚洲伦理在线精品| 成人av免费网站| 国产精品天美传媒| 国产精品系列在线播放| 日韩视频国产视频| 免费精品视频在线| 7777精品伊人久久久大香线蕉经典版下载 | 欧美美女一区二区在线观看| 亚洲精品伦理在线| 91亚洲大成网污www| 国产精品成人免费在线| bt7086福利一区国产| 国产精品久久久久久久久图文区| 成人免费看的视频| 欧美国产乱子伦 | 欧美午夜精品免费| 亚洲成av人片一区二区梦乃| 51精品久久久久久久蜜臀| 日韩高清不卡在线| 久久九九久久九九| 97se亚洲国产综合在线| 亚洲制服欧美中文字幕中文字幕| 欧美亚洲国产一区在线观看网站| 日韩专区中文字幕一区二区| 日韩欧美一二三四区| 国产乱一区二区| 亚洲欧美一区二区视频| 欧美一区二区三区播放老司机| 久久精品99久久久| 日韩电影免费在线观看网站| 久久综合999| 一本色道久久综合亚洲91| 丝袜诱惑亚洲看片| 欧美经典一区二区| 欧美一a一片一级一片| 国内一区二区在线| 一区二区成人在线视频| 久久久亚洲综合| 欧美肥大bbwbbw高潮| 99视频精品免费视频| 极品少妇xxxx偷拍精品少妇| 精品一区精品二区高清| 亚洲自拍偷拍麻豆| 亚洲欧洲色图综合| 国产亚洲美州欧州综合国| 欧美日韩dvd在线观看| 91免费观看视频在线| 国产一区亚洲一区| 蜜臀91精品一区二区三区| 一区二区三区高清| 中文字幕中文在线不卡住| 国产日韩av一区二区| 久久你懂得1024| 欧美成人在线直播| 欧美电影免费观看完整版| 日本一区二区久久| 精品电影一区二区| 久久精品水蜜桃av综合天堂| 日韩一区二区精品在线观看| 欧美性色黄大片手机版| 在线免费观看日韩欧美| 欧美亚洲动漫制服丝袜| 欧美日韩精品综合在线| 欧美裸体一区二区三区| 欧美一区二区性放荡片| 欧美xxxxx牲另类人与| 久久久久久久久岛国免费| 久久久久久久网| 国产精品久久久久久久久免费丝袜| 中文字幕+乱码+中文字幕一区| 中文字幕一区二区三区在线不卡| 欧美国产精品v| 亚洲一区二区三区四区五区黄 | 偷窥国产亚洲免费视频| 蜜桃视频一区二区三区在线观看 | 亚洲成av人**亚洲成av**| 五月综合激情日本mⅴ| 国产成人自拍网| 欧美日韩免费观看一区三区| 欧美成人猛片aaaaaaa| 中文字幕一区二区在线观看| 午夜视频一区在线观看| 精品一区二区三区在线观看国产 | 91免费精品国自产拍在线不卡| 欧美日韩在线播放| 国产日韩v精品一区二区| 亚洲mv大片欧洲mv大片精品| 国产精一品亚洲二区在线视频| 欧美亚洲国产一区在线观看网站 | 亚洲精品视频在线观看网站| 美女视频黄 久久| 91福利国产成人精品照片| 亚洲国产精品国自产拍av| 日韩精品成人一区二区在线| 97se狠狠狠综合亚洲狠狠| 欧美一级久久久| 日韩激情一区二区| 色婷婷久久久久swag精品| 久久久久亚洲综合| 成人黄页在线观看| 26uuu精品一区二区在线观看| 精品在线免费观看| 中文字幕亚洲区| 欧美亚洲另类激情小说| 一区二区三区加勒比av| 欧美高清视频一二三区| 偷拍与自拍一区| 久久久久久电影| a级高清视频欧美日韩| 亚洲美女视频在线| 91 com成人网| 国产精品一区三区| 亚洲柠檬福利资源导航|