summaryrefslogtreecommitdiffstats
path: root/macosx/HBJob.m
diff options
context:
space:
mode:
authorritsuka <[email protected]>2014-12-22 17:12:16 +0000
committerritsuka <[email protected]>2014-12-22 17:12:16 +0000
commitee10e1fdb417c7f1047406522379c85c47143bfd (patch)
tree1ed8f1ae02ee7296162c640bb238a425af93a02b /macosx/HBJob.m
parent6bcb7bd0894f9f44637b9668e5b5d3d388aef152 (diff)
MacGui: set the chapter titles directly in HBJob. Move more things over to HBTitle and HBJob.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6642 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBJob.m')
-rw-r--r--macosx/HBJob.m36
1 files changed, 25 insertions, 11 deletions
diff --git a/macosx/HBJob.m b/macosx/HBJob.m
index 5e334bae2..803460d21 100644
--- a/macosx/HBJob.m
+++ b/macosx/HBJob.m
@@ -15,22 +15,21 @@
@implementation HBJob
-- (instancetype)initWithTitle:(HBTitle *)title url:(NSURL *)fileURL andPreset:(HBPreset *)preset
+- (instancetype)initWithTitle:(HBTitle *)title andPreset:(HBPreset *)preset
{
self = [super init];
if (self) {
NSParameterAssert(title);
- NSParameterAssert(fileURL);
NSParameterAssert(preset);
_title = title;
- _fileURL = [fileURL copy];
- _fileFormat = HB_MUX_MP4;
+ _container = HB_MUX_MP4;
_audioDefaults = [[HBAudioDefaults alloc] init];
_subtitlesDefaults = [[HBSubtitlesDefaults alloc] init];
+ _range = [[HBRange alloc] init];
_video = [[HBVideo alloc] init];
_picture = [[HBPicture alloc] initWithTitle:title];
_filters = [[HBFilters alloc] init];
@@ -38,6 +37,8 @@
_audioTracks = [[NSMutableArray alloc] init];
_subtitlesTracks = [[NSMutableArray alloc] init];
+ _chapterTitles = [title.chapters mutableCopy];
+
[self applyPreset:preset];
}
@@ -46,8 +47,19 @@
- (void)applyPreset:(HBPreset *)preset
{
+ NSDictionary *content = preset.content;
+
+ self.container = hb_container_get_from_name(hb_container_sanitize_name([content[@"FileFormat"] UTF8String]));
+
+ // Mux mp4 with http optimization
+ self.mp4HttpOptimize = [content[@"Mp4HttpOptimize"] boolValue];
+ self.mp4iPodCompatible = [content[@"Mp4iPodCompatible"] boolValue];
+
+ // Chapter Markers
+ self.chaptersEnabled = [content[@"ChapterMarkers"] boolValue];
+
[@[self.audioDefaults, self.subtitlesDefaults, self.video, self.picture, self.filters] makeObjectsPerformSelector:@selector(applySettingsFromPreset:)
- withObject:preset.content];
+ withObject:content];
}
- (void)dealloc
@@ -119,7 +131,7 @@
}*/
// Format (Muxer) and Video Encoder
- job->mux = self.fileFormat;
+ job->mux = self.container;
job->vcodec = self.video.encoder;
// We set http optimized mp4 here
@@ -138,7 +150,7 @@
// Also, note that if for some reason we don't apply chapter names, the
// chapters just come out 001, 002, etc. etc.
int i = 0;
- for (NSString *name in self.chapterNames)
+ for (NSString *name in self.chapterTitles)
{
hb_chapter_t *chapter = (hb_chapter_t *) hb_list_item(job->list_chapter, i);
if (chapter != NULL)
@@ -583,10 +595,11 @@
encodeObject(_fileURL);
encodeObject(_destURL);
- encodeInt(_fileFormat);
+ encodeInt(_container);
encodeBool(_mp4HttpOptimize);
encodeBool(_mp4iPodCompatible);
+ encodeObject(_range);
encodeObject(_video);
encodeObject(_picture);
encodeObject(_filters);
@@ -595,7 +608,7 @@
encodeObject(_subtitlesTracks);
encodeBool(_chaptersEnabled);
- encodeObject(_chapterNames);
+ encodeObject(_chapterTitles);
encodeObject(_audioDefaults);
encodeObject(_subtitlesDefaults);
@@ -610,10 +623,11 @@
decodeObject(_fileURL);
decodeObject(_destURL);
- decodeInt(_fileFormat);
+ decodeInt(_container);
decodeBool(_mp4HttpOptimize);
decodeBool(_mp4iPodCompatible);
+ decodeObject(_range);
decodeObject(_video);
decodeObject(_picture);
decodeObject(_filters);
@@ -622,7 +636,7 @@
decodeObject(_subtitlesTracks);
decodeBool(_chaptersEnabled);
- decodeObject(_chapterNames);
+ decodeObject(_chapterTitles);
decodeObject(_audioDefaults);
decodeObject(_subtitlesDefaults);