This pull request adds the FFcommandExecuteSynchronous class and execute() methods needed to execute FFmpeg/FFprobe synchronously as requested in issue #27.
For example, rather than the asynchronous way of executing FFmpeg:
FFmpeg ffmpeg = FFmpeg.getInstance(context);
ffmpeg.execute(cmd, new ExecuteBinaryResponseHandler() {
@Override
public void onStart() {}
@Override
public void onProgress(String message) {}
@Override
public void onFailure(String message) {}
@Override
public void onSuccess(String message) {}
@Override
public void onFinish() {}
});
You can now run it synchronously with:
FFmpeg ffmpeg = FFmpeg.getInstance(context);
String result = ffmpeg.execute(cmd);
//Result is all the output of the ffmpeg command.
It is identical for FFprobe.
Most of the code is pulled from the already-existing asynchronous execution code, I just pulled it out of an AsyncTask.
I hope to continue to contribute to this excellent library, and I am willing to make requested changes to this pull request.
However, I think we need to abstract the way to execute commands otherwise we would have the same code in four places. If you have any ideas, please let me know.
This pull request adds the
FFcommandExecuteSynchronous
class andexecute()
methods needed to execute FFmpeg/FFprobe synchronously as requested in issue #27.For example, rather than the asynchronous way of executing FFmpeg:
You can now run it synchronously with:
It is identical for FFprobe.
Most of the code is pulled from the already-existing asynchronous execution code, I just pulled it out of an
AsyncTask
.I hope to continue to contribute to this excellent library, and I am willing to make requested changes to this pull request.