diff options
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/English.lproj/SubtitlesDefaults.xib | 101 | ||||
-rw-r--r-- | macosx/HBSubtitles.m | 61 | ||||
-rw-r--r-- | macosx/HBSubtitlesDefaults.h | 11 | ||||
-rw-r--r-- | macosx/HBSubtitlesDefaults.m | 58 |
4 files changed, 210 insertions, 21 deletions
diff --git a/macosx/English.lproj/SubtitlesDefaults.xib b/macosx/English.lproj/SubtitlesDefaults.xib index dcf8fc835..b6c1b3c7b 100644 --- a/macosx/English.lproj/SubtitlesDefaults.xib +++ b/macosx/English.lproj/SubtitlesDefaults.xib @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6724" systemVersion="14C106a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7515.2" systemVersion="14D72i" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> <dependencies> <deployment version="1060" identifier="macosx"/> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6724"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7515.2"/> </dependencies> <objects> <customObject id="-2" userLabel="File's Owner" customClass="HBSubtitlesDefaultsController"> @@ -17,16 +17,16 @@ <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="kwM-lz-5lG"> <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> - <rect key="contentRect" x="283" y="305" width="427" height="304"/> + <rect key="contentRect" x="283" y="305" width="427" height="409"/> <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/> <value key="minSize" type="size" width="427" height="304"/> <value key="maxSize" type="size" width="427" height="1000"/> <view key="contentView" id="ZP2-Cp-K5w"> - <rect key="frame" x="0.0" y="0.0" width="427" height="304"/> + <rect key="frame" x="0.0" y="5" width="427" height="409"/> <autoresizingMask key="autoresizingMask"/> <subviews> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="fPg-3n-1TN"> - <rect key="frame" x="-2" y="268" width="157" height="14"/> + <rect key="frame" x="-2" y="373" width="157" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Track Selection Behavior:" id="GbM-vm-RC2"> <font key="font" metaFont="smallSystem"/> @@ -35,7 +35,7 @@ </textFieldCell> </textField> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="Jsz-Er-bsF"> - <rect key="frame" x="-2" y="244" width="157" height="14"/> + <rect key="frame" x="-2" y="349" width="157" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Languages:" id="mAT-Jp-SG1"> <font key="font" metaFont="smallSystem"/> @@ -44,7 +44,7 @@ </textFieldCell> </textField> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="Hqz-Lw-gAu"> - <rect key="frame" x="-2" y="66" width="157" height="14"/> + <rect key="frame" x="-2" y="171" width="157" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Options:" id="NJl-q3-zXL"> <font key="font" metaFont="smallSystem"/> @@ -53,7 +53,7 @@ </textFieldCell> </textField> <popUpButton verticalHuggingPriority="750" id="oiD-QI-wly"> - <rect key="frame" x="158" y="263" width="252" height="22"/> + <rect key="frame" x="158" y="368" width="252" height="22"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <popUpButtonCell key="cell" type="push" title="None" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="mvw-Hg-JFM" id="21e-KY-8TR"> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> @@ -66,12 +66,13 @@ </items> </menu> </popUpButtonCell> + <accessibility description="Track Selection Behavior:"/> <connections> <binding destination="-2" name="selectedIndex" keyPath="self.settings.trackSelectionBehavior" id="sKn-Mr-Hce"/> </connections> </popUpButton> <button toolTip="Closed captions are text subtitles that can be added to any container as a soft subtitle track (not burned)." id="uF5-6E-EIe"> - <rect key="frame" x="158" y="63" width="251" height="18"/> + <rect key="frame" x="158" y="168" width="251" height="18"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <buttonCell key="cell" type="check" title="Add Closed Captions when available" bezelStyle="regularSquare" imagePosition="left" controlSize="small" state="on" inset="2" id="66v-2g-DHn"> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> @@ -82,7 +83,7 @@ </connections> </button> <button toolTip="This search pass finds short sequences of foreign audio and provides subtitles for them." id="OOC-GZ-OFA"> - <rect key="frame" x="158" y="45" width="251" height="18"/> + <rect key="frame" x="158" y="150" width="251" height="18"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <buttonCell key="cell" type="check" title="Add "Foreign Audio Search"" bezelStyle="regularSquare" imagePosition="left" controlSize="small" state="on" inset="2" id="vNY-OC-hTJ"> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> @@ -93,7 +94,7 @@ </connections> </button> <scrollView autohidesScrollers="YES" horizontalLineScroll="16" horizontalPageScroll="10" verticalLineScroll="16" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="aTC-39-h6S"> - <rect key="frame" x="161" y="123" width="246" height="135"/> + <rect key="frame" x="161" y="228" width="246" height="135"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <clipView key="contentView" id="TdE-Sh-NcS"> <rect key="frame" x="1" y="1" width="244" height="133"/> @@ -103,7 +104,7 @@ <rect key="frame" x="0.0" y="0.0" width="236" height="16"/> <autoresizingMask key="autoresizingMask"/> <size key="intercellSpacing" width="3" height="2"/> - <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> + <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/> <tableColumns> <tableColumn identifier="checkBox" width="20" minWidth="20" maxWidth="20" id="G44-XP-6xE"> @@ -156,7 +157,7 @@ </scroller> </scrollView> <button verticalHuggingPriority="750" id="QAt-5X-NBT"> - <rect key="frame" x="161" y="93" width="71" height="23"/> + <rect key="frame" x="161" y="198" width="71" height="23"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <buttonCell key="cell" type="smallSquare" title="Show All" bezelStyle="smallSquare" imagePosition="overlaps" alignment="center" controlSize="small" borderStyle="border" inset="3" id="PiQ-bA-7P1"> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/> @@ -166,8 +167,78 @@ <action selector="edit:" target="-2" id="13y-nD-hEj"/> </connections> </button> + <popUpButton verticalHuggingPriority="750" id="Lsa-kB-2BP"> + <rect key="frame" x="158" y="117" width="252" height="22"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <string key="toolTip">Set the behavior of subtitle "Burn-in" + +Burned-In subtitles are part of the video and can not be disabled during playback. +Only one subtitle track can be burned. Since conflics can occur, the first chosen wins.</string> + <popUpButtonCell key="cell" type="push" title="None" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="ej8-4k-1vd" id="vJS-B5-ELJ"> + <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="smallSystem"/> + <menu key="menu" id="WrT-aW-kW1"> + <items> + <menuItem title="None" state="on" id="ej8-4k-1vd"/> + <menuItem title="Foreign Audio Subtitles Track" id="QRd-XH-6TH"/> + <menuItem title="First Selected Track" id="mnl-P8-dtK"/> + <menuItem title="Foreign Audio, the First Selected Track" id="d79-2j-fhc"/> + </items> + </menu> + </popUpButtonCell> + <accessibility description="Burn-In Behavior:"/> + <connections> + <binding destination="-2" name="selectedIndex" keyPath="self.settings.burnInBehavior" id="VvM-Ka-msm"/> + </connections> + </popUpButton> + <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="qAf-lQ-GN4"> + <rect key="frame" x="-2" y="122" width="157" height="14"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Burn-In Behavior:" id="640-NB-Uby"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <button id="ceZ-On-t5S"> + <rect key="frame" x="158" y="97" width="96" height="18"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <string key="toolTip">Burn the first selected DVD subtitle track. All other DVD subtitle tracks will be discarded. Use this option if your player software or device does not support DVD Subtitles. + +Only one subtitle track can be burned. Since conflics can occur, the first chosen wins.</string> + <buttonCell key="cell" type="check" title="DVD Subtitles" bezelStyle="regularSquare" imagePosition="left" controlSize="small" state="on" inset="2" id="69Q-xB-Vyq"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="smallSystem"/> + </buttonCell> + <connections> + <binding destination="-2" name="value" keyPath="self.settings.burnInDVDSubtitles" id="JoG-RB-CFT"/> + </connections> + </button> + <button id="Px8-G6-NVX"> + <rect key="frame" x="158" y="79" width="110" height="18"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <string key="toolTip">Burn the first selected Blu-ray subtitle track. All other Blu-ray subtitle tracks will be discarded. Use this option if your player software or device does not support Blu-ray Subtitles. + +Only one subtitle track can be burned. Since conflics can occur, the first chosen wins.</string> + <buttonCell key="cell" type="check" title="Blu-ray Subtitles" bezelStyle="regularSquare" imagePosition="left" controlSize="small" state="on" inset="2" id="bfV-9D-6dh"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="smallSystem"/> + </buttonCell> + <connections> + <binding destination="-2" name="value" keyPath="self.settings.burnInBluraySubtitles" id="bZK-Kf-z6W"/> + </connections> + </button> + <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" setsMaxLayoutWidthAtFirstLayout="YES" id="MlS-tB-pEv"> + <rect key="frame" x="159" y="46" width="250" height="28"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" title="Only one of the above subtitle burn options will be applied, starting with the top." id="N4s-K9-RwM"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> <button verticalHuggingPriority="750" id="sC2-52-liU"> - <rect key="frame" x="358" y="14" width="54" height="28"/> + <rect key="frame" x="363" y="14" width="54" height="28"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/> <buttonCell key="cell" type="push" title="Done" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="kDe-1L-VkD"> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> @@ -182,7 +253,7 @@ DQ </button> </subviews> </view> - <point key="canvasLocation" x="380.5" y="287"/> + <point key="canvasLocation" x="302.5" y="103.5"/> </window> <arrayController objectClassName="HBLang" id="ZBe-aP-wvq" userLabel="Table Controller" customClass="HBLanguageArrayController"> <declaredKeys> diff --git a/macosx/HBSubtitles.m b/macosx/HBSubtitles.m index 82eceb963..a8fed1cae 100644 --- a/macosx/HBSubtitles.m +++ b/macosx/HBSubtitles.m @@ -306,9 +306,63 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex"; } } + // Set the burn key for the appropriate track. + if (self.defaults.burnInBehavior != HBSubtitleTrackBurnInBehaviorNone && self.tracks.count) + { + if (self.defaults.burnInBehavior == HBSubtitleTrackBurnInBehaviorFirst) + { + if ([self.tracks.firstObject[keySubTrackIndex] integerValue] != -1) + { + self.tracks.firstObject[keySubTrackBurned] = @YES; + } + else if (self.tracks.count > 1) + { + self.tracks[1][keySubTrackBurned] = @YES; + } + } + else if (self.defaults.burnInBehavior == HBSubtitleTrackBurnInBehaviorForeignAudio) + { + if ([self.tracks.firstObject[keySubTrackIndex] integerValue] == -1) + { + self.tracks.firstObject[keySubTrackBurned] = @YES; + } + } + else if (self.defaults.burnInBehavior == HBSubtitleTrackBurnInBehaviorForeignAudioThenFirst) + { + self.tracks.firstObject[keySubTrackBurned] = @YES; + } + } + + // Burn-in the first dvd or bluray track and remove the others. + if (self.defaults.burnInDVDSubtitles || self.defaults.burnInBluraySubtitles) + { + // Ugly settings for ugly players + BOOL bitmapSubtitlesFound = NO; + + NSMutableArray *tracksToDelete = [[NSMutableArray alloc] init]; + for (NSMutableDictionary *track in self.tracks) + { + if ([track[keySubTrackIndex] integerValue] != -1) + { + if ((([track[keySubTrackType] intValue] == VOBSUB && self.defaults.burnInDVDSubtitles) || + ([track[keySubTrackType] intValue] == PGSSUB && self.defaults.burnInBluraySubtitles)) && + !bitmapSubtitlesFound) + { + track[keySubTrackBurned] = @YES; + bitmapSubtitlesFound = YES; + } + else if ([track[keySubTrackType] intValue] == VOBSUB || [track[keySubTrackType] intValue] == PGSSUB) + { + [tracksToDelete addObject:track]; + } + } + } + [self.tracks removeObjectsInArray:tracksToDelete]; + [tracksToDelete release]; + } + // Add an empty track [self insertObject:[self createSubtitleTrack] inTracksAtIndex:[self countOfTracks]]; - [self validatePassthru]; } @@ -318,7 +372,6 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex"; */ - (void)validatePassthru { - int subtitleTrackType; BOOL convertToBurnInUsed = NO; NSMutableArray *tracksToDelete = [[NSMutableArray alloc] init]; @@ -330,7 +383,7 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex"; continue; } - subtitleTrackType = [track[keySubTrackType] intValue]; + int subtitleTrackType = [track[keySubTrackType] intValue]; if (!hb_subtitle_can_pass(subtitleTrackType, self.container)) { if (convertToBurnInUsed == NO) @@ -356,7 +409,7 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex"; continue; } - subtitleTrackType = [track[keySubTrackType] intValue]; + int subtitleTrackType = [track[keySubTrackType] intValue]; if (hb_subtitle_can_pass(subtitleTrackType, self.container)) { track[keySubTrackBurned] = @0; diff --git a/macosx/HBSubtitlesDefaults.h b/macosx/HBSubtitlesDefaults.h index ab65a20b3..793e31d3a 100644 --- a/macosx/HBSubtitlesDefaults.h +++ b/macosx/HBSubtitlesDefaults.h @@ -13,6 +13,13 @@ typedef NS_ENUM(NSUInteger, HBSubtitleTrackSelectionBehavior) { HBSubtitleTrackSelectionBehaviorAll, }; +typedef NS_ENUM(NSUInteger, HBSubtitleTrackBurnInBehavior) { + HBSubtitleTrackBurnInBehaviorNone, + HBSubtitleTrackBurnInBehaviorForeignAudio, + HBSubtitleTrackBurnInBehaviorFirst, + HBSubtitleTrackBurnInBehaviorForeignAudioThenFirst, +}; + @interface HBSubtitlesDefaults : NSObject <NSCoding, NSCopying, HBPresetCoding> @property (nonatomic, readwrite) HBSubtitleTrackSelectionBehavior trackSelectionBehavior; @@ -22,4 +29,8 @@ typedef NS_ENUM(NSUInteger, HBSubtitleTrackSelectionBehavior) { @property (nonatomic, readwrite) BOOL addForeignAudioSubtitle; @property (nonatomic, readwrite) BOOL addCC; +@property (nonatomic, readwrite) HBSubtitleTrackBurnInBehavior burnInBehavior; +@property (nonatomic, readwrite) BOOL burnInDVDSubtitles; +@property (nonatomic, readwrite) BOOL burnInBluraySubtitles; + @end diff --git a/macosx/HBSubtitlesDefaults.m b/macosx/HBSubtitlesDefaults.m index 359b19ea2..02d9cc345 100644 --- a/macosx/HBSubtitlesDefaults.m +++ b/macosx/HBSubtitlesDefaults.m @@ -37,6 +37,28 @@ self.addCC = [preset[@"SubtitleAddCC"] boolValue]; self.addForeignAudioSearch = [preset[@"SubtitleAddForeignAudioSearch"] boolValue]; self.addForeignAudioSubtitle = [preset[@"SubtitleAddForeignAudioSubtitle"] boolValue]; + + NSString *burnInBehavior = preset[@"SubtitleBurnBehavior"]; + + if ([burnInBehavior isEqualToString:@"foreign"]) + { + self.burnInBehavior = HBSubtitleTrackBurnInBehaviorForeignAudio; + } + else if ([burnInBehavior isEqualToString:@"fist"]) + { + self.burnInBehavior = HBSubtitleTrackBurnInBehaviorFirst; + } + else if ([burnInBehavior isEqualToString:@"foreign_first"]) + { + self.burnInBehavior = HBSubtitleTrackBurnInBehaviorForeignAudioThenFirst; + } + else + { + self.burnInBehavior = HBSubtitleTrackBurnInBehaviorNone; + } + + self.burnInDVDSubtitles = [preset[@"SubtitleBurnDVDSub"] boolValue]; + self.burnInBluraySubtitles = [preset[@"SubtitleBurnBDSub"] boolValue]; } - (void)writeToPreset:(NSMutableDictionary *)preset @@ -58,6 +80,26 @@ preset[@"SubtitleAddCC"] = @(self.addCC); preset[@"SubtitleAddForeignAudioSearch"] = @(self.addForeignAudioSearch); preset[@"SubtitleAddForeignAudioSubtitle"] = @(self.addForeignAudioSubtitle); + + if (self.burnInBehavior == HBSubtitleTrackBurnInBehaviorForeignAudio) + { + preset[@"SubtitleBurnBehavior"] = @"foreign"; + } + else if (self.burnInBehavior == HBSubtitleTrackBurnInBehaviorFirst) + { + preset[@"SubtitleBurnBehavior"] = @"fist"; + } + else if (self.burnInBehavior == HBSubtitleTrackBurnInBehaviorForeignAudioThenFirst) + { + preset[@"SubtitleBurnBehavior"] = @"foreign_first"; + } + else + { + preset[@"SubtitleBurnBehavior"] = @"none"; + } + + preset[@"SubtitleBurnDVDSub"] = @(self.burnInDVDSubtitles); + preset[@"SubtitleBurnBDSub"] = @(self.burnInBluraySubtitles); } #pragma mark - NSCopying @@ -75,8 +117,12 @@ copy->_addForeignAudioSearch = _addForeignAudioSearch; copy->_addForeignAudioSubtitle = _addForeignAudioSubtitle; copy->_addCC = _addCC; + + copy->_burnInBehavior = _burnInBehavior; + copy->_burnInDVDSubtitles = _burnInDVDSubtitles; + copy->_burnInBluraySubtitles = _burnInBluraySubtitles; } - + return copy; } @@ -84,7 +130,7 @@ - (void)encodeWithCoder:(NSCoder *)coder { - [coder encodeInt:1 forKey:@"HBAudioDefaultsVersion"]; + [coder encodeInt:1 forKey:@"HBSubtitlesDefaultsVersion"]; encodeInteger(_trackSelectionBehavior); encodeObject(_trackSelectionLanguages); @@ -92,6 +138,10 @@ encodeBool(_addForeignAudioSearch); encodeBool(_addForeignAudioSubtitle); encodeBool(_addCC); + + encodeInteger(_burnInBehavior); + encodeBool(_burnInDVDSubtitles); + encodeBool(_burnInBluraySubtitles); } - (id)initWithCoder:(NSCoder *)decoder @@ -105,6 +155,10 @@ decodeBool(_addForeignAudioSubtitle); decodeBool(_addCC); + decodeInteger(_burnInBehavior); + decodeBool(_burnInDVDSubtitles); + decodeBool(_burnInBluraySubtitles); + return self; } |