Package net.pms.io

Examples of net.pms.io.ProcessWrapper


    ProcessWrapperImpl p = new ProcessWrapperImpl(cmdArray, params);
    params.maxBufferSize = 100;
    params.input_pipes[0] = tsPipe;
    params.stdin = null;
    ProcessWrapper pipe_process = tsPipe.getPipeProcess();
    p.attachProcess(pipe_process);
    pipe_process.runInNewThread();

    try {
      Thread.sleep(50);
    } catch (InterruptedException e) {
    }
    tsPipe.deleteLater();

    ProcessWrapper ff_pipe_process = ffVideoPipe.getPipeProcess();
    p.attachProcess(ff_pipe_process);
    ff_pipe_process.runInNewThread();
    try {
      Thread.sleep(50);
    } catch (InterruptedException e) {
    }
    ffVideoPipe.deleteLater();

    p.attachProcess(ffVideo);
    ffVideo.runInNewThread();
    try {
      Thread.sleep(50);
    } catch (InterruptedException e) {
    }

    if (ffAudioPipe != null && params.aid != null) {
      for (int i = 0; i < ffAudioPipe.length; i++) {
        ff_pipe_process = ffAudioPipe[i].getPipeProcess();
        p.attachProcess(ff_pipe_process);
        ff_pipe_process.runInNewThread();
        try {
          Thread.sleep(50);
        } catch (InterruptedException e) {
        }
        ffAudioPipe[i].deleteLater();
View Full Code Here


    DLNAMediaInfo media,
    OutputParams params) throws IOException {
    boolean isWindows = Platform.isWindows();
    final String filename = dlna.getSystemName();
    PipeProcess tsPipe = new PipeProcess("VLC" + System.currentTimeMillis() + "." + getMux());
    ProcessWrapper pipe_process = tsPipe.getPipeProcess();

    // XXX it can take a long time for Windows to create a named pipe
    // (and mkfifo can be slow if /tmp isn't memory-mapped), so start this as early as possible
    pipe_process.runInNewThread();
    tsPipe.deleteLater();

    params.input_pipes[0] = tsPipe;
    params.minBufferSize = params.minFileSize;
    params.secondread_minsize = 100000;
View Full Code Here

    );

    // This process wraps the command that creates the named pipe
    PipeProcess pipe = new PipeProcess(fifoName);
    pipe.deleteLater(); // delete the named pipe later; harmless if it isn't created
    ProcessWrapper mkfifo_process = pipe.getPipeProcess();

    /**
     * It can take a long time for Windows to create a named pipe (and
     * mkfifo can be slow if /tmp isn't memory-mapped), so run this in
     * the current thread.
     */
    mkfifo_process.runInSameThread();

    params.input_pipes[0] = pipe;

    // Build the command line
    List<String> cmdList = new ArrayList<>();
View Full Code Here

    // Make sure we can play this
    CodecConfig config = genConfig(params.mediaRenderer);

    PipeProcess tsPipe = new PipeProcess("VLC" + System.currentTimeMillis() + "." + config.container);
    ProcessWrapper pipe_process = tsPipe.getPipeProcess();

    // XXX it can take a long time for Windows to create a named pipe
    // (and mkfifo can be slow if /tmp isn't memory-mapped), so start this as early as possible
    pipe_process.runInNewThread();
    tsPipe.deleteLater();

    params.input_pipes[0] = tsPipe;
    params.minBufferSize = params.minFileSize;
    params.secondread_minsize = 100000;
View Full Code Here

            externalProcess.stopProcess();
          }
        };
        new Thread(r, "External Process Stopper").start();
        lastStart = System.currentTimeMillis();
        ProcessWrapper newExternalProcess = player.launchTranscode(this, media, params);
        try {
          Thread.sleep(1000);
        } catch (InterruptedException e) {
          LOGGER.error(null, e);
        }
View Full Code Here

        cmdArrayDts
      );

      ProcessWrapperImpl ffVideo = new ProcessWrapperImpl(cmdArrayDts, ffparams);

      ProcessWrapper ff_video_pipe_process = ffVideoPipe.getPipeProcess();
      pw.attachProcess(ff_video_pipe_process);
      ff_video_pipe_process.runInNewThread();
      ffVideoPipe.deleteLater();

      pw.attachProcess(ffVideo);
      ffVideo.runInNewThread();

      PipeIPCProcess ffAudioPipe = new PipeIPCProcess(System.currentTimeMillis() + "ffmpegaudio01", System.currentTimeMillis() + "audioout", false, true);
      StreamModifier sm = new StreamModifier();
      sm.setPcm(false);
      sm.setDtsEmbed(dtsRemux);
      sm.setSampleFrequency(48000);
      sm.setBitsPerSample(16);
      sm.setNbChannels(2);

      List<String> cmdListDTS = new ArrayList<>();
      cmdListDTS.add(executable());
      cmdListDTS.add("-y");
      cmdListDTS.add("-ss");

      if (params.timeseek > 0) {
        cmdListDTS.add(String.valueOf(params.timeseek));
      } else {
        cmdListDTS.add("0");
      }

      if (params.stdin == null) {
        cmdListDTS.add("-i");
      } else {
        cmdListDTS.add("-");
      }
      cmdListDTS.add(filename);

      if (params.timeseek > 0) {
        cmdListDTS.add("-copypriorss");
        cmdListDTS.add("0");
        cmdListDTS.add("-avoid_negative_ts");
        cmdListDTS.add("1");
      }

      cmdListDTS.add("-ac");
      cmdListDTS.add("2");

      cmdListDTS.add("-f");
      cmdListDTS.add("dts");

      cmdListDTS.add("-c:a");
      cmdListDTS.add("copy");

      cmdListDTS.add(ffAudioPipe.getInputPipe());

      String[] cmdArrayDTS = new String[cmdListDTS.size()];
      cmdListDTS.toArray(cmdArrayDTS);

      if (!params.mediaRenderer.isMuxDTSToMpeg()) { // No need to use the PCM trick when media renderer supports DTS
        ffAudioPipe.setModifier(sm);
      }

      OutputParams ffaudioparams = new OutputParams(configuration);
      ffaudioparams.maxBufferSize = 1;
      ffaudioparams.stdin = params.stdin;
      ProcessWrapperImpl ffAudio = new ProcessWrapperImpl(cmdArrayDTS, ffaudioparams);

      params.stdin = null;
      try (PrintWriter pwMux = new PrintWriter(f)) {
        pwMux.println("MUXOPT --no-pcr-on-video-pid --no-asyncio --new-audio-pes --vbr --vbv-len=500");
        String videoType = "V_MPEG-2";

        if (renderer.isTranscodeToH264()) {
          videoType = "V_MPEG4/ISO/AVC";
        }

        if (params.no_videoencode && params.forceType != null) {
          videoType = params.forceType;
        }

        StringBuilder fps = new StringBuilder();
        fps.append("");
        if (params.forceFps != null) {
          fps.append("fps=").append(params.forceFps).append(", ");
        }

        String audioType = "A_AC3";
        if (dtsRemux) {
          if (params.mediaRenderer.isMuxDTSToMpeg()) {
            // Renderer can play proper DTS track
            audioType = "A_DTS";
          } else {
            // DTS padded in LPCM trick
            audioType = "A_LPCM";
          }
        }

        pwMux.println(videoType + ", \"" + ffVideoPipe.getOutputPipe() + "\", " + fps + "level=4.1, insertSEI, contSPS, track=1");
        pwMux.println(audioType + ", \"" + ffAudioPipe.getOutputPipe() + "\", track=2");
      }

      ProcessWrapper pipe_process = pipe.getPipeProcess();
      pw.attachProcess(pipe_process);
      pipe_process.runInNewThread();

      try {
        wait(50);
      } catch (InterruptedException e) {
      }

      pipe.deleteLater();
      params.input_pipes[0] = pipe;

      ProcessWrapper ff_pipe_process = ffAudioPipe.getPipeProcess();
      pw.attachProcess(ff_pipe_process);
      ff_pipe_process.runInNewThread();

      try {
        wait(50);
      } catch (InterruptedException e) {
      }
View Full Code Here

    cmdArray[1] = filename;
    System.arraycopy(args(), 0, cmdArray, 2, args().length);
    cmdArray[cmdArray.length - 2] = "-o";
    cmdArray[cmdArray.length - 1] = pipe.getInputPipe();

    ProcessWrapper mkfifo_process = pipe.getPipeProcess();

    cmdArray = finalizeTranscoderArgs(
      filename,
      dlna,
      media,
      params,
      cmdArray
    );

    ProcessWrapperImpl pw = new ProcessWrapperImpl(cmdArray, params);
    pw.attachProcess(mkfifo_process);

    /**
     * It can take a long time for Windows to create a named pipe (and
     * mkfifo can be slow if /tmp isn't memory-mapped), so run this in
     * the current thread.
     */
    mkfifo_process.runInSameThread();

    pipe.deleteLater();

    pw.runInNewThread();

 
View Full Code Here

    byte copy[] = new byte[media.getThumb().length];
    System.arraycopy(media.getThumb(), 0, copy, 0, media.getThumb().length);
    media.setThumb(new byte[0]);

    ProcessWrapper pw = new InternalJavaProcessImpl(new ByteArrayInputStream(copy));
    return pw;
  }
View Full Code Here

    }

    cmdArray[cmdArray.length - 2] = "-o";
    cmdArray[cmdArray.length - 1] = pipe.getInputPipe();

    ProcessWrapper mkfifo_process = pipe.getPipeProcess();

    cmdArray = finalizeTranscoderArgs(
      filename,
      dlna,
      media,
      params,
      cmdArray
    );

    ProcessWrapperImpl pw = new ProcessWrapperImpl(cmdArray, params);
    pw.attachProcess(mkfifo_process);

    // It can take a long time for Windows to create a named pipe (and
    // mkfifo can be slow if /tmp isn't memory-mapped), so run this in the
    // current thread.
    mkfifo_process.runInSameThread();

    pipe.deleteLater();

    pw.runInNewThread();
View Full Code Here

    byte copy[] = new byte[media.getThumb().length];
    System.arraycopy(media.getThumb(), 0, copy, 0, media.getThumb().length);
    media.setThumb(new byte[0]);

    ProcessWrapper pw = new InternalJavaProcessImpl(new ByteArrayInputStream(copy));
    return pw;
  }
View Full Code Here

TOP

Related Classes of net.pms.io.ProcessWrapper

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.