summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorritsuka <[email protected]>2015-05-07 15:33:13 +0000
committerritsuka <[email protected]>2015-05-07 15:33:13 +0000
commit3217ba5b96189802755b90d098d29c2f900dfcbe (patch)
tree2ed1e4a7fbd497d0697664339e420e1801cbd990
parent878199667e6a7c79ff39b3d48127324fcf2c53ad (diff)
MacGui: wrap more hb_title properties in HBTitle.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7162 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--macosx/HBJob.m2
-rw-r--r--macosx/HBPicture.m22
-rw-r--r--macosx/HBRange.m2
-rw-r--r--macosx/HBTitle.h13
-rw-r--r--macosx/HBTitle.m48
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)