From f318325dc8a2665f10d5b8b9d0bafa66e172edf2 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Sun, 18 Jun 2017 16:11:25 +0200 Subject: MacGui: Add checkbox for Legacy A/V alignment behaviour for players that don't support MP4 Edit Lists. #778 --- macosx/English.lproj/MainWindow.xib | 30 ++++++++++++++++++++++++------ macosx/HBJob+HBJobConversion.m | 6 +++++- macosx/HBJob.h | 2 ++ macosx/HBJob.m | 16 ++++++++++++++++ 4 files changed, 47 insertions(+), 7 deletions(-) diff --git a/macosx/English.lproj/MainWindow.xib b/macosx/English.lproj/MainWindow.xib index 3b1d50aab..efdb994a2 100644 --- a/macosx/English.lproj/MainWindow.xib +++ b/macosx/English.lproj/MainWindow.xib @@ -1,9 +1,10 @@ - + - - + + + @@ -444,8 +445,8 @@ - + @@ -657,7 +675,7 @@ Blu-ray and DVD sources often have multiple titles, the longest of which is typi - + diff --git a/macosx/HBJob+HBJobConversion.m b/macosx/HBJob+HBJobConversion.m index 3a28629a9..e67f39cf8 100644 --- a/macosx/HBJob+HBJobConversion.m +++ b/macosx/HBJob+HBJobConversion.m @@ -83,9 +83,13 @@ job->mux = self.container; job->vcodec = self.video.encoder; - // We set http optimized mp4 here job->mp4_optimize = self.mp4HttpOptimize; + if (self.container & HB_MUX_MASK_MP4) + { + job->align_av_start = self.alignAVStart; + } + // We set the chapter marker extraction here based on the format being // mpeg4 or mkv and the checkbox being checked. if (self.chaptersEnabled) diff --git a/macosx/HBJob.h b/macosx/HBJob.h index 66a42ccec..e77dd346e 100644 --- a/macosx/HBJob.h +++ b/macosx/HBJob.h @@ -70,8 +70,10 @@ typedef NS_ENUM(NSUInteger, HBJobState){ @property (nonatomic, readwrite) int container; @property (nonatomic, readwrite) int angle; +// Container options @property (nonatomic, readwrite) BOOL mp4HttpOptimize; @property (nonatomic, readwrite) BOOL mp4iPodCompatible; +@property (nonatomic, readwrite) BOOL alignAVStart; @property (nonatomic, readonly) HBRange *range; @property (nonatomic, readonly) HBVideo *video; diff --git a/macosx/HBJob.m b/macosx/HBJob.m index 35015f511..8c672445e 100644 --- a/macosx/HBJob.m +++ b/macosx/HBJob.m @@ -98,6 +98,8 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification"; self.mp4HttpOptimize = [preset[@"Mp4HttpOptimize"] boolValue]; self.mp4iPodCompatible = [preset[@"Mp4iPodCompatible"] boolValue]; + self.alignAVStart = [preset[@"AlignAVStart"] boolValue]; + // Chapter Markers self.chaptersEnabled = [preset[@"ChapterMarkers"] boolValue]; @@ -118,6 +120,8 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification"; preset[@"Mp4HttpOptimize"] = @(self.mp4HttpOptimize); preset[@"Mp4iPodCompatible"] = @(self.mp4iPodCompatible); + preset[@"AlignAVStart"] = @(self.alignAVStart); + [@[self.video, self.filters, self.picture, self.audio, self.subtitles] makeObjectsPerformSelector:@selector(writeToPreset:) withObject:preset]; } @@ -208,6 +212,15 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification"; _mp4HttpOptimize = mp4HttpOptimize; } +- (void)setAlignAVStart:(BOOL)alignAVStart +{ + if (alignAVStart != _alignAVStart) + { + [[self.undo prepareWithInvocationTarget:self] setAlignAVStart:_alignAVStart]; + } + _alignAVStart = alignAVStart; +} + - (void)setMp4iPodCompatible:(BOOL)mp4iPodCompatible { if (mp4iPodCompatible != _mp4iPodCompatible) @@ -291,6 +304,7 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification"; copy->_angle = _angle; copy->_mp4HttpOptimize = _mp4HttpOptimize; copy->_mp4iPodCompatible = _mp4iPodCompatible; + copy->_alignAVStart = _alignAVStart; copy->_range = [_range copy]; copy->_video = [_video copy]; @@ -357,6 +371,7 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification"; encodeInt(_angle); encodeBool(_mp4HttpOptimize); encodeBool(_mp4iPodCompatible); + encodeBool(_alignAVStart); encodeObject(_range); encodeObject(_video); @@ -416,6 +431,7 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification"; decodeInt(_angle); decodeBool(_mp4HttpOptimize); decodeBool(_mp4iPodCompatible); + decodeBool(_alignAVStart); decodeObjectOrFail(_range, HBRange); decodeObjectOrFail(_video, HBVideo); -- cgit v1.2.3