Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.github.hiteshsondhi88.libffmpeg;

import java.util.Map;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.AsyncTask;
import android.text.TextUtils;

import java.util.Map;

import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException;
import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegNotSupportedException;

Expand Down Expand Up @@ -60,15 +60,13 @@ public void loadBinary(FFmpegLoadBinaryResponseHandler ffmpegLoadBinaryResponseH
}
}

@Override
@SuppressLint("NewApi") @Override
public void execute(Map<String, String> environvenmentVars, String cmd, FFmpegExecuteResponseHandler ffmpegExecuteResponseHandler) throws FFmpegCommandAlreadyRunningException {
if (ffmpegExecuteAsyncTask != null && !ffmpegExecuteAsyncTask.isProcessCompleted()) {
throw new FFmpegCommandAlreadyRunningException("FFmpeg command is already running, you are only allowed to run single command at a time");
}

if (!TextUtils.isEmpty(cmd)) {
String ffmpegCmd = FileUtils.getFFmpeg(context, environvenmentVars) + " "+ cmd;
ffmpegExecuteAsyncTask = new FFmpegExecuteAsyncTask(ffmpegCmd, timeout, ffmpegExecuteResponseHandler);
ffmpegExecuteAsyncTask.execute();
FFmpegExecuteAsyncTask ffmpegExecuteAsyncTask = new FFmpegExecuteAsyncTask(ffmpegCmd, timeout, ffmpegExecuteResponseHandler);
ffmpegExecuteAsyncTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
} else {
throw new IllegalArgumentException("shell command cannot be empty");
}
Expand Down