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

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

?? avtransmit3.java

?? jmf視頻語音開發
?? JAVA
字號:
import java.awt.*;
import java.io.*;
import java.net.InetAddress;
import javax.media.*;
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 com.sun.media.rtp.*;

public class AVTransmit3 {

    // Input MediaLocator
    // Can be a file or http or capture source
    private MediaLocator locator;
    private String ipAddress;
    private int portBase;

    private Processor processor = null;
    private RTPManager rtpMgrs[];
    private DataSource dataOutput = null;
    
    public AVTransmit3(MediaLocator locator,
             String ipAddress,
             String pb,
             Format format) {
    
    this.locator = locator;
    this.ipAddress = ipAddress;
    Integer integer = Integer.valueOf(pb);
    if (integer != null)
        this.portBase = integer.intValue();
    }

    /**
     * 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 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();
    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;
        for (int i = 0; i < rtpMgrs.length; i++) {
            rtpMgrs[i].removeTargets( "Session ended.");
            rtpMgrs[i].dispose();
        }
        }
    }
    }

    private String createProcessor() {
    if (locator == null)
        return "Locator is null";

    DataSource ds;
    DataSource clone;

    try {
        ds = javax.media.Manager.createDataSource(locator);
    } catch (Exception e) {
        return "Couldn't create DataSource";
    }

    // Try to create a processor to handle the input media locator
    try {
        processor = javax.media.Manager.createProcessor(ds);
    } catch (NoProcessorException npe) {
        return "Couldn't create processor";
    } catch (IOException ioe) {
        return "IOException creating processor";
    } 

    // Wait for it to configure
    boolean result = 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;
    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.
        // We'll just pick the first one.

        if (supported.length > 0) {
            if (supported[0] instanceof VideoFormat) {
            // For video formats, we should double check the
            // sizes since not all formats work in all sizes.
            chosen = checkForVideoSizes(tracks[i].getFormat(), 
                            supported[0]);
            } else
            chosen = supported[0];
            tracks[i].setFormat(chosen);
            System.err.println("Track " + i + " is set to transmit as:");
            System.err.println("  " + chosen);
            atLeastOneTrack = true;
        } else
            tracks[i].setEnabled(false);
        } else
        tracks[i].setEnabled(false);
    }

    if (!atLeastOneTrack)
        return "Couldn't set any of the tracks to a valid RTP format";

    // Realize the processor. This will internally create a flow
    // graph and attempt to create an output datasource for JPEG/RTP
    // audio frames.
    result = waitForState(processor, Controller.Realized);
    if (result == false)
        return "Couldn't realize processor";

    // Set the JPEG quality to .5.
    setJPEGQuality(processor, 0.5f);

    // Get the output data source of the processor
    dataOutput = processor.getDataOutput();

    return null;
    }


    /**
     * Use the RTPManager API to create sessions for each media 
     * track of the processor.
     */
    private String createTransmitter() {

    // Cheated.  Should have checked the type.
    PushBufferDataSource pbds = (PushBufferDataSource)dataOutput;
    PushBufferStream pbss[] = pbds.getStreams();

    rtpMgrs = new RTPManager[pbss.length];
    SendStream sendStream;
    int port;
    SourceDescription srcDesList[];

    for (int i = 0; i < pbss.length; i++) {
        try {
        rtpMgrs[i] = RTPManager.newInstance();        

        port = portBase + 2*i;
        
        // Initialize the RTPManager with the RTPSocketAdapter
        rtpMgrs[i].initialize(new RTPSocketAdapter(
                    InetAddress.getByName(ipAddress), 
                    port));

        System.err.println( "Created RTP session: " + ipAddress + " " + port);
        
        sendStream = rtpMgrs[i].createSendStream(dataOutput, i);        
        sendStream.start();
        } catch (Exception  e) {
        return e.getMessage();
        }
    }

    return null;
    }


    /**
     * For JPEG and H263, we know that they only work for particular
     * sizes.  So we'll perform extra checking here to make sure they
     * are of the right sizes.
     */
    Format checkForVideoSizes(Format original, Format supported) {

    int width, height;
    Dimension size = ((VideoFormat)original).getSize();
    Format jpegFmt = new Format(VideoFormat.JPEG_RTP);
    Format h263Fmt = new Format(VideoFormat.H263_RTP);

    if (supported.matches(jpegFmt)) {
        // For JPEG, make sure width and height are divisible by 8.
        width = (size.width % 8 == 0 ? size.width :
                (int)(size.width / 8) * 8);
        height = (size.height % 8 == 0 ? size.height :
                (int)(size.height / 8) * 8);
    } else if (supported.matches(h263Fmt)) {
        // For H.263, we only support some specific sizes.
        if (size.width < 128) {
        width = 128;
        height = 96;
        } else if (size.width < 176) {
        width = 176;
        height = 144;
        } else {
        width = 352;
        height = 288;
        }
    } else {
        // We don't know this particular format.  We'll just
        // leave it alone then.
        return supported;
    }

    return (new VideoFormat(null, 
                new Dimension(width, height), 
                Format.NOT_SPECIFIED,
                null,
                Format.NOT_SPECIFIED)).intersects(supported);
    }


    /**
     * Setting the encoding quality to the specified value on the JPEG encoder.
     * 0.5 is a good default.
     */
    void setJPEGQuality(Player p, float val) {

    Control cs[] = p.getControls();
    QualityControl qc = null;
    VideoFormat jpegFmt = new VideoFormat(VideoFormat.JPEG);

    // Loop through the controls to find the Quality control for
     // the JPEG encoder.
    for (int i = 0; i < cs.length; i++) {

        if (cs[i] instanceof QualityControl &&
        cs[i] instanceof Owned) {
        Object owner = ((Owned)cs[i]).getOwner();

        // Check to see if the owner is a Codec.
        // Then check for the output format.
        if (owner instanceof Codec) {
            Format fmts[] = ((Codec)owner).getSupportedOutputFormats(null);
            for (int j = 0; j < fmts.length; j++) {
            if (fmts[j].matches(jpegFmt)) {
                qc = (QualityControl)cs[i];
                    qc.setQuality(val);
                System.err.println("- Setting quality to " + 
                    val + " on " + qc);
                break;
            }
            }
        }
        if (qc != null)
            break;
        }
    }
    }


    /****************************************************************
     * Convenience methods to handle processor's state changes.
     ****************************************************************/
    
    private Integer stateLock = new Integer(0);
    private boolean failed = false;
    
    Integer getStateLock() {
    return stateLock;
    }

    void setFailed() {
    failed = true;
    }
    
    private synchronized boolean waitForState(Processor p, int state) {
    p.addControllerListener(new StateListener());
    failed = false;

    // Call the required method on the processor
    if (state == Processor.Configured) {
        p.configure();
    } else if (state == Processor.Realized) {
        p.realize();
    }
    
    // Wait until we get an event that confirms the
    // success of the method, or a failure event.
    // See StateListener inner class
    while (p.getState() < state && !failed) {
        synchronized (getStateLock()) {
        try {
            getStateLock().wait();
        } catch (InterruptedException ie) {
            return false;
        }
        }
    }

    if (failed)
        return false;
    else
        return true;
    }

    /****************************************************************
     * Inner Classes
     ****************************************************************/

    class StateListener implements ControllerListener {

    public void controllerUpdate(ControllerEvent ce) {

        // If there was an error during configure or
        // realize, the processor will be closed
        if (ce instanceof ControllerClosedEvent)
        setFailed();

        // All controller events, send a notification
        // to the waiting thread in waitForState method.
        if (ce instanceof ControllerEvent) {
        synchronized (getStateLock()) {
            getStateLock().notifyAll();
        }
        }
    }
    }


    /****************************************************************
     * Sample Usage for AVTransmit3 class
     ****************************************************************/
    
    public static void main(String [] args) {
    // We need three parameters to do the transmission
    // For example,
    //   java AVTransmit3 file:/C:/media/test.mov  129.130.131.132 42050
    
    if (args.length < 3) {
        prUsage();
    }

    Format fmt = null;
    int i = 0;

    // Create a audio transmit object with the specified params.
    AVTransmit3 at = new AVTransmit3(new MediaLocator(args[i]),
                         args[i+1], args[i+2], fmt);
    // Start the transmission
    String result = at.start();

    // 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);
    }
    
    System.err.println("Start transmission for 60 seconds");

    // Transmit for 60 seconds and then close the processor
    // This is a safeguard when using a capture data source
    // so that the capture device will be properly released
    // before quitting.
    // The right thing to do would be to have a GUI with a
    // "Stop" button that would call stop on AVTransmit3
    try {
        Thread.currentThread().sleep(60000);
    } catch (InterruptedException ie) {
    }

    // Stop the transmission
    at.stop();
    
    System.err.println("transmission ended.");

    System.exit(0);
    }


    static void prUsage() {
    System.err.println("Usage: AVTransmit3 <sourceURL> <destIP> <destPortBase>");
    System.err.println("     <sourceURL>: input URL or file name");
    System.err.println("     <destIP>: multicast, broadcast or unicast IP address for the transmission");
    System.err.println("     <destPortBase>: network port numbers for the transmission.");
    System.err.println("                     The first track will use the destPortBase.");
    System.err.println("                     The next track will use destPortBase + 2 and so on.\n");
    System.exit(0);
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线观看www91| 岛国一区二区在线观看| 一区二区三区中文字幕精品精品 | 欧美视频一区二区在线观看| 99re视频精品| 91美女视频网站| 91丨九色porny丨蝌蚪| 91在线免费看| 色综合中文综合网| 国产精品麻豆一区二区| 国产视频一区二区在线观看| 国产亚洲成av人在线观看导航| 久久久一区二区三区捆绑**| 国产欧美日韩不卡| 亚洲欧美视频一区| 亚洲成av人片一区二区| 日韩一区精品视频| 九色porny丨国产精品| 国产精品99久| 91丨porny丨最新| 91精品国产一区二区| 精品欧美一区二区在线观看| 国产日韩精品一区| 17c精品麻豆一区二区免费| 一区二区三区欧美在线观看| 欧美aaa在线| 成人av影院在线| 欧美三级在线看| 久久综合99re88久久爱| 亚洲色欲色欲www在线观看| 婷婷久久综合九色国产成人| 精品一二三四在线| 在线一区二区三区| 久久久激情视频| 日韩高清在线电影| 成人国产在线观看| 日韩欧美电影一区| 亚洲最新视频在线观看| 国产剧情在线观看一区二区| 欧美在线看片a免费观看| 精品国产91亚洲一区二区三区婷婷| 国产网红主播福利一区二区| 亚洲成人激情自拍| 国产成人免费高清| 欧美一级免费大片| 尤物视频一区二区| 精品一区二区三区不卡 | 国产一区二区福利| 波多野结衣亚洲一区| 91精品一区二区三区在线观看| 国产精品久久久久久妇女6080 | 亚洲成a人在线观看| 国产v综合v亚洲欧| 日韩欧美成人激情| 亚洲一区成人在线| 99热在这里有精品免费| 亚洲精品一区二区三区四区高清| 色欧美片视频在线观看在线视频| 欧美群妇大交群中文字幕| 中文字幕国产一区| 国产乱人伦偷精品视频免下载| 在线免费亚洲电影| 国产精品免费丝袜| 激情综合一区二区三区| 日韩欧美一区在线观看| 亚洲成人在线网站| 色噜噜狠狠色综合中国| 欧美经典一区二区| 国产一区二区在线观看免费 | 欧美xxxxx牲另类人与| 亚洲成人黄色小说| 色偷偷88欧美精品久久久| 国产精品亲子乱子伦xxxx裸| 国产精品伊人色| 久久久久久99久久久精品网站| 麻豆精品视频在线观看免费 | 国产精品自在在线| 久久亚洲一级片| 国产一区日韩二区欧美三区| 日韩欧美高清dvd碟片| 久久精工是国产品牌吗| 日韩欧美一区二区在线视频| 日韩激情在线观看| 日韩你懂的电影在线观看| 免费成人在线观看| 日韩欧美一级精品久久| 国产风韵犹存在线视精品| 精品国产三级电影在线观看| 国产精品一区在线观看乱码| 国产日韩欧美激情| 成人ar影院免费观看视频| 中文字幕亚洲在| 91精品办公室少妇高潮对白| 亚洲国产欧美日韩另类综合| 欧美一区二区三区性视频| 另类综合日韩欧美亚洲| 欧美激情中文字幕一区二区| 色综合天天综合网天天狠天天| 亚洲精品免费在线| 欧美精品久久久久久久多人混战 | 亚洲成人av资源| 亚洲精品一区二区在线观看| 成人精品免费网站| 亚洲一区影音先锋| 26uuu精品一区二区| 99麻豆久久久国产精品免费优播| 亚洲亚洲精品在线观看| 精品va天堂亚洲国产| 成人动漫av在线| 日韩专区中文字幕一区二区| 国产亚洲一区二区三区| 一本色道久久综合狠狠躁的推荐| 日本网站在线观看一区二区三区| 日本一区二区视频在线| 欧美在线影院一区二区| 国产在线精品一区二区夜色| 亚洲欧洲国产专区| 日韩欧美高清一区| 欧美偷拍一区二区| 国产成人精品午夜视频免费| 亚洲国产精品久久久男人的天堂| 精品日产卡一卡二卡麻豆| 色94色欧美sute亚洲13| 国内成+人亚洲+欧美+综合在线| 日韩理论片在线| 欧美精品一区二区三区在线| 欧美色精品在线视频| 国产a久久麻豆| 美女任你摸久久| 亚洲电影激情视频网站| 久久精品亚洲精品国产欧美| 91精品一区二区三区在线观看| 色一区在线观看| 成人午夜电影小说| 精品一区二区在线视频| 日本欧美一区二区三区乱码| 亚洲精品国产a| 国产精品乱码人人做人人爱| 欧美zozozo| 精品欧美一区二区在线观看| 91麻豆精品国产91久久久资源速度| 99精品欧美一区二区三区小说 | 欧洲日韩一区二区三区| 国产一区二区三区高清播放| 美国十次综合导航| 蜜臀av性久久久久蜜臀aⅴ| 午夜精品久久一牛影视| 综合在线观看色| 国产精品久久三| 中国色在线观看另类| 国产日产欧美一区二区视频| 久久一区二区三区四区| 国产精品欧美久久久久一区二区| 欧美成人a在线| 2024国产精品| 久久九九全国免费| 国产精品看片你懂得| 欧美高清在线视频| 成人欧美一区二区三区视频网页 | 欧美在线你懂的| 欧美在线你懂得| 56国语精品自产拍在线观看| 欧美日本一区二区在线观看| 欧美欧美欧美欧美首页| 7777精品伊人久久久大香线蕉的| 欧美一区二区三区四区五区| 欧美v国产在线一区二区三区| 欧美一区二区久久久| 日韩一级免费观看| 久久人人97超碰com| 国产精品国产三级国产普通话99| 国产精品网站在线| 亚洲欧美视频在线观看| 午夜电影网亚洲视频| 麻豆精品一区二区综合av| 国产成人综合网| 一本色道**综合亚洲精品蜜桃冫| 欧美亚洲免费在线一区| 日韩精品综合一本久道在线视频| 国产人成一区二区三区影院| 国产精品久久毛片a| 天堂av在线一区| 国产高清久久久| 色av综合在线| 久久久久国产精品人| 一区二区三区日韩| 九九精品一区二区| 91成人在线精品| 久久中文字幕电影| 一区二区在线免费| 寂寞少妇一区二区三区| 色综合天天综合网天天狠天天 | 日本一区二区三区dvd视频在线 | 欧美日韩高清在线| 国产亚洲一区二区在线观看| 亚洲在线观看免费| 国产精品一品二品| 日韩欧美中文字幕制服| 一区二区三区欧美日韩| 国产毛片精品一区|