summaryrefslogtreecommitdiffstats
path: root/macosx/HBTitle.m
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2016-10-29 13:24:01 +0200
committerDamiano Galassi <[email protected]>2016-10-29 14:08:19 +0200
commit185a922d275ef95db2fa73ee31e07bcafbdecaae (patch)
tree8ae73547d8acaf987091d5ab29bf3a3db279bf4a /macosx/HBTitle.m
parent2e48a329ffa5123439cf82b5163176713eb64432 (diff)
MacGui: use hb_preset_job_init instead of custom logic for audio, subtitles and picture job settings.
Diffstat (limited to 'macosx/HBTitle.m')
-rw-r--r--macosx/HBTitle.m26
1 files changed, 24 insertions, 2 deletions
diff --git a/macosx/HBTitle.m b/macosx/HBTitle.m
index a0cd592d4..5d87bfaad 100644
--- a/macosx/HBTitle.m
+++ b/macosx/HBTitle.m
@@ -5,8 +5,10 @@
It may be used under the terms of the GNU General Public License. */
#import "HBTitle.h"
-#import "HBTitlePrivate.h"
+#import "HBTitle+Private.h"
#import "HBChapter.h"
+#import "HBPreset.h"
+#import "NSDictionary+HBAdditions.h"
#include "lang.h"
@@ -26,6 +28,7 @@ extern NSString *keySubTrackType;
@interface HBTitle ()
@property (nonatomic, readonly) hb_title_t *hb_title;
+@property (nonatomic, readonly) hb_handle_t *hb_handle;
@property (nonatomic, readwrite, strong) NSString *name;
@property (nonatomic, readwrite) NSArray *audioTracks;
@@ -36,7 +39,7 @@ extern NSString *keySubTrackType;
@implementation HBTitle
-- (instancetype)initWithTitle:(hb_title_t *)title featured:(BOOL)featured
+- (instancetype)initWithTitle:(hb_title_t *)title handle:(hb_handle_t *)handle featured:(BOOL)featured
{
self = [super init];
if (self)
@@ -47,6 +50,7 @@ extern NSString *keySubTrackType;
}
_hb_title = title;
+ _hb_handle = handle;
_featured = featured;
}
@@ -256,4 +260,22 @@ extern NSString *keySubTrackType;
return _chapters;
}
+- (NSDictionary *)jobSettingsWithPreset:(HBPreset *)preset
+{
+ NSDictionary *result = nil;
+
+ hb_dict_t *hb_preset = [preset content].hb_value;
+ hb_dict_t *job = hb_preset_job_init(self.hb_handle, self.hb_title->index, hb_preset);
+
+ if (job)
+ {
+ result = [[NSDictionary alloc] initWithHBDict:job];
+ }
+
+ hb_dict_free(&hb_preset);
+ hb_dict_free(&job);
+
+ return result;
+}
+
@end