#import "HBPreferencesController.h"
#import "HBDVDDetector.h"
#import "HBPresets.h"
+#import "HBPreviewController.h"
+#import "HBFilterController.h"
#define DragDropSimplePboardType @"MyCustomOutlineViewPboardType"
static NSString * PauseEncodingIdentifier = @"Pause Encoding Item Identifier";
static NSString * ShowQueueIdentifier = @"Show Queue Item Identifier";
static NSString * AddToQueueIdentifier = @"Add to Queue Item Identifier";
+static NSString * ShowPictureIdentifier = @"Show Picture Window Item Identifier";
static NSString * ShowActivityIdentifier = @"Debug Output Item Identifier";
static NSString * ChooseSourceIdentifier = @"Choose Source Item Identifier";
attributes:nil];
}
outputPanel = [[HBOutputPanelController alloc] init];
- fPictureController = [[PictureController alloc] initWithDelegate:self];
+ fPictureController = [[PictureController alloc] init];
+ fPictureFilterController = [[PictureFilterController alloc] init];
fQueueController = [[HBQueueController alloc] init];
fAdvancedOptions = [[HBAdvancedController alloc] init];
/* we init the HBPresets class which currently is only used
fPresetsBuiltin = [[HBPresets alloc] init];
fPreferencesController = [[HBPreferencesController alloc] init];
/* Lets report the HandBrake version number here to the activity log and text log file */
- NSString *versionStringFull = [[NSString stringWithFormat: @"Handbrake Version: %@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleGetInfoString"]] stringByAppendingString: [NSString stringWithFormat: @" (%@)", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]]];
+ NSString *versionStringFull = [[NSString stringWithFormat: @"Handbrake Version: %@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]] stringByAppendingString: [NSString stringWithFormat: @" (%@)", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]]];
[self writeToActivityLog: "%s", [versionStringFull UTF8String]];
return self;
[GrowlApplicationBridge setGrowlDelegate: self];
/* Init others controllers */
[fPictureController SetHandle: fHandle];
+ [fPictureController setHBController: self];
+ /* fPictureController */
+ [fPictureFilterController SetHandle: fHandle];
+ [fPictureFilterController setHBController: self];
+
[fQueueController setHandle: fQueueEncodeLibhb];
[fQueueController setHBController: self];
[fChapterTable setDataSource:fChapterTitlesDelegate];
[fChapterTable setDelegate:fChapterTitlesDelegate];
+ [fPresetsOutlineView setAutosaveName:@"Presets View"];
+ [fPresetsOutlineView setAutosaveExpandedItems:YES];
+
+ dockIconProgress = 0;
+
/* Call UpdateUI every 1/2 sec */
[[NSRunLoop currentRunLoop] addTimer:[NSTimer
scheduledTimerWithTimeInterval:0.5 target:self
}
else
{
+ /* We show whichever open source window specified in LaunchSourceBehavior preference key */
+ if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source"])
+ {
+ [self browseSources:nil];
+ }
- /* Show Browse Sources Window ASAP */
- [self performSelectorOnMainThread:@selector(browseSources:)
- withObject:nil waitUntilDone:NO];
+ if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source (Title Specific)"])
+ {
+ [self browseSources:(id)fOpenSourceTitleMMenu];
+ }
}
}
if (returnCode == NSAlertOtherReturn)
{
[self clearQueueAllItems];
- [self performSelectorOnMainThread:@selector(browseSources:)
- withObject:nil waitUntilDone:NO];
+ /* We show whichever open source window specified in LaunchSourceBehavior preference key */
+ if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source"])
+ {
+ [self browseSources:nil];
+ }
+
+ if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source (Title Specific)"])
+ {
+ [self browseSources:(id)fOpenSourceTitleMMenu];
+ }
}
else
{
- (NSApplicationTerminateReply) applicationShouldTerminate: (NSApplication *) app
{
+ /* if we are in preview full screen mode, we need to go to
+ * windowed mode and release the display before we terminate.
+ * We do it here (instead of applicationWillTerminate) so we
+ * release the displays and can then see the alerts below.
+ */
+ if ([fPictureController previewFullScreenMode] == YES)
+ {
+ [fPictureController previewGoWindowed:nil];
+ }
- // Warn if encoding a movie
hb_state_t s;
hb_get_state( fQueueEncodeLibhb, &s );
- (void)applicationWillTerminate:(NSNotification *)aNotification
{
- [browsedSourceDisplayName release];
+
+ [browsedSourceDisplayName release];
[outputPanel release];
[fQueueController release];
+ [fPreviewController release];
+ [fPictureController release];
+ [fPictureFilterController release];
+
hb_close(&fHandle);
hb_close(&fQueueEncodeLibhb);
}
/* Show/Dont Show Presets drawer upon launch based
on user preference DefaultPresetsDrawerShow*/
- if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow"] > 0)
+ if( [[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow"] > 0 )
{
+ [fPresetDrawer setDelegate:self];
+ NSSize drawerSize = NSSizeFromString( [[NSUserDefaults standardUserDefaults]
+ stringForKey:@"Drawer Size"] );
+ if( drawerSize.width )
+ [fPresetDrawer setContentSize: drawerSize];
[fPresetDrawer open];
}
-
-
-
+
/* Destination box*/
NSMenuItem *menuItem;
[fDstFormatPopUp removeAllItems];
- (void) enableUI: (bool) b
{
NSControl * controls[] =
- { fSrcTitleField, fSrcTitlePopUp,
+ { fSrcTitleField, fSrcTitlePopUp,
fSrcChapterField, fSrcChapterStartPopUp, fSrcChapterToField,
fSrcChapterEndPopUp, fSrcDuration1Field, fSrcDuration2Field,
fDstFormatField, fDstFormatPopUp, fDstFile1Field, fDstFile2Field,
- fDstBrowseButton, fVidRateField, fVidRatePopUp,
- fVidEncoderField, fVidEncoderPopUp, fVidQualityField,
- fVidQualityMatrix, fVidGrayscaleCheck, fSubField, fSubPopUp,
+ fDstBrowseButton, fVidRateField, fVidRatePopUp,fVidEncoderField, fVidEncoderPopUp, fVidQualityField,
+ fPictureSizeField,fPictureCroppingField, fVideoFiltersField,fVidQualityMatrix, fSubField, fSubPopUp,
fAudSourceLabel, fAudCodecLabel, fAudMixdownLabel, fAudSamplerateLabel, fAudBitrateLabel,
fAudTrack1Label, fAudTrack2Label, fAudTrack3Label, fAudTrack4Label,
fAudLang1PopUp, fAudLang2PopUp, fAudLang3PopUp, fAudLang4PopUp,
fAudTrack1BitratePopUp, fAudTrack2BitratePopUp, fAudTrack3BitratePopUp, fAudTrack4BitratePopUp,
fAudDrcLabel, fAudTrack1DrcSlider, fAudTrack1DrcField, fAudTrack2DrcSlider,
fAudTrack2DrcField, fAudTrack3DrcSlider, fAudTrack3DrcField, fAudTrack4DrcSlider,fAudTrack4DrcField,
- fPictureButton,fQueueStatus,fPicSettingARkeep, fPicSettingDeinterlace,fPicLabelSettings,fPicLabelSrc,
- fPicLabelOutp,fPicSettingsSrc,fPicSettingsOutp,fPicSettingsAnamorphic,
- fPicLabelAr,fPicLabelDeinterlace,fPicSettingPAR,fPicLabelAnamorphic,fPresetsAdd,fPresetsDelete,
- fCreateChapterMarkers,fVidTurboPassCheck,fDstMp4LargeFileCheck,fPicLabelAutoCrop,
- fPicSettingAutoCrop,fPicSettingDetelecine,fPicLabelDetelecine,fPicLabelDenoise,fPicSettingDenoise,
- fSubForcedCheck,fPicSettingDeblock,fPicLabelDeblock,fPicLabelDecomb,fPicSettingDecomb,fPresetsOutlineView,
- fAudDrcLabel,fDstMp4HttpOptFileCheck,fDstMp4iPodFileCheck};
-
+ fQueueStatus,fPresetsAdd,fPresetsDelete,
+ fCreateChapterMarkers,fVidTurboPassCheck,fDstMp4LargeFileCheck,fSubForcedCheck,fPresetsOutlineView,
+ fAudDrcLabel,fDstMp4HttpOptFileCheck,fDstMp4iPodFileCheck,fVidQualityRFField,fVidQualityRFLabel};
+
for( unsigned i = 0;
- i < sizeof( controls ) / sizeof( NSControl * ); i++ )
+ i < sizeof( controls ) / sizeof( NSControl * ); i++ )
{
if( [[controls[i] className] isEqualToString: @"NSTextField"] )
{
if( ![tf isBezeled] )
{
[tf setTextColor: b ? [NSColor controlTextColor] :
- [NSColor disabledControlTextColor]];
+ [NSColor disabledControlTextColor]];
continue;
}
}
[controls[i] setEnabled: b];
-
+
}
-
+
if (b) {
-
+
/* if we're enabling the interface, check if the audio mixdown controls need to be enabled or not */
/* these will have been enabled by the mass control enablement above anyway, so we're sense-checking it here */
[self setEnabledStateOfAudioMixdownControls:nil];
/* we also call calculatePictureSizing here to sense check if we already have vfr selected */
[self calculatePictureSizing:nil];
-
+
} else {
-
+
[fPresetsOutlineView setEnabled: NO];
-
+
}
-
+
[self videoMatrixChanged:nil];
[fAdvancedOptions enableUI:b];
}
NSLocalizedString( @"Scanning title %d of %d...", @"" ),
p.title_cur, p.title_count]];
[fScanIndicator setHidden: NO];
- [fScanIndicator setDoubleValue: 100.0 * ( p.title_cur - 1 ) / p.title_count];
+ [fScanIndicator setDoubleValue: 100.0 * ((double)( p.title_cur - 1 ) / p.title_count)];
break;
}
#undef p
[fQueueController setQueueStatusString: [NSString stringWithFormat:
NSLocalizedString( @"Queue Scanning title %d of %d...", @"" ),
p.title_cur, p.title_count]];
-
- [fRipIndicator setHidden: NO];
- [fRipIndicator setDoubleValue: 100.0 * ( p.title_cur - 1 ) / p.title_count];
break;
}
#undef p
#define p s.param.scandone
case HB_STATE_SCANDONE:
{
- [fRipIndicator setIndeterminate: NO];
- [fRipIndicator setDoubleValue: 0.0];
-
[self writeToActivityLog:"ScanDone state received from fQueueEncodeLibhb"];
[self processNewQueueEncode];
[[fWindow toolbar] validateVisibleItems];
#define p s.param.working
case HB_STATE_WORKING:
{
- float progress_total;
NSMutableString * string;
/* Update text field */
string = [NSMutableString stringWithFormat: NSLocalizedString( @"Encoding: pass %d of %d, %.2f %%", @"" ), p.job_cur, p.job_count, 100.0 * p.progress];
/* Set the status string in fQueueController as well */
[fQueueController setQueueStatusString: string];
/* Update slider */
- progress_total = ( p.progress + p.job_cur - 1 ) / p.job_count;
+ double progress_total = ( p.progress + p.job_cur - 1 ) / p.job_count;
[fRipIndicator setIndeterminate: NO];
- [fRipIndicator setDoubleValue: 100.0 * progress_total];
+ [fRipIndicator setDoubleValue:100.0 * progress_total];
// If progress bar hasn't been revealed at the bottom of the window, do
// that now. This code used to be in doRip. I moved it to here to handle
fRipIndicatorShown = YES;
}
-
+
/* Update dock icon */
- [self UpdateDockIcon: progress_total];
-
+ if( dockIconProgress < 100.0 * progress_total )
+ {
+ [self UpdateDockIcon: progress_total];
+ dockIconProgress += 5;
+ }
+
break;
}
#undef p
/* Set the status string in fQueueController as well */
[fQueueController setQueueStatusString: NSLocalizedString( @"Encode Finished.", @"" )];
[fRipIndicator setIndeterminate: NO];
+ [fRipIndicator stopAnimation: nil];
[fRipIndicator setDoubleValue: 0.0];
[[fWindow toolbar] validateVisibleItems];
/* Restore dock icon */
[self UpdateDockIcon: -1.0];
+ dockIconProgress = 0;
if( fRipIndicatorShown )
{
}
/* We use this to write messages to stderr from the macgui which show up in the activity window and log*/
-- (void) writeToActivityLog:(char *) format, ...
+- (void) writeToActivityLog:(const char *) format, ...
{
va_list args;
va_start(args, format);
[item setTarget: self];
[item setAction: @selector(Pause:)];
}
- else if ([itemIdent isEqualToString: ShowActivityIdentifier]) {
+ else if ([itemIdent isEqualToString: ShowPictureIdentifier])
+ {
+ [item setLabel: @"Picture Settings"];
+ [item setPaletteLabel: @"Show Picture Settings"];
+ [item setToolTip: @"Show Picture Settings"];
+ [item setImage: [NSImage imageNamed: @"pref-picture"]];
+ [item setTarget: self];
+ [item setAction: @selector(showPicturePanel:)];
+ }
+ else if ([itemIdent isEqualToString: ShowActivityIdentifier])
+ {
[item setLabel: @"Activity Window"];
[item setPaletteLabel: @"Show Activity Window"];
[item setToolTip: @"Show Activity Window"];
{
return [NSArray arrayWithObjects: ChooseSourceIdentifier, NSToolbarSeparatorItemIdentifier, StartEncodingIdentifier,
PauseEncodingIdentifier, AddToQueueIdentifier, ShowQueueIdentifier, NSToolbarFlexibleSpaceItemIdentifier,
- NSToolbarSpaceItemIdentifier, ShowActivityIdentifier, ToggleDrawerIdentifier, nil];
+ NSToolbarSpaceItemIdentifier, ShowPictureIdentifier, ShowActivityIdentifier, ToggleDrawerIdentifier, nil];
}
- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar
{
return [NSArray arrayWithObjects: StartEncodingIdentifier, PauseEncodingIdentifier, AddToQueueIdentifier,
- ChooseSourceIdentifier, ShowQueueIdentifier, ShowActivityIdentifier, ToggleDrawerIdentifier,
+ ChooseSourceIdentifier, ShowQueueIdentifier, ShowPictureIdentifier, ShowActivityIdentifier, ToggleDrawerIdentifier,
NSToolbarCustomizeToolbarItemIdentifier, NSToolbarFlexibleSpaceItemIdentifier,
NSToolbarSpaceItemIdentifier, NSToolbarSeparatorItemIdentifier, nil];
}
return YES;
}
if (SuccessfulScan)
+ {
if ([ident isEqualToString: AddToQueueIdentifier])
return YES;
+ if ([ident isEqualToString: ShowPictureIdentifier])
+ return YES;
+ }
}
else if (s.state == HB_STATE_PAUSED)
{
return YES;
if ([ident isEqualToString: AddToQueueIdentifier])
return YES;
+ if ([ident isEqualToString: ShowPictureIdentifier])
+ return YES;
}
else if (s.state == HB_STATE_SCANNING)
return NO;
}
if ([ident isEqualToString: AddToQueueIdentifier])
return YES;
+ if ([ident isEqualToString: ShowPictureIdentifier])
+ return YES;
}
}
[self writeToActivityLog: "trying to open a physical dvd at: %s", [scanPath UTF8String]];
/* lets check for vlc here to make sure we have a dylib available to use for decrypting */
- NSString *vlcPath = @"/Applications/VLC.app";
+ NSString *vlcPath = @"/Applications/VLC.app/Contents/MacOS/lib/libdvdcss.2.dylib";
NSFileManager * fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:vlcPath] == 0)
{
cancelScanDecrypt = 1;
[self writeToActivityLog: "VLC app not found for decrypting physical dvd"];
int status;
- status = NSRunAlertPanel(@"HandBrake could not find VLC.",@"Please download and install VLC media player in your /Applications folder if you wish to read encrypted DVDs.", @"Get VLC", @"Cancel Scan", @"Attempt Scan Anyway");
+ status = NSRunAlertPanel(@"HandBrake could not find VLC or your VLC is out of date.",@"Please download and install VLC media player in your /Applications folder if you wish to read encrypted DVDs.", @"Get VLC", @"Cancel Scan", @"Attempt Scan Anyway");
[NSApp requestUserAttention:NSCriticalRequest];
if (status == NSAlertDefaultReturn)
SuccessfulScan = YES;
[self enableUI: YES];
- /* if its the initial successful scan after awakeFromNib */
- if (currentSuccessfulScanCount == 1)
- {
- [self selectDefaultPreset:nil];
- /* initially set deinterlace to 0, will be overridden reset by the default preset anyway */
- //[fPictureController setDeinterlace:0];
-
- /* lets set Denoise to index 0 or "None" since this is the first scan */
- //[fPictureController setDenoise:0];
-
- [fPictureController setInitialPictureFilters];
- }
+ /* if its the initial successful scan after awakeFromNib */
+ if (currentSuccessfulScanCount == 1)
+ {
+ [self selectDefaultPreset:nil];
+
+ [fPictureFilterController setInitialPictureFilters];
+
+ // Open preview window now if it was visible when HB was closed
+ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"PreviewWindowIsOpen"])
+ [self showPreviewWindow:nil];
+
+ // Open picture sizing window now if it was visible when HB was closed
+ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"PictureSizeWindowIsOpen"])
+ [self showPicturePanel:nil];
+
+ // Open filters window now if it was visible when HB was closed
+ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"PictureFiltersWindowIsOpen"])
+ [self showFiltersPanel:nil];
+ }
}
return NO;
}
+- (NSSize) drawerWillResizeContents:(NSDrawer *) drawer toSize:(NSSize) contentSize {
+ [[NSUserDefaults standardUserDefaults] setObject:NSStringFromSize( contentSize ) forKey:@"Drawer Size"];
+ return contentSize;
+}
#pragma mark -
#pragma mark Queue File
[queueFileJob setObject:[NSNumber numberWithInt:[fVidQualityMatrix selectedRow]] forKey:@"VideoQualityType"];
[queueFileJob setObject:[fVidTargetSizeField stringValue] forKey:@"VideoTargetSize"];
[queueFileJob setObject:[fVidBitrateField stringValue] forKey:@"VideoAvgBitrate"];
- [queueFileJob setObject:[NSNumber numberWithFloat:[fVidQualitySlider floatValue]] forKey:@"VideoQualitySlider"];
+ [queueFileJob setObject:[NSNumber numberWithFloat:[fVidQualityRFField floatValue]] forKey:@"VideoQualitySlider"];
/* Framerate */
[queueFileJob setObject:[fVidRatePopUp titleOfSelectedItem] forKey:@"VideoFramerate"];
- /* GrayScale */
- [queueFileJob setObject:[NSNumber numberWithInt:[fVidGrayscaleCheck state]] forKey:@"VideoGrayScale"];
/* 2 Pass Encoding */
[queueFileJob setObject:[NSNumber numberWithInt:[fVidTwoPassCheck state]] forKey:@"VideoTwoPass"];
/* Turbo 2 pass Encoding fVidTurboPassCheck*/
[queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->width] forKey:@"PictureWidth"];
[queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PictureHeight"];
[queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->keep_ratio] forKey:@"PictureKeepRatio"];
- [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->pixel_ratio] forKey:@"PicturePAR"];
+ [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.mode] forKey:@"PicturePAR"];
NSString * pictureSummary;
- pictureSummary = [NSString stringWithFormat:@"Source: %@ Output: %@ Anamorphic: %@",
- [fPicSettingsSrc stringValue],
- [fPicSettingsOutp stringValue],
- [fPicSettingsAnamorphic stringValue]];
+ pictureSummary = [fPictureSizeField stringValue];
[queueFileJob setObject:pictureSummary forKey:@"PictureSizingSummary"];
/* Set crop settings here */
[queueFileJob setObject:[NSNumber numberWithInt:[fPictureController autoCrop]] forKey:@"PictureAutoCrop"];
[queueFileJob setObject:[NSNumber numberWithInt:job->crop[3]] forKey:@"PictureRightCrop"];
/* Picture Filters */
- [queueFileJob setObject:[NSNumber numberWithInt:[fPictureController deinterlace]] forKey:@"PictureDeinterlace"];
- [queueFileJob setObject:[NSNumber numberWithInt:[fPictureController detelecine]] forKey:@"PictureDetelecine"];
- [queueFileJob setObject:[NSNumber numberWithInt:[fPictureController denoise]] forKey:@"PictureDenoise"];
- [queueFileJob setObject:[NSString stringWithFormat:@"%d",[fPictureController deblock]] forKey:@"PictureDeblock"];
- [queueFileJob setObject:[NSNumber numberWithInt:[fPictureController decomb]] forKey:@"PictureDecomb"];
+ [queueFileJob setObject:[NSNumber numberWithInt:[fPictureFilterController detelecine]] forKey:@"PictureDetelecine"];
+ [queueFileJob setObject:[fPictureFilterController detelecineCustomString] forKey:@"PictureDetelecineCustom"];
+
+ [queueFileJob setObject:[NSNumber numberWithInt:[fPictureFilterController useDecomb]] forKey:@"PictureDecombDeinterlace"];
+ [queueFileJob setObject:[NSNumber numberWithInt:[fPictureFilterController decomb]] forKey:@"PictureDecomb"];
+ [queueFileJob setObject:[fPictureFilterController decombCustomString] forKey:@"PictureDecombCustom"];
+
+ [queueFileJob setObject:[NSNumber numberWithInt:[fPictureFilterController deinterlace]] forKey:@"PictureDeinterlace"];
+ [queueFileJob setObject:[fPictureFilterController deinterlaceCustomString] forKey:@"PictureDeinterlaceCustom"];
+
+ [queueFileJob setObject:[NSNumber numberWithInt:[fPictureFilterController denoise]] forKey:@"PictureDenoise"];
+ [queueFileJob setObject:[fPictureFilterController denoiseCustomString] forKey:@"PictureDenoiseCustom"];
+
+ [queueFileJob setObject:[NSString stringWithFormat:@"%d",[fPictureFilterController deblock]] forKey:@"PictureDeblock"];
+
+ [queueFileJob setObject:[NSNumber numberWithInt:[fPictureFilterController grayscale]] forKey:@"VideoGrayScale"];
/*Audio*/
if ([fAudLang1PopUp indexOfSelectedItem] > 0)
[queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->width] forKey:@"PictureWidth"];
[queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PictureHeight"];
[queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->keep_ratio] forKey:@"PictureKeepRatio"];
- [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->pixel_ratio] forKey:@"PicturePAR"];
+ [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.mode] forKey:@"PicturePAR"];
/* Set crop settings here */
[queueFileJob setObject:[NSNumber numberWithInt:[fPictureController autoCrop]] forKey:@"PictureAutoCrop"];
[queueFileJob setObject:[NSNumber numberWithInt:job->crop[3]] forKey:@"PictureRightCrop"];
/* Picture Filters */
- [queueFileJob setObject:[fPicSettingDecomb stringValue] forKey:@"JobPictureDecomb"];
+ //[queueFileJob setObject:[fPicSettingDecomb stringValue] forKey:@"JobPictureDecomb"];
/*Audio*/
if ([fAudLang1PopUp indexOfSelectedItem] > 0)
}
/* this is actually called from the queue controller to modify the queue array and return it back to the queue controller */
-- (void)moveObjectsInQueueArray:(NSMutableArray *)array fromIndexes:(NSIndexSet *)indexSet toIndex:(unsigned)insertIndex
+- (void)moveObjectsInQueueArray:(NSMutableArray *)array fromIndexes:(NSIndexSet *)indexSet toIndex:(NSUInteger)insertIndex
{
- unsigned index = [indexSet lastIndex];
- unsigned aboveInsertIndexCount = 0;
+ NSUInteger index = [indexSet lastIndex];
+ NSUInteger aboveInsertIndexCount = 0;
- while (index != NSNotFound)
- {
- unsigned removeIndex;
-
- if (index >= insertIndex)
- {
- removeIndex = index + aboveInsertIndexCount;
- aboveInsertIndexCount++;
- }
- else
- {
- removeIndex = index;
- insertIndex--;
- }
-
- id object = [[QueueFileArray objectAtIndex:removeIndex] retain];
- [QueueFileArray removeObjectAtIndex:removeIndex];
- [QueueFileArray insertObject:object atIndex:insertIndex];
- [object release];
+
+ NSUInteger removeIndex;
- index = [indexSet indexLessThanIndex:index];
+ if (index >= insertIndex)
+ {
+ removeIndex = index + aboveInsertIndexCount;
+ aboveInsertIndexCount++;
+ }
+ else
+ {
+ removeIndex = index;
+ insertIndex--;
}
+
+ id object = [[QueueFileArray objectAtIndex:removeIndex] retain];
+ [QueueFileArray removeObjectAtIndex:removeIndex];
+ [QueueFileArray insertObject:object atIndex:insertIndex];
+ [object release];
+
+ index = [indexSet indexLessThanIndex:index];
+
/* We save all of the Queue data here
* and it also gets sent back to the queue controller*/
[self saveQueueFileItem];
//status = NSRunAlertPanel(@"HandBrake is now loading up a new queue item...",@"Would You Like to wait until you add another encode?", @"Cancel", @"Okay", nil);
//[NSApp requestUserAttention:NSCriticalRequest];
- // Notify ChapterTitles that there's no title
- [fChapterTitlesDelegate resetWithTitle:nil];
- [fChapterTable reloadData];
-
- //[self enableUI: NO];
-
if( [detector isVideoDVD] )
{
// The chosen path was actually on a DVD, so use the raw block
[fVidRatePopUp selectItemWithTitle:[queueToApply objectForKey:@"VideoFramerate"]];
}
- /* GrayScale */
- [fVidGrayscaleCheck setState:[[queueToApply objectForKey:@"VideoGrayScale"] intValue]];
-
/* 2 Pass Encoding */
[fVidTwoPassCheck setState:[[queueToApply objectForKey:@"VideoTwoPass"] intValue]];
[self twoPassCheckboxChanged:nil];
hb_fix_aspect( job, HB_KEEP_HEIGHT );
}
}
- job->pixel_ratio = [[queueToApply objectForKey:@"PicturePAR"] intValue];
+ job->anamorphic.mode = [[queueToApply objectForKey:@"PicturePAR"] intValue];
/* If Cropping is set to custom, then recall all four crop values from
/* Filters */
/* Deinterlace */
- [fPictureController setDeinterlace:[[queueToApply objectForKey:@"PictureDeinterlace"] intValue]];
+ [fPictureFilterController setDeinterlace:[[queueToApply objectForKey:@"PictureDeinterlace"] intValue]];
/* Detelecine */
- [fPictureController setDetelecine:[[queueToApply objectForKey:@"PictureDetelecine"] intValue]];
+ [fPictureFilterController setDetelecine:[[queueToApply objectForKey:@"PictureDetelecine"] intValue]];
/* Denoise */
- [fPictureController setDenoise:[[queueToApply objectForKey:@"PictureDenoise"] intValue]];
+ [fPictureFilterController setDenoise:[[queueToApply objectForKey:@"PictureDenoise"] intValue]];
/* Deblock */
- [fPictureController setDeblock:[[queueToApply objectForKey:@"PictureDeblock"] intValue]];
+ [fPictureFilterController setDeblock:[[queueToApply objectForKey:@"PictureDeblock"] intValue]];
/* Decomb */
- [fPictureController setDecomb:[[queueToApply objectForKey:@"PictureDecomb"] intValue]];
+ [fPictureFilterController setDecomb:[[queueToApply objectForKey:@"PictureDecomb"] intValue]];
+ /* Grayscale */
+ [fPictureFilterController setGrayscale:[[queueToApply objectForKey:@"VideoGrayScale"] intValue]];
[self calculatePictureSizing:nil];
job->mux = [[fDstFormatPopUp selectedItem] tag];
job->vcodec = [[fVidEncoderPopUp selectedItem] tag];
-
- /* If mpeg-4, then set mpeg-4 specific options like chapters and > 4gb file sizes */
- if( [fDstFormatPopUp indexOfSelectedItem] == 0 )
- {
- /* We set the largeFileSize (64 bit formatting) variable here to allow for > 4gb files based on the format being
- mpeg4 and the checkbox being checked
- *Note: this will break compatibility with some target devices like iPod, etc.!!!!*/
- if( [fDstMp4LargeFileCheck state] == NSOnState )
- {
- job->largeFileSize = 1;
- }
- else
- {
- job->largeFileSize = 0;
- }
- /* We set http optimized mp4 here */
- if( [fDstMp4HttpOptFileCheck state] == NSOnState && [fDstMp4HttpOptFileCheck isEnabled] )
- {
- job->mp4_optimize = 1;
- }
- else
- {
- job->mp4_optimize = 0;
- }
- }
- if( [fDstFormatPopUp indexOfSelectedItem] == 0 || [fDstFormatPopUp indexOfSelectedItem] == 1 )
- {
- /* We set the chapter marker extraction here based on the format being
- mpeg4 or mkv and the checkbox being checked */
- if ([fCreateChapterMarkers state] == NSOnState)
- {
- job->chapter_markers = 1;
- }
- else
- {
- job->chapter_markers = 0;
- }
- }
-
- if( job->vcodec & HB_VCODEC_X264 )
+ job->chapter_markers = 0;
+
+ if( job->vcodec & HB_VCODEC_X264 )
{
- if ([fDstMp4iPodFileCheck state] == NSOnState)
- {
- job->ipod_atom = 1;
- }
- else
- {
- job->ipod_atom = 0;
- }
-
/* Set this flag to switch from Constant Quantizer(default) to Constant Rate Factor Thanks jbrjake
Currently only used with Constant Quality setting*/
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultCrf"] > 0 && [fVidQualityMatrix selectedRow] == 2)
/* If we are same as source and we have detelecine on, we need to turn on
* job->vfr
*/
- if ([fPictureController detelecine] == 1)
+ if ([fPictureFilterController detelecine] == 1)
{
job->vfr = 1;
}
job->vbitrate = [fVidBitrateField intValue];
break;
case 2:
- job->vquality = [fVidQualitySlider floatValue];
+ job->vquality = [fVidQualityRFField floatValue];
job->vbitrate = 0;
break;
}
- job->grayscale = ( [fVidGrayscaleCheck state] == NSOnState );
-
/* Subtitle settings */
job->subtitle = [fSubPopUp indexOfSelectedItem] - 2;
- /* Filters */
+ /* Filters */
+
+ /* Though Grayscale is not really a filter, per se
+ * we put it here since its in the filters panel
+ */
+
+ if ([fPictureFilterController grayscale])
+ {
+ job->grayscale = 1;
+ }
+ else
+ {
+ job->grayscale = 0;
+ }
+
+ /* Initialize the filters list */
job->filters = hb_list_init();
/* Now lets call the filters if applicable.
*/
/* Detelecine */
- if ([fPictureController detelecine])
+ if ([fPictureFilterController detelecine] == 1)
{
hb_list_add( job->filters, &hb_filter_detelecine );
}
-
- /* Decomb */
- if ([fPictureController decomb] > 0)
- {
- /* Run old deinterlacer fd by default */
- //fPicSettingDecomb
- hb_filter_decomb.settings = (char *) [[fPicSettingDecomb stringValue] UTF8String];
- //hb_filter_decomb.settings = "4:10:15:9:10:35:9"; // <-- jbrjakes recommended parameters as of 5/23/08
- hb_list_add( job->filters, &hb_filter_decomb );
- }
-
-
- /* Deinterlace */
- if ([fPictureController deinterlace] == 1)
+ if ([fPictureFilterController detelecine] == 2)
{
- /* Run old deinterlacer fd by default */
- hb_filter_deinterlace.settings = "-1";
- hb_list_add( job->filters, &hb_filter_deinterlace );
+ /* use a custom detelecine string */
+ hb_filter_detelecine.settings = (char *) [[fPictureFilterController detelecineCustomString] UTF8String];
+ hb_list_add( job->filters, &hb_filter_detelecine );
}
- else if ([fPictureController deinterlace] == 2)
+ if ([fPictureFilterController useDecomb] == 1)
{
- /* Yadif mode 0 (without spatial deinterlacing.) */
- hb_filter_deinterlace.settings = "2";
- hb_list_add( job->filters, &hb_filter_deinterlace );
+ /* Decomb */
+ if ([fPictureFilterController decomb] == 1)
+ {
+ /* Run old deinterlacer fd by default */
+ //hb_filter_decomb.settings = (char *) [[fPicSettingDecomb stringValue] UTF8String];
+ hb_list_add( job->filters, &hb_filter_decomb );
+ }
+ /* we add the custom string if present */
+ if ([fPictureFilterController decomb] == 2)
+ {
+ /* use a custom decomb string */
+ hb_filter_decomb.settings = (char *) [[fPictureFilterController decombCustomString] UTF8String];
+ hb_list_add( job->filters, &hb_filter_decomb );
+ }
}
- else if ([fPictureController deinterlace] == 3)
+ else
{
- /* Yadif (with spatial deinterlacing) */
- hb_filter_deinterlace.settings = "0";
- hb_list_add( job->filters, &hb_filter_deinterlace );
- }
-
+
+ /* Deinterlace */
+ if ([fPictureFilterController deinterlace] == 1)
+ {
+ /* Run old deinterlacer fd by default */
+ hb_filter_deinterlace.settings = "-1";
+ hb_list_add( job->filters, &hb_filter_deinterlace );
+ }
+ else if ([fPictureFilterController deinterlace] == 2)
+ {
+ /* Yadif mode 0 (without spatial deinterlacing.) */
+ hb_filter_deinterlace.settings = "2";
+ hb_list_add( job->filters, &hb_filter_deinterlace );
+ }
+ else if ([fPictureFilterController deinterlace] == 3)
+ {
+ /* Yadif (with spatial deinterlacing) */
+ hb_filter_deinterlace.settings = "0";
+ hb_list_add( job->filters, &hb_filter_deinterlace );
+ }
+ else if ([fPictureFilterController deinterlace] == 4)
+ {
+ /* we add the custom string if present */
+ hb_filter_deinterlace.settings = (char *) [[fPictureFilterController deinterlaceCustomString] UTF8String];
+ hb_list_add( job->filters, &hb_filter_deinterlace );
+ }
+ }
+
/* Denoise */
- if ([fPictureController denoise] == 1) // Weak in popup
+ if ([fPictureFilterController denoise] == 1) // Weak in popup
{
hb_filter_denoise.settings = "2:1:2:3";
hb_list_add( job->filters, &hb_filter_denoise );
}
- else if ([fPictureController denoise] == 2) // Medium in popup
+ else if ([fPictureFilterController denoise] == 2) // Medium in popup
{
hb_filter_denoise.settings = "3:2:2:3";
hb_list_add( job->filters, &hb_filter_denoise );
}
- else if ([fPictureController denoise] == 3) // Strong in popup
+ else if ([fPictureFilterController denoise] == 3) // Strong in popup
{
hb_filter_denoise.settings = "7:7:5:5";
hb_list_add( job->filters, &hb_filter_denoise );
}
+ else if ([fPictureFilterController denoise] == 4) // custom in popup
+ {
+ /* we add the custom string if present */
+ hb_filter_denoise.settings = (char *) [[fPictureFilterController denoiseCustomString] UTF8String];
+ hb_list_add( job->filters, &hb_filter_denoise );
+ }
/* Deblock (uses pp7 default) */
/* NOTE: even though there is a valid deblock setting of 0 for the filter, for
* the macgui's purposes a value of 0 actually means to not even use the filter
* current hb_filter_deblock.settings valid ranges are from 5 - 15
*/
- if ([fPictureController deblock] != 0)
+ if ([fPictureFilterController deblock] != 0)
{
- NSString *deblockStringValue = [NSString stringWithFormat: @"%d",[fPictureController deblock]];
+ NSString *deblockStringValue = [NSString stringWithFormat: @"%d",[fPictureFilterController deblock]];
hb_filter_deblock.settings = (char *) [deblockStringValue UTF8String];
hb_list_add( job->filters, &hb_filter_deblock );
}
job->height = [[queueToApply objectForKey:@"PictureHeight"] intValue];
job->keep_ratio = [[queueToApply objectForKey:@"PictureKeepRatio"] intValue];
- job->pixel_ratio = [[queueToApply objectForKey:@"PicturePAR"] intValue];
+ job->anamorphic.mode = [[queueToApply objectForKey:@"PicturePAR"] intValue];
/* Here we use the crop values saved at the time the preset was saved */
/* Detelecine */
if ([[queueToApply objectForKey:@"PictureDetelecine"] intValue] == 1)
{
+ //if ([queueToApply objectForKey:@"PictureDetelecineCustom"])
hb_list_add( job->filters, &hb_filter_detelecine );
}
-
- /* Decomb */
- if ([[queueToApply objectForKey:@"PictureDecomb"] intValue] == 1)
+ if ([[queueToApply objectForKey:@"PictureDetelecine"] intValue] == 2)
{
- /* Run old deinterlacer fd by default */
- hb_filter_decomb.settings = (char *) [[queueToApply objectForKey:@"JobPictureDecomb"] UTF8String];
- hb_list_add( job->filters, &hb_filter_decomb );
+ /* use a custom detelecine string */
+ hb_filter_detelecine.settings = (char *) [[queueToApply objectForKey:@"PictureDetelecineCustom"] UTF8String];
+ hb_list_add( job->filters, &hb_filter_detelecine );
}
- /* Deinterlace */
- if ([[queueToApply objectForKey:@"PictureDeinterlace"] intValue] == 1)
+ if ([[queueToApply objectForKey:@"PictureDecombDeinterlace"] intValue] == 1)
{
- /* Run old deinterlacer fd by default */
- hb_filter_deinterlace.settings = "-1";
- hb_list_add( job->filters, &hb_filter_deinterlace );
- }
- else if ([[queueToApply objectForKey:@"PictureDeinterlace"] intValue] == 2)
- {
- /* Yadif mode 0 (without spatial deinterlacing.) */
- hb_filter_deinterlace.settings = "2";
- hb_list_add( job->filters, &hb_filter_deinterlace );
+ /* Decomb */
+ if ([[queueToApply objectForKey:@"PictureDecomb"] intValue] == 1)
+ {
+ /* Run old deinterlacer fd by default */
+ hb_list_add( job->filters, &hb_filter_decomb );
+ }
+ /* we add the custom string if present */
+ if ([[queueToApply objectForKey:@"PictureDecomb"] intValue] == 2)
+ {
+ /* use a custom decomb string */
+ hb_filter_decomb.settings = (char *) [[queueToApply objectForKey:@"PictureDecombCustom"] UTF8String];
+ hb_list_add( job->filters, &hb_filter_decomb );
+ }
+
}
- else if ([[queueToApply objectForKey:@"PictureDeinterlace"] intValue] == 3)
+ else
{
- /* Yadif (with spatial deinterlacing) */
- hb_filter_deinterlace.settings = "0";
- hb_list_add( job->filters, &hb_filter_deinterlace );
+
+ /* Deinterlace */
+ if ([[queueToApply objectForKey:@"PictureDeinterlace"] intValue] == 1)
+ {
+ /* Run old deinterlacer fd by default */
+ hb_filter_deinterlace.settings = "-1";
+ hb_list_add( job->filters, &hb_filter_deinterlace );
+ }
+ else if ([[queueToApply objectForKey:@"PictureDeinterlace"] intValue] == 2)
+ {
+ /* Yadif mode 0 (without spatial deinterlacing.) */
+ hb_filter_deinterlace.settings = "2";
+ hb_list_add( job->filters, &hb_filter_deinterlace );
+ }
+ else if ([[queueToApply objectForKey:@"PictureDeinterlace"] intValue] == 3)
+ {
+ /* Yadif (with spatial deinterlacing) */
+ hb_filter_deinterlace.settings = "0";
+ hb_list_add( job->filters, &hb_filter_deinterlace );
+ }
+ else if ([[queueToApply objectForKey:@"PictureDeinterlace"] intValue] == 4)
+ {
+ /* we add the custom string if present */
+ hb_filter_deinterlace.settings = (char *) [[queueToApply objectForKey:@"PictureDeinterlaceCustom"] UTF8String];
+ hb_list_add( job->filters, &hb_filter_deinterlace );
+ }
+
+
}
-
/* Denoise */
if ([[queueToApply objectForKey:@"PictureDenoise"] intValue] == 1) // Weak in popup
{
hb_filter_denoise.settings = "7:7:5:5";
hb_list_add( job->filters, &hb_filter_denoise );
}
+ else if ([[queueToApply objectForKey:@"PictureDenoise"] intValue] == 4) // Custom in popup
+ {
+ /* we add the custom string if present */
+ hb_filter_denoise.settings = (char *) [[queueToApply objectForKey:@"PictureDenoiseCustom"] UTF8String];
+ hb_list_add( job->filters, &hb_filter_denoise );
+ }
/* Deblock (uses pp7 default) */
/* NOTE: even though there is a valid deblock setting of 0 for the filter, for
NSRunAlertPanel(@"Warning!", @"This is not a valid destination directory!", @"OK", nil, nil);
return;
}
-
- /* We check for duplicate name here */
- if( [[NSFileManager defaultManager] fileExistsAtPath:
- [fDstFile2Field stringValue]] )
+
+ BOOL fileExists;
+ fileExists = NO;
+
+ BOOL fileExistsInQueue;
+ fileExistsInQueue = NO;
+
+ /* We check for and existing file here */
+ if([[NSFileManager defaultManager] fileExistsAtPath: [fDstFile2Field stringValue]])
{
- NSBeginCriticalAlertSheet( NSLocalizedString( @"File already exists", @"" ),
- NSLocalizedString( @"Cancel", @"" ), NSLocalizedString( @"Overwrite", @"" ), nil, fWindow, self,
- @selector( overwriteAddToQueueAlertDone:returnCode:contextInfo: ),
- NULL, NULL, [NSString stringWithFormat:
- NSLocalizedString( @"Do you want to overwrite %@?", @"" ),
- [fDstFile2Field stringValue]] );
- // overwriteAddToQueueAlertDone: will be called when the alert is dismissed.
+ fileExists = YES;
+ }
+
+ /* We now run through the queue and make sure we are not overwriting an exisiting queue item */
+ int i = 0;
+ NSEnumerator *enumerator = [QueueFileArray objectEnumerator];
+ id tempObject;
+ while (tempObject = [enumerator nextObject])
+ {
+ NSDictionary *thisQueueDict = tempObject;
+ if ([[thisQueueDict objectForKey:@"DestinationPath"] isEqualToString: [fDstFile2Field stringValue]])
+ {
+ fileExistsInQueue = YES;
+ }
+ i++;
+ }
+
+
+ if(fileExists == YES)
+ {
+ NSBeginCriticalAlertSheet( NSLocalizedString( @"File already exists.", @"" ),
+ NSLocalizedString( @"Cancel", @"" ), NSLocalizedString( @"Overwrite", @"" ), nil, fWindow, self,
+ @selector( overwriteAddToQueueAlertDone:returnCode:contextInfo: ),
+ NULL, NULL, [NSString stringWithFormat:
+ NSLocalizedString( @"Do you want to overwrite %@?", @"" ),
+ [fDstFile2Field stringValue]] );
+ }
+ else if (fileExistsInQueue == YES)
+ {
+ NSBeginCriticalAlertSheet( NSLocalizedString( @"There is already a queue item for this destination.", @"" ),
+ NSLocalizedString( @"Cancel", @"" ), NSLocalizedString( @"Overwrite", @"" ), nil, fWindow, self,
+ @selector( overwriteAddToQueueAlertDone:returnCode:contextInfo: ),
+ NULL, NULL, [NSString stringWithFormat:
+ NSLocalizedString( @"Do you want to overwrite %@?", @"" ),
+ [fDstFile2Field stringValue]] );
}
else
{
hb_job_t * job = title->job;
fTitle = title;
- /*Set Source Size Field Here */
- [fPicSettingsSrc setStringValue: [NSString stringWithFormat: @"%d x %d", fTitle->width, fTitle->height]];
-
- /* Set Auto Crop to on upon selecting a new title */
+ /* Set Auto Crop to on upon selecting a new title */
[fPictureController setAutoCrop:YES];
/* We get the originial output picture width and height and put them
AutoCropLeft = job->crop[2];
AutoCropRight = job->crop[3];
- /* Reset the new title in fPictureController */
+ /* Reset the new title in fPictureController && fPreviewController*/
[fPictureController SetTitle:title];
-
+ //[fPictureFilterController SetTitle:title];
/* Update subtitle popups */
hb_subtitle_t * subtitle;
[fSubPopUp removeAllItems];
[fDstMp4iPodFileCheck setHidden: YES];
/* Update the Video Codec PopUp */
+ /* lets get the tag of the currently selected item first so we might reset it later */
+ int selectedVidEncoderTag;
+ selectedVidEncoderTag = [[fVidEncoderPopUp selectedItem] tag];
+
/* Note: we now store the video encoder int values from common.c in the tags of each popup for easy retrieval later */
[fVidEncoderPopUp removeAllItems];
NSMenuItem *menuItem;
[fCreateChapterMarkers setState: NSOffState];
break;
}
- [fVidEncoderPopUp selectItemAtIndex: 0];
+ /* if we have a previously selected vid encoder tag, then try to select it */
+ if (selectedVidEncoderTag)
+ {
+ [fVidEncoderPopUp selectItemWithTag: selectedVidEncoderTag];
+ }
+ else
+ {
+ [fVidEncoderPopUp selectItemAtIndex: 0];
+ }
[self audioAddAudioTrackCodecs: fAudTrack1CodecPopUp];
[self audioAddAudioTrackCodecs: fAudTrack2CodecPopUp];
to use the index itself but this is easier */
if (videoEncoder == HB_VCODEC_FFMPEG)
{
- if (job->pixel_ratio == 2)
+ if (job->anamorphic.mode == 2)
{
- job->pixel_ratio = 0;
+ job->anamorphic.mode = 0;
}
[fPictureController setAllowLooseAnamorphic:NO];
/* We set the iPod atom checkbox to disabled and uncheck it as its only for x264 in the mp4
[fPictureController setAllowLooseAnamorphic:YES];
[fDstMp4iPodFileCheck setEnabled: YES];
}
-
+ [self setupQualitySlider];
[self calculatePictureSizing: sender];
[self twoPassCheckboxChanged: sender];
}
[fVidTargetSizeField setEnabled: target];
[fVidBitrateField setEnabled: bitrate];
[fVidQualitySlider setEnabled: quality];
+ [fVidQualityRFField setEnabled: quality];
+ [fVidQualityRFLabel setEnabled: quality];
[fVidTwoPassCheck setEnabled: !quality &&
[fVidQualityMatrix isEnabled]];
if( quality )
[self customSettingUsed: sender];
}
+/* Use this method to setup the quality slider for cq/rf values depending on
+ * the video encoder selected.
+ */
+- (void) setupQualitySlider
+{
+ /* Get the current slider maxValue to check for a change in slider scale later
+ * so that we can choose a new similar value on the new slider scale */
+ float previousMaxValue = [fVidQualitySlider maxValue];
+ float previousPercentOfSliderScale = [fVidQualitySlider floatValue] / ([fVidQualitySlider maxValue] - [fVidQualitySlider minValue] + 1);
+ NSString * qpRFLabelString = @"QP:";
+ /* x264 0-51 */
+ if ([[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_X264)
+ {
+ [fVidQualitySlider setMinValue:0.0];
+ [fVidQualitySlider setMaxValue:51.0];
+ /* As x264 allows for qp/rf values that are fractional, we get the value from the preferences */
+ int fractionalGranularity = 1 / [[NSUserDefaults standardUserDefaults] floatForKey:@"x264CqSliderFractional"];
+ [fVidQualitySlider setNumberOfTickMarks:(([fVidQualitySlider maxValue] - [fVidQualitySlider minValue]) * fractionalGranularity) + 1];
+ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultCrf"] > 0)
+ {
+ qpRFLabelString = @"RF:";
+ }
+ }
+ /* ffmpeg and xvid 1-31 */
+ if ([[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_FFMPEG || [[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_XVID)
+ {
+ [fVidQualitySlider setMinValue:1.0];
+ [fVidQualitySlider setMaxValue:31.0];
+ [fVidQualitySlider setNumberOfTickMarks:31];
+ }
+ /* Theora 0-63 */
+ if ([[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_THEORA)
+ {
+ [fVidQualitySlider setMinValue:0.0];
+ [fVidQualitySlider setMaxValue:63.0];
+ [fVidQualitySlider setNumberOfTickMarks:64];
+ }
+ [fVidQualityRFLabel setStringValue:qpRFLabelString];
+
+ /* check to see if we have changed slider scales */
+ if (previousMaxValue != [fVidQualitySlider maxValue])
+ {
+ /* if so, convert the old setting to the new scale as close as possible based on percentages */
+ float rf = ([fVidQualitySlider maxValue] - [fVidQualitySlider minValue] + 1) * previousPercentOfSliderScale;
+ [fVidQualitySlider setFloatValue:rf];
+ }
+
+ [self qualitySliderChanged:nil];
+}
+
- (IBAction) qualitySliderChanged: (id) sender
{
+ /* Our constant quality slider is in a range based
+ * on each encoders qp/rf values. The range depends
+ * on the encoder. Also, the range is inverse of quality
+ * for all of the encoders *except* for theora
+ * (ie. as the "quality" goes up, the cq or rf value
+ * actually goes down). Since the IB sliders always set
+ * their max value at the right end of the slider, we
+ * will calculate the inverse, so as the slider floatValue
+ * goes up, we will show the inverse in the rf field
+ * so, the floatValue at the right for x264 would be 51
+ * and our rf field needs to show 0 and vice versa.
+ */
+
+ float sliderRfInverse = ([fVidQualitySlider maxValue] - [fVidQualitySlider floatValue]) + [fVidQualitySlider minValue];
+ /* If the encoder is theora, use the float, otherwise use the inverse float*/
+ float sliderRfToPercent;
+ if ([[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_THEORA)
+ {
+ [fVidQualityRFField setStringValue: [NSString stringWithFormat: @"%.2f", [fVidQualitySlider floatValue]]];
+ sliderRfToPercent = [fVidQualityRFField floatValue] / ([fVidQualitySlider maxValue] - [fVidQualitySlider minValue]);
+ }
+ else
+ {
+ [fVidQualityRFField setStringValue: [NSString stringWithFormat: @"%.2f", sliderRfInverse]];
+ sliderRfToPercent = ( ([fVidQualitySlider maxValue] - [fVidQualitySlider minValue]) - ([fVidQualityRFField floatValue] - [fVidQualitySlider minValue])) / ([fVidQualitySlider maxValue] - [fVidQualitySlider minValue]);
+ }
[fVidConstantCell setTitle: [NSString stringWithFormat:
- NSLocalizedString( @"Constant quality: %.0f %%", @"" ), 100.0 *
- [fVidQualitySlider floatValue]]];
- [self customSettingUsed: sender];
+ NSLocalizedString( @"Constant quality: %.2f %%", @"" ), 100 * sliderRfToPercent]];
+
+ [self customSettingUsed: sender];
}
- (void) controlTextDidChange: (NSNotification *) notification
* Registers changes made in the Picture Settings Window.
*/
-- (void)pictureSettingsDidChange {
+- (void)pictureSettingsDidChange
+{
[self calculatePictureSizing:nil];
}
/* Get and Display Current Pic Settings in main window */
- (IBAction) calculatePictureSizing: (id) sender
{
- [fPicSettingsOutp setStringValue: [NSString stringWithFormat:@"%d x %d", fTitle->job->width, fTitle->job->height]];
-
- if (fTitle->job->pixel_ratio == 1)
+ if (fTitle->job->anamorphic.mode > 0)
{
- int titlewidth = fTitle->width-fTitle->job->crop[2]-fTitle->job->crop[3];
- int arpwidth = fTitle->job->pixel_aspect_width;
- int arpheight = fTitle->job->pixel_aspect_height;
- int displayparwidth = titlewidth * arpwidth / arpheight;
- int displayparheight = fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1];
- [fPicSettingsOutp setStringValue: [NSString stringWithFormat:@"%d x %d", titlewidth, displayparheight]];
- [fPicSettingsAnamorphic setStringValue: [NSString stringWithFormat:@"%d x %d Strict", displayparwidth, displayparheight]];
fTitle->job->keep_ratio = 0;
}
- else if (fTitle->job->pixel_ratio == 2)
- {
- hb_job_t * job = fTitle->job;
- int output_width, output_height, output_par_width, output_par_height;
- hb_set_anamorphic_size(job, &output_width, &output_height, &output_par_width, &output_par_height);
- int display_width;
- display_width = output_width * output_par_width / output_par_height;
-
- [fPicSettingsOutp setStringValue: [NSString stringWithFormat:@"%d x %d", output_width, output_height]];
- [fPicSettingsAnamorphic setStringValue: [NSString stringWithFormat:@"%d x %d Loose", display_width, output_height]];
-
- fTitle->job->keep_ratio = 0;
- }
- else
- {
- [fPicSettingsAnamorphic setStringValue:@"Off"];
- }
-
- /* Set ON/Off values for the deinterlace/keep aspect ratio according to boolean */
- if (fTitle->job->keep_ratio > 0)
+
+ [fPictureSizeField setStringValue: [NSString stringWithFormat:@"Picture Size: %@", [fPictureController getPictureSizeInfoString]]];
+
+ NSString *picCropping;
+ /* Set the display field for crop as per boolean */
+ if (![fPictureController autoCrop])
{
- [fPicSettingARkeep setStringValue: @"On"];
+ picCropping = @"Custom";
}
else
{
- [fPicSettingARkeep setStringValue: @"Off"];
- }
+ picCropping = @"Auto";
+ }
+ picCropping = [picCropping stringByAppendingString:[NSString stringWithFormat:@" %d/%d/%d/%d",fTitle->job->crop[0],fTitle->job->crop[1],fTitle->job->crop[2],fTitle->job->crop[3]]];
+ [fPictureCroppingField setStringValue: [NSString stringWithFormat:@"Picture Cropping: %@",picCropping]];
+
+ NSString *videoFilters;
+ videoFilters = @"";
/* Detelecine */
- if ([fPictureController detelecine])
+ if ([fPictureFilterController detelecine] == 1)
{
- [fPicSettingDetelecine setStringValue: @"Yes"];
+ videoFilters = [videoFilters stringByAppendingString:@" - Detelecine (Default)"];
}
- else
+ else if ([fPictureFilterController detelecine] == 2)
{
- [fPicSettingDetelecine setStringValue: @"Off"];
+ videoFilters = [videoFilters stringByAppendingString:[NSString stringWithFormat:@" - Detelecine (%@)",[fPictureFilterController detelecineCustomString]]];
}
- /* Decomb */
- if ([fPictureController decomb])
- {
- [fPicSettingDecomb setStringValue: @"1:2:6:9:80:16:16"];
- }
- else
- {
- [fPicSettingDecomb setStringValue: @"Off"];
- }
-
- /* VFR (Variable Frame Rate) */
+ if ([fPictureFilterController useDecomb] == 1)
+ {
+ /* Decomb */
+ if ([fPictureFilterController decomb] == 1)
+ {
+ videoFilters = [videoFilters stringByAppendingString:@" - Decomb (Default)"];
+ }
+ else if ([fPictureFilterController decomb] == 2)
+ {
+ videoFilters = [videoFilters stringByAppendingString:[NSString stringWithFormat:@" - Decomb (%@)",[fPictureFilterController decombCustomString]]];
+ }
+ }
+ else
+ {
+ /* Deinterlace */
+ if ([fPictureFilterController deinterlace] > 0)
+ {
+ fTitle->job->deinterlace = 1;
+ }
+ else
+ {
+ fTitle->job->deinterlace = 0;
+ }
+
+ if ([fPictureFilterController deinterlace] == 1)
+ {
+ videoFilters = [videoFilters stringByAppendingString:@" - Deinterlace (Fast)"];
+ }
+ else if ([fPictureFilterController deinterlace] == 2)
+ {
+ videoFilters = [videoFilters stringByAppendingString:@" - Deinterlace (Slow)"];
+ }
+ else if ([fPictureFilterController deinterlace] == 3)
+ {
+ videoFilters = [videoFilters stringByAppendingString:@" - Deinterlace (Slower)"];
+ }
+ else if ([fPictureFilterController deinterlace] == 4)
+ {
+ videoFilters = [videoFilters stringByAppendingString:[NSString stringWithFormat:@" - Deinterlace (%@)",[fPictureFilterController deinterlaceCustomString]]];
+ }
+ }
- /* Deinterlace */
- if ([fPictureController deinterlace] == 0)
- {
- [fPicSettingDeinterlace setStringValue: @"Off"];
- }
- else if ([fPictureController deinterlace] == 1)
- {
- [fPicSettingDeinterlace setStringValue: @"Fast"];
- }
- else if ([fPictureController deinterlace] == 2)
- {
- [fPicSettingDeinterlace setStringValue: @"Slow"];
- }
- else if ([fPictureController deinterlace] == 3)
- {
- [fPicSettingDeinterlace setStringValue: @"Slower"];
- }
-
/* Denoise */
- if ([fPictureController denoise] == 0)
+ if ([fPictureFilterController denoise] == 1)
{
- [fPicSettingDenoise setStringValue: @"Off"];
- }
- else if ([fPictureController denoise] == 1)
+ videoFilters = [videoFilters stringByAppendingString:@" - Denoise (Weak)"];
+ }
+ else if ([fPictureFilterController denoise] == 2)
{
- [fPicSettingDenoise setStringValue: @"Weak"];
- }
- else if ([fPictureController denoise] == 2)
+ videoFilters = [videoFilters stringByAppendingString:@" - Denoise (Medium)"];
+ }
+ else if ([fPictureFilterController denoise] == 3)
{
- [fPicSettingDenoise setStringValue: @"Medium"];
+ videoFilters = [videoFilters stringByAppendingString:@" - Denoise (Strong)"];
}
- else if ([fPictureController denoise] == 3)
+ else if ([fPictureFilterController denoise] == 4)
{
- [fPicSettingDenoise setStringValue: @"Strong"];
+ videoFilters = [videoFilters stringByAppendingString:[NSString stringWithFormat:@" - Denoise (%@)",[fPictureFilterController denoiseCustomString]]];
}
/* Deblock */
- if ([fPictureController deblock] == 0)
+ if ([fPictureFilterController deblock] > 0)
{
- [fPicSettingDeblock setStringValue: @"Off"];
+ videoFilters = [videoFilters stringByAppendingString:[NSString stringWithFormat:@" - Deblock (%d)",[fPictureFilterController deblock]]];
}
- else
+
+ /* Grayscale */
+ if ([fPictureFilterController grayscale])
{
- [fPicSettingDeblock setStringValue: [NSString stringWithFormat:@"%d",[fPictureController deblock]]];
+ videoFilters = [videoFilters stringByAppendingString:@" - Grayscale"];
}
-
- if (fTitle->job->pixel_ratio > 0)
- {
- [fPicSettingPAR setStringValue: @""];
- }
- else
- {
- [fPicSettingPAR setStringValue: @"Off"];
- }
-
- /* Set the display field for crop as per boolean */
- if (![fPictureController autoCrop])
- {
- [fPicSettingAutoCrop setStringValue: @"Custom"];
- }
- else
- {
- [fPicSettingAutoCrop setStringValue: @"Auto"];
- }
-
+ [fVideoFiltersField setStringValue: [NSString stringWithFormat:@"Video Filters: %@", videoFilters]];
+
+ [fPictureController reloadStillPreview];
}
drcSlider = fAudTrack4DrcSlider;
drcField = fAudTrack4DrcField;
}
+
+ /* If we are between 0.0 and 1.0 on the slider, snap it to 1.0 */
+ if ([drcSlider floatValue] > 0.0 && [drcSlider floatValue] < 1.0)
+ {
+ [drcSlider setFloatValue:1.0];
+ }
+
+
[drcField setStringValue: [NSString stringWithFormat: @"%.2f", [drcSlider floatValue]]];
/* For now, do not call this until we have an intelligent way to determine audio track selections
* compared to presets
- (IBAction) showPicturePanel: (id) sender
{
- hb_list_t * list = hb_get_titles( fHandle );
- hb_title_t * title = (hb_title_t *) hb_list_item( list,
- [fSrcTitlePopUp indexOfSelectedItem] );
- //[fPictureController SetTitle:title];
- [fPictureController showPreviewPanel:sender forTitle:title];
+ [fPictureController showPictureWindow:sender];
+}
+
+- (void) picturePanelFullScreen
+{
+ [fPictureController setToFullScreenMode];
+}
+
+- (void) picturePanelWindowed
+{
+ [fPictureController setToWindowedMode];
+}
+
+- (IBAction) showFiltersPanel: (id) sender
+{
+ [fPictureFilterController showFilterWindow:sender];
+}
+
+- (IBAction) showPreviewWindow: (id) sender
+{
+ [fPictureController showPreviewWindow:sender];
}
#pragma mark -
}
/* We use this to deterimine children of an item */
-- (id)outlineView:(NSOutlineView *)fPresetsOutlineView child:(int)index ofItem:(id)item
+- (id)outlineView:(NSOutlineView *)fPresetsOutlineView child:(NSInteger)index ofItem:(id)item
{
/* we need to return the count of the array in ChildrenArray for this folder */
children = [item objectForKey:@"ChildrenArray"];
}
}
- if ((children == nil) || ([children count] <= index))
+ if ((children == nil) || ( [children count] <= (NSUInteger) index))
{
return nil;
}
}
}
+- (id)outlineView:(NSOutlineView *)outlineView itemForPersistentObject:(id)object
+{
+ return [NSKeyedUnarchiver unarchiveObjectWithData:object];
+}
+- (id)outlineView:(NSOutlineView *)outlineView persistentObjectForItem:(id)item
+{
+ return [NSKeyedArchiver archivedDataWithRootObject:item];
+}
+
#pragma mark - Added Functionality (optional)
/* Use to customize the font and display characteristics of the title cell */
- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
return YES;
}
-- (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(int)index
+- (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(NSInteger)index
{
// Don't allow dropping ONTO an item since they can't really contain any children.
-- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(int)index
+- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index
{
/* first, lets see if we are dropping into a folder */
if ([[fPresetsOutlineView itemAtRow:index] objectForKey:@"Folder"] && [[[fPresetsOutlineView itemAtRow:index] objectForKey:@"Folder"] intValue] == 1) // if its a folder
return YES;
}
-- (void)moveObjectsInPresetsArray:(NSMutableArray *)array fromIndexes:(NSIndexSet *)indexSet toIndex:(unsigned)insertIndex
+- (void)moveObjectsInPresetsArray:(NSMutableArray *)array fromIndexes:(NSIndexSet *)indexSet toIndex:(NSUInteger)insertIndex
{
- unsigned index = [indexSet lastIndex];
- unsigned aboveInsertIndexCount = 0;
+ NSUInteger index = [indexSet lastIndex];
+ NSUInteger aboveInsertIndexCount = 0;
- while (index != NSNotFound)
+ NSUInteger removeIndex;
+
+ if (index >= insertIndex)
{
- unsigned removeIndex;
-
- if (index >= insertIndex)
- {
- removeIndex = index + aboveInsertIndexCount;
- aboveInsertIndexCount++;
- }
- else
- {
- removeIndex = index;
- insertIndex--;
- }
-
- id object = [[array objectAtIndex:removeIndex] retain];
- [array removeObjectAtIndex:removeIndex];
- [array insertObject:object atIndex:insertIndex];
- [object release];
-
- index = [indexSet indexLessThanIndex:index];
+ removeIndex = index + aboveInsertIndexCount;
+ aboveInsertIndexCount++;
+ }
+ else
+ {
+ removeIndex = index;
+ insertIndex--;
}
+
+ id object = [[array objectAtIndex:removeIndex] retain];
+ [array removeObjectAtIndex:removeIndex];
+ [array insertObject:object atIndex:insertIndex];
+ [object release];
+
+ index = [indexSet indexLessThanIndex:index];
}
[fVidTargetSizeField setStringValue:[chosenPreset objectForKey:@"VideoTargetSize"]];
[fVidBitrateField setStringValue:[chosenPreset objectForKey:@"VideoAvgBitrate"]];
- [fVidQualitySlider setFloatValue:[[chosenPreset objectForKey:@"VideoQualitySlider"] floatValue]];
+
+ /* Since we are now using RF Values for the slider, we detect if the preset uses an old quality float.
+ * So, check to see if the quality value is less than 1.0 which should indicate the old ".062" type
+ * quality preset. Caveat: in the case of x264, where the RF scale starts at 0, it would misinterpret
+ * a preset that uses 0.0 - 0.99 for RF as an old style preset. Not sure how to get around that one yet,
+ * though it should be a corner case since it would pretty much be a preset for lossless encoding. */
+ if ([[chosenPreset objectForKey:@"VideoQualitySlider"] floatValue] < 1.0)
+ {
+ /* For the quality slider we need to convert the old percent's to the new rf scales */
+ float rf = (([fVidQualitySlider maxValue] - [fVidQualitySlider minValue]) * [[chosenPreset objectForKey:@"VideoQualitySlider"] floatValue]);
+ [fVidQualitySlider setFloatValue:rf];
+
+ }
+ else
+ {
+ [fVidQualitySlider setFloatValue:([fVidQualitySlider maxValue] - [fVidQualitySlider minValue]) - [[chosenPreset objectForKey:@"VideoQualitySlider"] floatValue]];
+ }
[self videoMatrixChanged:nil];
[fVidRatePopUp selectItemWithTitle:[chosenPreset objectForKey:@"VideoFramerate"]];
}
- /* GrayScale */
- [fVidGrayscaleCheck setState:[[chosenPreset objectForKey:@"VideoGrayScale"] intValue]];
/* 2 Pass Encoding */
[fVidTwoPassCheck setState:[[chosenPreset objectForKey:@"VideoTwoPass"] intValue]];
hb_fix_aspect( job, HB_KEEP_HEIGHT );
}
}
- job->pixel_ratio = [[chosenPreset objectForKey:@"PicturePAR"] intValue];
+ job->anamorphic.mode = [[chosenPreset objectForKey:@"PicturePAR"] intValue];
}
else // /* If not 0 or 2 we assume objectForKey:@"UsesPictureSettings is 1 which is "Use picture sizing from when the preset was set" */
{
if (fTitle->width < [[chosenPreset objectForKey:@"PictureWidth"] intValue] || fTitle->height < [[chosenPreset objectForKey:@"PictureHeight"] intValue])
{
/* if so, then we use the sources height and width to avoid scaling up */
- job->width = fTitle->width;
- job->height = fTitle->height;
+ //job->width = fTitle->width;
+ //job->height = fTitle->height;
+ [self revertPictureSizeToMax:nil];
}
else // source width/height is >= the preset height/width
{
hb_fix_aspect( job, HB_KEEP_HEIGHT );
}
}
- job->pixel_ratio = [[chosenPreset objectForKey:@"PicturePAR"] intValue];
+ job->anamorphic.mode = [[chosenPreset objectForKey:@"PicturePAR"] intValue];
}
if ([chosenPreset objectForKey:@"UsesPictureFilters"] && [[chosenPreset objectForKey:@"UsesPictureFilters"] intValue] > 0)
{
/* Filters */
- /* Deinterlace */
- if ([chosenPreset objectForKey:@"PictureDeinterlace"])
+
+ /* We only allow *either* Decomb or Deinterlace. So check for the PictureDecombDeinterlace key.
+ * also, older presets may not have this key, in which case we also check to see if that preset had PictureDecomb
+ * specified, in which case we use decomb and ignore any possible Deinterlace settings as using both was less than
+ * sane.
+ */
+ [fPictureFilterController setUseDecomb:1];
+ [fPictureFilterController setDecomb:0];
+ [fPictureFilterController setDeinterlace:0];
+ if ([[chosenPreset objectForKey:@"PictureDecombDeinterlace"] intValue] == 1 || [[chosenPreset objectForKey:@"PictureDecomb"] intValue] > 0)
{
- /* We check to see if the preset used the past fourth "Slowest" deinterlaceing and set that to "Slower
- * since we no longer have a fourth "Slowest" deinterlacing due to the mcdeint bug */
- if ([[chosenPreset objectForKey:@"PictureDeinterlace"] intValue] == 4)
+ /* we are using decomb */
+ /* Decomb */
+ if ([[chosenPreset objectForKey:@"PictureDecomb"] intValue] > 0)
{
- [fPictureController setDeinterlace:3];
- }
- else
- {
- [fPictureController setDeinterlace:[[chosenPreset objectForKey:@"PictureDeinterlace"] intValue]];
+ [fPictureFilterController setDecomb:[[chosenPreset objectForKey:@"PictureDecomb"] intValue]];
+
+ /* if we are using "Custom" in the decomb setting, also set the custom string*/
+ if ([[chosenPreset objectForKey:@"PictureDecomb"] intValue] == 2)
+ {
+ [fPictureFilterController setDecombCustomString:[chosenPreset objectForKey:@"PictureDecombCustom"]];
+ }
}
- }
+ }
else
{
- [fPictureController setDeinterlace:0];
+ /* We are using Deinterlace */
+ /* Deinterlace */
+ if ([[chosenPreset objectForKey:@"PictureDeinterlace"] intValue] > 0)
+ {
+ [fPictureFilterController setUseDecomb:0];
+ [fPictureFilterController setDeinterlace:[[chosenPreset objectForKey:@"PictureDeinterlace"] intValue]];
+ /* if we are using "Custom" in the deinterlace setting, also set the custom string*/
+ if ([[chosenPreset objectForKey:@"PictureDeinterlace"] intValue] == 4)
+ {
+ [fPictureFilterController setDeinterlaceCustomString:[chosenPreset objectForKey:@"PictureDeinterlaceCustom"]];
+ }
+ }
}
+
/* Detelecine */
- if ([[chosenPreset objectForKey:@"PictureDetelecine"] intValue] == 1)
+ if ([[chosenPreset objectForKey:@"PictureDetelecine"] intValue] > 0)
{
- [fPictureController setDetelecine:[[chosenPreset objectForKey:@"PictureDetelecine"] intValue]];
+ [fPictureFilterController setDetelecine:[[chosenPreset objectForKey:@"PictureDetelecine"] intValue]];
+ /* if we are using "Custom" in the detelecine setting, also set the custom string*/
+ if ([[chosenPreset objectForKey:@"PictureDetelecine"] intValue] == 2)
+ {
+ [fPictureFilterController setDetelecineCustomString:[chosenPreset objectForKey:@"PictureDetelecineCustom"]];
+ }
}
else
{
- [fPictureController setDetelecine:0];
+ [fPictureFilterController setDetelecine:0];
}
+
/* Denoise */
- if ([chosenPreset objectForKey:@"PictureDenoise"])
+ if ([[chosenPreset objectForKey:@"PictureDenoise"] intValue] > 0)
{
- [fPictureController setDenoise:[[chosenPreset objectForKey:@"PictureDenoise"] intValue]];
+ [fPictureFilterController setDenoise:[[chosenPreset objectForKey:@"PictureDenoise"] intValue]];
+ /* if we are using "Custom" in the denoise setting, also set the custom string*/
+ if ([[chosenPreset objectForKey:@"PictureDenoise"] intValue] == 4)
+ {
+ [fPictureFilterController setDenoiseCustomString:[chosenPreset objectForKey:@"PictureDenoiseCustom"]];
+ }
}
else
{
- [fPictureController setDenoise:0];
+ [fPictureFilterController setDenoise:0];
}
+
/* Deblock */
if ([[chosenPreset objectForKey:@"PictureDeblock"] intValue] == 1)
{
/* if its a one, then its the old on/off deblock, set on to 5*/
- [fPictureController setDeblock:5];
+ [fPictureFilterController setDeblock:5];
}
else
{
/* use the settings intValue */
- [fPictureController setDeblock:[[chosenPreset objectForKey:@"PictureDeblock"] intValue]];
+ [fPictureFilterController setDeblock:[[chosenPreset objectForKey:@"PictureDeblock"] intValue]];
}
- /* Decomb */
- if ([[chosenPreset objectForKey:@"PictureDecomb"] intValue] == 1)
+
+ if ([[chosenPreset objectForKey:@"VideoGrayScale"] intValue] == 1)
{
- [fPictureController setDecomb:1];
+ [fPictureFilterController setGrayscale:1];
}
else
{
- [fPictureController setDecomb:0];
+ [fPictureFilterController setGrayscale:0];
}
}
/* we call SetTitle: in fPictureController so we get an instant update in the Picture Settings window */
[fPictureController SetTitle:fTitle];
+ [fPictureFilterController SetTitle:fTitle];
[self calculatePictureSizing:nil];
}
}
[preset setObject:[NSNumber numberWithInt:[fVidQualityMatrix selectedRow]] forKey:@"VideoQualityType"];
[preset setObject:[fVidTargetSizeField stringValue] forKey:@"VideoTargetSize"];
[preset setObject:[fVidBitrateField stringValue] forKey:@"VideoAvgBitrate"];
- [preset setObject:[NSNumber numberWithFloat:[fVidQualitySlider floatValue]] forKey:@"VideoQualitySlider"];
+ [preset setObject:[NSNumber numberWithFloat:[fVidQualityRFField floatValue]] forKey:@"VideoQualitySlider"];
/* Video framerate */
if ([fVidRatePopUp indexOfSelectedItem] == 0) // Same as source is selected
{
[preset setObject:[fVidRatePopUp titleOfSelectedItem] forKey:@"VideoFramerate"];
}
- /* GrayScale */
- [preset setObject:[NSNumber numberWithInt:[fVidGrayscaleCheck state]] forKey:@"VideoGrayScale"];
+
/* 2 Pass Encoding */
[preset setObject:[NSNumber numberWithInt:[fVidTwoPassCheck state]] forKey:@"VideoTwoPass"];
/* Turbo 2 pass Encoding fVidTurboPassCheck*/
[preset setObject:[NSNumber numberWithInt:fTitle->job->width] forKey:@"PictureWidth"];
[preset setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PictureHeight"];
[preset setObject:[NSNumber numberWithInt:fTitle->job->keep_ratio] forKey:@"PictureKeepRatio"];
- [preset setObject:[NSNumber numberWithInt:fTitle->job->pixel_ratio] forKey:@"PicturePAR"];
+ [preset setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.mode] forKey:@"PicturePAR"];
/* Set crop settings here */
[preset setObject:[NSNumber numberWithInt:[fPictureController autoCrop]] forKey:@"PictureAutoCrop"];
[preset setObject:[NSNumber numberWithInt:job->crop[3]] forKey:@"PictureRightCrop"];
/* Picture Filters */
- [preset setObject:[NSNumber numberWithInt:[fPictureController deinterlace]] forKey:@"PictureDeinterlace"];
- [preset setObject:[NSNumber numberWithInt:[fPictureController detelecine]] forKey:@"PictureDetelecine"];
- //[preset setObject:[NSNumber numberWithInt:[fPictureController vfr]] forKey:@"VFR"];
- [preset setObject:[NSNumber numberWithInt:[fPictureController denoise]] forKey:@"PictureDenoise"];
- [preset setObject:[NSNumber numberWithInt:[fPictureController deblock]] forKey:@"PictureDeblock"];
- [preset setObject:[NSNumber numberWithInt:[fPictureController decomb]] forKey:@"PictureDecomb"];
+ [preset setObject:[NSNumber numberWithInt:[fPictureFilterController useDecomb]] forKey:@"PictureDecombDeinterlace"];
+ [preset setObject:[NSNumber numberWithInt:[fPictureFilterController deinterlace]] forKey:@"PictureDeinterlace"];
+ [preset setObject:[fPictureFilterController deinterlaceCustomString] forKey:@"PictureDeinterlaceCustom"];
+ [preset setObject:[NSNumber numberWithInt:[fPictureFilterController detelecine]] forKey:@"PictureDetelecine"];
+ [preset setObject:[fPictureFilterController detelecineCustomString] forKey:@"PictureDetelecineCustom"];
+ [preset setObject:[NSNumber numberWithInt:[fPictureFilterController denoise]] forKey:@"PictureDenoise"];
+ [preset setObject:[fPictureFilterController denoiseCustomString] forKey:@"PictureDenoiseCustom"];
+ [preset setObject:[NSNumber numberWithInt:[fPictureFilterController deblock]] forKey:@"PictureDeblock"];
+ [preset setObject:[NSNumber numberWithInt:[fPictureFilterController decomb]] forKey:@"PictureDecomb"];
+ [preset setObject:[fPictureFilterController decombCustomString] forKey:@"PictureDecombCustom"];
+ [preset setObject:[NSNumber numberWithInt:[fPictureFilterController grayscale]] forKey:@"VideoGrayScale"];
/*Audio*/