add helper methods to ReturnCode

pull/7/head
Taner Sener 4 years ago
parent 06a736fda4
commit bdb9601069
  1. 8
      android/ffmpeg-kit-android-lib/src/main/java/com/arthenica/ffmpegkit/ReturnCode.java
  2. 4
      apple/src/ReturnCode.h
  3. 8
      apple/src/ReturnCode.m

@ -31,6 +31,14 @@ public class ReturnCode {
this.value = value; 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() { public int getValue() {
return value; return value;
} }

@ -31,6 +31,10 @@ typedef NS_ENUM(NSUInteger, ReturnCodeEnum) {
- (instancetype)init:(int)value; - (instancetype)init:(int)value;
+ (BOOL)isSuccess:(ReturnCode*)value;
+ (BOOL)isCancel:(ReturnCode*)value;
- (int)getValue; - (int)getValue;
- (BOOL)isSuccess; - (BOOL)isSuccess;

@ -32,6 +32,14 @@
return self; return self;
} }
+ (BOOL)isSuccess:(ReturnCode*)value {
return (value != nil) && ([value getValue] == ReturnCodeSuccess);
}
+ (BOOL)isCancel:(ReturnCode*)value {
return (value != nil) && ([value getValue] == ReturnCodeCancel);
}
- (int)getValue { - (int)getValue {
return _value; return _value;
} }

Loading…
Cancel
Save