diff options
author | ritsuka <[email protected]> | 2014-12-20 17:37:18 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-12-20 17:37:18 +0000 |
commit | 35ee296426789c3ab55abd69d86509ae36ce6f81 (patch) | |
tree | 1f7b4f8443fa5b524a52c2c72b5a1b81d091d85b | |
parent | 3db4de8fa29af0c883f0bd90333629d79d64183b (diff) |
MacGui: small improvements to HBTitle and HBJob.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6625 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | macosx/HBJob.h | 7 | ||||
-rw-r--r-- | macosx/HBJob.m | 6 | ||||
-rw-r--r-- | macosx/HBTitle.h | 4 | ||||
-rw-r--r-- | macosx/HBTitle.m | 42 |
4 files changed, 34 insertions, 25 deletions
diff --git a/macosx/HBJob.h b/macosx/HBJob.h index 5fec2e079..bb69ed773 100644 --- a/macosx/HBJob.h +++ b/macosx/HBJob.h @@ -6,9 +6,7 @@ #import <Foundation/Foundation.h> -@class HBPreset; - -@class HBTitle; +#import "HBTitle.h" #import "HBVideo.h" #import "HBPicture.h" @@ -17,6 +15,8 @@ @class HBAudioDefaults; @class HBSubtitlesDefaults; +@class HBPreset; + typedef NS_ENUM(NSUInteger, HBJobStatus) { HBJobStatusNone, HBJobStatusWorking, @@ -30,6 +30,7 @@ typedef NS_ENUM(NSUInteger, HBJobStatus) { @interface HBJob : NSObject <NSCoding, NSCopying> - (instancetype)initWithTitle:(HBTitle *)title url:(NSURL *)fileURL andPreset:(HBPreset *)preset; +- (void)applyPreset:(HBPreset *)preset; @property (nonatomic, readonly) HBJobStatus status; diff --git a/macosx/HBJob.m b/macosx/HBJob.m index 395e5fa9f..03aafa2f8 100644 --- a/macosx/HBJob.m +++ b/macosx/HBJob.m @@ -20,6 +20,10 @@ { self = [super init]; if (self) { + NSParameterAssert(title); + NSParameterAssert(fileURL); + NSParameterAssert(preset); + _title = title; _fileURL = [fileURL copy]; @@ -27,7 +31,7 @@ _subtitlesDefaults = [[HBSubtitlesDefaults alloc] init]; _video = [[HBVideo alloc] init]; - _picture = [[HBPicture alloc] init]; + _picture = [[HBPicture alloc] initWithTitle:title]; _filters = [[HBFilters alloc] init]; [self applyPreset:preset]; diff --git a/macosx/HBTitle.h b/macosx/HBTitle.h index e0d5ebdf6..64f2fd9ab 100644 --- a/macosx/HBTitle.h +++ b/macosx/HBTitle.h @@ -9,7 +9,7 @@ /** * HBTitles is an interface to the low-level hb_title_t. - * the properties ara lazy-loaded. + * the properties are lazy-loaded. */ @interface HBTitle : NSObject @@ -25,7 +25,7 @@ @property (nonatomic, readonly) NSString *name; @property (nonatomic, readonly, getter=isFeatured) BOOL featured; -@property (nonatomic, readonly) hb_title_t *title; +@property (nonatomic, readonly) hb_title_t *hb_title; @property (nonatomic, readonly) NSArray *audioTracks; @property (nonatomic, readonly) NSArray *subtitlesTracks; diff --git a/macosx/HBTitle.m b/macosx/HBTitle.m index cde1c6100..6955935ef 100644 --- a/macosx/HBTitle.m +++ b/macosx/HBTitle.m @@ -54,6 +54,7 @@ extern NSString *keySubTrackSrtCharCode; return nil; } + _hb_title = title; _featured = featured; } @@ -64,32 +65,35 @@ extern NSString *keySubTrackSrtCharCode; { if (!_name) { - if (self.title->type == HB_BD_TYPE) - { - _name = [NSString stringWithFormat:@"%s %d (%05d.MPLS) - %02dh%02dm%02ds", - self.title->name, self.title->index, self.title->playlist, - self.title->hours, self.title->minutes, self.title->seconds]; - } - else - { - _name = [NSString stringWithFormat:@"%s %d - %02dh%02dm%02ds", - self.title->name, self.title->index, - self.title->hours, self.title->minutes, self.title->seconds]; - } - - [_name retain]; + _name = [@(self.hb_title->name) retain]; } return _name; } +- (NSString *)description +{ + if (self.hb_title->type == HB_BD_TYPE) + { + return [NSString stringWithFormat:@"%@ %d (%05d.MPLS) - %02dh%02dm%02ds", + @(self.hb_title->name), self.hb_title->index, self.hb_title->playlist, + self.hb_title->hours, self.hb_title->minutes, self.hb_title->seconds]; + } + else + { + return [NSString stringWithFormat:@"%@ %d - %02dh%02dm%02ds", + @(self.hb_title->name), self.hb_title->index, + self.hb_title->hours, self.hb_title->minutes, self.hb_title->seconds]; + } +} + - (NSArray *)audioTracks { if (!_audioTracks) { NSMutableArray *tracks = [NSMutableArray array]; hb_audio_config_t *audio; - hb_list_t *list = self.title->list_audio; + hb_list_t *list = self.hb_title->list_audio; int count = hb_list_count(list); // Initialize the audio list of available audio tracks from this title @@ -118,7 +122,7 @@ extern NSString *keySubTrackSrtCharCode; { NSMutableArray *tracks = [NSMutableArray array]; hb_subtitle_t *subtitle; - hb_list_t *list = self.title->list_audio; + hb_list_t *list = self.hb_title->list_audio; int count = hb_list_count(list); NSMutableArray *forcedSourceNamesArray = [[NSMutableArray alloc] init]; @@ -126,7 +130,7 @@ extern NSString *keySubTrackSrtCharCode; for (int i = 0; i < count; i++) { - subtitle = (hb_subtitle_t *)hb_list_item(self.title->list_subtitle, i); + subtitle = (hb_subtitle_t *)hb_list_item(self.hb_title->list_subtitle, i); /* Human-readable representation of subtitle->source */ NSString *bitmapOrText = subtitle->format == PICTURESUB ? @"Bitmap" : @"Text"; @@ -187,9 +191,9 @@ extern NSString *keySubTrackSrtCharCode; { NSMutableArray *chapters = [NSMutableArray array]; - for (int i = 0; i < hb_list_count(self.title->job->list_chapter); i++) + for (int i = 0; i < hb_list_count(self.hb_title->list_chapter); i++) { - hb_chapter_t *chapter = hb_list_item(self.title->job->list_chapter, i); + hb_chapter_t *chapter = hb_list_item(self.hb_title->list_chapter, i); if (chapter != NULL) { |