Package javax.media.protocol

Examples of javax.media.protocol.DataSource


    public 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";
View Full Code Here


    /**
     * Create the DataSink.
     */
    DataSink createDataSink(Processor p, MediaLocator outML) {

  DataSource ds;

  if ((ds = p.getDataOutput()) == null) {
      System.err.println("Something is really wrong: the processor does not have an output DataSource");
      return null;
  }
View Full Code Here

      success = waitForState(p, Processor.Realized);
      if (!success) {
    System.err.println("Could not realize output processor");
    buttonGo.setEnabled(true);
      }
      DataSource ds = p.getDataOutput();
      doSave(p, ds);
  } catch (Exception ex) {
      buttonGo.setEnabled(true);
      System.err.println("Exception creating processor: " + ex);
  }
View Full Code Here

    /**
     * Create the DataSink.
     */
    DataSink createDataSink(Processor p, MediaLocator outML) {

  DataSource ds;

  if ((ds = p.getDataOutput()) == null) {
      System.err.println("Something is really wrong: the processor does not have an output DataSource");
      return null;
  }
View Full Code Here

   
  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();
    PlayerWindow pw = new PlayerWindow(p, stream);
    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());
       }
View Full Code Here

    }
    proc.setContentDescriptor(new ContentDescriptor(ContentDescriptor.RAW));
    reachedState = waitForState(proc, Controller.Realized);
    if (!reachedState)
        return false;
    DataSource ds = proc.getDataOutput();
    if (ds == null)
        return false;
    inputSourceNext = ds;
    ds.connect();
    inputStreamsNext = ((PushBufferDataSource)ds).getStreams();
    inputProcessorNext = proc;
    return true;
      }
  } catch (MalformedURLException mue) {
View Full Code Here

  {
      // mgodehardt: updating data length field, some java versions cannot handle length of -1 in au file
      // ( microsoft mediaplayer is not playing au files with length -1 )
     
      // should we throw a IOException if length could not be written ?
        DataSource ds = getDataOutput();
        if ( ds instanceof InputStreamPushDataSource )
        {
            InputStreamPushDataSource pds = (InputStreamPushDataSource)ds;
            PushSourceStream pss = pds.getStreams()[0];
           
View Full Code Here

                    for (int i = 0; i < streamsV.size(); i++) {
                           RTPReceiveStream stream = (RTPReceiveStream)streamsV.get(i);
                           if (stream.checkInactivity())
                           {
                               // mgodehardt: resetting bitratecontrol
                               DataSource ds = stream.getDataSource();
                               if ( ds instanceof PushBufferDataSource )
                               {
                                   PushBufferDataSource pbds = (PushBufferDataSource)ds;
                                   PushBufferStream pbs = pbds.getStreams()[0];
                                   if ( pbs instanceof RTPDataStream )
View Full Code Here

      {  
       System.err.println("Failed to realize within 100 secs");
        System.exit(-1);
      }
      // get the output of the processor
      DataSource source = p.getDataOutput();
      System.out.println("p.getDataOutput()=" + source);
     System.out.println("source.getContentType()=" + source.getContentType());
      // create a File protocol MediaLocator with the location of the
      // file to which the data is to be written
      MediaLocator dest = new MediaLocator(destUrl);
      // create a datasink to do the file writing & open the sink to
      // make sure we can write to it.
View Full Code Here

  {
    // init FMJ/JMF logging/classpath
    FmjStartup.init();
   
    // create both data sources:
    final DataSource dsAudio = Manager.createDataSource(new MediaLocator("javasound://"));
    final DataSource dsVideo = Manager.createDataSource(new MediaLocator("civil:/0"));
   
    // merge them:
    final DataSource ds = Manager.createMergingDataSource(new DataSource[] {dsAudio, dsVideo});
   
    // create a player:
    final Player player = Manager.createRealizedPlayer(ds);
   
    // create GUI frame, add player's GUI components to it:
View Full Code Here

TOP

Related Classes of javax.media.protocol.DataSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.