diff --git a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/ReturnCode.java b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/ReturnCode.java index cdd1094..a91ff9e 100644 --- a/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/ReturnCode.java +++ b/android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/ReturnCode.java @@ -31,6 +31,14 @@ public class ReturnCode { this.value = value; } + public static boolean isSuccess(final ReturnCode returnCode) { + return (returnCode != null && returnCode.getValue() == SUCCESS); + } + + public static boolean isCancel(final ReturnCode returnCode) { + return (returnCode != null && returnCode.getValue() == CANCEL); + } + public int getValue() { return value; } diff --git a/apple/src/ReturnCode.h b/apple/src/ReturnCode.h index 76fba7c..3d47ee4 100644 --- a/apple/src/ReturnCode.h +++ b/apple/src/ReturnCode.h @@ -31,6 +31,10 @@ typedef NS_ENUM(NSUInteger, ReturnCodeEnum) { - (instancetype)init:(int)value; ++ (BOOL)isSuccess:(ReturnCode*)value; + ++ (BOOL)isCancel:(ReturnCode*)value; + - (int)getValue; - (BOOL)isSuccess; diff --git a/apple/src/ReturnCode.m b/apple/src/ReturnCode.m index 3253007..3f65732 100644 --- a/apple/src/ReturnCode.m +++ b/apple/src/ReturnCode.m @@ -32,6 +32,14 @@ return self; } ++ (BOOL)isSuccess:(ReturnCode*)value { + return (value != nil) && ([value getValue] == ReturnCodeSuccess); +} + ++ (BOOL)isCancel:(ReturnCode*)value { + return (value != nil) && ([value getValue] == ReturnCodeCancel); +} + - (int)getValue { return _value; }