コード例 #1
0
      // just before run process
      public void startConvert(File file) {
        // log.info("start:");
        // check command valid.
        String ffmpegPath = ffmpegExecuter.getFfmpegPreference().getFfmpegPath();
        String codec = ffmpegExecuter.getFfmpegPreference().getAudioCodec();

        System.out.println("executer:" + ffmpegPath);

        if (FFMpegUI.isPureFFMpeg(ffmpegPath)) {
          if (!FFMpegUI.isPureFFMpegSupportedAudioCodec(codec)) { // MP3 not support pure_ffmpeg.exe
            StatusBarUtils.showStatusBar(Messages.getString("ffmpeg_statusbar.no_ffmpeg"));
            try {
              getProcessPrinter().printError(Messages.getString("ffmpeg_error.no_ffmpeg"));
            } catch (IOException e) {

              e.printStackTrace();
            }
            perfomeCancel();
            return;
          }
        }

        log.info("set guess:" + ffmpegExecuter.getGuessSize() + "kB");
        setProgressMaxBytes(ffmpegExecuter.getGuessSize());
      }
コード例 #2
0
    // overwrite only work when ffmpeg is available
    public boolean isCanConvert() {

      // check ffmpeg path exists.
      String ffmpegPath = FFMpegUI.getFFmpegOrPureFFMpeg();
      if (!FFMpegUI.isFFMpegOrPureFFMpegAvailable(ffmpegPath)) {
        return false;
      }

      return super.isCanConvert();
    }
コード例 #3
0
    public void beforeConvert() {
      if (FFMpegUI.getFFmpeg() == null && !quickCopy.getSelection()) {
        log.warn("this never happend:must filtered by canConvert");
        return;
      }

      //			TODO if use pure_ffmpeg use it.if can handle codec.
      String ffmpegPath = FFMpegUI.getFFmpeg();
      if (ffmpegPath == null) {
        ffmpegPath = FFMpegUI.getPureFFmpeg();
      }

      // should initialize first.
      fileOverwriteControler = new FileOverwriteControler(tab.getShell());

      ffmpegExecuter = new FFMpegExecuter();
      ffmpegExecuter.setAllowDemuxingFLV(false); // if true newer ffmpeg.exe make problem.
      ffmpegExecuter.setIgnoreAvisynthExtensions(new String[0]); // use any file
      ffmpegExecuter.setExecuteListener(new FFMpegMonitor());

      MP3FFMpegPreference preference = new MP3FFMpegPreference();
      ffmpegExecuter.setFfmpegPreference(preference);

      preference.setFfmpegPath(ffmpegPath);
      preference.setExtension(FFMpegOptions.EXTENSION_MP3);

      // support thread.//no it crash
      /*
      boolean threads = Akj_betasPlugin.getDefault().getPreferenceStore()
      .getBoolean(FFMpegPage.USE_THREAD);
      */

      ffmpegExecuter.setSameDirectory(samefolder.getSelection());
      ffmpegExecuter.setBackup(backup.getSelection());
      if (!samefolder.getSelection()) {
        ffmpegExecuter.setExportDir(directoryChooser.getAbsoluteFilePath());
      }

      // copy settings
      preference.setForceConvert(forceConvert.getSelection());
      preference.setUseCopy(quickCopy.getSelection());
      preference.setDefaultBitrate(
          Integer.parseInt(defaultBitrate.getItem(defaultBitrate.getSelectionIndex())));
      ffmpegExecuter.setUseAvisynth(useAvisynth.getSelection());
      preference.setConvertBitrate(mp3setting.getBitrate());
      preference.setConvertFramerate(mp3setting.getFramerate());
      preference.setConvertChannel(mp3setting.getChannel());
    }
コード例 #4
0
    public void updateStatus() {
      if (quickCopy == null) {
        // this called before createPart from preference monitor.
        // ignore it
      }

      String ffmpegPath = FFMpegUI.getFFmpeg();
      if (ffmpegPath == null) {
        if (noFFMpegImage != null) { // initial call,there are null image
          dragHere.setImage(noFFMpegImage);
        }
        setMessage(""); // setMessage(Messages.getString(""));
        if (quickCopy != null) {

          setCanConvert(quickCopy.getSelection()); // enable only if copy on
          setCantConvertStatusbarMessage(Messages.getString("ffmpeg_statusbar.no_ffmpeg"));
        } else {
          log.warn("this never called");
          // before initialize
          setCanConvert(getPreferenceStore().getBoolean(getPreferenceKey() + "." + "quickcopy"));
        }
      } else {
        if (canConvertImage != null) dragHere.setImage(canConvertImage);
        if (samefolder.getSelection() || directoryChooser.getFile() != null) {
          setMessage(Messages.getString("dropsomething.drag_folder"));
          setCanConvert(true);
        } else {
          setErrorMessage(Messages.getString("dropsomething.choose_folder"));
          setCanConvert(false);
        }
      }
      log.info("currentStatus:" + isCanConvert());
    }