summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorritsuka <[email protected]>2015-01-23 16:29:24 +0000
committerritsuka <[email protected]>2015-01-23 16:29:24 +0000
commit757115d8e91180d9a548aa57c20dc01f4542ee7a (patch)
tree2af93d15299bf24b49a8457476ca4ade04f0c802 /macosx
parent99afd6b79b54bdc3e05983ff86f03d59f46654ab (diff)
MacGui: expose a isStream and a timeCode properties in HBTitle.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6801 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r--macosx/HBController.m2
-rw-r--r--macosx/HBJob.m2
-rw-r--r--macosx/HBTitle.h6
-rw-r--r--macosx/HBTitle.m25
4 files changed, 28 insertions, 7 deletions
diff --git a/macosx/HBController.m b/macosx/HBController.m
index 68620c4dc..e9a884c98 100644
--- a/macosx/HBController.m
+++ b/macosx/HBController.m
@@ -834,7 +834,7 @@
}
// If we are a stream type and a batch scan, grok the output file name from title->name upon title change
- if ((title.hb_title->type == HB_STREAM_TYPE || title.hb_title->type == HB_FF_STREAM_TYPE) && self.core.titles.count > 1)
+ if (title.isStream && self.core.titles.count > 1)
{
// Change the source to read out the parent folder also
fSrcDVD2Field.stringValue = [NSString stringWithFormat:@"%@/%@", self.browsedSourceDisplayName, title.name];
diff --git a/macosx/HBJob.m b/macosx/HBJob.m
index 5bff37510..62000a9c2 100644
--- a/macosx/HBJob.m
+++ b/macosx/HBJob.m
@@ -27,7 +27,7 @@ NSString *HBContainerChangedNotification = @"HBContainerChangedNotificatio
NSParameterAssert(preset);
_title = title;
- _titleIdx = title.hb_title->index;
+ _titleIdx = title.index;
_fileURL = [[NSURL fileURLWithPath:@(title.hb_title->path)] retain];
diff --git a/macosx/HBTitle.h b/macosx/HBTitle.h
index 19b126d21..a961e048b 100644
--- a/macosx/HBTitle.h
+++ b/macosx/HBTitle.h
@@ -17,20 +17,24 @@
* Returns an HBTitle object initialized with a given title.
* It must be called only inside HBCore.
*
- * @param title the lihhb title to wrap.
+ * @param title the libhb title to wrap.
* @param featured whether the title is the featured one or not.
*/
- (instancetype)initWithTitle:(hb_title_t *)title featured:(BOOL)featured;
@property (nonatomic, readonly) NSString *name;
@property (nonatomic, readonly, getter=isFeatured) BOOL featured;
+@property (nonatomic, readonly, getter=isStream) BOOL stream;
@property (nonatomic, readonly) hb_title_t *hb_title;
+@property (nonatomic, readonly) int index;
@property (nonatomic, readonly) int angles;
@property (nonatomic, readonly) int duration;
@property (nonatomic, readonly) int frames;
+@property (nonatomic, readonly) NSString *timeCode;
+
@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 c2f6dc305..7d44baef3 100644
--- a/macosx/HBTitle.m
+++ b/macosx/HBTitle.m
@@ -70,6 +70,7 @@ extern NSString *keySubTrackSrtCharCode;
[super dealloc];
}
+
- (NSString *)name
{
if (!_name)
@@ -88,22 +89,32 @@ extern NSString *keySubTrackSrtCharCode;
return _name;
}
+- (BOOL)isStream
+{
+ return (self.hb_title->type == HB_STREAM_TYPE || self.hb_title->type == HB_FF_STREAM_TYPE);
+}
+
- (NSString *)description
{
if (self.hb_title->type == HB_BD_TYPE)
{
- return [NSString stringWithFormat:@"%@ %d (%05d.MPLS) - %02dh%02dm%02ds",
+ return [NSString stringWithFormat:@"%@ %d (%05d.MPLS) - %@",
@(self.hb_title->name), self.hb_title->index, self.hb_title->playlist,
- self.hb_title->hours, self.hb_title->minutes, self.hb_title->seconds];
+ self.timeCode];
}
else
{
- return [NSString stringWithFormat:@"%@ %d - %02dh%02dm%02ds",
+ return [NSString stringWithFormat:@"%@ %d - %@",
@(self.hb_title->name), self.hb_title->index,
- self.hb_title->hours, self.hb_title->minutes, self.hb_title->seconds];
+ self.timeCode];
}
}
+- (int)index
+{
+ return self.hb_title->index;
+}
+
- (int)angles
{
return self.hb_title->angle_count;
@@ -119,6 +130,12 @@ extern NSString *keySubTrackSrtCharCode;
return self.duration * (self.hb_title->vrate.num / self.hb_title->vrate.den);
}
+- (NSString *)timeCode
+{
+ return [NSString stringWithFormat:@"%02dh%02dm%02ds",
+ self.hb_title->hours, self.hb_title->minutes, self.hb_title->seconds];
+}
+
- (NSArray *)audioTracks
{
if (!_audioTracks)