diff options
-rw-r--r-- | macosx/HBCore.h | 5 | ||||
-rw-r--r-- | macosx/HBCore.m | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/macosx/HBCore.h b/macosx/HBCore.h index 36335114e..dafda29ad 100644 --- a/macosx/HBCore.h +++ b/macosx/HBCore.h @@ -85,6 +85,11 @@ typedef void (^HBCoreCompletionHandler)(HBCoreResult result); - (instancetype)initWithLogLevel:(int)level name:(NSString *)name; /** + * Log level. + */ +@property (nonatomic, readwrite) int logLevel; + +/** * Current state of HBCore. */ @property (nonatomic, readonly) HBState state; diff --git a/macosx/HBCore.m b/macosx/HBCore.m index c6925abbf..88bc5e9c2 100644 --- a/macosx/HBCore.m +++ b/macosx/HBCore.m @@ -97,6 +97,7 @@ static void hb_error_handler(const char *errmsg) _state = HBStateIdle; _updateTimerQueue = dispatch_queue_create("fr.handbrake.coreQueue", DISPATCH_QUEUE_SERIAL); _hb_state = malloc(sizeof(struct hb_state_s)); + _logLevel = level; _hb_handle = hb_init(level, 0); if (!_hb_handle) @@ -132,10 +133,17 @@ static void hb_error_handler(const char *errmsg) free(_hb_state); } +- (void)setLogLevel:(int)logLevel +{ + _logLevel = logLevel; + hb_log_level_set(_hb_handle, logLevel); +} + #pragma mark - Scan - (BOOL)canScan:(NSURL *)url error:(NSError * __autoreleasing *)error { + NSAssert(url, @"[HBCore canScan:] called with nil url."); if (![[NSFileManager defaultManager] fileExistsAtPath:url.path]) { if (error) { *error = [NSError errorWithDomain:@"HBErrorDomain" |