diff options
author | Damiano Galassi <[email protected]> | 2020-04-11 12:19:17 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2020-04-11 12:19:17 +0200 |
commit | 21982a4e674d3382b13f30546f6e699bdfc5cafe (patch) | |
tree | 7da62e5317024d9e77d062678097a2eb2286c6fe /macosx/HandBrakeXPCService | |
parent | c3b2645cb09b48443bdd0e2670be6866d34b0dae (diff) |
MacGui: enhance the queue to allow up to 4 simultaneous encodes. Add a preference to set the number of queue workers.
Diffstat (limited to 'macosx/HandBrakeXPCService')
-rw-r--r-- | macosx/HandBrakeXPCService/HBRemoteCoreProtocol.h | 5 | ||||
-rw-r--r-- | macosx/HandBrakeXPCService/HandBrakeXPCService.m | 22 | ||||
-rw-r--r-- | macosx/HandBrakeXPCService/HandBrakeXPCService1.plist (renamed from macosx/HandBrakeXPCService/Info.plist) | 0 | ||||
-rw-r--r-- | macosx/HandBrakeXPCService/HandBrakeXPCService2.plist | 29 | ||||
-rw-r--r-- | macosx/HandBrakeXPCService/HandBrakeXPCService3.plist | 29 | ||||
-rw-r--r-- | macosx/HandBrakeXPCService/HandBrakeXPCService4.plist | 29 |
6 files changed, 113 insertions, 1 deletions
diff --git a/macosx/HandBrakeXPCService/HBRemoteCoreProtocol.h b/macosx/HandBrakeXPCService/HBRemoteCoreProtocol.h index 37fc73e2d..97c8870ef 100644 --- a/macosx/HandBrakeXPCService/HBRemoteCoreProtocol.h +++ b/macosx/HandBrakeXPCService/HBRemoteCoreProtocol.h @@ -19,6 +19,11 @@ NS_ASSUME_NONNULL_BEGIN - (void)provideResourceAccessWithBookmarks:(NSArray<NSData *> *)bookmarks; +- (void)setAutomaticallyPreventSleep:(BOOL)automaticallyPreventSleep; + +- (void)preventSleep; +- (void)allowSleep; + - (void)scanURL:(NSURL *)url titleIndex:(NSUInteger)index previews:(NSUInteger)previewsNum minDuration:(NSUInteger)seconds keepPreviews:(BOOL)keepPreviews withReply:(void (^)(HBCoreResult))reply; - (void)cancelScan; diff --git a/macosx/HandBrakeXPCService/HandBrakeXPCService.m b/macosx/HandBrakeXPCService/HandBrakeXPCService.m index 34d3c04cb..facf01268 100644 --- a/macosx/HandBrakeXPCService/HandBrakeXPCService.m +++ b/macosx/HandBrakeXPCService/HandBrakeXPCService.m @@ -57,7 +57,6 @@ static void *HandBrakeXPCServiceContext = &HandBrakeXPCServiceContext; _core = [[HBCore alloc] initWithLogLevel:level queue:_queue]; _core.name = name; - _core.automaticallyPreventSleep = NO; // Completion handler void (^completionHandler)(HBCoreResult result) = ^(HBCoreResult result) @@ -106,6 +105,13 @@ static void *HandBrakeXPCServiceContext = &HandBrakeXPCServiceContext; }); } +- (void)setAutomaticallyPreventSleep:(BOOL)automaticallyPreventSleep +{ + dispatch_sync(_queue, ^{ + self.core.automaticallyPreventSleep = automaticallyPreventSleep; + }); +} + - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if (context == HandBrakeXPCServiceContext) @@ -118,6 +124,20 @@ static void *HandBrakeXPCServiceContext = &HandBrakeXPCServiceContext; } } +- (void)preventSleep +{ + dispatch_sync(_queue, ^{ + [self.core preventSleep]; + }); +} + +- (void)allowSleep +{ + dispatch_sync(_queue, ^{ + [self.core allowSleep]; + }); +} + - (void)scanURL:(NSURL *)url titleIndex:(NSUInteger)index previews:(NSUInteger)previewsNum minDuration:(NSUInteger)seconds keepPreviews:(BOOL)keepPreviews withReply:(void (^)(HBCoreResult))reply { dispatch_sync(_queue, ^{ diff --git a/macosx/HandBrakeXPCService/Info.plist b/macosx/HandBrakeXPCService/HandBrakeXPCService1.plist index 78928db23..78928db23 100644 --- a/macosx/HandBrakeXPCService/Info.plist +++ b/macosx/HandBrakeXPCService/HandBrakeXPCService1.plist diff --git a/macosx/HandBrakeXPCService/HandBrakeXPCService2.plist b/macosx/HandBrakeXPCService/HandBrakeXPCService2.plist new file mode 100644 index 000000000..78928db23 --- /dev/null +++ b/macosx/HandBrakeXPCService/HandBrakeXPCService2.plist @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>$(DEVELOPMENT_LANGUAGE)</string> + <key>CFBundleDisplayName</key> + <string>HandBrakeXPCService</string> + <key>CFBundleExecutable</key> + <string>$(EXECUTABLE_NAME)</string> + <key>CFBundleIdentifier</key> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>$(PRODUCT_NAME)</string> + <key>CFBundlePackageType</key> + <string>XPC!</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> + <key>XPCService</key> + <dict> + <key>ServiceType</key> + <string>Application</string> + </dict> +</dict> +</plist> diff --git a/macosx/HandBrakeXPCService/HandBrakeXPCService3.plist b/macosx/HandBrakeXPCService/HandBrakeXPCService3.plist new file mode 100644 index 000000000..78928db23 --- /dev/null +++ b/macosx/HandBrakeXPCService/HandBrakeXPCService3.plist @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>$(DEVELOPMENT_LANGUAGE)</string> + <key>CFBundleDisplayName</key> + <string>HandBrakeXPCService</string> + <key>CFBundleExecutable</key> + <string>$(EXECUTABLE_NAME)</string> + <key>CFBundleIdentifier</key> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>$(PRODUCT_NAME)</string> + <key>CFBundlePackageType</key> + <string>XPC!</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> + <key>XPCService</key> + <dict> + <key>ServiceType</key> + <string>Application</string> + </dict> +</dict> +</plist> diff --git a/macosx/HandBrakeXPCService/HandBrakeXPCService4.plist b/macosx/HandBrakeXPCService/HandBrakeXPCService4.plist new file mode 100644 index 000000000..78928db23 --- /dev/null +++ b/macosx/HandBrakeXPCService/HandBrakeXPCService4.plist @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>$(DEVELOPMENT_LANGUAGE)</string> + <key>CFBundleDisplayName</key> + <string>HandBrakeXPCService</string> + <key>CFBundleExecutable</key> + <string>$(EXECUTABLE_NAME)</string> + <key>CFBundleIdentifier</key> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>$(PRODUCT_NAME)</string> + <key>CFBundlePackageType</key> + <string>XPC!</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> + <key>XPCService</key> + <dict> + <key>ServiceType</key> + <string>Application</string> + </dict> +</dict> +</plist> |