invokeSync method

FFmpegRawResponse invokeSync({
  1. String? pathFFmpeg,
  2. FFmpegArgs? fFmpegArgs,
  3. String? workingDirectory,
  4. Map<String, String>? environment,
  5. bool includeParentEnvironment = true,
  6. bool runInShell = false,
})

Implementation

FFmpegRawResponse invokeSync({
  String? pathFFmpeg,
  FFmpegArgs? fFmpegArgs,
  String? workingDirectory,
  Map<String, String>? environment,
  bool includeParentEnvironment = true,
  bool runInShell = false,
}) {
  fFmpegArgs ??= FFmpegArgs([]);
  pathFFmpeg ??= path_ffmpeg;
  ProcessResult res = Process.runSync(
    pathFFmpeg,
    fFmpegArgs.toList(),
    workingDirectory: workingDirectory,
    environment: environment,
    includeParentEnvironment: includeParentEnvironment,
    runInShell: runInShell,
  );
  if (res.exitCode == 0) {
    return FFmpegRawResponse(
      rawData: {"@type": "ok", "message": res.stdout},
      processResult: res,
    );
  } else {
    return FFmpegRawResponse(
      rawData: {"@type": "error", "message": res.stderr},
      processResult: res,
    );
  }
}