diff options
-rw-r--r-- | macosx/HBJob.m | 2 | ||||
-rw-r--r-- | macosx/HBPicture.m | 22 | ||||
-rw-r--r-- | macosx/HBRange.m | 2 | ||||
-rw-r--r-- | macosx/HBTitle.h | 13 | ||||
-rw-r--r-- | macosx/HBTitle.m | 48 |
5 files changed, 72 insertions, 15 deletions
diff --git a/macosx/HBJob.m b/macosx/HBJob.m index 25ee5c130..6578c9710 100644 --- a/macosx/HBJob.m +++ b/macosx/HBJob.m @@ -36,7 +36,7 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification"; _titleIdx = title.index; _name = [title.name copy]; - _fileURL = [NSURL fileURLWithPath:@(title.hb_title->path)]; + _fileURL = title.url; _container = HB_MUX_MP4; _angle = 1; diff --git a/macosx/HBPicture.m b/macosx/HBPicture.m index 68ae97b5a..8ebfb8477 100644 --- a/macosx/HBPicture.m +++ b/macosx/HBPicture.m @@ -61,21 +61,19 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification"; self = [self init]; if (self) { - hb_title_t *hb_title = title.hb_title; + _width = title.width; + _height = title.height; - _width = hb_title->geometry.width; - _height = hb_title->geometry.height; + _sourceWidth = title.width; + _sourceHeight = title.height; - _sourceWidth = hb_title->geometry.width; - _sourceHeight = hb_title->geometry.height; + _sourceParNum = title.parWidth; + _sourceParDen = title.parHeight; - _sourceParNum = hb_title->geometry.par.num; - _sourceParDen = hb_title->geometry.par.den; - - _autoCropTop = hb_title->crop[0]; - _autoCropBottom = hb_title->crop[1]; - _autoCropLeft = hb_title->crop[2]; - _autoCropRight = hb_title->crop[3]; + _autoCropTop = title.autoCropTop; + _autoCropBottom = title.autoCropBottom; + _autoCropLeft = title.autoCropLeft; + _autoCropRight = title.autoCropRight; [self validateSettings]; diff --git a/macosx/HBRange.m b/macosx/HBRange.m index d4e785b30..ae09edbe7 100644 --- a/macosx/HBRange.m +++ b/macosx/HBRange.m @@ -88,7 +88,7 @@ NSString *HBRangeChangedNotification = @"HBRangeChangedNotification"; else if (self.type == HBRangeTypeFrames) { hb_title_t *title = self.title.hb_title; - int duration = (self.frameStop - self.frameStart) / (title->vrate.num / (double)title->vrate.den); + int duration = (int) ((self.frameStop - self.frameStart) / (title->vrate.num / (double)title->vrate.den)); return [NSString stringWithFormat: @"%02d:%02d:%02d", duration / 3600, ( duration / 60 ) % 60, duration % 60]; } diff --git a/macosx/HBTitle.h b/macosx/HBTitle.h index d4d7cc1c7..b60af075c 100644 --- a/macosx/HBTitle.h +++ b/macosx/HBTitle.h @@ -26,6 +26,8 @@ @property (nonatomic, readonly, getter=isFeatured) BOOL featured; @property (nonatomic, readonly, getter=isStream) BOOL stream; +@property (nonatomic, readonly) NSURL *url; + @property (nonatomic, readonly) hb_title_t *hb_title; @property (nonatomic, readonly) int index; @@ -35,6 +37,17 @@ @property (nonatomic, readonly) NSString *timeCode; +@property (nonatomic, readonly) int width; +@property (nonatomic, readonly) int height; + +@property (nonatomic, readonly) int parWidth; +@property (nonatomic, readonly) int parHeight; + +@property (nonatomic, readonly) int autoCropTop; +@property (nonatomic, readonly) int autoCropBottom; +@property (nonatomic, readonly) int autoCropLeft; +@property (nonatomic, readonly) int autoCropRight; + @property (nonatomic, readonly) NSArray *audioTracks; @property (nonatomic, readonly) NSArray *subtitlesTracks; @property (nonatomic, readonly) NSArray *chapters; diff --git a/macosx/HBTitle.m b/macosx/HBTitle.m index f2e5b4fb3..42453d34a 100644 --- a/macosx/HBTitle.m +++ b/macosx/HBTitle.m @@ -97,6 +97,11 @@ extern NSString *keySubTrackSrtCharCode; } } +- (NSURL *)url +{ + return [NSURL fileURLWithPath:@(_hb_title->path)]; +} + - (int)index { return self.hb_title->index; @@ -114,7 +119,7 @@ extern NSString *keySubTrackSrtCharCode; - (int)frames { - return (self.hb_title->duration / 90000.) * (self.hb_title->vrate.num / (double)self.hb_title->vrate.den); + return (int) ((self.hb_title->duration / 90000.) * (self.hb_title->vrate.num / (double)self.hb_title->vrate.den)); } - (NSString *)timeCode @@ -123,6 +128,47 @@ extern NSString *keySubTrackSrtCharCode; self.hb_title->hours, self.hb_title->minutes, self.hb_title->seconds]; } +- (int)width +{ + return _hb_title->geometry.width; +} + +- (int)height +{ + return _hb_title->geometry.height; +} + +- (int)parWidth +{ + return _hb_title->geometry.par.num; +} + +- (int)parHeight +{ + return _hb_title->geometry.par.den; +} + +- (int)autoCropTop +{ + return _hb_title->crop[0]; +} + +- (int)autoCropBottom +{ + return _hb_title->crop[1]; +} + +- (int)autoCropLeft +{ + return _hb_title->crop[2]; +} + +- (int)autoCropRight +{ + return _hb_title->crop[3]; +} + + - (NSArray *)audioTracks { if (!_audioTracks) |