diff --git a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AbstractSession.java b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AbstractSession.java
index 9e799af..fcb8c62 100644
--- a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AbstractSession.java
+++ b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AbstractSession.java
@@ -28,8 +28,8 @@ import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicLong;
/**
- * Abstract session implementation which includes common features shared by FFmpeg
- * and FFprobe
sessions.
+ * Abstract session implementation which includes common features shared by FFmpeg
,
+ * FFprobe
and MediaInformation
sessions.
*/
public abstract class AbstractSession implements Session {
@@ -49,12 +49,7 @@ public abstract class AbstractSession implements Session {
protected final long sessionId;
/**
- * Session specific execute callback function.
- */
- protected final ExecuteCallback executeCallback;
-
- /**
- * Session specific log callback function.
+ * Session specific log callback.
*/
protected final LogCallback logCallback;
@@ -117,16 +112,13 @@ public abstract class AbstractSession implements Session {
* Creates a new abstract session.
*
* @param arguments command arguments
- * @param executeCallback session specific execute callback function
- * @param logCallback session specific log callback function
+ * @param logCallback session specific log callback
* @param logRedirectionStrategy session specific log redirection strategy
*/
public AbstractSession(final String[] arguments,
- final ExecuteCallback executeCallback,
final LogCallback logCallback,
final LogRedirectionStrategy logRedirectionStrategy) {
this.sessionId = sessionIdGenerator.getAndIncrement();
- this.executeCallback = executeCallback;
this.logCallback = logCallback;
this.createTime = new Date();
this.startTime = null;
@@ -143,11 +135,6 @@ public abstract class AbstractSession implements Session {
FFmpegKitConfig.addSession(this);
}
- @Override
- public ExecuteCallback getExecuteCallback() {
- return executeCallback;
- }
-
@Override
public LogCallback getLogCallback() {
return logCallback;
diff --git a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AsyncFFmpegExecuteTask.java b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AsyncFFmpegExecuteTask.java
index 56c4d30..934787f 100644
--- a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AsyncFFmpegExecuteTask.java
+++ b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AsyncFFmpegExecuteTask.java
@@ -26,33 +26,33 @@ import com.arthenica.smartexception.java.Exceptions;
*/
public class AsyncFFmpegExecuteTask implements Runnable {
private final FFmpegSession ffmpegSession;
- private final ExecuteCallback executeCallback;
+ private final FFmpegSessionCompleteCallback completeCallback;
public AsyncFFmpegExecuteTask(final FFmpegSession ffmpegSession) {
this.ffmpegSession = ffmpegSession;
- this.executeCallback = ffmpegSession.getExecuteCallback();
+ this.completeCallback = ffmpegSession.getCompleteCallback();
}
@Override
public void run() {
FFmpegKitConfig.ffmpegExecute(ffmpegSession);
- if (executeCallback != null) {
+ if (completeCallback != null) {
try {
// NOTIFY SESSION CALLBACK DEFINED
- executeCallback.apply(ffmpegSession);
+ completeCallback.apply(ffmpegSession);
} catch (final Exception e) {
- android.util.Log.e(FFmpegKitConfig.TAG, String.format("Exception thrown inside session ExecuteCallback block.%s", Exceptions.getStackTraceString(e)));
+ android.util.Log.e(FFmpegKitConfig.TAG, String.format("Exception thrown inside session complete callback.%s", Exceptions.getStackTraceString(e)));
}
}
- final ExecuteCallback globalExecuteCallbackFunction = FFmpegKitConfig.getExecuteCallback();
- if (globalExecuteCallbackFunction != null) {
+ final FFmpegSessionCompleteCallback globalFFmpegSessionCompleteCallback = FFmpegKitConfig.getFFmpegSessionCompleteCallback();
+ if (globalFFmpegSessionCompleteCallback != null) {
try {
// NOTIFY GLOBAL CALLBACK DEFINED
- globalExecuteCallbackFunction.apply(ffmpegSession);
+ globalFFmpegSessionCompleteCallback.apply(ffmpegSession);
} catch (final Exception e) {
- android.util.Log.e(FFmpegKitConfig.TAG, String.format("Exception thrown inside global ExecuteCallback block.%s", Exceptions.getStackTraceString(e)));
+ android.util.Log.e(FFmpegKitConfig.TAG, String.format("Exception thrown inside global complete callback.%s", Exceptions.getStackTraceString(e)));
}
}
}
diff --git a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AsyncFFprobeExecuteTask.java b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AsyncFFprobeExecuteTask.java
index 74182c9..9d2a3e8 100644
--- a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AsyncFFprobeExecuteTask.java
+++ b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AsyncFFprobeExecuteTask.java
@@ -26,33 +26,33 @@ import com.arthenica.smartexception.java.Exceptions;
*/
public class AsyncFFprobeExecuteTask implements Runnable {
private final FFprobeSession ffprobeSession;
- private final ExecuteCallback executeCallback;
+ private final FFprobeSessionCompleteCallback completeCallback;
public AsyncFFprobeExecuteTask(final FFprobeSession ffprobeSession) {
this.ffprobeSession = ffprobeSession;
- this.executeCallback = ffprobeSession.getExecuteCallback();
+ this.completeCallback = ffprobeSession.getCompleteCallback();
}
@Override
public void run() {
FFmpegKitConfig.ffprobeExecute(ffprobeSession);
- if (executeCallback != null) {
+ if (completeCallback != null) {
try {
// NOTIFY SESSION CALLBACK DEFINED
- executeCallback.apply(ffprobeSession);
+ completeCallback.apply(ffprobeSession);
} catch (final Exception e) {
- android.util.Log.e(FFmpegKitConfig.TAG, String.format("Exception thrown inside session ExecuteCallback block.%s", Exceptions.getStackTraceString(e)));
+ android.util.Log.e(FFmpegKitConfig.TAG, String.format("Exception thrown inside session complete callback.%s", Exceptions.getStackTraceString(e)));
}
}
- final ExecuteCallback globalExecuteCallbackFunction = FFmpegKitConfig.getExecuteCallback();
- if (globalExecuteCallbackFunction != null) {
+ final FFprobeSessionCompleteCallback globalFFprobeSessionCompleteCallback = FFmpegKitConfig.getFFprobeSessionCompleteCallback();
+ if (globalFFprobeSessionCompleteCallback != null) {
try {
// NOTIFY GLOBAL CALLBACK DEFINED
- globalExecuteCallbackFunction.apply(ffprobeSession);
+ globalFFprobeSessionCompleteCallback.apply(ffprobeSession);
} catch (final Exception e) {
- android.util.Log.e(FFmpegKitConfig.TAG, String.format("Exception thrown inside global ExecuteCallback block.%s", Exceptions.getStackTraceString(e)));
+ android.util.Log.e(FFmpegKitConfig.TAG, String.format("Exception thrown inside global complete callback.%s", Exceptions.getStackTraceString(e)));
}
}
}
diff --git a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AsyncGetMediaInformationTask.java b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AsyncGetMediaInformationTask.java
index c59d81d..cbfc3fa 100644
--- a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AsyncGetMediaInformationTask.java
+++ b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/AsyncGetMediaInformationTask.java
@@ -26,7 +26,7 @@ import com.arthenica.smartexception.java.Exceptions;
*/
public class AsyncGetMediaInformationTask implements Runnable {
private final MediaInformationSession mediaInformationSession;
- private final ExecuteCallback executeCallback;
+ private final MediaInformationSessionCompleteCallback completeCallback;
private final Integer waitTimeout;
public AsyncGetMediaInformationTask(final MediaInformationSession mediaInformationSession) {
@@ -35,7 +35,7 @@ public class AsyncGetMediaInformationTask implements Runnable {
public AsyncGetMediaInformationTask(final MediaInformationSession mediaInformationSession, final Integer waitTimeout) {
this.mediaInformationSession = mediaInformationSession;
- this.executeCallback = mediaInformationSession.getExecuteCallback();
+ this.completeCallback = mediaInformationSession.getCompleteCallback();
this.waitTimeout = waitTimeout;
}
@@ -43,22 +43,22 @@ public class AsyncGetMediaInformationTask implements Runnable {
public void run() {
FFmpegKitConfig.getMediaInformationExecute(mediaInformationSession, waitTimeout);
- if (executeCallback != null) {
+ if (completeCallback != null) {
try {
// NOTIFY SESSION CALLBACK DEFINED
- executeCallback.apply(mediaInformationSession);
+ completeCallback.apply(mediaInformationSession);
} catch (final Exception e) {
- android.util.Log.e(FFmpegKitConfig.TAG, String.format("Exception thrown inside session ExecuteCallback block.%s", Exceptions.getStackTraceString(e)));
+ android.util.Log.e(FFmpegKitConfig.TAG, String.format("Exception thrown inside session complete callback.%s", Exceptions.getStackTraceString(e)));
}
}
- final ExecuteCallback globalExecuteCallbackFunction = FFmpegKitConfig.getExecuteCallback();
- if (globalExecuteCallbackFunction != null) {
+ final MediaInformationSessionCompleteCallback globalMediaInformationSessionCompleteCallback = FFmpegKitConfig.getMediaInformationSessionCompleteCallback();
+ if (globalMediaInformationSessionCompleteCallback != null) {
try {
// NOTIFY GLOBAL CALLBACK DEFINEDs
- globalExecuteCallbackFunction.apply(mediaInformationSession);
+ globalMediaInformationSessionCompleteCallback.apply(mediaInformationSession);
} catch (final Exception e) {
- android.util.Log.e(FFmpegKitConfig.TAG, String.format("Exception thrown inside global ExecuteCallback block.%s", Exceptions.getStackTraceString(e)));
+ android.util.Log.e(FFmpegKitConfig.TAG, String.format("Exception thrown inside global complete callback.%s", Exceptions.getStackTraceString(e)));
}
}
}
diff --git a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/ExecuteCallback.java b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/ExecuteCallback.java
deleted file mode 100644
index 2d1af84..0000000
--- a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/ExecuteCallback.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2018-2021 Taner Sener
- *
- * This file is part of FFmpegKit.
- *
- * FFmpegKit is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * FFmpegKit is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with FFmpegKit. If not, see
Callback function invoked when an asynchronous session ends running. - *
Session has either {@link SessionState#COMPLETED} or {@link SessionState#FAILED} state when - * the callback is invoked. - *
If it has {@link SessionState#COMPLETED} state, ReturnCode
should be checked to
- * see the execution result.
- *
If getState
returns {@link SessionState#FAILED} then
- * getFailStackTrace
should be used to get the failure reason.
- *
- * switch (session.getState()) { - * case COMPLETED: { - * ReturnCode returnCode = session.getReturnCode(); - * } break; - * case FAILED: { - * String failStackTrace = session.getFailStackTrace(); - * } break; - * } - *- */ -@FunctionalInterface -public interface ExecuteCallback { - - /** - *
Called when an asynchronous session ends running. - * - * @param session session - */ - void apply(final Session session); - -} diff --git a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegKit.java b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegKit.java index 84750a8..d0b6dee 100644 --- a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegKit.java +++ b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegKit.java @@ -23,16 +23,16 @@ import java.util.List; import java.util.concurrent.ExecutorService; /** - *
Main class to run FFmpeg
commands. Supports executing commands both synchronously and
- * asynchronously.
+ *
Main class to run FFmpeg
commands. Supports executing commands both
+ * synchronously and asynchronously.
*
* FFmpegSession session = FFmpegKit.execute("-i file1.mp4 -c:v libxvid file1.avi"); * - * FFmpegSession asyncSession = FFmpegKit.executeAsync("-i file1.mp4 -c:v libxvid file1.avi", executeCallback); + * FFmpegSession asyncSession = FFmpegKit.executeAsync("-i file1.mp4 -c:v libxvid file1.avi", completeCallback); **
Provides overloaded execute
methods to define session specific callbacks.
*
- * FFmpegSession asyncSession = FFmpegKit.executeAsync("-i file1.mp4 -c:v libxvid file1.avi", executeCallback, logCallback, statisticsCallback); + * FFmpegSession asyncSession = FFmpegKit.executeAsync("-i file1.mp4 -c:v libxvid file1.avi", completeCallback, logCallback, statisticsCallback); **/ public class FFmpegKit { @@ -65,16 +65,17 @@ public class FFmpegKit { /** *
Starts an asynchronous FFmpeg execution with arguments provided. * - *
Note that this method returns immediately and does not wait the execution to complete. You must use an - * {@link ExecuteCallback} if you want to be notified about the result. + *
Note that this method returns immediately and does not wait the execution to complete. + * You must use an {@link FFmpegSessionCompleteCallback} if you want to be notified about the + * result. * - * @param arguments FFmpeg command options/arguments as string array - * @param executeCallback callback that will be called when the execution is completed + * @param arguments FFmpeg command options/arguments as string array + * @param completeCallback callback that will be called when the execution has completed * @return FFmpeg session created for this execution */ public static FFmpegSession executeWithArgumentsAsync(final String[] arguments, - final ExecuteCallback executeCallback) { - final FFmpegSession session = new FFmpegSession(arguments, executeCallback); + final FFmpegSessionCompleteCallback completeCallback) { + final FFmpegSession session = new FFmpegSession(arguments, completeCallback); FFmpegKitConfig.asyncFFmpegExecute(session); @@ -84,20 +85,21 @@ public class FFmpegKit { /** *
Starts an asynchronous FFmpeg execution with arguments provided. * - *
Note that this method returns immediately and does not wait the execution to complete. You must use an - * {@link ExecuteCallback} if you want to be notified about the result. + *
Note that this method returns immediately and does not wait the execution to complete. + * You must use an {@link FFmpegSessionCompleteCallback} if you want to be notified about the + * result. * * @param arguments FFmpeg command options/arguments as string array - * @param executeCallback callback that will be called when the execution is completed + * @param completeCallback callback that will be called when the execution has completed * @param logCallback callback that will receive logs * @param statisticsCallback callback that will receive statistics * @return FFmpeg session created for this execution */ public static FFmpegSession executeWithArgumentsAsync(final String[] arguments, - final ExecuteCallback executeCallback, + final FFmpegSessionCompleteCallback completeCallback, final LogCallback logCallback, final StatisticsCallback statisticsCallback) { - final FFmpegSession session = new FFmpegSession(arguments, executeCallback, logCallback, statisticsCallback); + final FFmpegSession session = new FFmpegSession(arguments, completeCallback, logCallback, statisticsCallback); FFmpegKitConfig.asyncFFmpegExecute(session); @@ -107,18 +109,19 @@ public class FFmpegKit { /** *
Starts an asynchronous FFmpeg execution with arguments provided. * - *
Note that this method returns immediately and does not wait the execution to complete. You must use an - * {@link ExecuteCallback} if you want to be notified about the result. + *
Note that this method returns immediately and does not wait the execution to complete. + * You must use an {@link FFmpegSessionCompleteCallback} if you want to be notified about the + * result. * - * @param arguments FFmpeg command options/arguments as string array - * @param executeCallback callback that will be called when the execution is completed - * @param executorService executor service that will be used to run this asynchronous operation + * @param arguments FFmpeg command options/arguments as string array + * @param completeCallback callback that will be called when the execution has completed + * @param executorService executor service that will be used to run this asynchronous operation * @return FFmpeg session created for this execution */ public static FFmpegSession executeWithArgumentsAsync(final String[] arguments, - final ExecuteCallback executeCallback, + final FFmpegSessionCompleteCallback completeCallback, final ExecutorService executorService) { - final FFmpegSession session = new FFmpegSession(arguments, executeCallback); + final FFmpegSession session = new FFmpegSession(arguments, completeCallback); FFmpegKitConfig.asyncFFmpegExecute(session, executorService); @@ -128,22 +131,24 @@ public class FFmpegKit { /** *
Starts an asynchronous FFmpeg execution with arguments provided. * - *
Note that this method returns immediately and does not wait the execution to complete. You must use an - * {@link ExecuteCallback} if you want to be notified about the result. + *
Note that this method returns immediately and does not wait the execution to complete. + * You must use an {@link FFmpegSessionCompleteCallback} if you want to be notified about the + * result. * * @param arguments FFmpeg command options/arguments as string array - * @param executeCallback callback that will be called when the execution is completed + * @param completeCallback callback that will be called when the execution has completed * @param logCallback callback that will receive logs * @param statisticsCallback callback that will receive statistics - * @param executorService executor service that will be used to run this asynchronous operation + * @param executorService executor service that will be used to run this asynchronous + * operation * @return FFmpeg session created for this execution */ public static FFmpegSession executeWithArgumentsAsync(final String[] arguments, - final ExecuteCallback executeCallback, + final FFmpegSessionCompleteCallback completeCallback, final LogCallback logCallback, final StatisticsCallback statisticsCallback, final ExecutorService executorService) { - final FFmpegSession session = new FFmpegSession(arguments, executeCallback, logCallback, statisticsCallback); + final FFmpegSession session = new FFmpegSession(arguments, completeCallback, logCallback, statisticsCallback); FFmpegKitConfig.asyncFFmpegExecute(session, executorService); @@ -163,57 +168,63 @@ public class FFmpegKit { } /** - *
Starts an asynchronous FFmpeg execution for the given command. Space character is used to split the command - * into arguments. You can use single or double quote characters to specify arguments inside your command. + *
Starts an asynchronous FFmpeg execution for the given command. Space character is used to + * split the command into arguments. You can use single or double quote characters to specify + * arguments inside your command. * - *
Note that this method returns immediately and does not wait the execution to complete. You must use an - * {@link ExecuteCallback} if you want to be notified about the result. + *
Note that this method returns immediately and does not wait the execution to complete. + * You must use an {@link FFmpegSessionCompleteCallback} if you want to be notified about the + * result. * - * @param command FFmpeg command - * @param executeCallback callback that will be called when the execution is completed + * @param command FFmpeg command + * @param completeCallback callback that will be called when the execution has completed * @return FFmpeg session created for this execution */ public static FFmpegSession executeAsync(final String command, - final ExecuteCallback executeCallback) { - return executeWithArgumentsAsync(FFmpegKitConfig.parseArguments(command), executeCallback); + final FFmpegSessionCompleteCallback completeCallback) { + return executeWithArgumentsAsync(FFmpegKitConfig.parseArguments(command), completeCallback); } /** - *
Starts an asynchronous FFmpeg execution for the given command. Space character is used to split the command - * into arguments. You can use single or double quote characters to specify arguments inside your command. + *
Starts an asynchronous FFmpeg execution for the given command. Space character is used to + * split the command into arguments. You can use single or double quote characters to specify + * arguments inside your command. * - *
Note that this method returns immediately and does not wait the execution to complete. You must use an - * {@link ExecuteCallback} if you want to be notified about the result. + *
Note that this method returns immediately and does not wait the execution to complete. + * You must use an {@link FFmpegSessionCompleteCallback} if you want to be notified about the + * result. * * @param command FFmpeg command - * @param executeCallback callback that will be called when the execution is completed + * @param completeCallback callback that will be called when the execution has completed * @param logCallback callback that will receive logs * @param statisticsCallback callback that will receive statistics * @return FFmpeg session created for this execution */ public static FFmpegSession executeAsync(final String command, - final ExecuteCallback executeCallback, + final FFmpegSessionCompleteCallback completeCallback, final LogCallback logCallback, final StatisticsCallback statisticsCallback) { - return executeWithArgumentsAsync(FFmpegKitConfig.parseArguments(command), executeCallback, logCallback, statisticsCallback); + return executeWithArgumentsAsync(FFmpegKitConfig.parseArguments(command), completeCallback, logCallback, statisticsCallback); } /** - *
Starts an asynchronous FFmpeg execution for the given command. Space character is used to split the command - * into arguments. You can use single or double quote characters to specify arguments inside your command. + *
Starts an asynchronous FFmpeg execution for the given command. Space character is used to + * split the command into arguments. You can use single or double quote characters to specify + * arguments inside your command. * - *
Note that this method returns immediately and does not wait the execution to complete. You must use an - * {@link ExecuteCallback} if you want to be notified about the result. + *
Note that this method returns immediately and does not wait the execution to complete. + * You must use an {@link FFmpegSessionCompleteCallback} if you want to be notified about the + * result. * - * @param command FFmpeg command - * @param executeCallback callback that will be called when the execution is completed - * @param executorService executor service that will be used to run this asynchronous operation + * @param command FFmpeg command + * @param completeCallback callback that will be called when the execution has completed + * @param executorService executor service that will be used to run this asynchronous operation * @return FFmpeg session created for this execution */ public static FFmpegSession executeAsync(final String command, - final ExecuteCallback executeCallback, + final FFmpegSessionCompleteCallback completeCallback, final ExecutorService executorService) { - final FFmpegSession session = new FFmpegSession(FFmpegKitConfig.parseArguments(command), executeCallback); + final FFmpegSession session = new FFmpegSession(FFmpegKitConfig.parseArguments(command), completeCallback); FFmpegKitConfig.asyncFFmpegExecute(session, executorService); @@ -221,25 +232,27 @@ public class FFmpegKit { } /** - *
Starts an asynchronous FFmpeg execution for the given command. Space character is used to split the command - * into arguments. You can use single or double quote characters to specify arguments inside your command. + *
Starts an asynchronous FFmpeg execution for the given command. Space character is used to + * split the command into arguments. You can use single or double quote characters to specify + * arguments inside your command. * - *
Note that this method returns immediately and does not wait the execution to complete. You must use an - * {@link ExecuteCallback} if you want to be notified about the result. + *
Note that this method returns immediately and does not wait the execution to complete. + * You must use an {@link FFmpegSessionCompleteCallback} if you want to be notified about the + * result. * * @param command FFmpeg command - * @param executeCallback callback that will be called when the execution is completed + * @param completeCallback callback that will be called when the execution has completed * @param logCallback callback that will receive logs * @param statisticsCallback callback that will receive statistics * @param executorService executor service that will be used to run this asynchronous operation * @return FFmpeg session created for this execution */ public static FFmpegSession executeAsync(final String command, - final ExecuteCallback executeCallback, + final FFmpegSessionCompleteCallback completeCallback, final LogCallback logCallback, final StatisticsCallback statisticsCallback, final ExecutorService executorService) { - final FFmpegSession session = new FFmpegSession(FFmpegKitConfig.parseArguments(command), executeCallback, logCallback, statisticsCallback); + final FFmpegSession session = new FFmpegSession(FFmpegKitConfig.parseArguments(command), completeCallback, logCallback, statisticsCallback); FFmpegKitConfig.asyncFFmpegExecute(session, executorService); @@ -249,7 +262,7 @@ public class FFmpegKit { /** *
Cancels all running sessions. * - *
This function does not wait for termination to complete and returns immediately. + *
This method does not wait for termination to complete and returns immediately. */ public static void cancel() { @@ -264,7 +277,7 @@ public class FFmpegKit { /** *
Cancels the session specified with sessionId
.
*
- *
This function does not wait for termination to complete and returns immediately. + *
This method does not wait for termination to complete and returns immediately.
*
* @param sessionId id of the session that will be cancelled
*/
diff --git a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegKitConfig.java b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegKitConfig.java
index 8fcb438..16b8829 100644
--- a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegKitConfig.java
+++ b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegKitConfig.java
@@ -120,9 +120,11 @@ public class FFmpegKitConfig {
private static ExecutorService asyncExecutorService;
/* Global callbacks */
- private static LogCallback globalLogCallbackFunction;
- private static StatisticsCallback globalStatisticsCallbackFunction;
- private static ExecuteCallback globalExecuteCallbackFunction;
+ private static LogCallback globalLogCallback;
+ private static StatisticsCallback globalStatisticsCallback;
+ private static FFmpegSessionCompleteCallback globalFFmpegSessionCompleteCallback;
+ private static FFprobeSessionCompleteCallback globalFFprobeSessionCompleteCallback;
+ private static MediaInformationSessionCompleteCallback globalMediaInformationSessionCompleteCallback;
private static final SparseArray Starts an asynchronous FFmpeg execution for the given session.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an {@link FFmpegSessionCompleteCallback} if you want to be notified about the
+ * result.
*
* @param ffmpegSession FFmpeg session which includes command options/arguments
*/
@@ -718,8 +723,9 @@ public class FFmpegKitConfig {
/**
* Starts an asynchronous FFmpeg execution for the given session.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an {@link FFmpegSessionCompleteCallback} if you want to be notified about the
+ * result.
*
* @param ffmpegSession FFmpeg session which includes command options/arguments
* @param executorService executor service that will be used to run this asynchronous operation
@@ -733,8 +739,9 @@ public class FFmpegKitConfig {
/**
* Starts an asynchronous FFprobe execution for the given session.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an {@link FFprobeSessionCompleteCallback} if you want to be notified about the
+ * result.
*
* @param ffprobeSession FFprobe session which includes command options/arguments
*/
@@ -747,8 +754,9 @@ public class FFmpegKitConfig {
/**
* Starts an asynchronous FFprobe execution for the given session.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an {@link FFprobeSessionCompleteCallback} if you want to be notified about the
+ * result.
*
* @param ffprobeSession FFprobe session which includes command options/arguments
* @param executorService executor service that will be used to run this asynchronous operation
@@ -762,10 +770,12 @@ public class FFmpegKitConfig {
/**
* Starts an asynchronous FFprobe execution for the given media information session.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use a {@link MediaInformationSessionCompleteCallback} if you want to be notified
+ * about the result.
*
- * @param mediaInformationSession media information session which includes command options/arguments
+ * @param mediaInformationSession media information session which includes command
+ * options/arguments
* @param waitTimeout max time to wait until media information is transmitted
*/
public static void asyncGetMediaInformationExecute(final MediaInformationSession mediaInformationSession, final int waitTimeout) {
@@ -777,11 +787,14 @@ public class FFmpegKitConfig {
/**
* Starts an asynchronous FFprobe execution for the given media information session.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use a {@link MediaInformationSessionCompleteCallback} if you want to be notified
+ * about the result.
*
- * @param mediaInformationSession media information session which includes command options/arguments
- * @param executorService executor service that will be used to run this asynchronous operation
+ * @param mediaInformationSession media information session which includes command
+ * options/arguments
+ * @param executorService executor service that will be used to run this asynchronous
+ * operation
* @param waitTimeout max time to wait until media information is transmitted
*/
public static void asyncGetMediaInformationExecute(final MediaInformationSession mediaInformationSession, final ExecutorService executorService, final int waitTimeout) {
@@ -822,42 +835,82 @@ public class FFmpegKitConfig {
}
/**
- * Sets a global callback function to redirect FFmpeg/FFprobe logs.
+ * Sets a global callback to redirect FFmpeg/FFprobe logs.
*
- * @param logCallback log callback function or null to disable a previously defined
- * callback
+ * @param logCallback log callback or null to disable a previously defined callback
*/
public static void enableLogCallback(final LogCallback logCallback) {
- globalLogCallbackFunction = logCallback;
+ globalLogCallback = logCallback;
}
/**
- * Sets a global callback function to redirect FFmpeg statistics.
+ * Sets a global callback to redirect FFmpeg statistics.
*
- * @param statisticsCallback statistics callback function or null to disable a previously
+ * @param statisticsCallback statistics callback or null to disable a previously
* defined callback
*/
public static void enableStatisticsCallback(final StatisticsCallback statisticsCallback) {
- globalStatisticsCallbackFunction = statisticsCallback;
+ globalStatisticsCallback = statisticsCallback;
}
/**
- * Sets a global callback function to receive execution results.
+ * Sets a global FFmpegSessionCompleteCallback to receive execution results for FFmpeg
+ * sessions.
*
- * @param executeCallback execute callback function or null to disable a previously
- * defined callback
+ * @param ffmpegSessionCompleteCallback complete callback or null to disable a
+ * previously defined callback
*/
- public static void enableExecuteCallback(final ExecuteCallback executeCallback) {
- globalExecuteCallbackFunction = executeCallback;
+ public static void enableFFmpegSessionCompleteCallback(final FFmpegSessionCompleteCallback ffmpegSessionCompleteCallback) {
+ globalFFmpegSessionCompleteCallback = ffmpegSessionCompleteCallback;
}
/**
- * Returns the global execute callback function.
+ * Returns the global FFmpegSessionCompleteCallback set.
*
- * @return global execute callback function
+ * @return global FFmpegSessionCompleteCallback or null if it is not set
*/
- static ExecuteCallback getExecuteCallback() {
- return globalExecuteCallbackFunction;
+ public static FFmpegSessionCompleteCallback getFFmpegSessionCompleteCallback() {
+ return globalFFmpegSessionCompleteCallback;
+ }
+
+ /**
+ * Sets a global FFprobeSessionCompleteCallback to receive execution results for FFprobe
+ * sessions.
+ *
+ * @param ffprobeSessionCompleteCallback complete callback or null to disable a
+ * previously defined callback
+ */
+ public static void enableFFprobeSessionCompleteCallback(final FFprobeSessionCompleteCallback ffprobeSessionCompleteCallback) {
+ globalFFprobeSessionCompleteCallback = ffprobeSessionCompleteCallback;
+ }
+
+ /**
+ * Returns the global FFprobeSessionCompleteCallback set.
+ *
+ * @return global FFprobeSessionCompleteCallback or null if it is not set
+ */
+ public static FFprobeSessionCompleteCallback getFFprobeSessionCompleteCallback() {
+ return globalFFprobeSessionCompleteCallback;
+ }
+
+ /**
+ * Sets a global MediaInformationSessionCompleteCallback to receive execution results for
+ * MediaInformation sessions.
+ *
+ * @param mediaInformationSessionCompleteCallback complete callback or null to disable
+ * a previously defined callback
+ */
+ public static void enableMediaInformationSessionCompleteCallback(final MediaInformationSessionCompleteCallback mediaInformationSessionCompleteCallback) {
+ globalMediaInformationSessionCompleteCallback = mediaInformationSessionCompleteCallback;
+ }
+
+ /**
+ * Returns the global MediaInformationSessionCompleteCallback set.
+ *
+ * @return global MediaInformationSessionCompleteCallback or null if it is not set
+ */
+ public static MediaInformationSessionCompleteCallback getMediaInformationSessionCompleteCallback() {
+ return globalMediaInformationSessionCompleteCallback;
}
/**
@@ -1135,7 +1188,7 @@ public class FFmpegKitConfig {
*
* @return all FFmpeg sessions in the session history
*/
- static List Returns all MediaInformation sessions in the session history.
+ *
+ * @return all MediaInformation sessions in the session history
+ */
+ public static List Returns sessions that have the given state.
*
@@ -1357,7 +1429,7 @@ public class FFmpegKitConfig {
native static int nativeFFprobeExecute(final long sessionId, final String[] arguments);
/**
- * Cancels an ongoing FFmpeg operation natively. This function does not wait for termination
+ * Cancels an ongoing FFmpeg operation natively. This method does not wait for termination
* to complete and returns immediately.
*
* @param sessionId id of the session
diff --git a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegSession.java b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegSession.java
index 2a897fe..ca7d105 100644
--- a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegSession.java
+++ b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegSession.java
@@ -28,10 +28,15 @@ import java.util.List;
public class FFmpegSession extends AbstractSession implements Session {
/**
- * Session specific statistics callback function.
+ * Session specific statistics callback.
*/
private final StatisticsCallback statisticsCallback;
+ /**
+ * Session specific complete callback.
+ */
+ private final FFmpegSessionCompleteCallback completeCallback;
+
/**
* Statistics entries received for this session.
*/
@@ -54,44 +59,45 @@ public class FFmpegSession extends AbstractSession implements Session {
/**
* Builds a new FFmpeg session.
*
- * @param arguments command arguments
- * @param executeCallback session specific execute callback function
+ * @param arguments command arguments
+ * @param completeCallback session specific complete callback
*/
- public FFmpegSession(final String[] arguments, final ExecuteCallback executeCallback) {
- this(arguments, executeCallback, null, null);
+ public FFmpegSession(final String[] arguments, final FFmpegSessionCompleteCallback completeCallback) {
+ this(arguments, completeCallback, null, null);
}
/**
* Builds a new FFmpeg session.
*
* @param arguments command arguments
- * @param executeCallback session specific execute callback function
- * @param logCallback session specific log callback function
- * @param statisticsCallback session specific statistics callback function
+ * @param completeCallback session specific complete callback
+ * @param logCallback session specific log callback
+ * @param statisticsCallback session specific statistics callback
*/
public FFmpegSession(final String[] arguments,
- final ExecuteCallback executeCallback,
+ final FFmpegSessionCompleteCallback completeCallback,
final LogCallback logCallback,
final StatisticsCallback statisticsCallback) {
- this(arguments, executeCallback, logCallback, statisticsCallback, FFmpegKitConfig.getLogRedirectionStrategy());
+ this(arguments, completeCallback, logCallback, statisticsCallback, FFmpegKitConfig.getLogRedirectionStrategy());
}
/**
* Builds a new FFmpeg session.
*
* @param arguments command arguments
- * @param executeCallback session specific execute callback function
- * @param logCallback session specific log callback function
- * @param statisticsCallback session specific statistics callback function
+ * @param completeCallback session specific complete callback
+ * @param logCallback session specific log callback
+ * @param statisticsCallback session specific statistics callback
* @param logRedirectionStrategy session specific log redirection strategy
*/
public FFmpegSession(final String[] arguments,
- final ExecuteCallback executeCallback,
+ final FFmpegSessionCompleteCallback completeCallback,
final LogCallback logCallback,
final StatisticsCallback statisticsCallback,
final LogRedirectionStrategy logRedirectionStrategy) {
- super(arguments, executeCallback, logCallback, logRedirectionStrategy);
+ super(arguments, logCallback, logRedirectionStrategy);
+ this.completeCallback = completeCallback;
this.statisticsCallback = statisticsCallback;
this.statistics = new LinkedList<>();
@@ -99,14 +105,23 @@ public class FFmpegSession extends AbstractSession implements Session {
}
/**
- * Returns the session specific statistics callback function.
+ * Returns the session specific statistics callback.
*
- * @return session specific statistics callback function
+ * @return session specific statistics callback
*/
public StatisticsCallback getStatisticsCallback() {
return statisticsCallback;
}
+ /**
+ * Returns the session specific complete callback.
+ *
+ * @return session specific complete callback
+ */
+ public FFmpegSessionCompleteCallback getCompleteCallback() {
+ return completeCallback;
+ }
+
/**
* Returns all statistics entries generated for this session. If there are asynchronous
* messages that are not delivered yet, this method waits for them until the given timeout.
@@ -165,10 +180,8 @@ public class FFmpegSession extends AbstractSession implements Session {
}
/**
- * Adds a new statistics entry for this session.
- *
- * It is invoked internally by Callback function that is invoked when an asynchronous Called when an FFmpeg session has ended.
+ *
+ * @param session FFmpeg session
+ */
+ void apply(final FFmpegSession session);
+
+}
diff --git a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFprobeKit.java b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFprobeKit.java
index 48cf946..d64c0d5 100644
--- a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFprobeKit.java
+++ b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFprobeKit.java
@@ -23,16 +23,16 @@ import java.util.List;
import java.util.concurrent.ExecutorService;
/**
- * Main class to run Main class to run Provides overloaded It can extract media information for a file or a url, using {@link #getMediaInformation(String)} method.
* Starts an asynchronous FFprobe execution with arguments provided.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an {@link FFprobeSessionCompleteCallback} if you want to be notified about the
+ * result.
*
- * @param arguments FFprobe command options/arguments as string array
- * @param executeCallback callback that will be called when the execution is completed
+ * @param arguments FFprobe command options/arguments as string array
+ * @param completeCallback callback that will be called when the execution has completed
* @return FFprobe session created for this execution
*/
public static FFprobeSession executeWithArgumentsAsync(final String[] arguments,
- final ExecuteCallback executeCallback) {
- final FFprobeSession session = new FFprobeSession(arguments, executeCallback);
+ final FFprobeSessionCompleteCallback completeCallback) {
+ final FFprobeSession session = new FFprobeSession(arguments, completeCallback);
FFmpegKitConfig.asyncFFprobeExecute(session);
@@ -98,18 +99,19 @@ public class FFprobeKit {
/**
* Starts an asynchronous FFprobe execution with arguments provided.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an {@link FFprobeSessionCompleteCallback} if you want to be notified about the
+ * result.
*
- * @param arguments FFprobe command options/arguments as string array
- * @param executeCallback callback that will be notified when execution is completed
- * @param logCallback callback that will receive logs
+ * @param arguments FFprobe command options/arguments as string array
+ * @param completeCallback callback that will be notified when execution has completed
+ * @param logCallback callback that will receive logs
* @return FFprobe session created for this execution
*/
public static FFprobeSession executeWithArgumentsAsync(final String[] arguments,
- final ExecuteCallback executeCallback,
+ final FFprobeSessionCompleteCallback completeCallback,
final LogCallback logCallback) {
- final FFprobeSession session = new FFprobeSession(arguments, executeCallback, logCallback);
+ final FFprobeSession session = new FFprobeSession(arguments, completeCallback, logCallback);
FFmpegKitConfig.asyncFFprobeExecute(session);
@@ -119,18 +121,19 @@ public class FFprobeKit {
/**
* Starts an asynchronous FFprobe execution with arguments provided.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an {@link FFprobeSessionCompleteCallback} if you want to be notified about the
+ * result.
*
- * @param arguments FFprobe command options/arguments as string array
- * @param executeCallback callback that will be called when the execution is completed
- * @param executorService executor service that will be used to run this asynchronous operation
+ * @param arguments FFprobe command options/arguments as string array
+ * @param completeCallback callback that will be called when the execution has completed
+ * @param executorService executor service that will be used to run this asynchronous operation
* @return FFprobe session created for this execution
*/
public static FFprobeSession executeWithArgumentsAsync(final String[] arguments,
- final ExecuteCallback executeCallback,
+ final FFprobeSessionCompleteCallback completeCallback,
final ExecutorService executorService) {
- final FFprobeSession session = new FFprobeSession(arguments, executeCallback);
+ final FFprobeSession session = new FFprobeSession(arguments, completeCallback);
FFmpegKitConfig.asyncFFprobeExecute(session, executorService);
@@ -140,20 +143,21 @@ public class FFprobeKit {
/**
* Starts an asynchronous FFprobe execution with arguments provided.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an {@link FFprobeSessionCompleteCallback} if you want to be notified about the
+ * result.
*
- * @param arguments FFprobe command options/arguments as string array
- * @param executeCallback callback that will be notified when execution is completed
- * @param logCallback callback that will receive logs
- * @param executorService executor service that will be used to run this asynchronous operation
+ * @param arguments FFprobe command options/arguments as string array
+ * @param completeCallback callback that will be notified when execution has completed
+ * @param logCallback callback that will receive logs
+ * @param executorService executor service that will be used to run this asynchronous operation
* @return FFprobe session created for this execution
*/
public static FFprobeSession executeWithArgumentsAsync(final String[] arguments,
- final ExecuteCallback executeCallback,
+ final FFprobeSessionCompleteCallback completeCallback,
final LogCallback logCallback,
final ExecutorService executorService) {
- final FFprobeSession session = new FFprobeSession(arguments, executeCallback, logCallback);
+ final FFprobeSession session = new FFprobeSession(arguments, completeCallback, logCallback);
FFmpegKitConfig.asyncFFprobeExecute(session, executorService);
@@ -173,55 +177,61 @@ public class FFprobeKit {
}
/**
- * Starts an asynchronous FFprobe execution for the given command. Space character is used to split the command
- * into arguments. You can use single or double quote characters to specify arguments inside your command.
+ * Starts an asynchronous FFprobe execution for the given command. Space character is used
+ * to split the command into arguments. You can use single or double quote characters to
+ * specify arguments inside your command.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an {@link FFprobeSessionCompleteCallback} if you want to be notified about the
+ * result.
*
- * @param command FFprobe command
- * @param executeCallback callback that will be called when the execution is completed
+ * @param command FFprobe command
+ * @param completeCallback callback that will be called when the execution has completed
* @return FFprobe session created for this execution
*/
public static FFprobeSession executeAsync(final String command,
- final ExecuteCallback executeCallback) {
- return executeWithArgumentsAsync(FFmpegKitConfig.parseArguments(command), executeCallback);
+ final FFprobeSessionCompleteCallback completeCallback) {
+ return executeWithArgumentsAsync(FFmpegKitConfig.parseArguments(command), completeCallback);
}
/**
- * Starts an asynchronous FFprobe execution for the given command. Space character is used to split the command
- * into arguments. You can use single or double quote characters to specify arguments inside your command.
+ * Starts an asynchronous FFprobe execution for the given command. Space character is used
+ * to split the command into arguments. You can use single or double quote characters to
+ * specify arguments inside your command.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an {@link FFprobeSessionCompleteCallback} if you want to be notified about the
+ * result.
*
- * @param command FFprobe command
- * @param executeCallback callback that will be notified when execution is completed
- * @param logCallback callback that will receive logs
+ * @param command FFprobe command
+ * @param completeCallback callback that will be notified when execution has completed
+ * @param logCallback callback that will receive logs
* @return FFprobe session created for this execution
*/
public static FFprobeSession executeAsync(final String command,
- final ExecuteCallback executeCallback,
+ final FFprobeSessionCompleteCallback completeCallback,
final LogCallback logCallback) {
- return executeWithArgumentsAsync(FFmpegKitConfig.parseArguments(command), executeCallback, logCallback);
+ return executeWithArgumentsAsync(FFmpegKitConfig.parseArguments(command), completeCallback, logCallback);
}
/**
- * Starts an asynchronous FFprobe execution for the given command. Space character is used to split the command
- * into arguments. You can use single or double quote characters to specify arguments inside your command.
+ * Starts an asynchronous FFprobe execution for the given command. Space character is used
+ * to split the command into arguments. You can use single or double quote characters to
+ * specify arguments inside your command.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an {@link FFprobeSessionCompleteCallback} if you want to be notified about the
+ * result.
*
- * @param command FFprobe command
- * @param executeCallback callback that will be called when the execution is completed
- * @param executorService executor service that will be used to run this asynchronous operation
+ * @param command FFprobe command
+ * @param completeCallback callback that will be called when the execution has completed
+ * @param executorService executor service that will be used to run this asynchronous operation
* @return FFprobe session created for this execution
*/
public static FFprobeSession executeAsync(final String command,
- final ExecuteCallback executeCallback,
+ final FFprobeSessionCompleteCallback completeCallback,
final ExecutorService executorService) {
- final FFprobeSession session = new FFprobeSession(FFmpegKitConfig.parseArguments(command), executeCallback);
+ final FFprobeSession session = new FFprobeSession(FFmpegKitConfig.parseArguments(command), completeCallback);
FFmpegKitConfig.asyncFFprobeExecute(session, executorService);
@@ -229,23 +239,25 @@ public class FFprobeKit {
}
/**
- * Starts an asynchronous FFprobe execution for the given command. Space character is used to split the command
- * into arguments. You can use single or double quote characters to specify arguments inside your command.
+ * Starts an asynchronous FFprobe execution for the given command. Space character is used
+ * to split the command into arguments. You can use single or double quote characters to
+ * specify arguments inside your command.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an {@link FFprobeSessionCompleteCallback} if you want to be notified about the
+ * result.
*
- * @param command FFprobe command
- * @param executeCallback callback that will be called when the execution is completed
- * @param logCallback callback that will receive logs
- * @param executorService executor service that will be used to run this asynchronous operation
+ * @param command FFprobe command
+ * @param completeCallback callback that will be called when the execution has completed
+ * @param logCallback callback that will receive logs
+ * @param executorService executor service that will be used to run this asynchronous operation
* @return FFprobe session created for this execution
*/
public static FFprobeSession executeAsync(final String command,
- final ExecuteCallback executeCallback,
+ final FFprobeSessionCompleteCallback completeCallback,
final LogCallback logCallback,
final ExecutorService executorService) {
- final FFprobeSession session = new FFprobeSession(FFmpegKitConfig.parseArguments(command), executeCallback, logCallback);
+ final FFprobeSession session = new FFprobeSession(FFmpegKitConfig.parseArguments(command), completeCallback, logCallback);
FFmpegKitConfig.asyncFFprobeExecute(session, executorService);
@@ -283,18 +295,20 @@ public class FFprobeKit {
}
/**
- * Starts an asynchronous FFprobe execution to extract the media information for the specified file.
+ * Starts an asynchronous FFprobe execution to extract the media information for the
+ * specified file.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use a {@link MediaInformationSessionCompleteCallback} if you want to be notified
+ * about the result.
*
- * @param path path or uri of a media file
- * @param executeCallback callback that will be called when the execution is completed
+ * @param path path or uri of a media file
+ * @param completeCallback callback that will be called when the execution has completed
* @return media information session created for this execution
*/
public static MediaInformationSession getMediaInformationAsync(final String path,
- final ExecuteCallback executeCallback) {
- final MediaInformationSession session = new MediaInformationSession(defaultGetMediaInformationCommandArguments(path), executeCallback);
+ final MediaInformationSessionCompleteCallback completeCallback) {
+ final MediaInformationSession session = new MediaInformationSession(defaultGetMediaInformationCommandArguments(path), completeCallback);
FFmpegKitConfig.asyncGetMediaInformationExecute(session, AbstractSession.DEFAULT_TIMEOUT_FOR_ASYNCHRONOUS_MESSAGES_IN_TRANSMIT);
@@ -302,22 +316,24 @@ public class FFprobeKit {
}
/**
- * Starts an asynchronous FFprobe execution to extract the media information for the specified file.
+ * Starts an asynchronous FFprobe execution to extract the media information for the
+ * specified file.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use a {@link MediaInformationSessionCompleteCallback} if you want to be notified
+ * about the result.
*
- * @param path path or uri of a media file
- * @param executeCallback callback that will be notified when execution is completed
- * @param logCallback callback that will receive logs
- * @param waitTimeout max time to wait until media information is transmitted
+ * @param path path or uri of a media file
+ * @param completeCallback callback that will be notified when execution has completed
+ * @param logCallback callback that will receive logs
+ * @param waitTimeout max time to wait until media information is transmitted
* @return media information session created for this execution
*/
public static MediaInformationSession getMediaInformationAsync(final String path,
- final ExecuteCallback executeCallback,
+ final MediaInformationSessionCompleteCallback completeCallback,
final LogCallback logCallback,
final int waitTimeout) {
- final MediaInformationSession session = new MediaInformationSession(defaultGetMediaInformationCommandArguments(path), executeCallback, logCallback);
+ final MediaInformationSession session = new MediaInformationSession(defaultGetMediaInformationCommandArguments(path), completeCallback, logCallback);
FFmpegKitConfig.asyncGetMediaInformationExecute(session, waitTimeout);
@@ -325,20 +341,22 @@ public class FFprobeKit {
}
/**
- * Starts an asynchronous FFprobe execution to extract the media information for the specified file.
+ * Starts an asynchronous FFprobe execution to extract the media information for the
+ * specified file.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use a {@link MediaInformationSessionCompleteCallback} if you want to be notified
+ * about the result.
*
- * @param path path or uri of a media file
- * @param executeCallback callback that will be called when the execution is completed
- * @param executorService executor service that will be used to run this asynchronous operation
+ * @param path path or uri of a media file
+ * @param completeCallback callback that will be called when the execution has completed
+ * @param executorService executor service that will be used to run this asynchronous operation
* @return media information session created for this execution
*/
public static MediaInformationSession getMediaInformationAsync(final String path,
- final ExecuteCallback executeCallback,
+ final MediaInformationSessionCompleteCallback completeCallback,
final ExecutorService executorService) {
- final MediaInformationSession session = new MediaInformationSession(defaultGetMediaInformationCommandArguments(path), executeCallback);
+ final MediaInformationSession session = new MediaInformationSession(defaultGetMediaInformationCommandArguments(path), completeCallback);
FFmpegKitConfig.asyncGetMediaInformationExecute(session, executorService, AbstractSession.DEFAULT_TIMEOUT_FOR_ASYNCHRONOUS_MESSAGES_IN_TRANSMIT);
@@ -346,24 +364,26 @@ public class FFprobeKit {
}
/**
- * Starts an asynchronous FFprobe execution to extract the media information for the specified file.
+ * Starts an asynchronous FFprobe execution to extract the media information for the
+ * specified file.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use a {@link MediaInformationSessionCompleteCallback} if you want to be notified
+ * about the result.
*
- * @param path path or uri of a media file
- * @param executeCallback callback that will be notified when execution is completed
- * @param logCallback callback that will receive logs
- * @param executorService executor service that will be used to run this asynchronous operation
- * @param waitTimeout max time to wait until media information is transmitted
+ * @param path path or uri of a media file
+ * @param completeCallback callback that will be notified when execution has completed
+ * @param logCallback callback that will receive logs
+ * @param executorService executor service that will be used to run this asynchronous operation
+ * @param waitTimeout max time to wait until media information is transmitted
* @return media information session created for this execution
*/
public static MediaInformationSession getMediaInformationAsync(final String path,
- final ExecuteCallback executeCallback,
+ final MediaInformationSessionCompleteCallback completeCallback,
final LogCallback logCallback,
final ExecutorService executorService,
final int waitTimeout) {
- final MediaInformationSession session = new MediaInformationSession(defaultGetMediaInformationCommandArguments(path), executeCallback, logCallback);
+ final MediaInformationSession session = new MediaInformationSession(defaultGetMediaInformationCommandArguments(path), completeCallback, logCallback);
FFmpegKitConfig.asyncGetMediaInformationExecute(session, executorService, waitTimeout);
@@ -385,44 +405,49 @@ public class FFprobeKit {
}
/**
- * Starts an asynchronous FFprobe execution to extract media information using a command. The command passed to
- * this method must generate the output in JSON format in order to successfully extract media information from it.
+ * Starts an asynchronous FFprobe execution to extract media information using a command.
+ * The command passed to this method must generate the output in JSON format in order to
+ * successfully extract media information from it.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use a {@link MediaInformationSessionCompleteCallback} if you want to be notified
+ * about the result.
*
- * @param command FFprobe command that prints media information for a file in JSON format
- * @param executeCallback callback that will be notified when execution is completed
- * @param logCallback callback that will receive logs
- * @param waitTimeout max time to wait until media information is transmitted
+ * @param command FFprobe command that prints media information for a file in JSON
+ * format
+ * @param completeCallback callback that will be notified when execution has completed
+ * @param logCallback callback that will receive logs
+ * @param waitTimeout max time to wait until media information is transmitted
* @return media information session created for this execution
*/
public static MediaInformationSession getMediaInformationFromCommandAsync(final String command,
- final ExecuteCallback executeCallback,
+ final MediaInformationSessionCompleteCallback completeCallback,
final LogCallback logCallback,
final int waitTimeout) {
- return getMediaInformationFromCommandArgumentsAsync(FFmpegKitConfig.parseArguments(command), executeCallback, logCallback, waitTimeout);
+ return getMediaInformationFromCommandArgumentsAsync(FFmpegKitConfig.parseArguments(command), completeCallback, logCallback, waitTimeout);
}
/**
- * Starts an asynchronous FFprobe execution to extract media information using command arguments. The command
- * passed to this method must generate the output in JSON format in order to successfully extract media information
- * from it.
+ * Starts an asynchronous FFprobe execution to extract media information using command
+ * arguments. The command passed to this method must generate the output in JSON format in
+ * order to successfully extract media information from it.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * {@link ExecuteCallback} if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use a {@link MediaInformationSessionCompleteCallback} if you want to be notified
+ * about the result.
*
- * @param arguments FFprobe command arguments that print media information for a file in JSON format
- * @param executeCallback callback that will be notified when execution is completed
- * @param logCallback callback that will receive logs
- * @param waitTimeout max time to wait until media information is transmitted
+ * @param arguments FFprobe command arguments that print media information for a file in
+ * JSON format
+ * @param completeCallback callback that will be notified when execution has completed
+ * @param logCallback callback that will receive logs
+ * @param waitTimeout max time to wait until media information is transmitted
* @return media information session created for this execution
*/
private static MediaInformationSession getMediaInformationFromCommandArgumentsAsync(final String[] arguments,
- final ExecuteCallback executeCallback,
+ final MediaInformationSessionCompleteCallback completeCallback,
final LogCallback logCallback,
final int waitTimeout) {
- final MediaInformationSession session = new MediaInformationSession(arguments, executeCallback, logCallback);
+ final MediaInformationSession session = new MediaInformationSession(arguments, completeCallback, logCallback);
FFmpegKitConfig.asyncGetMediaInformationExecute(session, waitTimeout);
@@ -434,8 +459,17 @@ public class FFprobeKit {
*
* @return all FFprobe sessions in the session history
*/
- public static List Lists all MediaInformation sessions in the session history.
+ *
+ * @return all MediaInformation sessions in the session history
+ */
+ public static List Callback function that is invoked when an asynchronous Called when an FFprobe session has ended.
+ *
+ * @param session FFprobe session
+ */
+ void apply(final FFprobeSession session);
+
+}
diff --git a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/MediaInformationSession.java b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/MediaInformationSession.java
index 004e1dd..97ed2d2 100644
--- a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/MediaInformationSession.java
+++ b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/MediaInformationSession.java
@@ -23,13 +23,18 @@ package com.arthenica.ffmpegkit;
* A custom FFprobe session, which produces a Callback function that is invoked when an asynchronous Called when a media information session has ended.
+ *
+ * @param session media information session
+ */
+ void apply(final MediaInformationSession session);
+
+}
diff --git a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/Session.java b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/Session.java
index c12c9a6..74aa7df 100644
--- a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/Session.java
+++ b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/Session.java
@@ -29,16 +29,9 @@ import java.util.concurrent.Future;
public interface Session {
/**
- * Returns the session specific execute callback function.
+ * Returns the session specific log callback.
*
- * @return session specific execute callback function
- */
- ExecuteCallback getExecuteCallback();
-
- /**
- * Returns the session specific log callback function.
- *
- * @return session specific log callback function
+ * @return session specific log callback
*/
LogCallback getLogCallback();
@@ -198,7 +191,7 @@ public interface Session {
/**
* Adds a new log entry for this session.
- *
+ *
* It is invoked internally by Provides overloaded Starts an asynchronous FFmpeg execution with arguments provided.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an FFmpegSessionCompleteCallback if you want to be notified about the result.
*
- * @param arguments FFmpeg command options/arguments as string array
- * @param executeCallback callback that will be called when the execution is completed
+ * @param arguments FFmpeg command options/arguments as string array
+ * @param completeCallback callback that will be called when the execution has completed
* @return FFmpeg session created for this execution
*/
-+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback;
++ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback;
/**
* Starts an asynchronous FFmpeg execution with arguments provided.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an FFmpegSessionCompleteCallback if you want to be notified about the result.
*
- * @param arguments FFmpeg command options/arguments as string array
- * @param executeCallback callback that will be called when the execution is completed
- * @param logCallback callback that will receive logs
- * @param statisticsCallback callback that will receive statistics
+ * @param arguments FFmpeg command options/arguments as string array
+ * @param completeCallback callback that will be called when the execution has completed
+ * @param logCallback callback that will receive logs
+ * @param statisticsCallback callback that will receive statistics
* @return FFmpeg session created for this execution
*/
-+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback;
++ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback;
/**
* Starts an asynchronous FFmpeg execution with arguments provided.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an FFmpegSessionCompleteCallback if you want to be notified about the result.
*
- * @param arguments FFmpeg command options/arguments as string array
- * @param executeCallback callback that will be called when the execution is completed
- * @param queue dispatch queue that will be used to run this asynchronous operation
+ * @param arguments FFmpeg command options/arguments as string array
+ * @param completeCallback callback that will be called when the execution has completed
+ * @param queue dispatch queue that will be used to run this asynchronous operation
* @return FFmpeg session created for this execution
*/
-+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue;
++ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue;
/**
* Starts an asynchronous FFmpeg execution with arguments provided.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an FFmpegSessionCompleteCallback if you want to be notified about the result.
*
- * @param arguments FFmpeg command options/arguments as string array
- * @param executeCallback callback that will be called when the execution is completed
- * @param logCallback callback that will receive logs
- * @param statisticsCallback callback that will receive statistics
- * @param queue dispatch queue that will be used to run this asynchronous operation
+ * @param arguments FFmpeg command options/arguments as string array
+ * @param completeCallback callback that will be called when the execution has completed
+ * @param logCallback callback that will receive logs
+ * @param statisticsCallback callback that will receive statistics
+ * @param queue dispatch queue that will be used to run this asynchronous operation
* @return FFmpeg session created for this execution
*/
-+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback onDispatchQueue:(dispatch_queue_t)queue;
++ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback onDispatchQueue:(dispatch_queue_t)queue;
/**
* Synchronously executes FFmpeg command provided. Space character is used to split command
@@ -120,70 +119,70 @@
* into arguments. You can use single or double quote characters to specify arguments inside your command.
*
* Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * FFmpegSessionCompleteCallback if you want to be notified about the result.
*
- * @param command FFmpeg command
- * @param executeCallback callback that will be called when the execution is completed
+ * @param command FFmpeg command
+ * @param completeCallback callback that will be called when the execution has completed
* @return FFmpeg session created for this execution
*/
-+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback;
++ (FFmpegSession*)executeAsync:(NSString*)command withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback;
/**
* Starts an asynchronous FFmpeg execution for the given command. Space character is used to split the command
* into arguments. You can use single or double quote characters to specify arguments inside your command.
*
* Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * FFmpegSessionCompleteCallback if you want to be notified about the result.
*
- * @param command FFmpeg command
- * @param executeCallback callback that will be called when the execution is completed
- * @param logCallback callback that will receive logs
- * @param statisticsCallback callback that will receive statistics
+ * @param command FFmpeg command
+ * @param completeCallback callback that will be called when the execution has completed
+ * @param logCallback callback that will receive logs
+ * @param statisticsCallback callback that will receive statistics
* @return FFmpeg session created for this execution
*/
-+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback;
++ (FFmpegSession*)executeAsync:(NSString*)command withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback;
/**
* Starts an asynchronous FFmpeg execution for the given command. Space character is used to split the command
* into arguments. You can use single or double quote characters to specify arguments inside your command.
*
* Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * FFmpegSessionCompleteCallback if you want to be notified about the result.
*
- * @param command FFmpeg command
- * @param executeCallback callback that will be called when the execution is completed
- * @param queue dispatch queue that will be used to run this asynchronous operation
+ * @param command FFmpeg command
+ * @param completeCallback callback that will be called when the execution has completed
+ * @param queue dispatch queue that will be used to run this asynchronous operation
* @return FFmpeg session created for this execution
*/
-+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue;
++ (FFmpegSession*)executeAsync:(NSString*)command withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue;
/**
* Starts an asynchronous FFmpeg execution for the given command. Space character is used to split the command
* into arguments. You can use single or double quote characters to specify arguments inside your command.
*
* Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * FFmpegSessionCompleteCallback if you want to be notified about the result.
*
- * @param command FFmpeg command
- * @param executeCallback callback that will be called when the execution is completed
- * @param logCallback callback that will receive logs
- * @param statisticsCallback callback that will receive statistics
- * @param queue dispatch queue that will be used to run this asynchronous operation
+ * @param command FFmpeg command
+ * @param completeCallback callback that will be called when the execution has completed
+ * @param logCallback callback that will receive logs
+ * @param statisticsCallback callback that will receive statistics
+ * @param queue dispatch queue that will be used to run this asynchronous operation
* @return FFmpeg session created for this execution
*/
-+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback onDispatchQueue:(dispatch_queue_t)queue;
++ (FFmpegSession*)executeAsync:(NSString*)command withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback onDispatchQueue:(dispatch_queue_t)queue;
/**
* Cancels all running sessions.
*
- * This function does not wait for termination to complete and returns immediately.
+ * This method does not wait for termination to complete and returns immediately.
*/
+ (void)cancel;
/**
* Cancels the session specified with This function does not wait for termination to complete and returns immediately.
+ * This method does not wait for termination to complete and returns immediately.
*
* @param sessionId id of the session that will be cancelled
*/
diff --git a/apple/src/FFmpegKit.m b/apple/src/FFmpegKit.m
index 9c082c8..562c0af 100644
--- a/apple/src/FFmpegKit.m
+++ b/apple/src/FFmpegKit.m
@@ -40,26 +40,26 @@
return session;
}
-+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback {
- FFmpegSession* session = [[FFmpegSession alloc] init:arguments withExecuteCallback:executeCallback];
++ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback {
+ FFmpegSession* session = [[FFmpegSession alloc] init:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFmpegExecute:session];
return session;
}
-+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback {
- FFmpegSession* session = [[FFmpegSession alloc] init:arguments withExecuteCallback:executeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
++ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback {
+ FFmpegSession* session = [[FFmpegSession alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
[FFmpegKitConfig asyncFFmpegExecute:session];
return session;
}
-+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue {
- FFmpegSession* session = [[FFmpegSession alloc] init:arguments withExecuteCallback:executeCallback];
++ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue {
+ FFmpegSession* session = [[FFmpegSession alloc] init:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFmpegExecute:session onDispatchQueue:queue];
return session;
}
-+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback onDispatchQueue:(dispatch_queue_t)queue {
- FFmpegSession* session = [[FFmpegSession alloc] init:arguments withExecuteCallback:executeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
++ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback onDispatchQueue:(dispatch_queue_t)queue {
+ FFmpegSession* session = [[FFmpegSession alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
[FFmpegKitConfig asyncFFmpegExecute:session onDispatchQueue:queue];
return session;
}
@@ -70,26 +70,26 @@
return session;
}
-+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback {
- FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKitConfig parseArguments:command] withExecuteCallback:executeCallback];
++ (FFmpegSession*)executeAsync:(NSString*)command withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback {
+ FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFmpegExecute:session];
return session;
}
-+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback {
- FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKitConfig parseArguments:command] withExecuteCallback:executeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
++ (FFmpegSession*)executeAsync:(NSString*)command withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback {
+ FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
[FFmpegKitConfig asyncFFmpegExecute:session];
return session;
}
-+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue {
- FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKitConfig parseArguments:command] withExecuteCallback:executeCallback];
++ (FFmpegSession*)executeAsync:(NSString*)command withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue {
+ FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFmpegExecute:session onDispatchQueue:queue];
return session;
}
-+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback onDispatchQueue:(dispatch_queue_t)queue {
- FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKitConfig parseArguments:command] withExecuteCallback:executeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
++ (FFmpegSession*)executeAsync:(NSString*)command withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback onDispatchQueue:(dispatch_queue_t)queue {
+ FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
[FFmpegKitConfig asyncFFmpegExecute:session onDispatchQueue:queue];
return session;
}
diff --git a/apple/src/FFmpegKitConfig.h b/apple/src/FFmpegKitConfig.h
index 59ddb62..acfad88 100644
--- a/apple/src/FFmpegKitConfig.h
+++ b/apple/src/FFmpegKitConfig.h
@@ -24,7 +24,6 @@
#import Starts an asynchronous FFmpeg execution for the given session.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an FFmpegSessionCompleteCallback if you want to be notified about the result.
*
* @param ffmpegSession FFmpeg session which includes command options/arguments
*/
@@ -201,8 +200,8 @@ typedef NS_ENUM(NSUInteger, Signal) {
/**
* Starts an asynchronous FFmpeg execution for the given session.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an FFmpegSessionCompleteCallback if you want to be notified about the result.
*
* @param ffmpegSession FFmpeg session which includes command options/arguments
* @param queue dispatch queue that will be used to run this asynchronous operation
@@ -212,8 +211,8 @@ typedef NS_ENUM(NSUInteger, Signal) {
/**
* Starts an asynchronous FFprobe execution for the given session.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an FFprobeSessionCompleteCallback if you want to be notified about the result.
*
* @param ffprobeSession FFprobe session which includes command options/arguments
*/
@@ -222,8 +221,8 @@ typedef NS_ENUM(NSUInteger, Signal) {
/**
* Starts an asynchronous FFprobe execution for the given session.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an FFprobeSessionCompleteCallback if you want to be notified about the result.
*
* @param ffprobeSession FFprobe session which includes command options/arguments
* @param queue dispatch queue that will be used to run this asynchronous operation
@@ -233,8 +232,8 @@ typedef NS_ENUM(NSUInteger, Signal) {
/**
* Starts an asynchronous FFprobe execution for the given media information session.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an MediaInformationSessionCompleteCallback if you want to be notified about the result.
*
* @param mediaInformationSession media information session which includes command options/arguments
* @param waitTimeout max time to wait until media information is transmitted
@@ -244,8 +243,8 @@ typedef NS_ENUM(NSUInteger, Signal) {
/**
* Starts an asynchronous FFprobe execution for the given media information session.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an MediaInformationSessionCompleteCallback if you want to be notified about the result.
*
* @param mediaInformationSession media information session which includes command options/arguments
* @param queue dispatch queue that will be used to run this asynchronous operation
@@ -268,18 +267,47 @@ typedef NS_ENUM(NSUInteger, Signal) {
+ (void)enableStatisticsCallback:(StatisticsCallback)statisticsCallback;
/**
- * Sets a global execute callback to receive execution results.
+ * Sets a global FFmpegSessionCompleteCallback to receive execution results for FFmpeg sessions.
*
- * @param executeCallback execute callback or nil to disable a previously execute callback
+ * @param ffmpegSessionCompleteCallback complete callback or nil to disable a previously defined callback
*/
-+ (void)enableExecuteCallback:(ExecuteCallback)executeCallback;
++ (void)enableFFmpegSessionCompleteCallback:(FFmpegSessionCompleteCallback)ffmpegSessionCompleteCallback;
/**
- * Returns the global execute callback.
+ * Returns the global FFmpegSessionCompleteCallback set.
*
- * @return global execute callback
+ * @return global FFmpegSessionCompleteCallback or nil if it is not set
*/
-+ (ExecuteCallback)getExecuteCallback;
++ (FFmpegSessionCompleteCallback)getFFmpegSessionCompleteCallback;
+
+/**
+ * Sets a global FFprobeSessionCompleteCallback to receive execution results for FFprobe sessions.
+ *
+ * @param ffprobeSessionCompleteCallback complete callback or nil to disable a previously defined callback
+ */
++ (void)enableFFprobeSessionCompleteCallback:(FFprobeSessionCompleteCallback)ffprobeSessionCompleteCallback;
+
+/**
+ * Returns the global FFprobeSessionCompleteCallback set.
+ *
+ * @return global FFprobeSessionCompleteCallback or nil if it is not set
+ */
++ (FFprobeSessionCompleteCallback)getFFprobeSessionCompleteCallback;
+
+/**
+ * Sets a global MediaInformationSessionCompleteCallback to receive execution results for MediaInformation sessions.
+ *
+ * @param mediaInformationSessionCompleteCallback complete callback or nil to disable a previously defined
+ * callback
+ */
++ (void)enableMediaInformationSessionCompleteCallback:(MediaInformationSessionCompleteCallback)mediaInformationSessionCompleteCallback;
+
+/**
+ * Returns the global MediaInformationSessionCompleteCallback set.
+ *
+ * @return global MediaInformationSessionCompleteCallback or nil if it is not set
+ */
++ (MediaInformationSessionCompleteCallback)getMediaInformationSessionCompleteCallback;
/**
* Returns the current log level.
@@ -367,6 +395,13 @@ typedef NS_ENUM(NSUInteger, Signal) {
*/
+ (NSArray*)getFFprobeSessions;
+/**
+ * Returns all MediaInformation sessions in the session history.
+ *
+ * @return all MediaInformation sessions in the session history
+ */
++ (NSArray*)getMediaInformationSessions;
+
/**
* Returns sessions that have the given state.
*
diff --git a/apple/src/FFmpegKitConfig.m b/apple/src/FFmpegKitConfig.m
index 8896186..37a4756 100644
--- a/apple/src/FFmpegKitConfig.m
+++ b/apple/src/FFmpegKitConfig.m
@@ -67,8 +67,10 @@ static LogCallback logCallback;
/** Holds callback defined to redirect statistics */
static StatisticsCallback statisticsCallback;
-/** Holds callback defined to redirect asynchronous execution results */
-static ExecuteCallback executeCallback;
+/** Holds complete callbacks defined to redirect asynchronous execution results */
+static FFmpegSessionCompleteCallback ffmpegSessionCompleteCallback;
+static FFprobeSessionCompleteCallback ffprobeSessionCompleteCallback;
+static MediaInformationSessionCompleteCallback mediaInformationSessionCompleteCallback;
static LogRedirectionStrategy globalLogRedirectionStrategy;
@@ -507,7 +509,7 @@ void process_log(long sessionId, int levelValue, AVBPrint* logMessage) {
sessionLogCallback(log);
}
@catch(NSException* exception) {
- NSLog(@"Exception thrown inside session LogCallback block. %@", [exception callStackSymbols]);
+ NSLog(@"Exception thrown inside session log callback. %@", [exception callStackSymbols]);
}
}
}
@@ -521,7 +523,7 @@ void process_log(long sessionId, int levelValue, AVBPrint* logMessage) {
globalLogCallback(log);
}
@catch(NSException* exception) {
- NSLog(@"Exception thrown inside global LogCallback block. %@", [exception callStackSymbols]);
+ NSLog(@"Exception thrown inside global log callback. %@", [exception callStackSymbols]);
}
}
@@ -580,7 +582,7 @@ void process_statistics(long sessionId, int videoFrameNumber, float videoFps, fl
sessionStatisticsCallback(statistics);
}
@catch(NSException* exception) {
- NSLog(@"Exception thrown inside session StatisticsCallback block. %@", [exception callStackSymbols]);
+ NSLog(@"Exception thrown inside session statistics callback. %@", [exception callStackSymbols]);
}
}
}
@@ -591,7 +593,7 @@ void process_statistics(long sessionId, int videoFrameNumber, float videoFps, fl
globalStatisticsCallback(statistics);
}
@catch(NSException* exception) {
- NSLog(@"Exception thrown inside global StatisticsCallback block. %@", [exception callStackSymbols]);
+ NSLog(@"Exception thrown inside global statistics callback. %@", [exception callStackSymbols]);
}
}
}
@@ -751,7 +753,9 @@ int executeFFprobe(long sessionId, NSArray* arguments) {
logCallback = nil;
statisticsCallback = nil;
- executeCallback = nil;
+ ffmpegSessionCompleteCallback = nil;
+ ffprobeSessionCompleteCallback = nil;
+ mediaInformationSessionCompleteCallback = nil;
globalLogRedirectionStrategy = LogRedirectionStrategyPrintLogsWhenNoCallbacksDefined;
@@ -1008,25 +1012,25 @@ int executeFFprobe(long sessionId, NSArray* arguments) {
dispatch_async(queue, ^{
[FFmpegKitConfig ffmpegExecute:ffmpegSession];
- ExecuteCallback sessionExecuteCallback = [ffmpegSession getExecuteCallback];
- if (sessionExecuteCallback != nil) {
+ FFmpegSessionCompleteCallback completeCallback = [ffmpegSession getCompleteCallback];
+ if (completeCallback != nil) {
@try {
// NOTIFY SESSION CALLBACK DEFINED
- sessionExecuteCallback(ffmpegSession);
+ completeCallback(ffmpegSession);
}
@catch(NSException* exception) {
- NSLog(@"Exception thrown inside session ExecuteCallback block. %@", [exception callStackSymbols]);
+ NSLog(@"Exception thrown inside session complete callback. %@", [exception callStackSymbols]);
}
}
- ExecuteCallback globalExecuteCallback = [FFmpegKitConfig getExecuteCallback];
- if (globalExecuteCallback != nil) {
+ FFmpegSessionCompleteCallback globalFFmpegSessionCompleteCallback = [FFmpegKitConfig getFFmpegSessionCompleteCallback];
+ if (globalFFmpegSessionCompleteCallback != nil) {
@try {
// NOTIFY SESSION CALLBACK DEFINED
- globalExecuteCallback(ffmpegSession);
+ globalFFmpegSessionCompleteCallback(ffmpegSession);
}
@catch(NSException* exception) {
- NSLog(@"Exception thrown inside session ExecuteCallback block. %@", [exception callStackSymbols]);
+ NSLog(@"Exception thrown inside global complete callback. %@", [exception callStackSymbols]);
}
}
});
@@ -1040,25 +1044,25 @@ int executeFFprobe(long sessionId, NSArray* arguments) {
dispatch_async(queue, ^{
[FFmpegKitConfig ffprobeExecute:ffprobeSession];
- ExecuteCallback sessionExecuteCallback = [ffprobeSession getExecuteCallback];
- if (sessionExecuteCallback != nil) {
+ FFprobeSessionCompleteCallback completeCallback = [ffprobeSession getCompleteCallback];
+ if (completeCallback != nil) {
@try {
// NOTIFY SESSION CALLBACK DEFINED
- sessionExecuteCallback(ffprobeSession);
+ completeCallback(ffprobeSession);
}
@catch(NSException* exception) {
- NSLog(@"Exception thrown inside session ExecuteCallback block. %@", [exception callStackSymbols]);
+ NSLog(@"Exception thrown inside session complete callback. %@", [exception callStackSymbols]);
}
}
- ExecuteCallback globalExecuteCallback = [FFmpegKitConfig getExecuteCallback];
- if (globalExecuteCallback != nil) {
+ FFprobeSessionCompleteCallback globalFFprobeSessionCompleteCallback = [FFmpegKitConfig getFFprobeSessionCompleteCallback];
+ if (globalFFprobeSessionCompleteCallback != nil) {
@try {
// NOTIFY SESSION CALLBACK DEFINED
- globalExecuteCallback(ffprobeSession);
+ globalFFprobeSessionCompleteCallback(ffprobeSession);
}
@catch(NSException* exception) {
- NSLog(@"Exception thrown inside session ExecuteCallback block. %@", [exception callStackSymbols]);
+ NSLog(@"Exception thrown inside global complete callback. %@", [exception callStackSymbols]);
}
}
});
@@ -1072,25 +1076,25 @@ int executeFFprobe(long sessionId, NSArray* arguments) {
dispatch_async(queue, ^{
[FFmpegKitConfig getMediaInformationExecute:mediaInformationSession withTimeout:waitTimeout];
- ExecuteCallback sessionExecuteCallback = [mediaInformationSession getExecuteCallback];
- if (sessionExecuteCallback != nil) {
+ MediaInformationSessionCompleteCallback completeCallback = [mediaInformationSession getCompleteCallback];
+ if (completeCallback != nil) {
@try {
// NOTIFY SESSION CALLBACK DEFINED
- sessionExecuteCallback(mediaInformationSession);
+ completeCallback(mediaInformationSession);
}
@catch(NSException* exception) {
- NSLog(@"Exception thrown inside session ExecuteCallback block. %@", [exception callStackSymbols]);
+ NSLog(@"Exception thrown inside session complete callback. %@", [exception callStackSymbols]);
}
}
- ExecuteCallback globalExecuteCallback = [FFmpegKitConfig getExecuteCallback];
- if (globalExecuteCallback != nil) {
+ MediaInformationSessionCompleteCallback globalMediaInformationSessionCompleteCallback = [FFmpegKitConfig getMediaInformationSessionCompleteCallback];
+ if (globalMediaInformationSessionCompleteCallback != nil) {
@try {
// NOTIFY SESSION CALLBACK DEFINED
- globalExecuteCallback(mediaInformationSession);
+ globalMediaInformationSessionCompleteCallback(mediaInformationSession);
}
@catch(NSException* exception) {
- NSLog(@"Exception thrown inside session ExecuteCallback block. %@", [exception callStackSymbols]);
+ NSLog(@"Exception thrown inside global complete callback. %@", [exception callStackSymbols]);
}
}
});
@@ -1104,12 +1108,28 @@ int executeFFprobe(long sessionId, NSArray* arguments) {
statisticsCallback = callback;
}
-+ (void)enableExecuteCallback:(ExecuteCallback)callback {
- executeCallback = callback;
++ (void)enableFFmpegSessionCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback {
+ ffmpegSessionCompleteCallback = completeCallback;
}
-+ (ExecuteCallback)getExecuteCallback {
- return executeCallback;
++ (FFmpegSessionCompleteCallback)getFFmpegSessionCompleteCallback {
+ return ffmpegSessionCompleteCallback;
+}
+
++ (void)enableFFprobeSessionCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback {
+ ffprobeSessionCompleteCallback = completeCallback;
+}
+
++ (FFprobeSessionCompleteCallback)getFFprobeSessionCompleteCallback {
+ return ffprobeSessionCompleteCallback;
+}
+
++ (void)enableMediaInformationSessionCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback {
+ mediaInformationSessionCompleteCallback = completeCallback;
+}
+
++ (MediaInformationSessionCompleteCallback)getMediaInformationSessionCompleteCallback {
+ return mediaInformationSessionCompleteCallback;
}
+ (int)getLogLevel {
@@ -1243,6 +1263,23 @@ int executeFFprobe(long sessionId, NSArray* arguments) {
return ffprobeSessions;
}
++ (NSArray*)getMediaInformationSessions {
+ NSMutableArray* mediaInformationSessions = [[NSMutableArray alloc] init];
+
+ [sessionHistoryLock lock];
+
+ for(int i = 0; i < [sessionHistoryList count]; i++) {
+ id An FFmpeg session.
@@ -39,31 +40,31 @@
/**
* Builds a new FFmpeg session.
*
- * @param arguments command arguments
- * @param executeCallback session specific execute callback
+ * @param arguments command arguments
+ * @param completeCallback session specific complete callback
*/
-- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback;
+- (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback;
/**
* Builds a new FFmpeg session.
*
- * @param arguments command arguments
- * @param executeCallback session specific execute callback
- * @param logCallback session specific log callback
- * @param statisticsCallback session specific statistics callback
+ * @param arguments command arguments
+ * @param completeCallback session specific complete callback
+ * @param logCallback session specific log callback
+ * @param statisticsCallback session specific statistics callback
*/
-- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback;
+- (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback;
/**
* Builds a new FFmpeg session.
*
- * @param arguments command arguments
- * @param executeCallback session specific execute callback
- * @param logCallback session specific log callback
- * @param statisticsCallback session specific statistics callback
- * @param logRedirectionStrategy session specific log redirection strategy
+ * @param arguments command arguments
+ * @param completeCallback session specific complete callback
+ * @param logCallback session specific log callback
+ * @param statisticsCallback session specific statistics callback
+ * @param logRedirectionStrategy session specific log redirection strategy
*/
-- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy;
+- (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy;
/**
* Returns the session specific statistics callback.
@@ -72,6 +73,13 @@
*/
- (StatisticsCallback)getStatisticsCallback;
+/**
+ * Returns the session specific complete callback.
+ *
+ * @return session specific complete callback
+ */
+- (FFmpegSessionCompleteCallback)getCompleteCallback;
+
/**
* Returns all statistics entries generated for this session. If there are asynchronous
* messages that are not delivered yet, this method waits for them until the given timeout.
@@ -108,10 +116,8 @@
- (Statistics*)getLastReceivedStatistics;
/**
- * Adds a new statistics entry for this session.
- *
- * It is invoked internally by Callback invoked when an asynchronous session ends running.
+ * Callback function that is invoked when an asynchronous Session has either SessionStateCompleted or SessionStateFailed state when
* the callback is invoked.
* If it has SessionStateCompleted state, Provides overloaded It can extract media information for a file or a url, using getMediaInformation method.
* Starts an asynchronous FFprobe execution with arguments provided.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an FFprobeSessionCompleteCallback if you want to be notified about the result.
*
- * @param arguments FFprobe command options/arguments as string array
- * @param executeCallback callback that will be called when the execution is completed
+ * @param arguments FFprobe command options/arguments as string array
+ * @param completeCallback callback that will be called when the execution has completed
* @return FFprobe session created for this execution
*/
-+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback;
++ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback;
/**
* Starts an asynchronous FFprobe execution with arguments provided.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an FFprobeSessionCompleteCallback if you want to be notified about the result.
*
- * @param arguments FFprobe command options/arguments as string array
- * @param executeCallback callback that will be notified when execution is completed
- * @param logCallback callback that will receive logs
+ * @param arguments FFprobe command options/arguments as string array
+ * @param completeCallback callback that will be notified when execution has completed
+ * @param logCallback callback that will receive logs
* @return FFprobe session created for this execution
*/
-+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback;
++ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback;
/**
* Starts an asynchronous FFprobe execution with arguments provided.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an FFprobeSessionCompleteCallback if you want to be notified about the result.
*
- * @param arguments FFprobe command options/arguments as string array
- * @param executeCallback callback that will be called when the execution is completed
- * @param queue dispatch queue that will be used to run this asynchronous operation
+ * @param arguments FFprobe command options/arguments as string array
+ * @param completeCallback callback that will be called when the execution has completed
+ * @param queue dispatch queue that will be used to run this asynchronous operation
* @return FFprobe session created for this execution
*/
-+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue;
++ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue;
/**
* Starts an asynchronous FFprobe execution with arguments provided.
*
- * Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * Note that this method returns immediately and does not wait the execution to complete.
+ * You must use an FFprobeSessionCompleteCallback if you want to be notified about the result.
*
- * @param arguments FFprobe command options/arguments as string array
- * @param executeCallback callback that will be notified when execution is completed
- * @param logCallback callback that will receive logs
- * @param queue dispatch queue that will be used to run this asynchronous operation
+ * @param arguments FFprobe command options/arguments as string array
+ * @param completeCallback callback that will be notified when execution has completed
+ * @param logCallback callback that will receive logs
+ * @param queue dispatch queue that will be used to run this asynchronous operation
* @return FFprobe session created for this execution
*/
-+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue;
++ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue;
/**
* Synchronously executes FFprobe command provided. Space character is used to split command
@@ -120,56 +120,56 @@
* into arguments. You can use single or double quote characters to specify arguments inside your command.
*
* Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * FFprobeSessionCompleteCallback if you want to be notified about the result.
*
- * @param command FFprobe command
- * @param executeCallback callback that will be called when the execution is completed
+ * @param command FFprobe command
+ * @param completeCallback callback that will be called when the execution has completed
* @return FFprobe session created for this execution
*/
-+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback;
++ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback;
/**
* Starts an asynchronous FFprobe execution for the given command. Space character is used to split the command
* into arguments. You can use single or double quote characters to specify arguments inside your command.
*
* Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * FFprobeSessionCompleteCallback if you want to be notified about the result.
*
- * @param command FFprobe command
- * @param executeCallback callback that will be notified when execution is completed
- * @param logCallback callback that will receive logs
+ * @param command FFprobe command
+ * @param completeCallback callback that will be notified when execution has completed
+ * @param logCallback callback that will receive logs
* @return FFprobe session created for this execution
*/
-+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback;
++ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback;
/**
* Starts an asynchronous FFprobe execution for the given command. Space character is used to split the command
* into arguments. You can use single or double quote characters to specify arguments inside your command.
*
* Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * FFprobeSessionCompleteCallback if you want to be notified about the result.
*
- * @param command FFprobe command
- * @param executeCallback callback that will be called when the execution is completed
- * @param queue dispatch queue that will be used to run this asynchronous operation
+ * @param command FFprobe command
+ * @param completeCallback callback that will be called when the execution has completed
+ * @param queue dispatch queue that will be used to run this asynchronous operation
* @return FFprobe session created for this execution
*/
-+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue;
++ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue;
/**
* Starts an asynchronous FFprobe execution for the given command. Space character is used to split the command
* into arguments. You can use single or double quote characters to specify arguments inside your command.
*
* Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * FFprobeSessionCompleteCallback if you want to be notified about the result.
*
- * @param command FFprobe command
- * @param executeCallback callback that will be called when the execution is completed
- * @param logCallback callback that will receive logs
- * @param queue dispatch queue that will be used to run this asynchronous operation
+ * @param command FFprobe command
+ * @param completeCallback callback that will be called when the execution has completed
+ * @param logCallback callback that will receive logs
+ * @param queue dispatch queue that will be used to run this asynchronous operation
* @return FFprobe session created for this execution
*/
-+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue;
++ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue;
/**
* Extracts media information for the file specified with path.
@@ -192,55 +192,55 @@
* Starts an asynchronous FFprobe execution to extract the media information for the specified file.
*
* Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * MediaInformationSessionCompleteCallback if you want to be notified about the result.
*
- * @param path path or uri of a media file
- * @param executeCallback callback that will be called when the execution is completed
+ * @param path path or uri of a media file
+ * @param completeCallback callback that will be called when the execution has completed
* @return media information session created for this execution
*/
-+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteCallback:(ExecuteCallback)executeCallback;
++ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback;
/**
* Starts an asynchronous FFprobe execution to extract the media information for the specified file.
*
* Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * MediaInformationSessionCompleteCallback if you want to be notified about the result.
*
- * @param path path or uri of a media file
- * @param executeCallback callback that will be notified when execution is completed
- * @param logCallback callback that will receive logs
- * @param waitTimeout max time to wait until media information is transmitted
+ * @param path path or uri of a media file
+ * @param completeCallback callback that will be notified when execution has completed
+ * @param logCallback callback that will receive logs
+ * @param waitTimeout max time to wait until media information is transmitted
* @return media information session created for this execution
*/
-+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withTimeout:(int)waitTimeout;
++ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withTimeout:(int)waitTimeout;
/**
* Starts an asynchronous FFprobe execution to extract the media information for the specified file.
*
* Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * MediaInformationSessionCompleteCallback if you want to be notified about the result.
*
- * @param path path or uri of a media file
- * @param executeCallback callback that will be called when the execution is completed
- * @param queue dispatch queue that will be used to run this asynchronous operation
+ * @param path path or uri of a media file
+ * @param completeCallback callback that will be called when the execution has completed
+ * @param queue dispatch queue that will be used to run this asynchronous operation
* @return media information session created for this execution
*/
-+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue;
++ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue;
/**
* Starts an asynchronous FFprobe execution to extract the media information for the specified file.
*
* Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * MediaInformationSessionCompleteCallback if you want to be notified about the result.
*
- * @param path path or uri of a media file
- * @param executeCallback callback that will be notified when execution is completed
- * @param logCallback callback that will receive logs
- * @param queue dispatch queue that will be used to run this asynchronous operation
- * @param waitTimeout max time to wait until media information is transmitted
+ * @param path path or uri of a media file
+ * @param completeCallback callback that will be notified when execution has completed
+ * @param logCallback callback that will receive logs
+ * @param queue dispatch queue that will be used to run this asynchronous operation
+ * @param waitTimeout max time to wait until media information is transmitted
* @return media information session created for this execution
*/
-+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout;
++ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout;
/**
* Extracts media information using the command provided asynchronously.
@@ -255,16 +255,16 @@
* this method must generate the output in JSON format in order to successfully extract media information from it.
*
* Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * MediaInformationSessionCompleteCallback if you want to be notified about the result.
*
- * @param command FFprobe command that prints media information for a file in JSON format
- * @param executeCallback callback that will be notified when execution is completed
- * @param logCallback callback that will receive logs
- * @param queue dispatch queue that will be used to run this asynchronous operation
- * @param waitTimeout max time to wait until media information is transmitted
+ * @param command FFprobe command that prints media information for a file in JSON format
+ * @param completeCallback callback that will be notified when execution has completed
+ * @param logCallback callback that will receive logs
+ * @param queue dispatch queue that will be used to run this asynchronous operation
+ * @param waitTimeout max time to wait until media information is transmitted
* @return media information session created for this execution
*/
-+ (MediaInformationSession*)getMediaInformationFromCommandAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout;
++ (MediaInformationSession*)getMediaInformationFromCommandAsync:(NSString*)command withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout;
/**
* Starts an asynchronous FFprobe execution to extract media information using command arguments. The command
@@ -272,23 +272,30 @@
* from it.
*
* Note that this method returns immediately and does not wait the execution to complete. You must use an
- * ExecuteCallback if you want to be notified about the result.
+ * MediaInformationSessionCompleteCallback if you want to be notified about the result.
*
- * @param command FFprobe command that prints media information for a file in JSON format
- * @param executeCallback callback that will be notified when execution is completed
- * @param logCallback callback that will receive logs
- * @param queue dispatch queue that will be used to run this asynchronous operation
- * @param waitTimeout max time to wait until media information is transmitted
+ * @param command FFprobe command that prints media information for a file in JSON format
+ * @param completeCallback callback that will be notified when execution has completed
+ * @param logCallback callback that will receive logs
+ * @param queue dispatch queue that will be used to run this asynchronous operation
+ * @param waitTimeout max time to wait until media information is transmitted
* @return media information session created for this execution
*/
-+ (MediaInformationSession*)getMediaInformationFromCommandArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout;
++ (MediaInformationSession*)getMediaInformationFromCommandArgumentsAsync:(NSArray*)arguments withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout;
/**
* Lists all FFprobe sessions in the session history.
*
* @return all FFprobe sessions in the session history
*/
-+ (NSArray*)listSessions;
++ (NSArray*)listFFprobeSessions;
+
+/**
+ * Lists all MediaInformation sessions in the session history.
+ *
+ * @return all MediaInformation sessions in the session history
+ */
++ (NSArray*)listMediaInformationSessions;
@end
diff --git a/apple/src/FFprobeKit.m b/apple/src/FFprobeKit.m
index cc013ea..59cdeab 100644
--- a/apple/src/FFprobeKit.m
+++ b/apple/src/FFprobeKit.m
@@ -38,26 +38,26 @@
return session;
}
-+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback {
- FFprobeSession* session = [[FFprobeSession alloc] init:arguments withExecuteCallback:executeCallback];
++ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback {
+ FFprobeSession* session = [[FFprobeSession alloc] init:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFprobeExecute:session];
return session;
}
-+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback {
- FFprobeSession* session = [[FFprobeSession alloc] init:arguments withExecuteCallback:executeCallback withLogCallback:logCallback];
++ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback {
+ FFprobeSession* session = [[FFprobeSession alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncFFprobeExecute:session];
return session;
}
-+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue {
- FFprobeSession* session = [[FFprobeSession alloc] init:arguments withExecuteCallback:executeCallback];
++ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue {
+ FFprobeSession* session = [[FFprobeSession alloc] init:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
return session;
}
-+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue {
- FFprobeSession* session = [[FFprobeSession alloc] init:arguments withExecuteCallback:executeCallback withLogCallback:logCallback];
++ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue {
+ FFprobeSession* session = [[FFprobeSession alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
return session;
}
@@ -68,26 +68,26 @@
return session;
}
-+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback {
- FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKitConfig parseArguments:command] withExecuteCallback:executeCallback];
++ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback {
+ FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFprobeExecute:session];
return session;
}
-+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback {
- FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKitConfig parseArguments:command] withExecuteCallback:executeCallback withLogCallback:logCallback];
++ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback {
+ FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncFFprobeExecute:session];
return session;
}
-+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue {
- FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKitConfig parseArguments:command] withExecuteCallback:executeCallback];
++ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue {
+ FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
return session;
}
-+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue {
- FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKitConfig parseArguments:command] withExecuteCallback:executeCallback withLogCallback:logCallback];
++ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue {
+ FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
return session;
}
@@ -106,30 +106,30 @@
return session;
}
-+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteCallback:(ExecuteCallback)executeCallback {
++ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback {
NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
- MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withExecuteCallback:executeCallback];
+ MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncGetMediaInformationExecute:session withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit];
return session;
}
-+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withTimeout:(int)waitTimeout {
++ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withTimeout:(int)waitTimeout {
NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
- MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withExecuteCallback:executeCallback withLogCallback:logCallback];
+ MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncGetMediaInformationExecute:session withTimeout:waitTimeout];
return session;
}
-+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue {
++ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue {
NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
- MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withExecuteCallback:executeCallback];
+ MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit];
return session;
}
-+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
++ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
- MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withExecuteCallback:executeCallback];
+ MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:waitTimeout];
return session;
}
@@ -140,20 +140,24 @@
return session;
}
-+ (MediaInformationSession*)getMediaInformationFromCommandAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
- MediaInformationSession* session = [[MediaInformationSession alloc] init:[FFmpegKitConfig parseArguments:command] withExecuteCallback:executeCallback withLogCallback:logCallback];
++ (MediaInformationSession*)getMediaInformationFromCommandAsync:(NSString*)command withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
+ MediaInformationSession* session = [[MediaInformationSession alloc] init:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:waitTimeout];
return session;
}
-+ (MediaInformationSession*)getMediaInformationFromCommandArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
- MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withExecuteCallback:executeCallback withLogCallback:logCallback];
++ (MediaInformationSession*)getMediaInformationFromCommandArgumentsAsync:(NSArray*)arguments withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
+ MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:waitTimeout];
return session;
}
-+ (NSArray*)listSessions {
++ (NSArray*)listFFprobeSessions {
return [FFmpegKitConfig getFFprobeSessions];
}
++ (NSArray*)listMediaInformationSessions {
+ return [FFmpegKitConfig getMediaInformationSessions];
+}
+
@end
diff --git a/apple/src/FFprobeSession.h b/apple/src/FFprobeSession.h
index 4565fca..40f62df 100644
--- a/apple/src/FFprobeSession.h
+++ b/apple/src/FFprobeSession.h
@@ -22,6 +22,7 @@
#import An FFprobe session.
@@ -38,29 +39,36 @@
/**
* Builds a new FFprobe session.
*
- * @param arguments command arguments
- * @param executeCallback session specific execute callback
+ * @param arguments command arguments
+ * @param completeCallback session specific complete callback
*/
-- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback;
+- (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback;
/**
* Builds a new FFprobe session.
*
- * @param arguments command arguments
- * @param executeCallback session specific execute callback
- * @param logCallback session specific log callback
+ * @param arguments command arguments
+ * @param completeCallback session specific complete callback
+ * @param logCallback session specific log callback
*/
-- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback;
+- (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback;
/**
* Builds a new FFprobe session.
*
- * @param arguments command arguments
- * @param executeCallback session specific execute callback
- * @param logCallback session specific log callback
- * @param logRedirectionStrategy session specific log redirection strategy
+ * @param arguments command arguments
+ * @param completeCallback session specific complete callback
+ * @param logCallback session specific log callback
+ * @param logRedirectionStrategy session specific log redirection strategy
*/
-- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy;
+- (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy;
+
+/**
+ * Returns the session specific complete callback.
+ *
+ * @return session specific complete callback
+ */
+- (FFprobeSessionCompleteCallback)getCompleteCallback;
@end
diff --git a/apple/src/FFprobeSession.m b/apple/src/FFprobeSession.m
index f6c1582..8036d91 100644
--- a/apple/src/FFprobeSession.m
+++ b/apple/src/FFprobeSession.m
@@ -17,45 +17,66 @@
* along with FFmpegKit. If not, see Callback function that is invoked when an asynchronous Session has either SessionStateCompleted or SessionStateFailed state when
+ * the callback is invoked.
+ * If it has SessionStateCompleted state, If A custom FFprobe session, which produces a Callback function that is invoked when an asynchronous Session has either SessionStateCompleted or SessionStateFailed state when
+ * the callback is invoked.
+ * If it has SessionStateCompleted state, If FFmpegKit
library methods. Must not be used by user
- * applications.
+ * Adds a new statistics entry for this session. It is invoked internally by
+ * FFmpegKit
library methods. Must not be used by user applications.
*
* @param statistics statistics entry
*/
@@ -188,6 +201,11 @@ public class FFmpegSession extends AbstractSession implements Session {
return false;
}
+ @Override
+ public boolean isMediaInformation() {
+ return false;
+ }
+
@Override
public String toString() {
final StringBuilder stringBuilder = new StringBuilder();
diff --git a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegSessionCompleteCallback.java b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegSessionCompleteCallback.java
new file mode 100644
index 0000000..98dd9de
--- /dev/null
+++ b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/FFmpegSessionCompleteCallback.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2018-2021 Taner Sener
+ *
+ * This file is part of FFmpegKit.
+ *
+ * FFmpegKit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * FFmpegKit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with FFmpegKit. If not, see FFmpeg
session has ended.
+ */
+@FunctionalInterface
+public interface FFmpegSessionCompleteCallback {
+
+ /**
+ * FFprobe
commands. Supports executing commands both synchronously and
- * asynchronously.
+ * FFprobe
commands. Supports executing commands both
+ * synchronously and asynchronously.
*
* FFprobeSession session = FFprobeKit.execute("-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4");
*
- * FFprobeSession asyncSession = FFprobeKit.executeAsync("-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4", executeCallback);
+ * FFprobeSession asyncSession = FFprobeKit.executeAsync("-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4", completeCallback);
*
* execute
methods to define session specific callbacks.
*
- * FFprobeSession session = FFprobeKit.executeAsync("-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4", executeCallback, logCallback);
+ * FFprobeSession session = FFprobeKit.executeAsync("-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4", completeCallback, logCallback);
*
*
@@ -79,16 +79,17 @@ public class FFprobeKit {
/**
*
FFprobe
session has ended.
+ */
+@FunctionalInterface
+public interface FFprobeSessionCompleteCallback {
+
+ /**
+ * MediaInformation
object using the
* FFprobe output.
*/
-public class MediaInformationSession extends FFprobeSession implements Session {
+public class MediaInformationSession extends AbstractSession implements Session {
/**
* Media information extracted in the session.
*/
private MediaInformation mediaInformation;
+ /**
+ * Session specific complete callback.
+ */
+ private final MediaInformationSessionCompleteCallback completeCallback;
+
/**
* Creates a new media information session.
*
@@ -42,22 +47,24 @@ public class MediaInformationSession extends FFprobeSession implements Session {
/**
* Creates a new media information session.
*
- * @param arguments command arguments
- * @param executeCallback session specific execute callback function
+ * @param arguments command arguments
+ * @param completeCallback session specific complete callback
*/
- public MediaInformationSession(final String[] arguments, final ExecuteCallback executeCallback) {
- this(arguments, executeCallback, null);
+ public MediaInformationSession(final String[] arguments, final MediaInformationSessionCompleteCallback completeCallback) {
+ this(arguments, completeCallback, null);
}
/**
* Creates a new media information session.
*
- * @param arguments command arguments
- * @param executeCallback session specific execute callback function
- * @param logCallback session specific log callback function
+ * @param arguments command arguments
+ * @param completeCallback session specific complete callback
+ * @param logCallback session specific log callback
*/
- public MediaInformationSession(final String[] arguments, final ExecuteCallback executeCallback, final LogCallback logCallback) {
- super(arguments, executeCallback, logCallback, LogRedirectionStrategy.NEVER_PRINT_LOGS);
+ public MediaInformationSession(final String[] arguments, final MediaInformationSessionCompleteCallback completeCallback, final LogCallback logCallback) {
+ super(arguments, logCallback, LogRedirectionStrategy.NEVER_PRINT_LOGS);
+
+ this.completeCallback = completeCallback;
}
/**
@@ -79,6 +86,30 @@ public class MediaInformationSession extends FFprobeSession implements Session {
this.mediaInformation = mediaInformation;
}
+ /**
+ * Returns the session specific complete callback.
+ *
+ * @return session specific complete callback
+ */
+ public MediaInformationSessionCompleteCallback getCompleteCallback() {
+ return completeCallback;
+ }
+
+ @Override
+ public boolean isFFmpeg() {
+ return false;
+ }
+
+ @Override
+ public boolean isFFprobe() {
+ return false;
+ }
+
+ @Override
+ public boolean isMediaInformation() {
+ return true;
+ }
+
@Override
public String toString() {
final StringBuilder stringBuilder = new StringBuilder();
diff --git a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/MediaInformationSessionCompleteCallback.java b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/MediaInformationSessionCompleteCallback.java
new file mode 100644
index 0000000..544b58b
--- /dev/null
+++ b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/MediaInformationSessionCompleteCallback.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2018-2021 Taner Sener
+ *
+ * This file is part of FFmpegKit.
+ *
+ * FFmpegKit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * FFmpegKit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with FFmpegKit. If not, see MediaInformation
session
+ * has ended.
+ */
+@FunctionalInterface
+public interface MediaInformationSessionCompleteCallback {
+
+ /**
+ * FFmpegKit
library methods. Must not be used by user
* applications.
*
@@ -227,6 +220,13 @@ public interface Session {
*/
boolean isFFprobe();
+ /**
+ * Returns whether it is a MediaInformation
session or not.
+ *
+ * @return true if it is a MediaInformation
session, false otherwise
+ */
+ boolean isMediaInformation();
+
/**
* Cancels running the session.
*/
diff --git a/android/ffmpeg-kit-android-lib/src/test/java/com/arthenica/ffmpegkit/FFmpegSessionTest.java b/android/ffmpeg-kit-android-lib/src/test/java/com/arthenica/ffmpegkit/FFmpegSessionTest.java
index b387225..488da35 100644
--- a/android/ffmpeg-kit-android-lib/src/test/java/com/arthenica/ffmpegkit/FFmpegSessionTest.java
+++ b/android/ffmpeg-kit-android-lib/src/test/java/com/arthenica/ffmpegkit/FFmpegSessionTest.java
@@ -32,8 +32,8 @@ public class FFmpegSessionTest {
public void constructorTest() {
FFmpegSession ffmpegSession = new FFmpegSession(TEST_ARGUMENTS);
- // 1. getExecuteCallback
- Assert.assertNull(ffmpegSession.getExecuteCallback());
+ // 1. getCompleteCallback
+ Assert.assertNull(ffmpegSession.getCompleteCallback());
// 2. getLogCallback
Assert.assertNull(ffmpegSession.getLogCallback());
@@ -93,17 +93,17 @@ public class FFmpegSessionTest {
@Test
public void constructorTest2() {
- ExecuteCallback executeCallback = new ExecuteCallback() {
+ FFmpegSessionCompleteCallback completeCallback = new FFmpegSessionCompleteCallback() {
@Override
- public void apply(Session session) {
+ public void apply(FFmpegSession session) {
}
};
- FFmpegSession ffmpegSession = new FFmpegSession(TEST_ARGUMENTS, executeCallback);
+ FFmpegSession ffmpegSession = new FFmpegSession(TEST_ARGUMENTS, completeCallback);
- // 1. getExecuteCallback
- Assert.assertEquals(ffmpegSession.getExecuteCallback(), executeCallback);
+ // 1. getCompleteCallback
+ Assert.assertEquals(ffmpegSession.getCompleteCallback(), completeCallback);
// 2. getLogCallback
Assert.assertNull(ffmpegSession.getLogCallback());
@@ -163,10 +163,10 @@ public class FFmpegSessionTest {
@Test
public void constructorTest3() {
- ExecuteCallback executeCallback = new ExecuteCallback() {
+ FFmpegSessionCompleteCallback completeCallback = new FFmpegSessionCompleteCallback() {
@Override
- public void apply(Session session) {
+ public void apply(FFmpegSession session) {
}
};
@@ -184,10 +184,10 @@ public class FFmpegSessionTest {
}
};
- FFmpegSession ffmpegSession = new FFmpegSession(TEST_ARGUMENTS, executeCallback, logCallback, statisticsCallback);
+ FFmpegSession ffmpegSession = new FFmpegSession(TEST_ARGUMENTS, completeCallback, logCallback, statisticsCallback);
- // 1. getExecuteCallback
- Assert.assertEquals(ffmpegSession.getExecuteCallback(), executeCallback);
+ // 1. getCompleteCallback
+ Assert.assertEquals(ffmpegSession.getCompleteCallback(), completeCallback);
// 2. getLogCallback
Assert.assertEquals(ffmpegSession.getLogCallback(), logCallback);
diff --git a/android/ffmpeg-kit-android-lib/src/test/java/com/arthenica/ffmpegkit/FFprobeSessionTest.java b/android/ffmpeg-kit-android-lib/src/test/java/com/arthenica/ffmpegkit/FFprobeSessionTest.java
index 634e901..7374e6c 100644
--- a/android/ffmpeg-kit-android-lib/src/test/java/com/arthenica/ffmpegkit/FFprobeSessionTest.java
+++ b/android/ffmpeg-kit-android-lib/src/test/java/com/arthenica/ffmpegkit/FFprobeSessionTest.java
@@ -32,8 +32,8 @@ public class FFprobeSessionTest {
public void constructorTest() {
FFprobeSession ffprobeSession = new FFprobeSession(TEST_ARGUMENTS);
- // 1. getExecuteCallback
- Assert.assertNull(ffprobeSession.getExecuteCallback());
+ // 1. getCompleteCallback
+ Assert.assertNull(ffprobeSession.getCompleteCallback());
// 2. getLogCallback
Assert.assertNull(ffprobeSession.getLogCallback());
@@ -90,17 +90,17 @@ public class FFprobeSessionTest {
@Test
public void constructorTest2() {
- ExecuteCallback executeCallback = new ExecuteCallback() {
+ FFprobeSessionCompleteCallback completeCallback = new FFprobeSessionCompleteCallback() {
@Override
- public void apply(Session session) {
+ public void apply(FFprobeSession session) {
}
};
- FFprobeSession ffprobeSession = new FFprobeSession(TEST_ARGUMENTS, executeCallback);
+ FFprobeSession ffprobeSession = new FFprobeSession(TEST_ARGUMENTS, completeCallback);
- // 1. getExecuteCallback
- Assert.assertEquals(ffprobeSession.getExecuteCallback(), executeCallback);
+ // 1. getCompleteCallback
+ Assert.assertEquals(ffprobeSession.getCompleteCallback(), completeCallback);
// 2. getLogCallback
Assert.assertNull(ffprobeSession.getLogCallback());
@@ -157,10 +157,10 @@ public class FFprobeSessionTest {
@Test
public void constructorTest3() {
- ExecuteCallback executeCallback = new ExecuteCallback() {
+ FFprobeSessionCompleteCallback completeCallback = new FFprobeSessionCompleteCallback() {
@Override
- public void apply(Session session) {
+ public void apply(FFprobeSession session) {
}
};
@@ -171,10 +171,10 @@ public class FFprobeSessionTest {
}
};
- FFprobeSession ffprobeSession = new FFprobeSession(TEST_ARGUMENTS, executeCallback, logCallback);
+ FFprobeSession ffprobeSession = new FFprobeSession(TEST_ARGUMENTS, completeCallback, logCallback);
- // 1. getExecuteCallback
- Assert.assertEquals(ffprobeSession.getExecuteCallback(), executeCallback);
+ // 1. getCompleteCallback
+ Assert.assertEquals(ffprobeSession.getCompleteCallback(), completeCallback);
// 2. getLogCallback
Assert.assertEquals(ffprobeSession.getLogCallback(), logCallback);
diff --git a/apple/src/AbstractSession.h b/apple/src/AbstractSession.h
index 31dfc9a..e44ea5e 100644
--- a/apple/src/AbstractSession.h
+++ b/apple/src/AbstractSession.h
@@ -29,8 +29,8 @@
extern int const AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit;
/**
- * Abstract session implementation which includes common features shared by FFmpeg
- * and FFprobe
sessions.
+ * Abstract session implementation which includes common features shared by FFmpeg
,
+ * FFprobe
and MediaInformation
sessions.
*/
@interface AbstractSession : NSObject
* FFmpegSession *session = [FFmpegKit execute:@"-i file1.mp4 -c:v libxvid file1.avi"];
*
- * FFmpegSession *asyncSession = [FFmpegKit executeAsync:@"-i file1.mp4 -c:v libxvid file1.avi" withExecuteCallback:executeCallback];
+ * FFmpegSession *asyncSession = [FFmpegKit executeAsync:@"-i file1.mp4 -c:v libxvid file1.avi" withCompleteCallback:completeCallback];
*
* execute
methods to define session specific callbacks.
*
- * FFmpegSession *asyncSession = [FFmpegKit executeAsync:@"-i file1.mp4 -c:v libxvid file1.avi" withExecuteCallback:executeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
+ * FFmpegSession *asyncSession = [FFmpegKit executeAsync:@"-i file1.mp4 -c:v libxvid file1.avi" withCompleteCallback:completeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
*
*/
@interface FFmpegKit : NSObject
@@ -54,56 +53,56 @@
/**
* sessionId
.
*
- * FFmpegKit
library methods. Must not be used by user
- * applications.
+ * Adds a new statistics entry for this session. It is invoked internally by FFmpegKit
library methods.
+ * Must not be used by user applications.
*
* @param statistics statistics entry
*/
diff --git a/apple/src/FFmpegSession.m b/apple/src/FFmpegSession.m
index 0290153..6fdcd68 100644
--- a/apple/src/FFmpegSession.m
+++ b/apple/src/FFmpegSession.m
@@ -17,7 +17,6 @@
* along with FFmpegKit. If not, see FFmpeg
session has ended.
* ReturnCode
should be checked to
@@ -43,8 +43,8 @@
*
* @param session session of the completed execution
*/
-typedef void (^ExecuteCallback)(id
* FFprobeSession *session = [FFprobeKit execute:@"-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4"];
*
- * FFprobeSession *asyncSession = [FFprobeKit executeAsync:@"-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4" withExecuteCallback:executeCallback];
+ * FFprobeSession *asyncSession = [FFprobeKit executeAsync:@"-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4" withCompleteCallback:completeCallback];
*
* execute
methods to define session specific callbacks.
*
- * FFprobeSession *session = [FFprobeKit executeAsync:@"-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4" withExecuteCallback:executeCallback withLogCallback:logCallback];
+ * FFprobeSession *session = [FFprobeKit executeAsync:@"-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4" withCompleteCallback:completeCallback withLogCallback:logCallback];
*
*
@@ -56,54 +56,54 @@
/**
*
FFprobe
session has ended.
+ * ReturnCode
should be checked to
+ * see the execution result.
+ * getState
returns SessionStateFailed then
+ * getFailStackTrace
should be used to get the failure reason.
+ *
+ * switch ([session getState]) {
+ * case SessionStateCompleted:
+ * ReturnCode *returnCode = [session getReturnCode];
+ * break;
+ * case SessionStateFailed:
+ * NSString *failStackTrace = [session getFailStackTrace];
+ * break;
+ * }
+ *
+ *
+ * @param session session of the completed execution
+ */
+typedef void (^FFprobeSessionCompleteCallback)(FFprobeSession* session);
+
+#import "FFprobeSession.h"
+
+#endif // FFMPEG_KIT_FFPROBE_SESSION_COMPLETE_CALLBACK_H
diff --git a/apple/src/Makefile.am b/apple/src/Makefile.am
index 2a2d6d8..40ce966 100644
--- a/apple/src/Makefile.am
+++ b/apple/src/Makefile.am
@@ -37,28 +37,30 @@ include_HEADERS = \
ArchDetect.h \
AtomicLong.h \
Chapter.h \
- ExecuteCallback.h \
FFmpegKit.h \
FFmpegKitConfig.h \
FFmpegSession.h \
- FFprobeKit.h \
- FFprobeSession.h \
- Level.h \
- Log.h \
- LogCallback.h \
- LogRedirectionStrategy.h \
- MediaInformation.h \
- MediaInformationJsonParser.h \
- MediaInformationSession.h \
- Packages.h \
- ReturnCode.h \
- Session.h \
- SessionState.h \
- Statistics.h \
- StatisticsCallback.h \
- StreamInformation.h \
- ffmpegkit_exception.h \
- fftools_cmdutils.h \
+ FFmpegSessionCompleteCallback.h \
+ FFprobeKit.h \
+ FFprobeSession.h \
+ FFprobeSessionCompleteCallback.h \
+ Level.h \
+ Log.h \
+ LogCallback.h \
+ LogRedirectionStrategy.h \
+ MediaInformation.h \
+ MediaInformationJsonParser.h \
+ MediaInformationSession.h \
+ MediaInformationSessionCompleteCallback.h \
+ Packages.h \
+ ReturnCode.h \
+ Session.h \
+ SessionState.h \
+ Statistics.h \
+ StatisticsCallback.h \
+ StreamInformation.h \
+ ffmpegkit_exception.h \
+ fftools_cmdutils.h \
fftools_ffmpeg.h
libffmpegkit_la_CFLAGS = $(CFLAGS)
diff --git a/apple/src/Makefile.in b/apple/src/Makefile.in
index 600e946..1020462 100644
--- a/apple/src/Makefile.in
+++ b/apple/src/Makefile.in
@@ -414,28 +414,30 @@ include_HEADERS = \
ArchDetect.h \
AtomicLong.h \
Chapter.h \
- ExecuteCallback.h \
FFmpegKit.h \
FFmpegKitConfig.h \
FFmpegSession.h \
- FFprobeKit.h \
- FFprobeSession.h \
- Level.h \
- Log.h \
- LogCallback.h \
- LogRedirectionStrategy.h \
- MediaInformation.h \
- MediaInformationJsonParser.h \
- MediaInformationSession.h \
- Packages.h \
- ReturnCode.h \
- Session.h \
- SessionState.h \
- Statistics.h \
- StatisticsCallback.h \
- StreamInformation.h \
- ffmpegkit_exception.h \
- fftools_cmdutils.h \
+ FFmpegSessionCompleteCallback.h \
+ FFprobeKit.h \
+ FFprobeSession.h \
+ FFprobeSessionCompleteCallback.h \
+ Level.h \
+ Log.h \
+ LogCallback.h \
+ LogRedirectionStrategy.h \
+ MediaInformation.h \
+ MediaInformationJsonParser.h \
+ MediaInformationSession.h \
+ MediaInformationSessionCompleteCallback.h \
+ Packages.h \
+ ReturnCode.h \
+ Session.h \
+ SessionState.h \
+ Statistics.h \
+ StatisticsCallback.h \
+ StreamInformation.h \
+ ffmpegkit_exception.h \
+ fftools_cmdutils.h \
fftools_ffmpeg.h
libffmpegkit_la_CFLAGS = $(CFLAGS)
diff --git a/apple/src/MediaInformationSession.h b/apple/src/MediaInformationSession.h
index 3b6f2c7..e529edb 100644
--- a/apple/src/MediaInformationSession.h
+++ b/apple/src/MediaInformationSession.h
@@ -21,14 +21,15 @@
#define FFMPEG_KIT_MEDIA_INFORMATION_SESSION_H
#import MediaInformation
object using the
* FFprobe output.
*/
-@interface MediaInformationSession : FFprobeSession
+@interface MediaInformationSession : AbstractSession
/**
* Creates a new media information session.
@@ -40,19 +41,19 @@
/**
* Creates a new media information session.
*
- * @param arguments command arguments
- * @param executeCallback session specific execute callback
+ * @param arguments command arguments
+ * @param completeCallback session specific complete callback
*/
-- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback;
+- (instancetype)init:(NSArray*)arguments withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback;
/**
* Creates a new media information session.
*
- * @param arguments command arguments
- * @param executeCallback session specific execute callback
- * @param logCallback session specific log callback
+ * @param arguments command arguments
+ * @param completeCallback session specific complete callback
+ * @param logCallback session specific log callback
*/
-- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback;
+- (instancetype)init:(NSArray*)arguments withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback;
/**
* Returns the media information extracted in this session.
@@ -69,6 +70,13 @@
*/
- (void)setMediaInformation:(MediaInformation*)mediaInformation;
+/**
+ * Returns the session specific complete callback.
+ *
+ * @return session specific complete callback
+ */
+- (MediaInformationSessionCompleteCallback)getCompleteCallback;
+
@end
#endif // FFMPEG_KIT_MEDIA_INFORMATION_SESSION_H
diff --git a/apple/src/MediaInformationSession.m b/apple/src/MediaInformationSession.m
index da59e42..76214b0 100644
--- a/apple/src/MediaInformationSession.m
+++ b/apple/src/MediaInformationSession.m
@@ -17,13 +17,13 @@
* along with FFmpegKit. If not, see MediaInformation
session
+ * has ended.
+ * ReturnCode
should be checked to
+ * see the execution result.
+ * getState
returns SessionStateFailed then
+ * getFailStackTrace
should be used to get the failure reason.
+ *
+ * switch ([session getState]) {
+ * case SessionStateCompleted:
+ * ReturnCode *returnCode = [session getReturnCode];
+ * break;
+ * case SessionStateFailed:
+ * NSString *failStackTrace = [session getFailStackTrace];
+ * break;
+ * }
+ *
+ *
+ * @param session session of the completed execution
+ */
+typedef void (^MediaInformationSessionCompleteCallback)(MediaInformationSession* session);
+
+#import "MediaInformationSession.h"
+
+#endif // FFMPEG_KIT_MEDIA_INFORMATION_SESSION_COMPLETE_CALLBACK_H
diff --git a/apple/src/Session.h b/apple/src/Session.h
index 17ea178..980fad3 100644
--- a/apple/src/Session.h
+++ b/apple/src/Session.h
@@ -21,7 +21,6 @@
#define FFMPEG_KIT_SESSION_H
#import MediaInformation
session or not.
+ *
+ * @return true if it is a MediaInformation
session, false otherwise
+ */
+- (BOOL)isMediaInformation;
+
/**
* Cancels running the session.
*/
diff --git a/scripts/function-apple.sh b/scripts/function-apple.sh
index 17280cc..f41b10a 100755
--- a/scripts/function-apple.sh
+++ b/scripts/function-apple.sh
@@ -841,12 +841,13 @@ framework module ffmpegkit {
header "ArchDetect.h"
header "AtomicLong.h"
header "Chapter.h"
- header "ExecuteCallback.h"
header "FFmpegKit.h"
header "FFmpegKitConfig.h"
header "FFmpegSession.h"
+ header "FFmpegSessionCompleteCallback.h"
header "FFprobeKit.h"
header "FFprobeSession.h"
+ header "FFprobeSessionCompleteCallback.h"
header "Level.h"
header "Log.h"
header "LogCallback.h"
@@ -854,6 +855,7 @@ framework module ffmpegkit {
header "MediaInformation.h"
header "MediaInformationJsonParser.h"
header "MediaInformationSession.h"
+ header "MediaInformationSessionCompleteCallback.h"
header "Packages.h"
header "ReturnCode.h"
header "Session.h"