Class FFmpegResultFuture

java.lang.Object
com.github.kokorin.jaffree.ffmpeg.FFmpegResultFuture

public class FFmpegResultFuture extends Object
A FFmpegResultFuture represents the result of an asynchronous ffmpeg execution.
  • Constructor Details

  • Method Details

    • forceStop

      public void forceStop()
      Immediately stops ffmpeg process. Note output media may be corrupted.
    • graceStop

      public void graceStop()
      Requests ffmpeg process to stop. Note output media finalization may take some time - up to several seconds.
    • stop

      public void stop(boolean forcefully)
      Stops ffmpeg process.
      Parameters:
      forcefully - true to stop immediately
    • cancel

      @Deprecated public boolean cancel(boolean forceStop)
      Deprecated.
      This method is left for backward compatibility. May be removed. Use stop(boolean), forceStop() or graceStop()
      Parameters:
      forceStop - true to stop immediately
      Returns:
      true
    • get

      Waits if necessary for ffmpeg process to complete, and then retrieves its result.
      Returns:
      ffmpeg result
      Throws:
      CancellationException - if the computation was cancelled
      ExecutionException - if the computation threw an exception
      InterruptedException - if the current thread was interrupted while waiting
    • get

      Waits if necessary for at most the given time for ffmpeg process to complete, and then retrieves its result, if available.
      Parameters:
      timeout - the maximum time to wait
      unit - the time unit of the timeout argument
      Returns:
      the computed result
      Throws:
      CancellationException - if the computation was cancelled
      ExecutionException - if the computation threw an exception
      InterruptedException - if the current thread was interrupted while waiting
      TimeoutException - if the wait timed out
    • isCancelled

      public boolean isCancelled()
      Returns true if ffmpeg execution was cancelled before it completed normally.
      Returns:
      true if ffmpeg execution was cancelled before it completed
    • isDone

      public boolean isDone()
      Returns true if ffmpeg execution completed.

      Completion may be due to normal termination, an exception, or cancellation -- in all of these cases, this method will return true.

      Returns:
      true if ffmpeg execution completed
    • toCompletableFuture

      public CompletableFuture<FFmpegResult> toCompletableFuture()
      Returns a completion that can be used to chain operations after FFmpeg completes, using the CompletionStage Java 8 API.
      Returns:
      completion that will complete when ffmpeg completes normally, and will complete exceptionally with a CancellationException if ffmpeg is forcefully stopped or with a JaffreeException if an error occurs.