--- /dev/null
+/* HBFlippedClipView.m
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface HBFlippedClipView : NSClipView
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+/* HBFlippedClipView.m
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License.
+ */
+
+#import "HBFlippedClipView.h"
+
+@implementation HBFlippedClipView
+
+- (BOOL)isFlipped
+{
+ return YES;
+}
+
+@end
@interface HBQueue : NSObject
+- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithURL:(NSURL *)queueURL;
@property (nonatomic, readonly) HBCore *core;
- (void)pause
{
+ [self.currentItem pausedAtDate:[NSDate date]];
[self.core pause];
[self.core allowSleep];
}
- (void)resume
{
+ [self.currentItem resumedAtDate:[NSDate date]];
[self.core resume];
[self.core preventSleep];
}
{
// now we mark the queue item as working so another instance can not come along and try to scan it while we are scanning
nextItem.state = HBQueueItemStateWorking;
+ nextItem.startedDate = [NSDate date];
// Tell HB to output a new activity log file for this encode
self.currentLog = [[HBJobOutputFileWriter alloc] initWithJob:nextItem.job];
NSParameterAssert(item);
[self.items beginTransaction];
+ item.endedDate = [NSDate date];
+
// Since we are done with this encode, tell output to stop writing to the
// individual encode log.
[[HBOutputRedirect stderrRedirect] removeListener:self.currentLog];
/**
* A flag to indicate the item's state
*/
-typedef NS_ENUM(NSUInteger, HBQueueItemState){
+typedef NS_ENUM(NSUInteger, HBQueueItemState) {
HBQueueItemStateReady,
HBQueueItemStateWorking,
HBQueueItemStateCompleted,
@property (nonatomic, readonly) NSAttributedString *attributedTitleDescription;
@property (nonatomic, readonly) NSAttributedString *attributedDescription;
-@property (nonatomic, readwrite) BOOL expanded;
+@property (nonatomic) NSTimeInterval encodeDuration;
+@property (nonatomic) NSTimeInterval pauseDuration;
+
+@property (nonatomic, nullable) NSDate *startedDate;
+@property (nonatomic, nullable) NSDate *endedDate;
+
+- (void)pausedAtDate:(NSDate *)date;
+- (void)resumedAtDate:(NSDate *)date;
@property (nonatomic, readonly) HBJob *job;
#import "HBCodingUtilities.h"
+@interface HBQueueItem ()
+
+@property (nonatomic, nullable) NSDate *pausedDate;
+@property (nonatomic, nullable) NSDate *resumedDate;
+
+@end
+
@implementation HBQueueItem
@synthesize job = _job;
@synthesize attributedTitleDescription = _attributedTitleDescription;
@synthesize attributedDescription = _attributedDescription;
+
@synthesize uuid = _uuid;
- (instancetype)initWithJob:(HBJob *)job
#pragma mark - Properties
+- (void)setState:(HBQueueItemState)state
+{
+ _state = state;
+ if (state == HBQueueItemStateReady)
+ {
+ [self resetStatistics];
+ }
+}
+
- (NSURL *)fileURL
{
return _job.fileURL;
return _attributedDescription;
}
+#pragma mark - Statistics
+
+- (void)resetStatistics
+{
+ self.pausedDate = nil;
+ self.resumedDate = nil;
+ self.startedDate = nil;
+ self.endedDate = nil;
+ self.encodeDuration = 0;
+ self.pauseDuration = 0;
+}
+
+- (void)pausedAtDate:(NSDate *)date
+{
+ self.pausedDate = date;
+}
+
+- (void)resumedAtDate:(NSDate *)date
+{
+ self.resumedDate = date;
+ self.pauseDuration += [self.resumedDate timeIntervalSinceDate:self.pausedDate];
+}
+
+- (void)setEndedDate:(NSDate *)endedDate
+{
+ _endedDate = endedDate;
+ self.encodeDuration = [self.startedDate timeIntervalSinceDate:self.endedDate];
+ self.encodeDuration -= self.pauseDuration;
+}
+
#pragma mark - NSSecureCoding
+ (BOOL)supportsSecureCoding
encodeInt(_state);
encodeObject(_job);
encodeObject(_uuid);
+
+ encodeDouble(_encodeDuration);
+ encodeDouble(_pauseDuration);
+
+ encodeObject(_startedDate);
+ encodeObject(_endedDate);
}
- (nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder
decodeInt(_state); if (_state < HBQueueItemStateReady || _state > HBQueueItemStateFailed) { goto fail; }
decodeObjectOrFail(_job, HBJob);
decodeObjectOrFail(_uuid, NSString);
+
+ decodeDouble(_encodeDuration);
+ decodeDouble(_pauseDuration);
+
+ decodeObject(_startedDate, NSDate);
+ decodeObject(_endedDate, NSDate);
+
return self;
}
fail:
A9B6B9F1217B408E00B957AE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A9B6B9EF217B408E00B957AE /* InfoPlist.strings */; };
A9B6B9F4217B408E00B957AE /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = A9B6B9F2217B408E00B957AE /* Localizable.strings */; };
A9BC24C91A69293E007DC41A /* HBAttributedStringAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = A9BC24C81A69293E007DC41A /* HBAttributedStringAdditions.m */; };
+ A9C61F9E22E31CDB00C28E7C /* HBFlippedClipView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9C61F9D22E31CDB00C28E7C /* HBFlippedClipView.m */; };
A9CE0A921F57EC3400724577 /* HBImageUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = A9CE0A911F57EC3400724577 /* HBImageUtilities.m */; };
A9CF25F71990D6820023F727 /* HBPresetsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9CF25F61990D6820023F727 /* HBPresetsViewController.m */; };
A9D0FA771C1C284D0003F2A9 /* HBFocusRingView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D0FA761C1C284D0003F2A9 /* HBFocusRingView.m */; };
A9BC24C81A69293E007DC41A /* HBAttributedStringAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBAttributedStringAdditions.m; sourceTree = "<group>"; };
A9C183931A716B8F00C897C2 /* HBTitleSelectionController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBTitleSelectionController.h; sourceTree = "<group>"; };
A9C183941A716B8F00C897C2 /* HBTitleSelectionController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBTitleSelectionController.m; sourceTree = "<group>"; };
+ A9C61F9C22E31CDB00C28E7C /* HBFlippedClipView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HBFlippedClipView.h; sourceTree = "<group>"; };
+ A9C61F9D22E31CDB00C28E7C /* HBFlippedClipView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HBFlippedClipView.m; sourceTree = "<group>"; };
A9CAC26E1CCB6B0F00A39E72 /* HBPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBPlayer.h; sourceTree = "<group>"; };
A9CE0A911F57EC3400724577 /* HBImageUtilities.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HBImageUtilities.m; sourceTree = "<group>"; };
A9CE0A931F57EC4600724577 /* HBImageUtilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HBImageUtilities.h; sourceTree = "<group>"; };
A9D0FA761C1C284D0003F2A9 /* HBFocusRingView.m */,
A93B49201DA3AA6900DD70A3 /* HBToolbarBadgedItem.h */,
A93B49211DA3AA6900DD70A3 /* HBToolbarBadgedItem.m */,
+ A9C61F9C22E31CDB00C28E7C /* HBFlippedClipView.h */,
+ A9C61F9D22E31CDB00C28E7C /* HBFlippedClipView.m */,
);
name = "UI Views";
sourceTree = "<group>";
A98036CD1CCA91DD007661AA /* HBAVPlayer.m in Sources */,
A9BC24C91A69293E007DC41A /* HBAttributedStringAdditions.m in Sources */,
273F20B314ADBE670021BE6D /* HBOutputPanelController.m in Sources */,
+ A9C61F9E22E31CDB00C28E7C /* HBFlippedClipView.m in Sources */,
273F20B414ADBE670021BE6D /* HBOutputRedirect.m in Sources */,
A95BA15D220C968500A2F9F9 /* HBQueueItem.m in Sources */,
A9D0FA771C1C284D0003F2A9 /* HBFocusRingView.m in Sources */,