Examples of Processor


Examples of javax.media.Processor

    String srcUrl = "file:///home/ken/Dev/LTI/fmj/samplemedia/gulp2.wav";
    String destUrl = "file:///home/ken/Desktop/foo.wav";
    String outputType = FileTypeDescriptor.WAVE;
   
//     CaptureDeviceInfo di = null;
      Processor p = null;
      StateHelper sh = null;
//      Vector deviceList = CaptureDeviceManager.getDeviceList(new
//               AudioFormat(AudioFormat.LINEAR, 44100, 16, 2));
//      if (deviceList.size() > 0)
//          di = (CaptureDeviceInfo)deviceList.firstElement();
//      else
//          // Exit if we can't find a device that does linear,
//            // 44100Hz, 16 bit,
//          // stereo audio.
//          System.exit(-1);
      try {
          p = Manager.createProcessor(new MediaLocator(srcUrl));
          System.out.println("Processor: " + p);
          sh = new StateHelper(p);
      } catch (IOException e) {
        e.printStackTrace();
          System.exit(-1);
      } catch (NoProcessorException e) {
        e.printStackTrace();
          System.exit(-1);
      }
      // Configure the processor
      if (!sh.configure(100000))
      {   System.err.println("Failed to configure within 100 secs");
        System.exit(-1);
      }
      // Set the output content type and realize the processor
      p.setContentDescriptor(new
                    FileTypeDescriptor(outputType));
      if (!sh.realize(100000))
      {  
       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.
      DataSink filewriter = null;
      try {
          filewriter = Manager.createDataSink(source, dest);
          System.out.println("DataSink: " + filewriter);
         System.out.println("DataSink content type: " + filewriter.getContentType());
          filewriter.open();
      } catch (NoDataSinkException e) {
        e.printStackTrace();
          System.exit(-1);
      } catch (IOException e) {
       e.printStackTrace();
          System.exit(-1);
      } catch (SecurityException e) {
       e.printStackTrace();
          System.exit(-1);
      }

      // if the Processor implements StreamWriterControl, we can
      // call setStreamSizeLimit
      // to set a limit on the size of the file that is written.
      StreamWriterControl swc = (StreamWriterControl)
          p.getControl("javax.media.control.StreamWriterControl");
      //set limit to 5MB
      if (swc != null)
          swc.setStreamSizeLimit(5000000);
  
      // now start the filewriter and processor
View Full Code Here

Examples of javax.media.Processor

              waitFileSync.notifyAll();
            }
          }
        }
      };
    Processor processor = null;
    DataSink dataSink = null;
    try {
      processor = Manager.createProcessor(dataSource);
      processor.addControllerListener(controllerListener);
      processor.configure();
      // Put the Processor into configured state so we can set
      // some processing options on the processor.
      if (!waitForState(processor, Processor.Configured)) {
        throw new IOException("Failed to configure the processor.");
      }

      // Set the output content descriptor to QuickTime.
      processor.setContentDescriptor(new ContentDescriptor(FileTypeDescriptor.QUICKTIME));

      // Query for the processor for supported formats.
      // Then set it on the processor.
      TrackControl trackControls[] = processor.getTrackControls();
      Format format[] = trackControls [0].getSupportedFormats();
      if (format == null || format.length <= 0) {
        throw new IOException("The mux does not support the input format: " + trackControls [0].getFormat());
      }

      trackControls [0].setFormat(format [0]);

      // We are done with programming the processor. Let's just realize it.
      processor.realize();
      if (!waitForState(processor, Controller.Realized)) {
        throw new IOException("Failed to realize the processor.");
      }

      // Now, we'll need to create a DataSink.
      // Caution: do not use file.toURI().toURL() with JMF
      dataSink = Manager.createDataSink(processor.getDataOutput(),
          new MediaLocator(file.toURL()));
      dataSink.open();
      dataSink.addDataSinkListener(dataSinkListener);
      this.fileDone = false;

      // Start the actual transcoding
      processor.start();
      dataSink.start();

      // Wait for EndOfStream event.
      synchronized (this.waitFileSync) {
        while (!this.fileDone) {
          this.waitFileSync.wait();
        }
      }
     
      if (this.fileError != null) {
        throw new IOException(this.fileError);
      }
    } catch (NoProcessorException ex) {
      IOException ex2 = new IOException(ex.getMessage());
      ex2.initCause(ex);
      throw ex2;
    } catch (NoDataSinkException ex) {
      IOException ex2 = new IOException("Failed to create a DataSink for the given output MediaLocator");
      ex2.initCause(ex);
      throw ex2;
    } catch (InterruptedException ex) {
      if (dataSink != null) {
        dataSink.stop();
      }
      throw new InterruptedIOException("Video creation interrupted");
    } finally {
      if (dataSink != null) {
        dataSink.close();
        dataSink.removeDataSinkListener(dataSinkListener);
      }
      if (processor != null) {
        processor.close();
        processor.removeControllerListener(controllerListener);
      }
    }
  }
View Full Code Here

Examples of jmt.jmarkov.Queues.Processor

      int numServer;
      numServer = ql.getNumberServer();
      processors = new Processor[numServer];
      for (int i = 0; i < numServer; i++) {
        processors[i] = new Processor(ql, jq, tan, i/*, jobsDialog.getValidatedValue()*/);
      }

      sim = new Simulator(arrival, processors, accelerationS.getValue(), tan);

      arrival.sim = sim;
View Full Code Here

Examples of net.sf.antcontrib.cpptasks.compiler.Processor

            return ((ProcessorDef) getCheckedRef(ProcessorDef.class,
                    "ProcessorDef")).createConfiguration(task, linkType,
                    baseDef, targetPlatform, versionInfo);
        }
        ProcessorDef[] defaultProviders = getDefaultProviders(baseDef);
        Processor proc = getProcessor(linkType);
        return proc.createConfiguration(task, linkType, defaultProviders, this, targetPlatform, versionInfo);
    }
View Full Code Here

Examples of net.sf.saxon.s9api.Processor

    XProcConfiguration config = new XProcConfiguration();
    config.debug = true;
    this.runtime = new XProcRuntime(config);
    //GenericConfig config = new GenericConfig();
    //this.runtime = new XProcRuntime(config);
    Processor proc = runtime.getProcessor();
    this.builder = proc.newDocumentBuilder();
    XsltCompiler comp = proc.newXsltCompiler();
    XsltExecutable exp = null;
    try {
      //xslStylesheet = getServeletContext().getResourceAsStream("/WEB-INF/proc.xsl");
      exp = comp.compile(new StreamSource(xslSheet));
      //exp = comp.compile(new StreamSource(new File("proc.xsl")));
View Full Code Here

Examples of no.priv.garshol.duke.Processor

   * @return The F-number of the configuration.
   */
  private double evaluate(GeneticConfiguration config,
                          MatchListener listener) {
    Configuration cconfig = config.getConfiguration();
    Processor proc = new Processor(cconfig, database);
    TestFileListener eval = makeEval(cconfig, testdb, proc);

    if (active || incomplete)
      // in active learning the test file is incomplete, so F-number eval
      // should be optimistic. similarly if the test file is known to be
      // incomplete, for whatever reason
      eval.setPessimistic(false);

    proc.addMatchListener(eval);
    TestFileListener seval = null;
    if (scientific) {
      seval = makeEval(cconfig, ((LinkFileOracle) oracle).getLinkDatabase(),
                       proc);
      seval.setPessimistic(true);
      proc.addMatchListener(seval);
    }
    if (listener != null)
      proc.addMatchListener(listener);
    if (cconfig.isDeduplicationMode())
      proc.linkRecords(cconfig.getDataSources());
    else
      proc.linkRecords(cconfig.getDataSources(2), false);

    if (seval != null)
      sciencetracker.put(config, seval.getFNumber());

    config.setFNumber(eval.getFNumber());
View Full Code Here

Examples of org.apache.accumulo.core.master.thrift.MasterClientService.Processor

      throw new IOException(e);
    } catch (InterruptedException e) {
      throw new IOException(e);
    }
   
    Processor processor = new MasterClientService.Processor(TraceWrap.service(new MasterClientServiceHandler()));
    clientService = TServerUtils.startServer(Property.MASTER_CLIENTPORT, processor, "Master", "Master Client Service Handler", null,
        Property.MASTER_MINTHREADS, Property.MASTER_THREADCHECK).server;
   
    while (!clientService.isServing()) {
      UtilWaitThread.sleep(100);
View Full Code Here

Examples of org.apache.axis2.jaxbri.processor.client.Processor

        UtilServer.stop();
    }
   
    @Test
    public void testStub() throws Exception {
        Processor stub = new ProcessorStub(UtilServer.getConfigurationContext(), ENDPOINT);
        RequestMessage request = new RequestMessage();
        request.setRequestID("A3TN39840");
        request.setRequestData("DATA");
        ReplyMessage reply = stub.runTransaction(request);
        assertEquals("A3TN39840.1", reply.getReplyID());
        assertEquals("PROCESSED", reply.getReplyData());
    }
View Full Code Here

Examples of org.apache.camel.Processor

    protected RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {
            public void configure() {
                from("direct:start").
                        marshal().xstream().
                        process(new Processor() {
                            public void process(Exchange exchange) throws Exception {
                                log.debug("marshalled: " + exchange.getIn().getBody(String.class));
                            }
                        }).
                        unmarshal().xstream().
View Full Code Here

Examples of org.apache.camel.Processor

                    .handled(header("foo").isEqualTo("bar"))
                    .setHeader(MESSAGE_INFO, constant("Handled exchange with IOException"))
                    .to(ERROR_QUEUE);
                // END SNIPPET: exceptionBuilder1

                from("direct:a").process(new Processor() {
                    public void process(Exchange exchange) throws Exception {
                        String s = exchange.getIn().getBody(String.class);
                        if ("Hello NPE".equals(s)) {
                            throw new NullPointerException();
                        } else if ("Hello IOE".equals(s)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.