summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--macosx/HBController.m2
-rw-r--r--macosx/HBCore.m15
-rw-r--r--macosx/HBPreviewGenerator.m2
-rw-r--r--macosx/HBQueueController.m18
4 files changed, 13 insertions, 24 deletions
diff --git a/macosx/HBController.m b/macosx/HBController.m
index 75c3c5ef1..3ada22255 100644
--- a/macosx/HBController.m
+++ b/macosx/HBController.m
@@ -314,7 +314,7 @@
[toolbarItem setLabel: @"Stop"];
[toolbarItem setPaletteLabel: @"Stop"];
[toolbarItem setToolTip: @"Stop Encoding"];
- return YES;
+ return (queueState != HBStateScanning);
}
if (action == @selector(pause:))
{
diff --git a/macosx/HBCore.m b/macosx/HBCore.m
index 8446a6a33..dbbbb790e 100644
--- a/macosx/HBCore.m
+++ b/macosx/HBCore.m
@@ -246,7 +246,6 @@ static void hb_error_handler(const char *errmsg)
{
if (self.isCancelled)
{
- self.cancelled = NO;
return NO;
}
@@ -385,15 +384,7 @@ static void hb_error_handler(const char *errmsg)
[HBUtilities writeToActivityLog:"%s work done", self.name.UTF8String];
- if (self.isCancelled)
- {
- self.cancelled = NO;
- return NO;
- }
- else
- {
- return YES;
- }
+ return self.isCancelled || (_hb_state->param.workdone.error == 0);
}
- (void)cancelEncode
@@ -403,7 +394,6 @@ static void hb_error_handler(const char *errmsg)
[HBUtilities writeToActivityLog:"%s encode cancelled", self.name.UTF8String];
}
-
- (void)pause
{
hb_pause(_hb_handle);
@@ -519,6 +509,9 @@ static void hb_error_handler(const char *errmsg)
{
[self handleScanCompletion];
}
+
+ // Reset the cancelled state.
+ self.cancelled = NO;
}
/**
diff --git a/macosx/HBPreviewGenerator.m b/macosx/HBPreviewGenerator.m
index 61ed448bb..a4dba01f3 100644
--- a/macosx/HBPreviewGenerator.m
+++ b/macosx/HBPreviewGenerator.m
@@ -218,8 +218,6 @@
- (void) dealloc
{
[self.core cancelEncode];
- [_core release];
- _core = nil;
[_picturePreviews release];
_picturePreviews = nil;
diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m
index 2e4249fb8..054db0568 100644
--- a/macosx/HBQueueController.m
+++ b/macosx/HBQueueController.m
@@ -155,7 +155,7 @@
menuItem.title = NSLocalizedString(@"Stop Encoding", nil);
menuItem.keyEquivalent = @".";
- return YES;
+ return self.core.state != HBStateScanning;
}
}
@@ -183,12 +183,12 @@
if (action == @selector(toggleStartCancel:))
{
- if ((s == HBStatePaused) || (s == HBStateWorking) || (s == HBStateMuxing))
+ if ((s == HBStateScanning) || (s == HBStatePaused) || (s == HBStateWorking) || (s == HBStateMuxing))
{
theItem.image = [NSImage imageNamed:@"stopencode"];
theItem.label = NSLocalizedString(@"Stop", @"");
theItem.toolTip = NSLocalizedString(@"Stop Encoding", @"");
- return YES;
+ return s != HBStateScanning;
}
else
{
@@ -449,6 +449,9 @@
// now we mark the queue item as working so another instance can not come along and try to scan it while we are scanning
self.currentJob.state = HBJobStateWorking;
+ // Tell HB to output a new activity log file for this encode
+ [self.outputPanel startEncodeLog:self.currentJob.destURL];
+
// now we can go ahead and scan the new pending queue item
[self performScan:self.currentJob.fileURL titleIdx:self.currentJob.titleIdx];
}
@@ -511,9 +514,6 @@
*/
- (void)performScan:(NSURL *)scanURL titleIdx:(NSInteger)index
{
- // Tell HB to output a new activity log file for this encode
- [self.outputPanel startEncodeLog:self.currentJob.destURL];
-
// Only scan 10 previews before an encode - additional previews are
// only useful for autocrop and static previews, which are already taken care of at this point
[self.core scanURL:scanURL
@@ -565,11 +565,11 @@
progressHandler:^(HBState state, hb_state_t hb_state) {
NSMutableString *string = nil;
CGFloat progress = 0;
+ #define p hb_state.param.working
switch (state)
{
case HBStateSearching:
{
- #define p hb_state.param.working
string = [NSMutableString stringWithFormat:
NSLocalizedString(@"Searching for start point… : %.2f %%", @""),
100.0 * p.progress];
@@ -578,13 +578,11 @@
{
[string appendFormat:NSLocalizedString(@" (ETA %02dh%02dm%02ds)", @"" ), p.hours, p.minutes, p.seconds];
}
- #undef p
break;
}
case HBStateWorking:
{
- #define p hb_state.param.working
NSString *pass_desc = @"";
if (p.job_cur == 1 && p.job_count > 1)
{
@@ -647,7 +645,6 @@
self.dockIconProgress += dockTileUpdateFrequency;
}
- #undef p
break;
}
@@ -668,6 +665,7 @@
default:
break;
}
+ #undef p
// Update text field
self.progressTextField.stringValue = string;