diff options
author | ritsuka <[email protected]> | 2014-08-21 17:26:28 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-08-21 17:26:28 +0000 |
commit | f96f713a3d83538ef59be552c0987ebf1b21d0a0 (patch) | |
tree | 896f1bbe81972224a7e3b02e9cd87cd5182c2802 /macosx | |
parent | 6998c5f6e5c600273d9722536d1aef41651ea366 (diff) |
MacGui: generalize video preset/tune/profile/level handling to make it works with the x265 encoder. Moved the lavc encoder options textfield to the video tab.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6334 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/Controller.m | 37 | ||||
-rw-r--r-- | macosx/English.lproj/AdvancedView.xib | 65 | ||||
-rw-r--r-- | macosx/English.lproj/Video.xib | 452 | ||||
-rw-r--r-- | macosx/HBAdvancedController.h | 14 | ||||
-rw-r--r-- | macosx/HBAdvancedController.m | 33 | ||||
-rw-r--r-- | macosx/HBPresetsManager.m | 120 | ||||
-rw-r--r-- | macosx/HBQueueController.mm | 32 | ||||
-rw-r--r-- | macosx/HBVideoController.h | 8 | ||||
-rw-r--r-- | macosx/HBVideoController.m | 709 |
9 files changed, 754 insertions, 716 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m index e9a20c61d..d9327b0a1 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -893,7 +893,8 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It /* Update text field */ if (p.job_cur == 1 && p.job_count > 1) { - if ([[QueueFileArray objectAtIndex:currentQueueEncodeIndex] objectForKey:@"SubtitleList"] && [[[[[QueueFileArray objectAtIndex:currentQueueEncodeIndex]objectForKey:@"SubtitleList"] objectAtIndex:0] objectForKey:@"subtitleSourceTrackNum"] intValue] == 1) + if (QueueFileArray[currentQueueEncodeIndex][@"SubtitleList"] && + [[QueueFileArray[currentQueueEncodeIndex][@"SubtitleList"] firstObject][keySubTrackIndex] intValue] == -1) { pass_desc = @"(subtitle scan)"; } @@ -3358,7 +3359,7 @@ fWorkingCount = 0; job->chapter_markers = 0; } - if (job->vcodec == HB_VCODEC_X264) + if (job->vcodec == HB_VCODEC_X264 || job->vcodec == HB_VCODEC_X265) { /* iPod 5G atom */ job->ipod_atom = ([[queueToApply objectForKey:@"Mp4iPodCompatible"] @@ -3390,23 +3391,23 @@ fWorkingCount = 0; else { // we are using the x264 preset system - if ([(tmpString = [queueToApply objectForKey:@"x264Tune"]) length]) + if ([(tmpString = [queueToApply objectForKey:@"VideoTune"]) length]) { encoder_tune = [tmpString UTF8String]; } - if ([(tmpString = [queueToApply objectForKey:@"x264OptionExtra"]) length]) + if ([(tmpString = [queueToApply objectForKey:@"VideoOptionExtra"]) length]) { encoder_options = [tmpString UTF8String]; } - if ([(tmpString = [queueToApply objectForKey:@"h264Profile"]) length]) + if ([(tmpString = [queueToApply objectForKey:@"VideoProfile"]) length]) { encoder_profile = [tmpString UTF8String]; } - if ([(tmpString = [queueToApply objectForKey:@"h264Level"]) length]) + if ([(tmpString = [queueToApply objectForKey:@"VideoLevel"]) length]) { encoder_level = [tmpString UTF8String]; } - encoder_preset = [[queueToApply objectForKey:@"x264Preset"] UTF8String]; + encoder_preset = [[queueToApply objectForKey:@"VideoPreset"] UTF8String]; } hb_job_set_encoder_preset (job, encoder_preset); hb_job_set_encoder_tune (job, encoder_tune); @@ -4200,9 +4201,9 @@ fWorkingCount = 0; NSString *fileName = [HBUtilities automaticNameForSource:@(title->name) title:title->index chapters:NSMakeRange([fSrcChapterStartPopUp indexOfSelectedItem] + 1, [fSrcChapterEndPopUp indexOfSelectedItem] + 1) - quality:fVideoController.selectedQualityType ? fVideoController.selectedQuality : 0 - bitrate:!fVideoController.selectedQualityType ? fVideoController.selectedBitrate : 0 - videoCodec:fVideoController.selectedCodec]; + quality:fVideoController.qualityType ? fVideoController.selectedQuality : 0 + bitrate:!fVideoController.qualityType ? fVideoController.selectedBitrate : 0 + videoCodec:fVideoController.codec]; // Swap the old one with the new one [fDstFile2Field setStringValue: [NSString stringWithFormat:@"%@/%@.%@", @@ -4483,7 +4484,7 @@ fWorkingCount = 0; - (void)updateMp4Checkboxes:(NSNotification *)notification { - if (fVideoController.selectedCodec != HB_VCODEC_X264) + if (fVideoController.codec != HB_VCODEC_X264) { /* We set the iPod atom checkbox to disabled and uncheck it as its only for x264 in the mp4 * container. Format is taken care of in formatPopUpChanged method by hiding and unchecking @@ -4533,8 +4534,8 @@ the user is using "Custom" settings by determining the sender*/ /* Store storage resolution for unparse */ if (fTitle) { - fVideoController.fX264PresetsWidthForUnparse = fTitle->job->width; - fVideoController.fX264PresetsHeightForUnparse = fTitle->job->height; + fVideoController.fPresetsWidthForUnparse = fTitle->job->width; + fVideoController.fPresetsHeightForUnparse = fTitle->job->height; // width or height may have changed, unparse [fVideoController x264PresetsChangedDisplayExpandedOptions:nil]; } @@ -4715,17 +4716,7 @@ the user is using "Custom" settings by determining the sender*/ /* Video encoder */ [fVideoController applySettingsFromPreset:chosenPreset]; - if ([chosenPreset objectForKey:@"lavcOption"]) - { - [fAdvancedOptions setLavcOptions:[chosenPreset objectForKey:@"lavcOption"]]; - } - else - { - [fAdvancedOptions setLavcOptions:@""]; - } - /* Lets run through the following functions to get variables set there */ - //[self videoEncoderPopUpChanged:nil]; /* Set the state of ipod compatible with Mp4iPodCompatible. Only for x264*/ [fDstMp4iPodFileCheck setState:[[chosenPreset objectForKey:@"Mp4iPodCompatible"] intValue]]; diff --git a/macosx/English.lproj/AdvancedView.xib b/macosx/English.lproj/AdvancedView.xib index 0d1d888cf..714b58c98 100644 --- a/macosx/English.lproj/AdvancedView.xib +++ b/macosx/English.lproj/AdvancedView.xib @@ -1,19 +1,15 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F12" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F14" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> <dependencies> - <deployment version="1060" identifier="macosx"/> + <deployment version="1060" defaultVersion="1060" identifier="macosx"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/> </dependencies> <objects> <customObject id="-2" userLabel="File's Owner" customClass="HBAdvancedController"> <connections> - <outlet property="fDisplayLavcOptions" destination="450" id="455"/> - <outlet property="fDisplayLavcOptionsLabel" destination="453" id="456"/> - <outlet property="fDisplayTheoraOptionsLabel" destination="457" id="459"/> <outlet property="fDisplayX264Options" destination="30" id="191"/> <outlet property="fDisplayX264OptionsLabel" destination="55" id="192"/> - <outlet property="fEmptyView" destination="254" id="256"/> - <outlet property="fFFmpegView" destination="254" id="BvK-gC-9EN"/> + <outlet property="fEmptyView" destination="nxI-yk-oWT" id="vLJ-P2-ROb"/> <outlet property="fOptionsBox" destination="sPV-JX-8CO" id="OhE-r2-gaB"/> <outlet property="fX264opt8x8dctLabel" destination="88" id="196"/> <outlet property="fX264opt8x8dctSwitch" destination="87" id="195"/> @@ -53,7 +49,7 @@ <outlet property="fX264optView" destination="5" id="194"/> <outlet property="fX264optWeightPLabel" destination="408" id="413"/> <outlet property="fX264optWeightPSwitch" destination="407" id="414"/> - <outlet property="view" destination="kZH-f0-3MZ" id="0dl-gO-Cma"/> + <outlet property="view" destination="kZH-f0-3MZ" id="vhL-OP-goq"/> </connections> </customObject> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> @@ -564,43 +560,7 @@ </textField> </subviews> </customView> - <customView id="254" userLabel="ffmpeg"> - <rect key="frame" x="0.0" y="0.0" width="891" height="290"/> - <autoresizingMask key="autoresizingMask"/> - <subviews> - <textField verticalHuggingPriority="750" id="450"> - <rect key="frame" x="4" y="4" width="882" height="34"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/> - <textFieldCell key="cell" controlSize="small" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="451"> - <font key="font" metaFont="smallSystem"/> - <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> - <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - <connections> - <action selector="X264AdvancedOptionsSet:" target="-2" id="452"/> - </connections> - </textField> - <textField verticalHuggingPriority="750" id="453"> - <rect key="frame" x="1" y="42" width="888" height="17"/> - <autoresizingMask key="autoresizingMask"/> - <textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Current FFmpeg Advanced Option String:" id="454"> - <font key="font" metaFont="smallSystemBold"/> - <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> - <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - </textField> - <textField verticalHuggingPriority="750" id="457"> - <rect key="frame" x="191" y="137" width="509" height="17"/> - <autoresizingMask key="autoresizingMask"/> - <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="center" title="HandBrake Does Not Support Advanced Theora Options" id="458"> - <font key="font" metaFont="smallSystemBold"/> - <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> - <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - </textField> - </subviews> - </customView> - <customView id="kZH-f0-3MZ" userLabel="empty"> + <customView id="kZH-f0-3MZ" userLabel="view"> <rect key="frame" x="0.0" y="0.0" width="905" height="294"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <subviews> @@ -616,5 +576,20 @@ </box> </subviews> </customView> + <customView id="nxI-yk-oWT" userLabel="empty"> + <rect key="frame" x="0.0" y="0.0" width="905" height="294"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <subviews> + <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="60D-Fv-Yl5"> + <rect key="frame" x="18" y="139" width="869" height="17"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Advanced options not available for the selected codec." id="lPc-aK-FOh"> + <font key="font" metaFont="system"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + </subviews> + </customView> </objects> </document> diff --git a/macosx/English.lproj/Video.xib b/macosx/English.lproj/Video.xib index 3009e8451..299cea6ec 100644 --- a/macosx/English.lproj/Video.xib +++ b/macosx/English.lproj/Video.xib @@ -1,20 +1,35 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F12" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F14" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> <dependencies> - <deployment version="1060" identifier="macosx"/> + <deployment version="1060" defaultVersion="1060" identifier="macosx"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/> </dependencies> <objects> <customObject id="-2" userLabel="File's Owner" customClass="HBVideoController"> <connections> - <outlet property="fDisplayX264PresetsAdditonalOptionsLabel" destination="z5f-9f-CkC" id="Vjj-gk-xgv"/> - <outlet property="fDisplayX264PresetsAdditonalOptionsTextField" destination="nd4-77-0zJ" id="6Gt-Hx-Bda"/> - <outlet property="fDisplayX264PresetsUnparseTextField" destination="5rt-5S-acT" id="YST-Hq-mBY"/> + <outlet property="fDisplayPresetsAdditonalOptionsLabel" destination="ijg-ux-uvb" id="Zhw-D7-xOs"/> + <outlet property="fDisplayPresetsAdditonalOptionsTextField" destination="oJk-ur-wgc" id="TUr-Lt-UHQ"/> + <outlet property="fDisplayX264PresetsUnparseTextField" destination="wk1-2U-z4i" id="aIk-h1-bOP"/> + <outlet property="fFastDecodeCheck" destination="z7F-H2-Vfr" id="usU-aE-DUt"/> <outlet property="fFramerateCfrCell" destination="ZRE-Ig-mhJ" id="vqQ-Pd-63o"/> <outlet property="fFramerateMatrix" destination="Xe2-d5-nEH" id="GCQ-qu-zBk"/> <outlet property="fFramerateVfrPfrCell" destination="DD4-13-4gw" id="Cwu-GV-AKd"/> + <outlet property="fLavcOptionsLabel" destination="26w-dz-St2" id="R7C-nz-BBZ"/> + <outlet property="fLavcOptionsTextField" destination="mL3-yC-hUj" id="DHu-CV-Emx"/> + <outlet property="fLevelPopUp" destination="P7c-Zk-G99" id="dHU-91-P9m"/> + <outlet property="fLevelPopUpLabel" destination="BY1-IG-JvI" id="kmr-tF-K73"/> <outlet property="fPictureFiltersField" destination="gPF-Jh-4d0" id="6AQ-Ee-tFl"/> <outlet property="fPictureSettingsField" destination="9L5-i4-5eu" id="elr-IU-9BI"/> + <outlet property="fPresetSelectedTextField" destination="gvn-wG-crj" id="vzQ-yp-EBS"/> + <outlet property="fPresetSliderLabel" destination="0sa-ep-yfr" id="DVa-aK-Cq4"/> + <outlet property="fPresetView" destination="2dX-Hf-Hxl" id="OEP-rM-gGp"/> + <outlet property="fPresetsBox" destination="A4U-3F-pYq" id="m5l-h9-Ak8"/> + <outlet property="fPresetsSlider" destination="Biw-5K-pPD" id="ixn-dK-MaZ"/> + <outlet property="fProfilePopUp" destination="CPP-lh-FbN" id="rch-3L-jwi"/> + <outlet property="fProfilePopUpLabel" destination="dY9-5D-mXX" id="Lno-BZ-ZMH"/> + <outlet property="fSimplePresetView" destination="aRi-vN-oR0" id="e0P-NK-oHv"/> + <outlet property="fTunePopUp" destination="A7d-wM-Xmp" id="J1a-PP-NEr"/> + <outlet property="fTunePopUpLabel" destination="gzq-SL-YVY" id="uCk-oz-Mow"/> <outlet property="fVidBitrateCell" destination="6tI-Qz-3bJ" id="oWy-lK-5aZ"/> <outlet property="fVidBitrateField" destination="A3o-Zx-OfM" id="IzD-XM-sDC"/> <outlet property="fVidConstantCell" destination="au3-pU-KX6" id="M31-Xr-Rsv"/> @@ -29,18 +44,7 @@ <outlet property="fVidRatePopUp" destination="9tc-EO-QMd" id="O1B-x4-qfm"/> <outlet property="fVidTurboPassCheck" destination="olm-zg-k9Y" id="r9Y-Ym-R0Y"/> <outlet property="fVidTwoPassCheck" destination="bnV-aE-FVh" id="yPb-4E-8CL"/> - <outlet property="fX264FastDecodeCheck" destination="40r-Rt-3Kj" id="32H-ba-oMp"/> - <outlet property="fX264LevelPopUp" destination="Bc9-RS-X0z" id="pUh-ol-tli"/> - <outlet property="fX264LevelPopUpLabel" destination="Zx9-aq-QUO" id="jjZ-4j-1QK"/> - <outlet property="fX264PresetSelectedTextField" destination="Dau-qh-WdE" id="u7d-d0-Rnq"/> - <outlet property="fX264PresetSliderLabel" destination="3O9-81-H2o" id="ICQ-EA-fXq"/> - <outlet property="fX264PresetsBox" destination="A4U-3F-pYq" id="ZWI-nV-Xch"/> - <outlet property="fX264PresetsSlider" destination="bWg-Ip-WlZ" id="vOO-eN-auR"/> - <outlet property="fX264ProfilePopUp" destination="M7o-me-kIK" id="B3q-AD-eth"/> - <outlet property="fX264ProfilePopUpLabel" destination="xhg-dJ-Jmi" id="V3u-jn-fcf"/> - <outlet property="fX264TunePopUp" destination="KOr-SM-yFa" id="plC-0t-1Bk"/> - <outlet property="fX264TunePopUpLabel" destination="6q1-ib-FgH" id="M4n-rc-szP"/> - <outlet property="fX264UseAdvancedOptionsCheck" destination="304-sL-Qb9" id="rPi-LC-n0h"/> + <outlet property="fX264UseAdvancedOptionsCheck" destination="Zs7-1Y-50A" id="WWx-OC-tor"/> <outlet property="view" destination="wAC-5p-nXb" id="i3V-vv-tDn"/> </connections> </customObject> @@ -69,7 +73,7 @@ </textFieldCell> </textField> <textField verticalHuggingPriority="750" id="9L5-i4-5eu"> - <rect key="frame" x="18" y="21" width="892" height="14"/> + <rect key="frame" x="18" y="21" width="884" height="14"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" title="Picture Settings:" id="UWU-31-FxR"> <font key="font" metaFont="smallSystem"/> @@ -91,7 +95,7 @@ </textFieldCell> </textField> <textField verticalHuggingPriority="750" id="gPF-Jh-4d0"> - <rect key="frame" x="18" y="5" width="892" height="14"/> + <rect key="frame" x="18" y="5" width="884" height="14"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" title="Picture Filters:" id="l1l-8S-ttm"> <font key="font" metaFont="smallSystem"/> @@ -103,14 +107,14 @@ </connections> </textField> <popUpButton verticalHuggingPriority="750" id="9tc-EO-QMd"> - <rect key="frame" x="112" y="258" width="149" height="22"/> + <rect key="frame" x="110" y="258" width="149" height="22"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="Xzy-hl-maq" id="0VS-Ah-Q3S"> + <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" id="0VS-Ah-Q3S"> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> <font key="font" metaFont="smallSystem"/> <menu key="menu" title="OtherViews" id="Jj0-Qw-HF8"> <items> - <menuItem state="on" id="Xzy-hl-maq"/> + <menuItem id="Xzy-hl-maq"/> </items> </menu> </popUpButtonCell> @@ -138,23 +142,24 @@ </buttonCell> </button> <popUpButton verticalHuggingPriority="750" id="xwK-Yu-a1e"> - <rect key="frame" x="112" y="284" width="149" height="22"/> + <rect key="frame" x="110" y="284" width="149" height="22"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="cZC-bI-lgS" id="KHu-7m-NR7"> + <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" id="KHu-7m-NR7"> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> <font key="font" metaFont="smallSystem"/> <menu key="menu" title="OtherViews" id="6Cs-jo-8Q6"> <items> - <menuItem state="on" id="cZC-bI-lgS"/> + <menuItem id="cZC-bI-lgS"/> </items> </menu> </popUpButtonCell> <connections> <action selector="videoEncoderPopUpChanged:" target="-2" id="ojB-Jd-Au6"/> + <binding destination="-2" name="selectedTag" keyPath="self.codec" id="CvW-H4-Tco"/> </connections> </popUpButton> <textField verticalHuggingPriority="750" id="bAn-iZ-ieF"> - <rect key="frame" x="20" y="263" width="90" height="14"/> + <rect key="frame" x="18" y="263" width="90" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Framerate (FPS):" id="SJc-tv-AMH"> <font key="font" metaFont="smallSystem"/> @@ -163,7 +168,7 @@ </textFieldCell> </textField> <textField verticalHuggingPriority="750" id="rOd-nt-22T"> - <rect key="frame" x="18" y="289" width="91" height="14"/> + <rect key="frame" x="16" y="289" width="91" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Video Codec:" id="Mrb-6Q-0YM"> <font key="font" metaFont="smallSystem"/> @@ -195,10 +200,11 @@ </cells> <connections> <action selector="videoMatrixChanged:" target="-2" id="rGb-Wc-eBW"/> + <binding destination="-2" name="selectedTag" keyPath="self.qualityType" id="JkP-GB-eWw"/> </connections> </matrix> <matrix verticalHuggingPriority="750" allowsEmptySelection="NO" id="Xe2-d5-nEH"> - <rect key="frame" x="115" y="215" width="157" height="38"/> + <rect key="frame" x="113" y="215" width="157" height="38"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> <size key="cellSize" width="157" height="18"/> @@ -220,173 +226,12 @@ </column> </cells> </matrix> - <box autoresizesSubviews="NO" title="x264 Presets" borderType="bezel" titlePosition="noTitle" id="A4U-3F-pYq"> - <rect key="frame" x="17" y="36" width="886" height="160"/> + <box autoresizesSubviews="NO" title="x264 Presets" borderType="none" titlePosition="noTitle" id="A4U-3F-pYq"> + <rect key="frame" x="0.0" y="52" width="923" height="134"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <view key="contentView"> - <rect key="frame" x="3" y="3" width="880" height="154"/> + <rect key="frame" x="0.0" y="0.0" width="923" height="134"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <subviews> - <slider verticalHuggingPriority="750" id="bWg-Ip-WlZ"> - <rect key="frame" x="246" y="109" width="618" height="16"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> - <sliderCell key="cell" controlSize="mini" continuous="YES" state="on" alignment="left" maxValue="5" tickMarkPosition="above" numberOfTickMarks="2" allowsTickMarkValuesOnly="YES" sliderType="linear" id="4Su-5w-YOc"/> - <connections> - <action selector="x264PresetsSliderChanged:" target="-2" id="AqS-DX-fly"/> - </connections> - </slider> - <textField verticalHuggingPriority="750" id="3O9-81-H2o"> - <rect key="frame" x="18" y="111" width="79" height="13"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="x264 Preset:" id="Ukc-RA-XL5"> - <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> - <textField verticalHuggingPriority="750" id="6q1-ib-FgH"> - <rect key="frame" x="18" y="90" width="79" height="13"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="x264 Tune:" id="2eQ-Jg-bXh"> - <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> - <textField verticalHuggingPriority="750" id="xhg-dJ-Jmi"> - <rect key="frame" x="18" y="69" width="79" height="13"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="H.264 Profile:" id="brS-VD-Laz"> - <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> - <textField verticalHuggingPriority="750" id="Zx9-aq-QUO"> - <rect key="frame" x="18" y="48" width="79" height="13"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="H.264 Level:" id="KrD-UK-LYs"> - <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> - <popUpButton verticalHuggingPriority="750" id="KOr-SM-yFa"> - <rect key="frame" x="101" y="88" width="126" height="15"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="cfq-xj-BRo" id="bLm-PZ-R5A"> - <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="miniSystem"/> - <menu key="menu" title="OtherViews" id="7nV-xW-qaD"> - <items> - <menuItem title="Item 1" state="on" id="cfq-xj-BRo"/> - <menuItem title="Item 2" id="UPL-Zb-3Xd"/> - <menuItem title="Item 3" id="EtH-09-EHF"/> - </items> - </menu> - </popUpButtonCell> - <connections> - <action selector="x264PresetsChangedDisplayExpandedOptions:" target="-2" id="ht2-EV-ydT"/> - </connections> - </popUpButton> - <popUpButton verticalHuggingPriority="750" id="M7o-me-kIK"> - <rect key="frame" x="101" y="67" width="126" height="15"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="kBz-wm-XOZ" id="IEi-CG-TxH"> - <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="miniSystem"/> - <menu key="menu" title="OtherViews" id="G1A-9W-cJa"> - <items> - <menuItem title="Item 1" state="on" id="kBz-wm-XOZ"/> - <menuItem title="Item 2" id="5Rp-9r-HV3"/> - <menuItem title="Item 3" id="nRE-UN-2Au"/> - </items> - </menu> - </popUpButtonCell> - <connections> - <action selector="x264PresetsChangedDisplayExpandedOptions:" target="-2" id="eCE-Aq-zNc"/> - </connections> - </popUpButton> - <popUpButton verticalHuggingPriority="750" id="Bc9-RS-X0z"> - <rect key="frame" x="101" y="46" width="126" height="15"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="3yN-hT-w38" id="6MD-Fg-LbH"> - <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="miniSystem"/> - <menu key="menu" title="OtherViews" id="awh-D2-IGg"> - <items> - <menuItem title="Item 1" state="on" id="3yN-hT-w38"/> - <menuItem title="Item 2" id="Ifh-EU-YmV"/> - <menuItem title="Item 3" id="Is1-hb-ZV9"/> - </items> - </menu> - </popUpButtonCell> - <connections> - <action selector="x264PresetsChangedDisplayExpandedOptions:" target="-2" id="Iak-Zl-GR9"/> - </connections> - </popUpButton> - <button id="40r-Rt-3Kj"> - <rect key="frame" x="243" y="88" width="108" height="18"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <buttonCell key="cell" type="check" title="Fast Decode" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="k1V-Fa-g1s"> - <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> - <font key="font" metaFont="smallSystem"/> - </buttonCell> - <connections> - <action selector="x264PresetsChangedDisplayExpandedOptions:" target="-2" id="2Zq-Jp-9Me"/> - </connections> - </button> - <textField verticalHuggingPriority="750" id="z5f-9f-CkC"> - <rect key="frame" x="243" y="69" width="110" height="13"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Additional Options:" id="xtl-bu-yOc"> - <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> - <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="nd4-77-0zJ"> - <rect key="frame" x="359" y="51" width="505" height="32"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <textFieldCell key="cell" controlSize="small" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="Sgj-JS-4Un"> - <font key="font" metaFont="smallSystem"/> - <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> - <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - <connections> - <action selector="x264PresetsChangedDisplayExpandedOptions:" target="-2" id="7Ee-gb-ZSL"/> - </connections> - </textField> - <textField verticalHuggingPriority="750" id="Dau-qh-WdE"> - <rect key="frame" x="99" y="111" width="129" height="13"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" id="GFY-BH-2SD"> - <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="304-sL-Qb9"> - <rect key="frame" x="13" y="129" width="209" height="18"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <buttonCell key="cell" type="check" title="Use x264 Advanced Options Panel" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="mRh-IJ-juS"> - <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> - <font key="font" metaFont="smallSystem"/> - </buttonCell> - <connections> - <action selector="updateX264Widgets:" target="-2" id="9Vz-FZ-hTj"/> - </connections> - </button> - <textField verticalHuggingPriority="750" id="5rt-5S-acT"> - <rect key="frame" x="15" y="11" width="851" height="29"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" title="x264 Unparse:" id="CW8-Fr-sh7"> - <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> - </subviews> </view> <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/> <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> @@ -410,7 +255,230 @@ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> </textField> + <box autoresizesSubviews="NO" verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="aeW-F6-jrd"> + <rect key="frame" x="20" y="41" width="880" height="5"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> + <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/> + <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> + <font key="titleFont" metaFont="system"/> + </box> + <box autoresizesSubviews="NO" verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="NtL-8e-tS7"> + <rect key="frame" x="20" y="194" width="880" height="5"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> + <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/> + <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> + <font key="titleFont" metaFont="system"/> + </box> </subviews> </view> + <customView id="2dX-Hf-Hxl" userLabel="x264/x264 presets view"> + <rect key="frame" x="0.0" y="0.0" width="920" height="134"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <subviews> + <slider verticalHuggingPriority="750" id="Biw-5K-pPD"> + <rect key="frame" x="120" y="97" width="123" height="17"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <string key="toolTip">Adjust encoder settings to trade off compression efficiency against encoding speed. + +This estabilishes your default encoder settings. Tunes, profiles, levels and advances option string will be applied to this. +You should generally set this option to the slowest you can bear since slower settings will result in better quality or smaller files.</string> + <sliderCell key="cell" controlSize="mini" continuous="YES" state="on" alignment="left" maxValue="5" tickMarkPosition="above" numberOfTickMarks="2" allowsTickMarkValuesOnly="YES" sliderType="linear" id="suZ-F3-AGy"/> + <connections> + <action selector="presetsSliderChanged:" target="-2" id="bKH-cB-TyO"/> + </connections> + </slider> + <textField verticalHuggingPriority="750" id="0sa-ep-yfr"> + <rect key="frame" x="35" y="99" width="79" height="14"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Preset:" id="iab-iA-j04"> + <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> + <textField verticalHuggingPriority="750" id="gzq-SL-YVY"> + <rect key="frame" x="35" y="78" width="79" height="14"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Tune:" id="zSD-4Y-1cI"> + <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> + <textField verticalHuggingPriority="750" id="dY9-5D-mXX"> + <rect key="frame" x="35" y="57" width="79" height="14"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Profile:" id="hib-wi-BDx"> + <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> + <textField verticalHuggingPriority="750" id="BY1-IG-JvI"> + <rect key="frame" x="35" y="36" width="79" height="14"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Level:" id="QyZ-rl-uGw"> + <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> + <popUpButton verticalHuggingPriority="750" id="A7d-wM-Xmp"> + <rect key="frame" x="119" y="77" width="126" height="15"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <string key="toolTip">Tune settings to optimize for common scenarios. + +This can improve efficiency for particular source characteristics or set characteristics of the output file. Changes will be applied after the preset but before all other parameters.</string> + <popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="rl3-yb-lhe" id="dy8-w4-ycN"> + <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="miniSystem"/> + <menu key="menu" title="OtherViews" id="c4N-uO-iVC"> + <items> + <menuItem title="Item 1" state="on" id="rl3-yb-lhe"/> + <menuItem title="Item 2" id="Oh1-Pi-VOR"/> + <menuItem title="Item 3" id="8PG-Nw-5ky"/> + </items> + </menu> + </popUpButtonCell> + <connections> + <action selector="x264PresetsChangedDisplayExpandedOptions:" target="-2" id="NXN-UM-juC"/> + </connections> + </popUpButton> + <popUpButton verticalHuggingPriority="750" id="CPP-lh-FbN"> + <rect key="frame" x="119" y="56" width="126" height="15"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <string key="toolTip">Sets and ensures compliance with the specified profile. +Overrides all other settings.</string> + <popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="mmg-zN-rCB" id="oOm-hC-AoS"> + <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="miniSystem"/> + <menu key="menu" title="OtherViews" id="7CG-ga-88H"> + <items> + <menuItem title="Item 1" state="on" id="mmg-zN-rCB"/> + <menuItem title="Item 2" id="got-Ie-NJ2"/> + <menuItem title="Item 3" id="Dgy-rE-2Tr"/> + </items> + </menu> + </popUpButtonCell> + <connections> + <action selector="x264PresetsChangedDisplayExpandedOptions:" target="-2" id="WDW-WH-NRA"/> + </connections> + </popUpButton> + <popUpButton toolTip="Sets and ensures compliance with the specified level.
Overrides all other settings." verticalHuggingPriority="750" id="P7c-Zk-G99"> + <rect key="frame" x="119" y="35" width="126" height="15"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="kAg-9O-5hF" id="PhX-Wa-Vhs"> + <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="miniSystem"/> + <menu key="menu" title="OtherViews" id="pPu-oR-2R8"> + <items> + <menuItem title="Item 1" state="on" id="kAg-9O-5hF"/> + <menuItem title="Item 2" id="D7y-fr-REA"/> + <menuItem title="Item 3" id="b0U-ow-7Mq"/> + </items> + </menu> + </popUpButtonCell> + <connections> + <action selector="x264PresetsChangedDisplayExpandedOptions:" target="-2" id="vbv-LQ-CX5"/> + </connections> + </popUpButton> + <button id="z7F-H2-Vfr"> + <rect key="frame" x="261" y="77" width="108" height="18"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <string key="toolTip">Reduce decoder CPU usage. +Set this if your device is struggling to play the output (dropped frames).</string> + <buttonCell key="cell" type="check" title="Fast Decode" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="5De-nU-l3h"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="smallSystem"/> + </buttonCell> + <connections> + <action selector="x264PresetsChangedDisplayExpandedOptions:" target="-2" id="UYm-bq-oxP"/> + </connections> + </button> + <textField verticalHuggingPriority="750" id="ijg-ux-uvb"> + <rect key="frame" x="261" y="58" width="110" height="13"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Additional Options:" id="ZSm-03-g0B"> + <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> + <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="oJk-ur-wgc"> + <rect key="frame" x="377" y="35" width="523" height="37"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" controlSize="small" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="IID-yp-or8"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + <connections> + <action selector="x264PresetsChangedDisplayExpandedOptions:" target="-2" id="wJH-X4-1oP"/> + </connections> + </textField> + <textField verticalHuggingPriority="750" id="gvn-wG-crj"> + <rect key="frame" x="250" y="100" width="129" height="13"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" id="rHx-Kg-tc2"> + <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 toolTip="Use Advanced Options tab for x264 settings. Use at your own risk!" id="Zs7-1Y-50A"> + <rect key="frame" x="117" y="118" width="209" height="18"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <buttonCell key="cell" type="check" title="Use Advanced Options Panel" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="sa6-r3-eVr"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="smallSystem"/> + </buttonCell> + <connections> + <action selector="updateEncoderOptionsWidgets:" target="-2" id="kT9-0X-dVp"/> + </connections> + </button> + <textField verticalHuggingPriority="750" id="wk1-2U-z4i"> + <rect key="frame" x="18" y="0.0" width="883" height="29"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" title="Unparse:" id="G8P-IF-mpl"> + <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> + <textField verticalHuggingPriority="750" id="mkM-81-g3d"> + <rect key="frame" x="18" y="120" width="96" height="14"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Encoder Options:" id="XIe-8Z-tIF"> + <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> + </subviews> + </customView> + <customView id="aRi-vN-oR0" userLabel="ffmpeg presets view"> + <rect key="frame" x="0.0" y="0.0" width="920" height="34"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <subviews> + <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="mL3-yC-hUj"> + <rect key="frame" x="120" y="2" width="545" height="32"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" controlSize="small" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="z0u-VS-m0l"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <textField verticalHuggingPriority="750" id="26w-dz-St2"> + <rect key="frame" x="18" y="20" width="96" height="14"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Encoder Options:" id="7bP-tR-sAX"> + <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> + </subviews> + </customView> </objects> </document> diff --git a/macosx/HBAdvancedController.h b/macosx/HBAdvancedController.h index d80923ddd..e7267cfe0 100644 --- a/macosx/HBAdvancedController.h +++ b/macosx/HBAdvancedController.h @@ -14,17 +14,14 @@ { /* Advanced Tab for opts fX264optView*/ IBOutlet NSBox * fOptionsBox; - + + IBOutlet NSView * fEmptyView; + IBOutlet NSView * fX264optView; - IBOutlet NSView * fFFmpegView; IBOutlet NSTextField * fX264optViewTitleLabel; IBOutlet NSTextField * fDisplayX264OptionsLabel; IBOutlet NSTextField * fDisplayX264Options; - IBOutlet NSTextField * fDisplayLavcOptionsLabel; - IBOutlet NSTextField * fDisplayLavcOptions; - - IBOutlet NSTextField * fDisplayTheoraOptionsLabel; - + IBOutlet NSTextField * fX264optBframesLabel; IBOutlet NSPopUpButton * fX264optBframesPopUp; IBOutlet NSTextField * fX264optRefLabel; @@ -67,11 +64,8 @@ // x264 Advanced Panel Methods - (NSString *) optionsString; -- (NSString *) optionsStringLavc; - (void) setOptions: (NSString *)string; -- (void) setLavcOptions: (NSString *)string; - (void) setHidden: (BOOL) hide; -- (void) setLavcOptsEnabled: (BOOL) lavc; - (IBAction) X264AdvancedOptionsAnimate: (id) sender; - (IBAction) X264AdvancedOptionsSet: (id) sender; - (IBAction) X264AdvancedOptionsStandardizeOptString: (id) sender; diff --git a/macosx/HBAdvancedController.m b/macosx/HBAdvancedController.m index e0f509235..e005dc61d 100644 --- a/macosx/HBAdvancedController.m +++ b/macosx/HBAdvancedController.m @@ -30,27 +30,17 @@ return [fDisplayX264Options stringValue]; } -- (NSString *) optionsStringLavc -{ - return [fDisplayLavcOptions stringValue]; -} - - (void) setOptions: (NSString *)string { [fDisplayX264Options setStringValue:string]; [self X264AdvancedOptionsSet:nil]; } -- (void) setLavcOptions: (NSString *)string -{ - [fDisplayLavcOptions setStringValue:string]; -} - - (void) setHidden: (BOOL) hide { - if(hide) + if (hide) { - [fOptionsBox setContentView:fFFmpegView]; + [fOptionsBox setContentView:fEmptyView]; } else { @@ -59,23 +49,6 @@ return; } -- (void) setLavcOptsEnabled: (BOOL) lavc -{ - if(lavc) - { - [fDisplayLavcOptions setHidden:NO]; - [fDisplayLavcOptionsLabel setHidden:NO]; - [fDisplayTheoraOptionsLabel setHidden:YES]; - } - else - { - [fDisplayLavcOptions setHidden:YES]; - [fDisplayLavcOptionsLabel setHidden:YES]; - [fDisplayTheoraOptionsLabel setHidden:NO]; - } - return; -} - - (void)setUIEnabled:(BOOL)flag { unsigned i; @@ -105,8 +78,6 @@ [controls[i] setEnabled: flag]; } - - //[fX264optView setWantsLayer:YES]; } - (void)dealloc diff --git a/macosx/HBPresetsManager.m b/macosx/HBPresetsManager.m index c8dc9b797..1384a7438 100644 --- a/macosx/HBPresetsManager.m +++ b/macosx/HBPresetsManager.m @@ -435,11 +435,11 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; preset[@"lavcOption"] = @""; preset[@"x264Option"] = @""; preset[@"x264UseAdvancedOptions"] = @0; - preset[@"x264Preset"] = @"fast"; - preset[@"x264Tune"] = @""; - preset[@"x264OptionExtra"] = @""; - preset[@"h264Profile"] = @"baseline"; - preset[@"h264Level"] = @"3.0"; + preset[@"VideoPreset"] = @"fast"; + preset[@"VideoTune"] = @""; + preset[@"VideoOptionExtra"] = @""; + preset[@"VideoProfile"] = @"baseline"; + preset[@"VideoLevel"] = @"3.0"; /* Video rate control */ preset[@"VideoAvgBitrate"] = @"2500"; @@ -550,11 +550,11 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; preset[@"lavcOption"] = @""; preset[@"x264Option"] = @""; preset[@"x264UseAdvancedOptions"] = @0; - preset[@"x264Preset"] = @"medium"; - preset[@"x264Tune"] = @""; - preset[@"x264OptionExtra"] = @""; - preset[@"h264Profile"] = @"baseline"; - preset[@"h264Level"] = @"1.3"; + preset[@"VideoPreset"] = @"medium"; + preset[@"VideoTune"] = @""; + preset[@"VideoOptionExtra"] = @""; + preset[@"VideoProfile"] = @"baseline"; + preset[@"VideoLevel"] = @"1.3"; /* Video rate control */ preset[@"VideoAvgBitrate"] = @"2500"; @@ -654,11 +654,11 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; preset[@"lavcOption"] = @""; preset[@"x264Option"] = @""; preset[@"x264UseAdvancedOptions"] = @0; - preset[@"x264Preset"] = @"medium"; - preset[@"x264Tune"] = @""; - preset[@"x264OptionExtra"] = @""; - preset[@"h264Profile"] = @"high"; - preset[@"h264Level"] = @"3.1"; + preset[@"VideoPreset"] = @"medium"; + preset[@"VideoTune"] = @""; + preset[@"VideoOptionExtra"] = @""; + preset[@"VideoProfile"] = @"high"; + preset[@"VideoLevel"] = @"3.1"; /* Video rate control */ preset[@"VideoAvgBitrate"] = @"2500"; @@ -758,11 +758,11 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; preset[@"lavcOption"] = @""; preset[@"x264Option"] = @""; preset[@"x264UseAdvancedOptions"] = @0; - preset[@"x264Preset"] = @"medium"; - preset[@"x264Tune"] = @""; - preset[@"x264OptionExtra"] = @""; - preset[@"h264Profile"] = @"high"; - preset[@"h264Level"] = @"3.1"; + preset[@"VideoPreset"] = @"medium"; + preset[@"VideoTune"] = @""; + preset[@"VideoOptionExtra"] = @""; + preset[@"VideoProfile"] = @"high"; + preset[@"VideoLevel"] = @"3.1"; /* Video rate control */ preset[@"VideoAvgBitrate"] = @"2500"; @@ -862,11 +862,11 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; preset[@"lavcOption"] = @""; preset[@"x264Option"] = @""; preset[@"x264UseAdvancedOptions"] = @0; - preset[@"x264Preset"] = @"medium"; - preset[@"x264Tune"] = @""; - preset[@"x264OptionExtra"] = @"qpmin=4:cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500"; - preset[@"h264Profile"] = @"high"; - preset[@"h264Level"] = @"3.1"; + preset[@"VideoPreset"] = @"medium"; + preset[@"VideoTune"] = @""; + preset[@"VideoOptionExtra"] = @"qpmin=4:cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500"; + preset[@"VideoProfile"] = @"high"; + preset[@"VideoLevel"] = @"3.1"; /* Video rate control */ preset[@"VideoAvgBitrate"] = @"2500"; @@ -977,11 +977,11 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; preset[@"lavcOption"] = @""; preset[@"x264Option"] = @""; preset[@"x264UseAdvancedOptions"] = @0; - preset[@"x264Preset"] = @"medium"; - preset[@"x264Tune"] = @""; - preset[@"x264OptionExtra"] = @""; - preset[@"h264Profile"] = @"high"; - preset[@"h264Level"] = @"3.1"; + preset[@"VideoPreset"] = @"medium"; + preset[@"VideoTune"] = @""; + preset[@"VideoOptionExtra"] = @""; + preset[@"VideoProfile"] = @"high"; + preset[@"VideoLevel"] = @"3.1"; /* Video rate control */ preset[@"VideoAvgBitrate"] = @"2500"; @@ -1092,11 +1092,11 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; preset[@"lavcOption"] = @""; preset[@"x264Option"] = @""; preset[@"x264UseAdvancedOptions"] = @0; - preset[@"x264Preset"] = @"medium"; - preset[@"x264Tune"] = @""; - preset[@"x264OptionExtra"] = @""; - preset[@"h264Profile"] = @"high"; - preset[@"h264Level"] = @"4.0"; + preset[@"VideoPreset"] = @"medium"; + preset[@"VideoTune"] = @""; + preset[@"VideoOptionExtra"] = @""; + preset[@"VideoProfile"] = @"high"; + preset[@"VideoLevel"] = @"4.0"; /* Video rate control */ preset[@"VideoAvgBitrate"] = @"2500"; @@ -1207,11 +1207,11 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; preset[@"lavcOption"] = @""; preset[@"x264Option"] = @""; preset[@"x264UseAdvancedOptions"] = @0; - preset[@"x264Preset"] = @"medium"; - preset[@"x264Tune"] = @""; - preset[@"x264OptionExtra"] = @""; - preset[@"h264Profile"] = @"main"; - preset[@"h264Level"] = @"3.0"; + preset[@"VideoPreset"] = @"medium"; + preset[@"VideoTune"] = @""; + preset[@"VideoOptionExtra"] = @""; + preset[@"VideoProfile"] = @"main"; + preset[@"VideoLevel"] = @"3.0"; /* Video rate control */ preset[@"VideoAvgBitrate"] = @"2500"; @@ -1311,11 +1311,11 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; preset[@"lavcOption"] = @""; preset[@"x264Option"] = @""; preset[@"x264UseAdvancedOptions"] = @0; - preset[@"x264Preset"] = @"medium"; - preset[@"x264Tune"] = @""; - preset[@"x264OptionExtra"] = @""; - preset[@"h264Profile"] = @"main"; - preset[@"h264Level"] = @"3.1"; + preset[@"VideoPreset"] = @"medium"; + preset[@"VideoTune"] = @""; + preset[@"VideoOptionExtra"] = @""; + preset[@"VideoProfile"] = @"main"; + preset[@"VideoLevel"] = @"3.1"; /* Video rate control */ preset[@"VideoAvgBitrate"] = @"2500"; @@ -1415,11 +1415,11 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; preset[@"lavcOption"] = @""; preset[@"x264Option"] = @""; preset[@"x264UseAdvancedOptions"] = @0; - preset[@"x264Preset"] = @"medium"; - preset[@"x264Tune"] = @""; - preset[@"x264OptionExtra"] = @""; - preset[@"h264Profile"] = @"main"; - preset[@"h264Level"] = @"3.1"; + preset[@"VideoPreset"] = @"medium"; + preset[@"VideoTune"] = @""; + preset[@"VideoOptionExtra"] = @""; + preset[@"VideoProfile"] = @"main"; + preset[@"VideoLevel"] = @"3.1"; /* Video rate control */ preset[@"VideoAvgBitrate"] = @"2500"; @@ -1519,11 +1519,11 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; preset[@"lavcOption"] = @""; preset[@"x264Option"] = @""; preset[@"x264UseAdvancedOptions"] = @0; - preset[@"x264Preset"] = @"veryfast"; - preset[@"x264Tune"] = @""; - preset[@"x264OptionExtra"] = @""; - preset[@"h264Profile"] = @"main"; - preset[@"h264Level"] = @"4.0"; + preset[@"VideoPreset"] = @"veryfast"; + preset[@"VideoTune"] = @""; + preset[@"VideoOptionExtra"] = @""; + preset[@"VideoProfile"] = @"main"; + preset[@"VideoLevel"] = @"4.0"; /* Video rate control */ preset[@"VideoAvgBitrate"] = @"2500"; @@ -1623,11 +1623,11 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; preset[@"lavcOption"] = @""; preset[@"x264Option"] = @""; preset[@"x264UseAdvancedOptions"] = @0; - preset[@"x264Preset"] = @"medium"; - preset[@"x264Tune"] = @""; - preset[@"x264OptionExtra"] = @""; - preset[@"h264Profile"] = @"high"; - preset[@"h264Level"] = @"4.1"; + preset[@"VideoPreset"] = @"medium"; + preset[@"VideoTune"] = @""; + preset[@"VideoOptionExtra"] = @""; + preset[@"VideoProfile"] = @"high"; + preset[@"VideoLevel"] = @"4.1"; /* Video rate control */ preset[@"VideoAvgBitrate"] = @"2500"; diff --git a/macosx/HBQueueController.mm b/macosx/HBQueueController.mm index ef2fb3889..9fedcf943 100644 --- a/macosx/HBQueueController.mm +++ b/macosx/HBQueueController.mm @@ -945,46 +945,46 @@ [finalString appendString: videoInfo withAttributes:detailAttr]; [finalString appendString:@"\n" withAttributes:detailAttr]; - if ([item[@"VideoEncoder"] isEqualToString: @"H.264 (x264)"]) + if ([item[@"VideoEncoder"] isEqualToString: @"H.264 (x264)"] || [item[@"VideoEncoder"] isEqualToString: @"H.265 (x265)"]) { - /* we are using x264 */ - NSString *x264Info = @""; + /* we are using x264/x265 */ + NSString *encoderPresetInfo = @""; if ([item[@"x264UseAdvancedOptions"] intValue]) { // we are using the old advanced panel if (item[@"x264Option"] && [item[@"x264Option"] length]) { - x264Info = [x264Info stringByAppendingString: item[@"x264Option"]]; + encoderPresetInfo = [encoderPresetInfo stringByAppendingString: item[@"x264Option"]]; } else { - x264Info = [x264Info stringByAppendingString: @"default settings"]; + encoderPresetInfo = [encoderPresetInfo stringByAppendingString: @"default settings"]; } } else { // we are using the x264 system - x264Info = [x264Info stringByAppendingString: [NSString stringWithFormat:@"Preset: %@", item[@"x264Preset"]]]; - if ([item[@"x264Tune"] length]) + encoderPresetInfo = [encoderPresetInfo stringByAppendingString: [NSString stringWithFormat:@"Preset: %@", item[@"VideoPreset"]]]; + if ([item[@"VideoTune"] length]) { - x264Info = [x264Info stringByAppendingString: [NSString stringWithFormat:@" - Tune: %@", item[@"x264Tune"]]]; + encoderPresetInfo = [encoderPresetInfo stringByAppendingString: [NSString stringWithFormat:@" - Tune: %@", item[@"VideoTune"]]]; } - if ([item[@"x264OptionExtra"] length]) + if ([item[@"VideoOptionExtra"] length]) { - x264Info = [x264Info stringByAppendingString: [NSString stringWithFormat:@" - Options: %@", item[@"x264OptionExtra"]]]; + encoderPresetInfo = [encoderPresetInfo stringByAppendingString: [NSString stringWithFormat:@" - Options: %@", item[@"VideoOptionExtra"]]]; } - if ([item[@"h264Profile"] length]) + if ([item[@"VideoProfile"] length]) { - x264Info = [x264Info stringByAppendingString: [NSString stringWithFormat:@" - Profile: %@", item[@"h264Profile"]]]; + encoderPresetInfo = [encoderPresetInfo stringByAppendingString: [NSString stringWithFormat:@" - Profile: %@", item[@"VideoProfile"]]]; } - if ([item[@"h264Level"] length]) + if ([item[@"VideoLevel"] length]) { - x264Info = [x264Info stringByAppendingString: [NSString stringWithFormat:@" - Level: %@", item[@"h264Level"]]]; + encoderPresetInfo = [encoderPresetInfo stringByAppendingString: [NSString stringWithFormat:@" - Level: %@", item[@"VideoLevel"]]]; } } - [finalString appendString: @"x264: " withAttributes:detailBoldAttr]; - [finalString appendString: x264Info withAttributes:detailAttr]; + [finalString appendString: @"Encoder Options: " withAttributes:detailBoldAttr]; + [finalString appendString: encoderPresetInfo withAttributes:detailAttr]; [finalString appendString:@"\n" withAttributes:detailAttr]; } else if (![item[@"VideoEncoder"] isEqualToString: @"VP3 (Theora)"]) diff --git a/macosx/HBVideoController.h b/macosx/HBVideoController.h index b3d0637bc..6845ed703 100644 --- a/macosx/HBVideoController.h +++ b/macosx/HBVideoController.h @@ -36,14 +36,14 @@ extern NSString *HBVideoEncoderChangedNotification; @property (nonatomic, copy, readwrite) NSString *pictureFiltersField; // Property exposed for the auto name function -@property (nonatomic, readonly) int selectedCodec; -@property (nonatomic, readonly) int selectedQualityType; +@property (nonatomic, readonly) int codec; +@property (nonatomic, readonly) int qualityType; @property (nonatomic, readonly) NSString *selectedBitrate; @property (nonatomic, readonly) NSString *selectedQuality; // Property updates when the video size changes -@property (nonatomic, readwrite) NSUInteger fX264PresetsWidthForUnparse; -@property (nonatomic, readwrite) NSUInteger fX264PresetsHeightForUnparse; +@property (nonatomic, readwrite) NSUInteger fPresetsWidthForUnparse; +@property (nonatomic, readwrite) NSUInteger fPresetsHeightForUnparse; @property (nonatomic, retain, readwrite) HBController *fHBController; @property (nonatomic, retain, readwrite) HBAdvancedController *fAdvancedOptions; diff --git a/macosx/HBVideoController.m b/macosx/HBVideoController.m index 3490b483d..9a6cb4b73 100644 --- a/macosx/HBVideoController.m +++ b/macosx/HBVideoController.m @@ -40,37 +40,44 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio IBOutlet NSTextField * fPictureSettingsField; IBOutlet NSTextField * fPictureFiltersField; - /* x264 Presets Box */ - NSArray * fX264PresetNames; - NSUInteger fX264MediumPresetIndex; + + /* Encoder options views */ + IBOutlet NSView *fPresetView; + IBOutlet NSView *fSimplePresetView; + + /* Simple Presets Box */ + IBOutlet NSTextField *fLavcOptionsTextField; + IBOutlet NSTextField *fLavcOptionsLabel; + + /* x264/x265 Presets Box */ + NSArray * fPresetNames; + NSUInteger fMediumPresetIndex; IBOutlet NSButton * fX264UseAdvancedOptionsCheck; - IBOutlet NSBox * fX264PresetsBox; - IBOutlet NSSlider * fX264PresetsSlider; - IBOutlet NSTextField * fX264PresetSliderLabel; - IBOutlet NSTextField * fX264PresetSelectedTextField; - IBOutlet NSPopUpButton * fX264TunePopUp; - IBOutlet NSTextField * fX264TunePopUpLabel; - IBOutlet NSPopUpButton * fX264ProfilePopUp; - IBOutlet NSTextField * fX264ProfilePopUpLabel; - IBOutlet NSPopUpButton * fX264LevelPopUp; - IBOutlet NSTextField * fX264LevelPopUpLabel; - IBOutlet NSButton * fX264FastDecodeCheck; - IBOutlet NSTextField * fDisplayX264PresetsAdditonalOptionsTextField; - IBOutlet NSTextField * fDisplayX264PresetsAdditonalOptionsLabel; + IBOutlet NSBox * fPresetsBox; + IBOutlet NSSlider * fPresetsSlider; + IBOutlet NSTextField * fPresetSliderLabel; + IBOutlet NSTextField * fPresetSelectedTextField; + IBOutlet NSPopUpButton * fTunePopUp; + IBOutlet NSTextField * fTunePopUpLabel; + IBOutlet NSPopUpButton * fProfilePopUp; + IBOutlet NSTextField * fProfilePopUpLabel; + IBOutlet NSPopUpButton * fLevelPopUp; + IBOutlet NSTextField * fLevelPopUpLabel; + IBOutlet NSButton * fFastDecodeCheck; + IBOutlet NSTextField * fDisplayPresetsAdditonalOptionsTextField; + IBOutlet NSTextField * fDisplayPresetsAdditonalOptionsLabel; // Text Field to show the expanded opts from unparse() IBOutlet NSTextField * fDisplayX264PresetsUnparseTextField; char * fX264PresetsUnparsedUTF8String; - NSUInteger _fX264PresetsHeightForUnparse; - NSUInteger _fX264PresetsWidthForUnparse; } +@property (nonatomic, readwrite) int codec; +@property (nonatomic, readwrite) int qualityType; + @end @implementation HBVideoController -@synthesize fX264PresetsHeightForUnparse = _fX264PresetsHeightForUnparse; -@synthesize fX264PresetsWidthForUnparse = _fX264PresetsWidthForUnparse; - - (void)setPictureSettingsField:(NSString *)string { if (string) @@ -89,16 +96,6 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio } } -- (int)selectedCodec -{ - return (int)[[fVidEncoderPopUp selectedItem] tag]; -} - -- (int)selectedQualityType -{ - return (int)[[fVidQualityMatrix selectedCell] tag]; -} - - (NSString *)selectedBitrate { return [fVidBitrateField stringValue]; @@ -138,14 +135,15 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio /* Video encoder */ [fVidEncoderPopUp removeAllItems]; - [fVidEncoderPopUp addItemWithTitle: @"FFmpeg"]; + [fVidEncoderPopUp addItemWithTitle:@"H.264 (x264)"]; - /* setup our x264 presets widgets - this only needs to be done once */ - [self setupX264PresetsWidgets]; + /* setup our x264/x265 presets widgets */ + [self switchPresetViewForEncoder:HB_VCODEC_X264]; /* Video quality */ - [fVidBitrateField setIntValue: 1000]; - [fVidQualityMatrix selectCell: fVidBitrateCell]; + [fVidBitrateField setIntValue: 1000]; + self.qualityType = 0; + [self videoMatrixChanged:nil]; /* Video framerate */ @@ -173,7 +171,7 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio } else { - itemTitle = [NSString stringWithUTF8String:video_framerate->name]; + itemTitle = @(video_framerate->name); } menuItem = [[fVidRatePopUp menu] addItemWithTitle:itemTitle action:nil @@ -224,17 +222,18 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio } [self videoMatrixChanged:nil]; - [self enableX264Widgets:flag]; + [self enableEncoderOptionsWidgets:flag]; } - (void)containerChanged:(NSNotification *)aNotification { NSDictionary *notDict = [aNotification userInfo]; - int videoContainer = [[notDict objectForKey: keyContainerTag] intValue]; + int videoContainer = [notDict[keyContainerTag] intValue]; /* lets get the tag of the currently selected item first so we might reset it later */ - int selectedVidEncoderTag = (int)[[fVidEncoderPopUp selectedItem] tag]; + int selectedVidEncoderTag = self.codec; + BOOL encoderSupported = NO; /* Note: we now store the video encoder int values from common.c in the tags of each popup for easy retrieval later */ [fVidEncoderPopUp removeAllItems]; @@ -244,30 +243,21 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio { if (video_encoder->muxers & videoContainer) { - NSMenuItem *menuItem = [[fVidEncoderPopUp menu] addItemWithTitle:[NSString stringWithUTF8String:video_encoder->name] + NSMenuItem *menuItem = [[fVidEncoderPopUp menu] addItemWithTitle:@(video_encoder->name) action:nil keyEquivalent:@""]; [menuItem setTag:video_encoder->codec]; - } - } - /* - * item 0 will be selected by default - * deselect it so that we can detect whether the video encoder has changed - */ - [fVidEncoderPopUp selectItem:nil]; - if (selectedVidEncoderTag) - { - // if we have a tag for previously selected encoder, try to select it - // if this fails, [fVidEncoderPopUp selectedItem] will be nil - // we'll handle that scenario further down - [fVidEncoderPopUp selectItemWithTag:selectedVidEncoderTag]; + if (selectedVidEncoderTag == video_encoder->codec) + { + encoderSupported = YES; + } + } } - if ([fVidEncoderPopUp selectedItem] == nil) + if (!encoderSupported) { - /* this means the above call to selectItemWithTag failed */ - [fVidEncoderPopUp selectItemAtIndex:0]; + self.codec = hb_video_encoder_get_default(videoContainer); [self videoEncoderPopUpChanged:nil]; } } @@ -282,53 +272,56 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio - (void)applyVideoSettingsFromQueue:(NSDictionary *)queueToApply { /* video encoder */ - [fVidEncoderPopUp selectItemWithTitle:[queueToApply objectForKey:@"VideoEncoder"]]; - [self.fAdvancedOptions setLavcOptions: [queueToApply objectForKey:@"lavcOption"]]; + self.codec = [queueToApply[@"JobVideoEncoderVcodec"] intValue]; + + self.lavcOptions = queueToApply[@"lavcOption"]; + /* advanced x264 options */ - if ([[queueToApply objectForKey:@"x264UseAdvancedOptions"] intValue]) + if ([queueToApply[@"x264UseAdvancedOptions"] intValue]) { // we are using the advanced panel - [self.fAdvancedOptions setOptions:[queueToApply objectForKey:@"x264Option"]]; + [self.fAdvancedOptions setOptions:queueToApply[@"x264Option"]]; // preset does not use the x264 preset system, reset the widgets - [self setX264Preset: nil]; - [self setX264Tune: nil]; - [self setX264OptionExtra:[queueToApply objectForKey:@"x264Option"]]; - [self setH264Profile: nil]; - [self setH264Level: nil]; + [self setPreset: nil]; + [self setTune: nil]; + [self setOptionExtra:queueToApply[@"x264Option"]]; + [self setProfile: nil]; + [self setLevel: nil]; // enable the advanced panel and update the widgets [fX264UseAdvancedOptionsCheck setState:NSOnState]; - [self updateX264Widgets:nil]; + [self updateEncoderOptionsWidgets:nil]; } else { // we are using the x264 preset system - [self setX264Preset: [queueToApply objectForKey:@"x264Preset"]]; - [self setX264Tune: [queueToApply objectForKey:@"x264Tune"]]; - [self setX264OptionExtra:[queueToApply objectForKey:@"x264OptionExtra"]]; - [self setH264Profile: [queueToApply objectForKey:@"h264Profile"]]; - [self setH264Level: [queueToApply objectForKey:@"h264Level"]]; + [self setPreset: queueToApply[@"VideoPreset"]]; + [self setTune: queueToApply[@"VideoTune"]]; + [self setOptionExtra:queueToApply[@"VideoOptionExtra"]]; + [self setProfile: queueToApply[@"VideoProfile"]]; + [self setLevel: queueToApply[@"VideoLevel"]]; // preset does not use the advanced panel, reset it [self.fAdvancedOptions setOptions:@""]; // disable the advanced panel and update the widgets [fX264UseAdvancedOptionsCheck setState:NSOffState]; - [self updateX264Widgets:nil]; + [self updateEncoderOptionsWidgets:nil]; } /* Lets run through the following functions to get variables set there */ [self videoEncoderPopUpChanged:nil]; /* Video quality */ - [fVidQualityMatrix selectCellAtRow:[[queueToApply objectForKey:@"VideoQualityType"] intValue] column:0]; + self.qualityType = [queueToApply[@"VideoQualityType"] intValue]; - [fVidBitrateField setStringValue:[queueToApply objectForKey:@"VideoAvgBitrate"]]; + [fVidBitrateField setStringValue:queueToApply[@"VideoAvgBitrate"]]; int direction; float minValue, maxValue, granularity; - hb_video_quality_get_limits((int)[[fVidEncoderPopUp selectedItem] tag], - &minValue, &maxValue, &granularity, &direction); + + hb_video_quality_get_limits(self.codec, &minValue, &maxValue, &granularity, &direction); + if (!direction) { - [fVidQualitySlider setFloatValue:[[queueToApply objectForKey:@"VideoQualitySlider"] floatValue]]; + [fVidQualitySlider setFloatValue:[queueToApply[@"VideoQualitySlider"] floatValue]]; } else { @@ -338,16 +331,16 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio */ [fVidQualitySlider setFloatValue:([fVidQualitySlider minValue] + [fVidQualitySlider maxValue] - - [[queueToApply objectForKey:@"VideoQualitySlider"] floatValue])]; + [queueToApply[@"VideoQualitySlider"] floatValue])]; } [self videoMatrixChanged:nil]; /* Video framerate */ - if ([[queueToApply objectForKey:@"VideoFramerate"] isEqualToString:@"Same as source"]) + if ([queueToApply[@"VideoFramerate"] isEqualToString:@"Same as source"]) { /* Now set the Video Frame Rate Mode to either vfr or cfr according to the preset */ - if ([[queueToApply objectForKey:@"VideoFramerateMode"] isEqualToString:@"vfr"]) + if ([queueToApply[@"VideoFramerateMode"] isEqualToString:@"vfr"]) { [fFramerateMatrix selectCellAtRow:0 column:0]; // we want vfr } @@ -359,7 +352,7 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio else { /* Now set the Video Frame Rate Mode to either pfr or cfr according to the preset */ - if ([[queueToApply objectForKey:@"VideoFramerateMode"] isEqualToString:@"pfr"]) + if ([queueToApply[@"VideoFramerateMode"] isEqualToString:@"pfr"]) { [fFramerateMatrix selectCellAtRow:0 column:0]; // we want pfr } @@ -368,51 +361,53 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio [fFramerateMatrix selectCellAtRow:1 column:0]; // we want cfr } } - [fVidRatePopUp selectItemWithTitle:[queueToApply objectForKey:@"VideoFramerate"]]; + [fVidRatePopUp selectItemWithTitle:queueToApply[@"VideoFramerate"]]; [self videoFrameRateChanged:nil]; /* 2 Pass Encoding */ - [fVidTwoPassCheck setState:[[queueToApply objectForKey:@"VideoTwoPass"] intValue]]; + [fVidTwoPassCheck setState:[queueToApply[@"VideoTwoPass"] intValue]]; [self twoPassCheckboxChanged:nil]; /* Turbo 1st pass for 2 Pass Encoding */ - [fVidTurboPassCheck setState:[[queueToApply objectForKey:@"VideoTurboTwoPass"] intValue]]; + [fVidTurboPassCheck setState:[queueToApply[@"VideoTurboTwoPass"] intValue]]; } - (void)applySettingsFromPreset:(NSDictionary *)preset { /* map legacy encoder names via libhb */ - const char *strValue = hb_video_encoder_sanitize_name([[preset objectForKey:@"VideoEncoder"] UTF8String]); - [fVidEncoderPopUp selectItemWithTitle:[NSString stringWithFormat:@"%s", strValue]]; + const char *strValue = hb_video_encoder_sanitize_name([preset[@"VideoEncoder"] UTF8String]); + + self.codec = hb_video_encoder_get_from_name(strValue); [self videoEncoderPopUpChanged:nil]; - if ([[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_X264) + if (self.codec == HB_VCODEC_X264 || self.codec == HB_VCODEC_X265) { - if (![preset objectForKey:@"x264UseAdvancedOptions"] || - [[preset objectForKey:@"x264UseAdvancedOptions"] intValue]) + if (self.codec == HB_VCODEC_X264 && + (!preset[@"x264UseAdvancedOptions"] || + [preset[@"x264UseAdvancedOptions"] intValue])) { /* * x264UseAdvancedOptions is not set (legacy preset) * or set to 1 (enabled), so we use the old advanced panel */ - if ([preset objectForKey:@"x264Option"]) + if (preset[@"x264Option"]) { /* we set the advanced options string here if applicable */ - [self.fAdvancedOptions setOptions:[preset objectForKey:@"x264Option"]]; - [self setX264OptionExtra:[preset objectForKey:@"x264Option"]]; + [self.fAdvancedOptions setOptions:preset[@"x264Option"]]; + [self setOptionExtra:preset[@"x264Option"]]; } else { [self.fAdvancedOptions setOptions: @""]; - [self setX264OptionExtra:nil]; + [self setOptionExtra:nil]; } /* preset does not use the x264 preset system, reset the widgets */ - [self setX264Preset: nil]; - [self setX264Tune: nil]; - [self setH264Profile:nil]; - [self setH264Level: nil]; + [self setPreset: nil]; + [self setTune: nil]; + [self setProfile:nil]; + [self setLevel: nil]; /* we enable the advanced panel and update the widgets */ [fX264UseAdvancedOptionsCheck setState:NSOnState]; - [self updateX264Widgets:nil]; + [self updateEncoderOptionsWidgets:nil]; } else { @@ -420,20 +415,31 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio * x264UseAdvancedOptions is set to 0 (disabled), * so we use the x264 preset system */ - [self setX264Preset: [preset objectForKey:@"x264Preset"]]; - [self setX264Tune: [preset objectForKey:@"x264Tune"]]; - [self setX264OptionExtra:[preset objectForKey:@"x264OptionExtra"]]; - [self setH264Profile: [preset objectForKey:@"h264Profile"]]; - [self setH264Level: [preset objectForKey:@"h264Level"]]; + if (preset[@"x264Preset"]) + { + [self setPreset: preset[@"x264Preset"]]; + [self setTune: preset[@"x264Tune"]]; + [self setOptionExtra:preset[@"x264OptionExtra"]]; + [self setProfile: preset[@"h264Profile"]]; + [self setLevel: preset[@"h264Level"]]; + } + else + { + [self setPreset: preset[@"VideoPreset"]]; + [self setTune: preset[@"VideoTune"]]; + [self setOptionExtra:preset[@"VideoOptionExtra"]]; + [self setProfile: preset[@"VideoProfile"]]; + [self setLevel: preset[@"VideoLevel"]]; + } /* preset does not use the advanced panel, reset it */ [self.fAdvancedOptions setOptions:@""]; /* we disable the advanced panel and update the widgets */ [fX264UseAdvancedOptionsCheck setState:NSOffState]; - [self updateX264Widgets:nil]; + [self updateEncoderOptionsWidgets:nil]; } } - int qualityType = [[preset objectForKey:@"VideoQualityType"] intValue] - 1; + int qualityType = [preset[@"VideoQualityType"] intValue] - 1; /* Note since the removal of Target Size encoding, the possible values for VideoQuality type are 0 - 1. * Therefore any preset that uses the old 2 for Constant Quality would now use 1 since there is one less index * for the fVidQualityMatrix. It should also be noted that any preset that used the deprecated Target Size @@ -443,17 +449,18 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio { qualityType = 0; } - [fVidQualityMatrix selectCellWithTag:qualityType]; + self.qualityType = qualityType; - [fVidBitrateField setStringValue:[preset objectForKey:@"VideoAvgBitrate"]]; + [fVidBitrateField setStringValue:preset[@"VideoAvgBitrate"]]; int direction; float minValue, maxValue, granularity; - hb_video_quality_get_limits((int)[[fVidEncoderPopUp selectedItem] tag], - &minValue, &maxValue, &granularity, &direction); + + hb_video_quality_get_limits(self.codec, &minValue, &maxValue, &granularity, &direction); + if (!direction) { - [fVidQualitySlider setFloatValue:[[preset objectForKey:@"VideoQualitySlider"] floatValue]]; + [fVidQualitySlider setFloatValue:[preset[@"VideoQualitySlider"] floatValue]]; } else { @@ -463,17 +470,17 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio */ [fVidQualitySlider setFloatValue:([fVidQualitySlider minValue] + [fVidQualitySlider maxValue] - - [[preset objectForKey:@"VideoQualitySlider"] floatValue])]; + [preset[@"VideoQualitySlider"] floatValue])]; } [self videoMatrixChanged:nil]; /* Video framerate */ - if ([[preset objectForKey:@"VideoFramerate"] isEqualToString:@"Same as source"]) + if ([preset[@"VideoFramerate"] isEqualToString:@"Same as source"]) { /* Now set the Video Frame Rate Mode to either vfr or cfr according to the preset */ - if (![preset objectForKey:@"VideoFramerateMode"] || - [[preset objectForKey:@"VideoFramerateMode"] isEqualToString:@"vfr"]) + if (!preset[@"VideoFramerateMode"] || + [preset[@"VideoFramerateMode"] isEqualToString:@"vfr"]) { [fFramerateMatrix selectCellAtRow:0 column:0]; // we want vfr } @@ -485,8 +492,8 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio else { /* Now set the Video Frame Rate Mode to either pfr or cfr according to the preset */ - if ([[preset objectForKey:@"VideoFramerateMode"] isEqualToString:@"pfr"] || - [[preset objectForKey:@"VideoFrameratePFR"] intValue] == 1) + if ([preset[@"VideoFramerateMode"] isEqualToString:@"pfr"] || + [preset[@"VideoFrameratePFR"] intValue] == 1) { [fFramerateMatrix selectCellAtRow:0 column:0]; // we want pfr } @@ -496,81 +503,81 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio } } /* map legacy names via libhb */ - int intValue = hb_video_framerate_get_from_name([[preset objectForKey:@"VideoFramerate"] UTF8String]); + int intValue = hb_video_framerate_get_from_name([preset[@"VideoFramerate"] UTF8String]); [fVidRatePopUp selectItemWithTag:intValue]; [self videoFrameRateChanged:nil]; /* 2 Pass Encoding */ - [fVidTwoPassCheck setState:[[preset objectForKey:@"VideoTwoPass"] intValue]]; + [fVidTwoPassCheck setState:[preset[@"VideoTwoPass"] intValue]]; [self twoPassCheckboxChanged:nil]; /* Turbo 1st pass for 2 Pass Encoding */ - [fVidTurboPassCheck setState:[[preset objectForKey:@"VideoTurboTwoPass"] intValue]]; + [fVidTurboPassCheck setState:[preset[@"VideoTurboTwoPass"] intValue]]; } - (void)prepareVideoForQueueFileJob:(NSMutableDictionary *)queueFileJob { - [queueFileJob setObject:[fVidEncoderPopUp titleOfSelectedItem] forKey:@"VideoEncoder"]; + queueFileJob[@"VideoEncoder"] = @(hb_video_encoder_get_name(self.codec)); /* x264 advanced options */ if ([fX264UseAdvancedOptionsCheck state]) { // we are using the advanced panel - [queueFileJob setObject:[NSNumber numberWithInt:1] forKey: @"x264UseAdvancedOptions"]; - [queueFileJob setObject:[self.fAdvancedOptions optionsString] forKey:@"x264Option"]; + queueFileJob[@"x264UseAdvancedOptions"] = @1; + queueFileJob[@"x264Option"] = [self.fAdvancedOptions optionsString]; } else { - // we are using the x264 preset system - [queueFileJob setObject:[NSNumber numberWithInt:0] forKey: @"x264UseAdvancedOptions"]; - [queueFileJob setObject:[self x264Preset] forKey: @"x264Preset"]; - [queueFileJob setObject:[self x264Tune] forKey: @"x264Tune"]; - [queueFileJob setObject:[self x264OptionExtra] forKey: @"x264OptionExtra"]; - [queueFileJob setObject:[self h264Profile] forKey: @"h264Profile"]; - [queueFileJob setObject:[self h264Level] forKey: @"h264Level"]; + // we are using the x264/x265 preset system + queueFileJob[@"x264UseAdvancedOptions"] = @0; + queueFileJob[@"VideoPreset"] = [self preset]; + queueFileJob[@"VideoTune"] = [self tune]; + queueFileJob[@"VideoOptionExtra"] = [self optionExtra]; + queueFileJob[@"VideoProfile"] = [self profile]; + queueFileJob[@"VideoLevel"] = [self level]; } /* FFmpeg (lavc) Option String */ - [queueFileJob setObject:[self.fAdvancedOptions optionsStringLavc] forKey:@"lavcOption"]; + queueFileJob[@"lavcOption"] = self.lavcOptions; - [queueFileJob setObject:[NSNumber numberWithInteger:[[fVidQualityMatrix selectedCell] tag] + 1] forKey:@"VideoQualityType"]; - [queueFileJob setObject:[fVidBitrateField stringValue] forKey:@"VideoAvgBitrate"]; - [queueFileJob setObject:[NSNumber numberWithFloat:[fVidQualityRFField floatValue]] forKey:@"VideoQualitySlider"]; + queueFileJob[@"VideoQualityType"] = @(self.qualityType + 1); + queueFileJob[@"VideoAvgBitrate"] = [fVidBitrateField stringValue]; + queueFileJob[@"VideoQualitySlider"] = @([fVidQualityRFField floatValue]); /* Framerate */ - [queueFileJob setObject:[fVidRatePopUp titleOfSelectedItem] forKey:@"VideoFramerate"]; + queueFileJob[@"VideoFramerate"] = [fVidRatePopUp titleOfSelectedItem]; /* Frame Rate Mode */ if ([fFramerateMatrix selectedRow] == 1) // if selected we are cfr regardless of the frame rate popup { - [queueFileJob setObject:@"cfr" forKey:@"VideoFramerateMode"]; + queueFileJob[@"VideoFramerateMode"] = @"cfr"; } else { if ([fVidRatePopUp indexOfSelectedItem] == 0) // Same as source frame rate { - [queueFileJob setObject:@"vfr" forKey:@"VideoFramerateMode"]; + queueFileJob[@"VideoFramerateMode"] = @"vfr"; } else { - [queueFileJob setObject:@"pfr" forKey:@"VideoFramerateMode"]; + queueFileJob[@"VideoFramerateMode"] = @"pfr"; } } /* 2 Pass Encoding */ - [queueFileJob setObject:[NSNumber numberWithInteger:[fVidTwoPassCheck state]] forKey:@"VideoTwoPass"]; + queueFileJob[@"VideoTwoPass"] = @([fVidTwoPassCheck state]); /* Turbo 2 pass Encoding fVidTurboPassCheck*/ - [queueFileJob setObject:[NSNumber numberWithInteger:[fVidTurboPassCheck state]] forKey:@"VideoTurboTwoPass"]; + queueFileJob[@"VideoTurboTwoPass"] = @([fVidTurboPassCheck state]); /* Video encoder */ - [queueFileJob setObject:[NSNumber numberWithInteger:[[fVidEncoderPopUp selectedItem] tag]] forKey:@"JobVideoEncoderVcodec"]; + queueFileJob[@"JobVideoEncoderVcodec"] = @(self.codec); /* Framerate */ - [queueFileJob setObject:[NSNumber numberWithInteger:[[fVidRatePopUp selectedItem] tag]] forKey:@"JobIndexVideoFramerate"]; + queueFileJob[@"JobIndexVideoFramerate"] = @([[fVidRatePopUp selectedItem] tag]); } - (void)prepareVideoForJobPreview:(hb_job_t *)job andTitle:(hb_title_t *)title { - job->vcodec = (int)[[fVidEncoderPopUp selectedItem] tag]; + job->vcodec = self.codec; job->fastfirstpass = 0; job->chapter_markers = 0; @@ -596,23 +603,23 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio else { // we are using the x264 preset system - if ([(tmpString = [self x264Tune]) length]) + if ([(tmpString = [self tune]) length]) { encoder_tune = [tmpString UTF8String]; } - if ([(tmpString = [self x264OptionExtra]) length]) + if ([(tmpString = [self optionExtra]) length]) { encoder_options = [tmpString UTF8String]; } - if ([(tmpString = [self h264Profile]) length]) + if ([(tmpString = [self profile]) length]) { encoder_profile = [tmpString UTF8String]; } - if ([(tmpString = [self h264Level]) length]) + if ([(tmpString = [self level]) length]) { encoder_level = [tmpString UTF8String]; } - encoder_preset = [[self x264Preset] UTF8String]; + encoder_preset = [[self preset] UTF8String]; } hb_job_set_encoder_preset (job, encoder_preset); hb_job_set_encoder_tune (job, encoder_tune); @@ -622,9 +629,7 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio } else if (job->vcodec & HB_VCODEC_FFMPEG_MASK) { - hb_job_set_encoder_options(job, - [[self.fAdvancedOptions optionsStringLavc] - UTF8String]); + hb_job_set_encoder_options(job, [self.lavcOptions UTF8String]); } /* Video settings */ @@ -662,7 +667,7 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio } } - switch( [[fVidQualityMatrix selectedCell] tag] ) + switch (self.qualityType) { case 0: /* ABR */ @@ -684,119 +689,87 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio - (void)prepareVideoForPreset:(NSMutableDictionary *)preset { - [preset setObject:[fVidEncoderPopUp titleOfSelectedItem] forKey:@"VideoEncoder"]; - /* x264 Options, this will either be advanced panel or the video tabs x264 presets panel with modded option string */ + preset[@"VideoEncoder"] = @(hb_video_encoder_get_name(self.codec)); + /* x264 Options, this will either be advanced panel or the video tabs x264 presets panel with modded option string */ if ([fX264UseAdvancedOptionsCheck state] == NSOnState) { /* use the old advanced panel */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:[self.fAdvancedOptions optionsString] forKey:@"x264Option"]; + preset[@"x264UseAdvancedOptions"] = @1; + preset[@"x264Option"] = [self.fAdvancedOptions optionsString]; } else { /* use the x264 preset system */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:[self x264Preset] forKey:@"x264Preset"]; - [preset setObject:[self x264Tune] forKey:@"x264Tune"]; - [preset setObject:[self x264OptionExtra] forKey:@"x264OptionExtra"]; - [preset setObject:[self h264Profile] forKey:@"h264Profile"]; - [preset setObject:[self h264Level] forKey:@"h264Level"]; + preset[@"x264UseAdvancedOptions"] = @0; + preset[@"VideoPreset"] = [self preset]; + preset[@"VideoTune"] = [self tune]; + preset[@"VideoOptionExtra"] = [self optionExtra]; + preset[@"VideoProfile"] = [self profile]; + preset[@"VideoLevel"] = [self level]; + /* * bonus: set the unparsed options to make the preset compatible * with old HB versions */ if (fX264PresetsUnparsedUTF8String != NULL) { - [preset setObject:[NSString stringWithUTF8String:fX264PresetsUnparsedUTF8String] - forKey:@"x264Option"]; + preset[@"x264Option"] = @(fX264PresetsUnparsedUTF8String); } else { - [preset setObject:@"" forKey:@"x264Option"]; + preset[@"x264Option"] = @""; } } /* FFmpeg (lavc) Option String */ - [preset setObject:[self.fAdvancedOptions optionsStringLavc] forKey:@"lavcOption"]; + preset[@"lavcOption"] = self.lavcOptions; /* though there are actually only 0 - 1 types available in the ui we need to map to the old 0 - 2 * set of indexes from when we had 0 == Target , 1 == Abr and 2 == Constant Quality for presets * to take care of any legacy presets. */ - [preset setObject:[NSNumber numberWithInteger:[[fVidQualityMatrix selectedCell] tag] +1 ] forKey:@"VideoQualityType"]; - [preset setObject:[fVidBitrateField stringValue] forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithFloat:[fVidQualityRFField floatValue]] forKey:@"VideoQualitySlider"]; + preset[@"VideoQualityType"] = @(self.qualityType +1); + preset[@"VideoAvgBitrate"] = [fVidBitrateField stringValue]; + preset[@"VideoQualitySlider"] = @([fVidQualityRFField floatValue]); /* Video framerate and framerate mode */ if ([fFramerateMatrix selectedRow] == 1) { - [preset setObject:@"cfr" forKey:@"VideoFramerateMode"]; + preset[@"VideoFramerateMode"] = @"cfr"; } if ([fVidRatePopUp indexOfSelectedItem] == 0) // Same as source is selected { - [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; + preset[@"VideoFramerate"] = @"Same as source"; if ([fFramerateMatrix selectedRow] == 0) { - [preset setObject:@"vfr" forKey:@"VideoFramerateMode"]; + preset[@"VideoFramerateMode"] = @"vfr"; } } else // translate the rate (selected item's tag) to the official libhb name { - [preset setObject:[NSString stringWithFormat:@"%s", - hb_video_framerate_get_name((int)[[fVidRatePopUp selectedItem] tag])] - forKey:@"VideoFramerate"]; + preset[@"VideoFramerate"] = [NSString stringWithFormat:@"%s", + hb_video_framerate_get_name((int)[[fVidRatePopUp selectedItem] tag])]; if ([fFramerateMatrix selectedRow] == 0) { - [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; + preset[@"VideoFramerateMode"] = @"pfr"; } } /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInteger:[fVidTwoPassCheck state]] forKey:@"VideoTwoPass"]; + preset[@"VideoTwoPass"] = @([fVidTwoPassCheck state]); /* Turbo 2 pass Encoding fVidTurboPassCheck*/ - [preset setObject:[NSNumber numberWithInteger:[fVidTurboPassCheck state]] forKey:@"VideoTurboTwoPass"]; + preset[@"VideoTurboTwoPass"] = @([fVidTurboPassCheck state]); } #pragma mark - Video - (IBAction) videoEncoderPopUpChanged: (id) sender { - /* if no valid encoder is selected, use the first one */ - if ([fVidEncoderPopUp selectedItem] == nil) - { - [fVidEncoderPopUp selectItemAtIndex:0]; - } - - int videoEncoder = (int)[[fVidEncoderPopUp selectedItem] tag]; - - [self.fAdvancedOptions setHidden:YES]; - /* If we are using x264 then show the x264 advanced panel and the x264 presets box */ - if (videoEncoder == HB_VCODEC_X264) - { - [self.fAdvancedOptions setHidden:NO]; - - // show the x264 presets box - [fX264PresetsBox setHidden:NO]; - } - else // we are FFmpeg (lavc) or Theora - { - [self.fAdvancedOptions setHidden:YES]; - [fX264PresetsBox setHidden:YES]; - - // We Are Lavc - if ([[fVidEncoderPopUp selectedItem] tag] & HB_VCODEC_FFMPEG_MASK) - { - [self.fAdvancedOptions setLavcOptsEnabled:YES]; - } - else /// We are Theora - { - [self.fAdvancedOptions setLavcOptsEnabled:NO]; - } - } + [self switchPresetViewForEncoder:self.codec]; [[NSNotificationCenter defaultCenter] postNotificationName:HBVideoEncoderChangedNotification object:self]; @@ -804,11 +777,10 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio [self twoPassCheckboxChanged: sender]; } - - (IBAction) twoPassCheckboxChanged: (id) sender { /* check to see if x264 is chosen */ - if([[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_X264) + if(self.codec == HB_VCODEC_X264) { if( [fVidTwoPassCheck state] == NSOnState) { @@ -870,7 +842,7 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio bitrate = quality = false; if( [fVidQualityMatrix isEnabled] ) { - switch( [[fVidQualityMatrix selectedCell] tag] ) + switch(self.qualityType) { case 0: bitrate = true; @@ -912,11 +884,10 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio ([fVidQualitySlider maxValue] - [fVidQualitySlider minValue] + 1)); [fVidQualityRFLabel setStringValue:[NSString stringWithFormat:@"%s", - hb_video_quality_get_name((int)[[fVidEncoderPopUp - selectedItem] tag])]]; + hb_video_quality_get_name(self.codec)]]; int direction; float minValue, maxValue, granularity; - hb_video_quality_get_limits((int)[[fVidEncoderPopUp selectedItem] tag], + hb_video_quality_get_limits([self codec], &minValue, &maxValue, &granularity, &direction); if (granularity < 1.0f) { @@ -966,8 +937,9 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio float inverseValue = ([fVidQualitySlider minValue] + [fVidQualitySlider maxValue] - [fVidQualitySlider floatValue]); - hb_video_quality_get_limits((int)[[fVidEncoderPopUp selectedItem] tag], - &minValue, &maxValue, &granularity, &direction); + + hb_video_quality_get_limits(self.codec, &minValue, &maxValue, &granularity, &direction); + if (!direction) { [fVidQualityRFField setStringValue:[NSString stringWithFormat:@"%.2f", @@ -979,7 +951,7 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio inverseValue]]; } /* Show a warning if x264 and rf 0 which is lossless */ - if ([[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_X264 && inverseValue == 0.0) + if (self.codec == HB_VCODEC_X264 && inverseValue == 0.0) { [fVidQualityRFField setStringValue:[NSString stringWithFormat:@"%.2f (Warning: Lossless)", inverseValue]]; @@ -988,74 +960,114 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio [self.fHBController customSettingUsed: sender]; } -#pragma mark - Video x264 Presets +#pragma mark - Video x264/x265 Presets + +- (void)switchPresetViewForEncoder:(int)encoder +{ + [self.fAdvancedOptions setHidden:YES]; + + if (encoder == HB_VCODEC_X264 || encoder == HB_VCODEC_X265) + { + [fPresetsBox setContentView:fPresetView]; + [self setupPresetsWidgetsForEncoder:encoder]; + + if (encoder == HB_VCODEC_X264) + { + [self.fAdvancedOptions setHidden:NO]; + } + } + else if (encoder & HB_VCODEC_FFMPEG_MASK) + { + [fPresetsBox setContentView:fSimplePresetView]; + } + else + { + [fPresetsBox setContentView:nil]; + } +} -- (void) setupX264PresetsWidgets +- (void) setupPresetsWidgetsForEncoder:(int)encoder { + + if (encoder == HB_VCODEC_X264) + { + [fX264UseAdvancedOptionsCheck setHidden:NO]; + [fFastDecodeCheck setHidden:NO]; + } + else + { + [fX264UseAdvancedOptionsCheck setHidden:YES]; + [fFastDecodeCheck setHidden:YES]; + } + NSUInteger i; // populate the preset system widgets via hb_video_encoder_get_* functions. - // store x264 preset names - const char* const *x264_presets = hb_video_encoder_get_presets(HB_VCODEC_X264); + // store preset names + const char* const *presets = hb_video_encoder_get_presets(encoder); NSMutableArray *tmp_array = [[NSMutableArray alloc] init]; - for (i = 0; x264_presets[i] != NULL; i++) + for (i = 0; presets[i] != NULL; i++) { - [tmp_array addObject:[NSString stringWithUTF8String:x264_presets[i]]]; - if (!strcasecmp(x264_presets[i], "medium")) + [tmp_array addObject:@(presets[i])]; + if (!strcasecmp(presets[i], "medium")) { - fX264MediumPresetIndex = i; + fMediumPresetIndex = i; } } - fX264PresetNames = [[NSArray alloc] initWithArray:tmp_array]; + fPresetNames = [[NSArray alloc] initWithArray:tmp_array]; [tmp_array release]; - // setup the x264 preset slider - [fX264PresetsSlider setMinValue:0]; - [fX264PresetsSlider setMaxValue:[fX264PresetNames count]-1]; - [fX264PresetsSlider setNumberOfTickMarks:[fX264PresetNames count]]; - [fX264PresetsSlider setIntegerValue:fX264MediumPresetIndex]; - [fX264PresetsSlider setTickMarkPosition:NSTickMarkAbove]; - [fX264PresetsSlider setAllowsTickMarkValuesOnly:YES]; - [self x264PresetsSliderChanged: nil]; - // setup the x264 tune popup - [fX264TunePopUp removeAllItems]; - [fX264TunePopUp addItemWithTitle: @"none"]; - const char* const *x264_tunes = hb_video_encoder_get_tunes(HB_VCODEC_X264); - for (int i = 0; x264_tunes[i] != NULL; i++) + // setup the preset slider + [fPresetsSlider setMinValue:0]; + [fPresetsSlider setMaxValue:[fPresetNames count]-1]; + [fPresetsSlider setNumberOfTickMarks:[fPresetNames count]]; + [fPresetsSlider setIntegerValue:fMediumPresetIndex]; + [fPresetsSlider setTickMarkPosition:NSTickMarkAbove]; + [fPresetsSlider setAllowsTickMarkValuesOnly:YES]; + [self presetsSliderChanged: nil]; + // setup the tune popup + [fTunePopUp removeAllItems]; + [fTunePopUp addItemWithTitle: @"none"]; + const char* const *tunes = hb_video_encoder_get_tunes(encoder); + for (int i = 0; tunes[i] != NULL; i++) { // we filter out "fastdecode" as we have a dedicated checkbox for it - if (strcasecmp(x264_tunes[i], "fastdecode") != 0) + if (strcasecmp(tunes[i], "fastdecode") != 0) { - [fX264TunePopUp addItemWithTitle: [NSString stringWithUTF8String:x264_tunes[i]]]; + [fTunePopUp addItemWithTitle: @(tunes[i])]; } } // the fastdecode checkbox is off by default - [fX264FastDecodeCheck setState: NSOffState]; + [fFastDecodeCheck setState: NSOffState]; // setup the h264 profile popup - [fX264ProfilePopUp removeAllItems]; - const char* const *h264_profiles = hb_video_encoder_get_profiles(HB_VCODEC_X264); - for (int i = 0; h264_profiles[i] != NULL; i++) + [fProfilePopUp removeAllItems]; + const char* const *profiles = hb_video_encoder_get_profiles(encoder); + for (int i = 0; profiles[i] != NULL; i++) + { + [fProfilePopUp addItemWithTitle: @(profiles[i])]; + } + // setup the level popup + [fLevelPopUp removeAllItems]; + const char* const *levels = hb_video_encoder_get_levels(encoder); + for (int i = 0; levels != NULL && levels[i] != NULL; i++) { - [fX264ProfilePopUp addItemWithTitle: [NSString stringWithUTF8String:h264_profiles[i]]]; + [fLevelPopUp addItemWithTitle: @(levels[i])]; } - // setup the h264 level popup - [fX264LevelPopUp removeAllItems]; - const char* const *h264_levels = hb_video_encoder_get_levels(HB_VCODEC_X264); - for (int i = 0; h264_levels[i] != NULL; i++) + if ([[fLevelPopUp itemArray] count] == 0) { - [fX264LevelPopUp addItemWithTitle: [NSString stringWithUTF8String:h264_levels[i]]]; + [fLevelPopUp addItemWithTitle:@"auto"]; } // clear the additional x264 options - [fDisplayX264PresetsAdditonalOptionsTextField setStringValue:@""]; + [fDisplayPresetsAdditonalOptionsTextField setStringValue:@""]; } -- (void) enableX264Widgets: (bool) enable +- (void) enableEncoderOptionsWidgets: (BOOL) enable { NSControl *controls[] = { - fX264PresetsSlider, fX264PresetSliderLabel, fX264PresetSelectedTextField, - fX264TunePopUp, fX264TunePopUpLabel, fX264FastDecodeCheck, - fDisplayX264PresetsAdditonalOptionsTextField, fDisplayX264PresetsAdditonalOptionsLabel, - fX264ProfilePopUp, fX264ProfilePopUpLabel, - fX264LevelPopUp, fX264LevelPopUpLabel, + fPresetsSlider, fPresetSliderLabel, fPresetSelectedTextField, + fTunePopUp, fTunePopUpLabel, fFastDecodeCheck, + fDisplayPresetsAdditonalOptionsTextField, fDisplayPresetsAdditonalOptionsLabel, + fProfilePopUp, fProfilePopUpLabel, + fLevelPopUp, fLevelPopUpLabel, fDisplayX264PresetsUnparseTextField, }; @@ -1085,7 +1097,7 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio } } -- (IBAction) updateX264Widgets: (id) sender +- (IBAction) updateEncoderOptionsWidgets: (id) sender { if ([fX264UseAdvancedOptionsCheck state] == NSOnState) { @@ -1102,8 +1114,7 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio { if (fX264PresetsUnparsedUTF8String != NULL) { - [self.fAdvancedOptions setOptions: - [NSString stringWithUTF8String:fX264PresetsUnparsedUTF8String]]; + [self.fAdvancedOptions setOptions:@(fX264PresetsUnparsedUTF8String)]; } else { @@ -1112,159 +1123,182 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio } } // enable/disable, populate and update the various widgets - [self enableX264Widgets: YES]; - [self x264PresetsSliderChanged:nil]; + [self enableEncoderOptionsWidgets: YES]; + [self presetsSliderChanged:nil]; [self.fAdvancedOptions X264AdvancedOptionsSet: nil]; } +#pragma mark - Lavc presets + +- (void) setLavcOptions: (NSString *)optionExtra +{ + if (!optionExtra) + { + [fLavcOptionsTextField setStringValue:@""]; + return; + } + [fLavcOptionsTextField setStringValue:optionExtra]; +} + +- (NSString *) lavcOptions +{ + return [fLavcOptionsTextField stringValue]; +} + #pragma mark - -#pragma mark x264 preset system +#pragma mark x264/x265 preset system -- (NSString *) x264Preset +- (NSString *) preset { - return (NSString *)[fX264PresetNames objectAtIndex:[fX264PresetsSlider intValue]]; + return (NSString *)fPresetNames[[fPresetsSlider intValue]]; } -- (NSString *) x264Tune +- (NSString *) tune { - NSString *x264Tune = @""; - if ([fX264TunePopUp indexOfSelectedItem]) + NSString *tune = @""; + if ([fTunePopUp indexOfSelectedItem]) { - x264Tune = [x264Tune stringByAppendingString: - [fX264TunePopUp titleOfSelectedItem]]; + tune = [tune stringByAppendingString: + [fTunePopUp titleOfSelectedItem]]; } - if ([fX264FastDecodeCheck state]) + if ([fFastDecodeCheck state]) { - if ([x264Tune length]) + if ([tune length]) { - x264Tune = [x264Tune stringByAppendingString: @","]; + tune = [tune stringByAppendingString: @","]; } - x264Tune = [x264Tune stringByAppendingString: @"fastdecode"]; + tune = [tune stringByAppendingString: @"fastdecode"]; } - return x264Tune; + return tune; } -- (NSString*) x264OptionExtra +- (NSString *) optionExtra { - return [fDisplayX264PresetsAdditonalOptionsTextField stringValue]; + return [fDisplayPresetsAdditonalOptionsTextField stringValue]; } -- (NSString*) h264Profile +- (NSString *) profile { - if ([fX264ProfilePopUp indexOfSelectedItem]) + if ([fProfilePopUp indexOfSelectedItem]) { - return [fX264ProfilePopUp titleOfSelectedItem]; + return [fProfilePopUp titleOfSelectedItem]; } return @""; } -- (NSString*) h264Level +- (NSString *) level { - if ([fX264LevelPopUp indexOfSelectedItem]) + if ([fLevelPopUp indexOfSelectedItem]) { - return [fX264LevelPopUp titleOfSelectedItem]; + return [fLevelPopUp titleOfSelectedItem]; } return @""; } -- (void) setX264Preset: (NSString*)x264Preset +- (void) setPreset: (NSString *)preset { - if (x264Preset) + if (preset) { - NSString *name; - NSEnumerator *enumerator = [fX264PresetNames objectEnumerator]; - while ((name = (NSString *)[enumerator nextObject])) + for (NSString *name in fPresetNames) { - if ([name isEqualToString:x264Preset]) + if ([name isEqualToString:preset]) { - [fX264PresetsSlider setIntegerValue: - [fX264PresetNames indexOfObject:name]]; + [fPresetsSlider setIntegerValue: + [fPresetNames indexOfObject:name]]; return; } } } - [fX264PresetsSlider setIntegerValue:fX264MediumPresetIndex]; + [fPresetsSlider setIntegerValue:fMediumPresetIndex]; } -- (void) setX264Tune: (NSString*)x264Tune +- (void) setTune: (NSString *)tune { - if (!x264Tune) + if (!tune) { - [fX264TunePopUp selectItemAtIndex:0]; - [fX264FastDecodeCheck setState:NSOffState]; + [fTunePopUp selectItemAtIndex:0]; + [fFastDecodeCheck setState:NSOffState]; return; } // handle fastdecode - if ([x264Tune rangeOfString:@"fastdecode"].location != NSNotFound) + if ([tune rangeOfString:@"fastdecode"].location != NSNotFound) { - [fX264FastDecodeCheck setState:NSOnState]; + [fFastDecodeCheck setState:NSOnState]; } else { - [fX264FastDecodeCheck setState:NSOffState]; + [fFastDecodeCheck setState:NSOffState]; } // filter out fastdecode - x264Tune = [x264Tune stringByReplacingOccurrencesOfString:@"," + tune = [tune stringByReplacingOccurrencesOfString:@"," withString:@""]; - x264Tune = [x264Tune stringByReplacingOccurrencesOfString:@"fastdecode" + tune = [tune stringByReplacingOccurrencesOfString:@"fastdecode" withString:@""]; // set the tune - [fX264TunePopUp selectItemWithTitle:x264Tune]; + [fTunePopUp selectItemWithTitle:tune]; // fallback - if ([fX264TunePopUp indexOfSelectedItem] == -1) + if ([fTunePopUp indexOfSelectedItem] == -1) { - [fX264TunePopUp selectItemAtIndex:0]; + [fTunePopUp selectItemAtIndex:0]; } } -- (void) setX264OptionExtra: (NSString*)x264OptionExtra +- (void) setOptionExtra: (NSString *)optionExtra { - if (!x264OptionExtra) + if (!optionExtra) { - [fDisplayX264PresetsAdditonalOptionsTextField setStringValue:@""]; + [fDisplayPresetsAdditonalOptionsTextField setStringValue:@""]; return; } - [fDisplayX264PresetsAdditonalOptionsTextField setStringValue:x264OptionExtra]; + [fDisplayPresetsAdditonalOptionsTextField setStringValue:optionExtra]; } -- (void) setH264Profile: (NSString*)h264Profile +- (void) setProfile: (NSString *)profile { - if (!h264Profile) + if (!profile) { - [fX264ProfilePopUp selectItemAtIndex:0]; + [fProfilePopUp selectItemAtIndex:0]; return; } // set the profile - [fX264ProfilePopUp selectItemWithTitle:h264Profile]; + [fProfilePopUp selectItemWithTitle:profile]; // fallback - if ([fX264ProfilePopUp indexOfSelectedItem] == -1) + if ([fProfilePopUp indexOfSelectedItem] == -1) { - [fX264ProfilePopUp selectItemAtIndex:0]; + [fProfilePopUp selectItemAtIndex:0]; } } -- (void) setH264Level: (NSString*)h264Level +- (void) setLevel: (NSString *)level { - if (!h264Level) + if (!level) { - [fX264LevelPopUp selectItemAtIndex:0]; + [fLevelPopUp selectItemAtIndex:0]; return; } // set the level - [fX264LevelPopUp selectItemWithTitle:h264Level]; + [fLevelPopUp selectItemWithTitle:level]; // fallback - if ([fX264LevelPopUp indexOfSelectedItem] == -1) + if ([fLevelPopUp indexOfSelectedItem] == -1) { - [fX264LevelPopUp selectItemAtIndex:0]; + [fLevelPopUp selectItemAtIndex:0]; } } - -- (IBAction) x264PresetsSliderChanged: (id) sender +- (IBAction) presetsSliderChanged: (id) sender { // we assume the preset names and slider were setup properly - [fX264PresetSelectedTextField setStringValue: [self x264Preset]]; - [self x264PresetsChangedDisplayExpandedOptions:nil]; + [fPresetSelectedTextField setStringValue: [self preset]]; + + if (self.codec == HB_VCODEC_X264) + { + [self x264PresetsChangedDisplayExpandedOptions:nil]; + [fDisplayX264PresetsUnparseTextField setHidden:NO]; + } + else + { + [fDisplayX264PresetsUnparseTextField setHidden:YES]; + } } @@ -1274,6 +1308,11 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio - (IBAction) x264PresetsChangedDisplayExpandedOptions: (id) sender { + if (self.codec != HB_VCODEC_X264) + { + return; + } + /* API reference: * * char * hb_x264_param_unparse(const char *x264_preset, @@ -1284,7 +1323,7 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio * int width, int height); */ NSString *tmpString; - const char *x264_preset = [[self x264Preset] UTF8String]; + const char *x264_preset = [[self preset] UTF8String]; const char *x264_tune = NULL; const char *advanced_opts = NULL; const char *h264_profile = NULL; @@ -1292,27 +1331,27 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio int width = 1; int height = 1; // prepare the tune, advanced options, profile and level - if ([(tmpString = [self x264Tune]) length]) + if ([(tmpString = [self tune]) length]) { x264_tune = [tmpString UTF8String]; } - if ([(tmpString = [self x264OptionExtra]) length]) + if ([(tmpString = [self optionExtra]) length]) { advanced_opts = [tmpString UTF8String]; } - if ([(tmpString = [self h264Profile]) length]) + if ([(tmpString = [self profile]) length]) { h264_profile = [tmpString UTF8String]; } - if ([(tmpString = [self h264Level]) length]) + if ([(tmpString = [self level]) length]) { h264_level = [tmpString UTF8String]; } // width and height must be non-zero - if (_fX264PresetsWidthForUnparse && _fX264PresetsHeightForUnparse) + if (_fPresetsWidthForUnparse && _fPresetsHeightForUnparse) { - width = (int)_fX264PresetsWidthForUnparse; - height = (int)_fX264PresetsHeightForUnparse; + width = (int)_fPresetsWidthForUnparse; + height = (int)_fPresetsHeightForUnparse; } // free the previous unparsed string free(fX264PresetsUnparsedUTF8String); |