#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";
{
return nil;
}
-
+
[HBPreferencesController registerUserDefaults];
fHandle = NULL;
fQueueEncodeLibhb = NULL;
* outputPanel needs it right away, as may other future methods
*/
NSString *libraryDir = [NSSearchPathForDirectoriesInDomains( NSLibraryDirectory,
- NSUserDomainMask,
- YES ) objectAtIndex:0];
+ NSUserDomainMask,
+ YES ) objectAtIndex:0];
AppSupportDirectory = [[libraryDir stringByAppendingPathComponent:@"Application Support"]
- stringByAppendingPathComponent:@"HandBrake"];
+ stringByAppendingPathComponent:@"HandBrake"];
if( ![[NSFileManager defaultManager] fileExistsAtPath:AppSupportDirectory] )
{
[[NSFileManager defaultManager] createDirectoryAtPath:AppSupportDirectory
attributes:nil];
}
-
+ /* Check for and create the App Support Preview directory if necessary */
+ NSString *PreviewDirectory = [AppSupportDirectory stringByAppendingPathComponent:@"Previews"];
+ if( ![[NSFileManager defaultManager] fileExistsAtPath:PreviewDirectory] )
+ {
+ [[NSFileManager defaultManager] createDirectoryAtPath:PreviewDirectory
+ 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
- * for updating built in presets, may move more functionality
- * there in the future
- */
+ * for updating built in presets, may move more functionality
+ * there in the future
+ */
fPresetsBuiltin = [[HBPresets alloc] init];
fPreferencesController = [[HBPreferencesController alloc] init];
/* Lets report the HandBrake version number here to the activity log and text log file */
[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];
+
/* 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 ([fPreviewController fullScreen] == YES)
+ {
+ [fPreviewController goWindowedScreen:nil];
+ }
- // Warn if encoding a movie
hb_state_t s;
hb_get_state( fQueueEncodeLibhb, &s );
[browsedSourceDisplayName release];
[outputPanel release];
[fQueueController release];
+ [fPictureController release];
+ [fPictureFilterController release];
+
+ [fPreviewController 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};
+
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];
- [self shouldEnableHttpMp4CheckBox: nil];
-
+
} else {
-
+
[fPresetsOutlineView setEnabled: NO];
-
+
}
-
+
[self videoMatrixChanged:nil];
[fAdvancedOptions enableUI:b];
}
[fWindow setFrame:frame display:YES animate:YES];
fRipIndicatorShown = NO;
}
-
- /* Check to see if the encode state has not been cancelled
+ /* Since we are done with this encode, tell output to stop writing to the
+ * individual encode log
+ */
+ [outputPanel endEncodeLog];
+ /* Check to see if the encode state has not been cancelled
to determine if we should check for encode done notifications */
if( fEncodeState != 2 )
{
[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)
{
[self writeToActivityLog: "scanning specifically for title: %d", scanTitleNum];
}
-
- hb_scan( fHandle, [path UTF8String], scanTitleNum );
+ /* We use our advance pref to determine how many previews to scan */
+ int hb_num_previews = [[[NSUserDefaults standardUserDefaults] objectForKey:@"PreviewsNumber"] intValue];
+ hb_scan( fHandle, [path UTF8String], scanTitleNum, hb_num_previews, 1 );
[fSrcDVD2Field setStringValue:@"Scanning new source ..."];
}
}
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];
+ }
}
}
- (void) browseFileDone: (NSSavePanel *) sheet
- returnCode: (int) returnCode contextInfo: (void *) contextInfo
+ returnCode: (int) returnCode contextInfo: (void *) contextInfo
{
if( returnCode == NSOKButton )
{
[fDstFile2Field setStringValue: [sheet filename]];
+ /* Save this path to the prefs so that on next browse destination window it opens there */
+ NSString *destinationDirectory = [[fDstFile2Field stringValue] stringByDeletingLastPathComponent];
+ [[NSUserDefaults standardUserDefaults] setObject:destinationDirectory forKey:@"LastDestinationDirectory"];
}
}
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
hb_chapter_t *chapter = (hb_chapter_t *) hb_list_item( fTitle->list_chapter, i );
if( chapter != NULL )
{
- [ChapterNamesArray addObject:[NSString stringWithFormat:@"%s",chapter->title]];
+ [ChapterNamesArray addObject:[NSString stringWithCString:chapter->title encoding:NSUTF8StringEncoding]];
}
}
[queueFileJob setObject:[NSMutableArray arrayWithArray: ChapterNamesArray] forKey:@"ChapterNames"];
/* 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)
/* Here we actually tell hb_scan to perform the source scan, using the path to source and title number*/
- (void) performNewQueueScan:(NSString *) scanPath scanTitleNum: (int) scanTitleNum
{
- //NSRunAlertPanel(@"Hello!", @"We are now performing a new queue scan!", @"OK", nil, nil);
-
+ /* Tell HB to output a new activity log file for this encode */
+ [outputPanel startEncodeLog:[[QueueFileArray objectAtIndex:currentQueueEncodeIndex] objectForKey:@"DestinationPath"]];
+
+
/* use a bool to determine whether or not we can decrypt using vlc */
BOOL cancelScanDecrypt = 0;
/* set the bool so that showNewScan knows to apply the appropriate queue
//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
{
[self writeToActivityLog: "scanning specifically for title: %d", scanTitleNum];
}
+
[self writeToActivityLog: "performNewQueueScan currentQueueEncodeIndex is: %d", currentQueueEncodeIndex];
- hb_scan( fQueueEncodeLibhb, [path UTF8String], scanTitleNum );
+ /* We use our advance pref to determine how many previews to scan */
+ int hb_num_previews = [[[NSUserDefaults standardUserDefaults] objectForKey:@"PreviewsNumber"] intValue];
+ hb_scan( fQueueEncodeLibhb, [path UTF8String], scanTitleNum, hb_num_previews, 0 );
}
}
[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];
}
NSMutableDictionary * queueToApply = [QueueFileArray objectAtIndex:currentQueueEncodeIndex];
- [self writeToActivityLog: "processNewQueueEncode currentQueueEncodeIndex is: %d", currentQueueEncodeIndex];
+ [self writeToActivityLog: "Preset: %s", [[queueToApply objectForKey:@"PresetName"] UTF8String]];
[self writeToActivityLog: "processNewQueueEncode number of passes expected is: %d", ([[queueToApply objectForKey:@"VideoTwoPass"] intValue] + 1)];
job->file = [[queueToApply objectForKey:@"DestinationPath"] UTF8String];
- [self writeToActivityLog: "processNewQueueEncode sending to prepareJob"];
+ //[self writeToActivityLog: "processNewQueueEncode sending to prepareJob"];
[self prepareJob];
if( [[queueToApply objectForKey:@"SubtitlesForced"] intValue] == 1 )
job->subtitle_force = 1;
[self doRip];
}
-
#pragma mark -
-#pragma mark Job Handling
-
-
-- (void) prepareJob
+#pragma mark Live Preview
+/* Note,this is much like prepareJob, but directly sets the job vars so Picture Preview
+ * can encode to its temp preview directory and playback. This is *not* used for any actual user
+ * encodes
+ */
+- (void) prepareJobForPreview
{
-
- NSMutableDictionary * queueToApply = [QueueFileArray objectAtIndex:currentQueueEncodeIndex];
- hb_list_t * list = hb_get_titles( fQueueEncodeLibhb );
- hb_title_t * title = (hb_title_t *) hb_list_item( list,0 ); // is always zero since now its a single title scan
+ hb_list_t * list = hb_get_titles( fHandle );
+ hb_title_t * title = (hb_title_t *) hb_list_item( list,
+ [fSrcTitlePopUp indexOfSelectedItem] );
hb_job_t * job = title->job;
hb_audio_config_t * audio;
+
/* Chapter selection */
- job->chapter_start = [[queueToApply objectForKey:@"JobChapterStart"] intValue];
- job->chapter_end = [[queueToApply objectForKey:@"JobChapterEnd"] intValue];
+ job->chapter_start = [fSrcChapterStartPopUp indexOfSelectedItem] + 1;
+ job->chapter_end = [fSrcChapterEndPopUp indexOfSelectedItem] + 1;
/* Format (Muxer) and Video Encoder */
- job->mux = [[queueToApply objectForKey:@"JobFileFormatMux"] intValue];
- job->vcodec = [[queueToApply objectForKey:@"JobVideoEncoderVcodec"] intValue];
-
-
- /* 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( [[queueToApply objectForKey:@"Mp4LargeFile"] intValue] == 1)
- {
- job->largeFileSize = 1;
- }
- else
- {
- job->largeFileSize = 0;
- }
- /* We set http optimized mp4 here */
- if( [[queueToApply objectForKey:@"Mp4HttpOptimize"] intValue] == 1 )
- {
- job->mp4_optimize = 1;
- }
- else
- {
- job->mp4_optimize = 0;
- }
-
- //}
-
- /* We set the chapter marker extraction here based on the format being
- mpeg4 or mkv and the checkbox being checked */
- if ([[queueToApply objectForKey:@"ChapterMarkers"] intValue] == 1)
- {
- job->chapter_markers = 1;
-
- /* now lets get our saved chapter names out the array in the queue file
- * and insert them back into the title chapter list. We have it here,
- * because unless we are inserting chapter markers there is no need to
- * spend the overhead of iterating through the chapter names array imo
- * Also, note that if for some reason we don't apply chapter names, the
- * chapters just come out 001, 002, etc. etc.
- */
-
- NSMutableArray *ChapterNamesArray = [queueToApply objectForKey:@"ChapterNames"];
- int i = 0;
- NSEnumerator *enumerator = [ChapterNamesArray objectEnumerator];
- id tempObject;
- while (tempObject = [enumerator nextObject])
- {
- hb_chapter_t *chapter = (hb_chapter_t *) hb_list_item( title->list_chapter, i );
- if( chapter != NULL )
- {
- strncpy( chapter->title, [tempObject UTF8String], 1023);
- chapter->title[1023] = '\0';
- }
- i++;
- }
- }
- else
- {
- job->chapter_markers = 0;
- }
-
+ job->mux = [[fDstFormatPopUp selectedItem] tag];
+ job->vcodec = [[fVidEncoderPopUp selectedItem] tag];
+ job->chapter_markers = 0;
-
-
- if( job->vcodec & HB_VCODEC_X264 )
+ if( job->vcodec & HB_VCODEC_X264 )
{
- if ([[queueToApply objectForKey:@"Mp4iPodCompatible"] intValue] == 1)
- {
- 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 && [[queueToApply objectForKey:@"VideoQualityType"] intValue] == 2)
+ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultCrf"] > 0 && [fVidQualityMatrix selectedRow] == 2)
{
job->crf = 1;
}
+
/* Below Sends x264 options to the core library if x264 is selected*/
/* Lets use this as per Nyx, Thanks Nyx!*/
job->x264opts = (char *)calloc(1024, 1); /* Fixme, this just leaks */
- /* Turbo first pass if two pass and Turbo First pass is selected */
- if( [[queueToApply objectForKey:@"VideoTwoPass"] intValue] == 1 && [[queueToApply objectForKey:@"VideoTurboTwoPass"] intValue] == 1 )
- {
- /* pass the "Turbo" string to be appended to the existing x264 opts string into a variable for the first pass */
- NSString *firstPassOptStringTurbo = @":ref=1:subme=1:me=dia:analyse=none:trellis=0:no-fast-pskip=0:8x8dct=0:weightb=0";
- /* append the "Turbo" string variable to the existing opts string.
- Note: the "Turbo" string must be appended, not prepended to work properly*/
- NSString *firstPassOptStringCombined = [[queueToApply objectForKey:@"x264Option"] stringByAppendingString:firstPassOptStringTurbo];
- strcpy(job->x264opts, [firstPassOptStringCombined UTF8String]);
- }
- else
- {
- strcpy(job->x264opts, [[queueToApply objectForKey:@"x264Option"] UTF8String]);
- }
+ /* For previews we ignore the turbo option for the first pass of two since we only use 1 pass */
+ strcpy(job->x264opts, [[fAdvancedOptions optionsString] UTF8String]);
+
}
-
-
- /* Picture Size Settings */
- job->width = [[queueToApply objectForKey:@"PictureWidth"] intValue];
- job->height = [[queueToApply objectForKey:@"PictureHeight"] intValue];
-
- job->keep_ratio = [[queueToApply objectForKey:@"PictureKeepRatio"] intValue];
- job->pixel_ratio = [[queueToApply objectForKey:@"PicturePAR"] intValue];
-
-
- /* Here we use the crop values saved at the time the preset was saved */
- job->crop[0] = [[queueToApply objectForKey:@"PictureTopCrop"] intValue];
- job->crop[1] = [[queueToApply objectForKey:@"PictureBottomCrop"] intValue];
- job->crop[2] = [[queueToApply objectForKey:@"PictureLeftCrop"] intValue];
- job->crop[3] = [[queueToApply objectForKey:@"PictureRightCrop"] intValue];
-
+
/* Video settings */
- /* Framerate */
-
- /* Set vfr to 0 as it's only on if using same as source in the framerate popup
+ /* Set vfr to 0 as it's only on if using same as source in the framerate popup
* and detelecine is on, so we handle that in the logic below
*/
job->vfr = 0;
- if( [[queueToApply objectForKey:@"JobIndexVideoFramerate"] intValue] > 0 )
+ if( [fVidRatePopUp indexOfSelectedItem] > 0 )
{
/* a specific framerate has been chosen */
job->vrate = 27000000;
- job->vrate_base = hb_video_rates[[[queueToApply objectForKey:@"JobIndexVideoFramerate"] intValue]-1].rate;
+ job->vrate_base = hb_video_rates[[fVidRatePopUp indexOfSelectedItem]-1].rate;
/* We are not same as source so we set job->cfr to 1
* to enable constant frame rate since user has specified
* a specific framerate*/
else
{
/* We are same as source (variable) */
- job->vrate = [[queueToApply objectForKey:@"JobVrate"] intValue];
- job->vrate_base = [[queueToApply objectForKey:@"JobVrateBase"] intValue];
+ job->vrate = title->rate;
+ job->vrate_base = title->rate_base;
/* We are same as source so we set job->cfr to 0
* to enable true same as source framerate */
job->cfr = 0;
/* If we are same as source and we have detelecine on, we need to turn on
* job->vfr
*/
- if ([[queueToApply objectForKey:@"PictureDetelecine"] intValue] == 1)
+ if ([fPictureFilterController detelecine] == 1)
{
job->vfr = 1;
}
}
- if ( [[queueToApply objectForKey:@"VideoQualityType"] intValue] != 2 )
- {
- /* Target size.
- Bitrate should already have been calculated and displayed
- in fVidBitrateField, so let's just use it same as abr*/
- job->vquality = -1.0;
- job->vbitrate = [[queueToApply objectForKey:@"VideoAvgBitrate"] intValue];
- }
- if ( [[queueToApply objectForKey:@"VideoQualityType"] intValue] == 2 )
+
+ switch( [fVidQualityMatrix selectedRow] )
{
- job->vquality = [[queueToApply objectForKey:@"VideoQualitySlider"] floatValue];
- job->vbitrate = 0;
-
+ case 0:
+ /* Target size.
+ Bitrate should already have been calculated and displayed
+ in fVidBitrateField, so let's just use it */
+ case 1:
+ job->vquality = -1.0;
+ job->vbitrate = [fVidBitrateField intValue];
+ break;
+ case 2:
+ job->vquality = [fVidQualitySlider floatValue];
+ job->vbitrate = 0;
+ break;
}
-
- job->grayscale = [[queueToApply objectForKey:@"VideoGrayScale"] intValue];
+
/* Subtitle settings */
- job->subtitle = [[queueToApply objectForKey:@"JobSubtitlesIndex"] intValue] - 2;
-
+ job->subtitle = [fSubPopUp indexOfSelectedItem] - 2;
+
/* Audio tracks and mixdowns */
/* Lets make sure there arent any erroneous audio tracks in the job list, so lets make sure its empty*/
int audiotrack_count = hb_list_count(job->list_audio);
hb_list_rem(job->list_audio, temp_audio);
}
/* Now lets add our new tracks to the audio list here */
- if ([[queueToApply objectForKey:@"Audio1Track"] intValue] > 0)
+ if ([fAudLang1PopUp indexOfSelectedItem] > 0)
{
audio = (hb_audio_config_t *) calloc(1, sizeof(*audio));
hb_audio_config_init(audio);
- audio->in.track = [[queueToApply objectForKey:@"Audio1Track"] intValue] - 1;
+ audio->in.track = [fAudLang1PopUp indexOfSelectedItem] - 1;
/* We go ahead and assign values to our audio->out.<properties> */
- audio->out.track = [[queueToApply objectForKey:@"Audio1Track"] intValue] - 1;
- audio->out.codec = [[queueToApply objectForKey:@"JobAudio1Encoder"] intValue];
- audio->out.mixdown = [[queueToApply objectForKey:@"JobAudio1Mixdown"] intValue];
- audio->out.bitrate = [[queueToApply objectForKey:@"JobAudio1Bitrate"] intValue];
- audio->out.samplerate = [[queueToApply objectForKey:@"JobAudio1Samplerate"] intValue];
- audio->out.dynamic_range_compression = [[queueToApply objectForKey:@"Audio1TrackDRCSlider"] floatValue];
+ audio->out.track = [fAudLang1PopUp indexOfSelectedItem] - 1;
+ audio->out.codec = [[fAudTrack1CodecPopUp selectedItem] tag];
+ audio->out.mixdown = [[fAudTrack1MixPopUp selectedItem] tag];
+ audio->out.bitrate = [[fAudTrack1BitratePopUp selectedItem] tag];
+ audio->out.samplerate = [[fAudTrack1RatePopUp selectedItem] tag];
+ audio->out.dynamic_range_compression = [fAudTrack1DrcField floatValue];
+
+ hb_audio_add( job, audio );
+ free(audio);
+ }
+ if ([fAudLang2PopUp indexOfSelectedItem] > 0)
+ {
+ audio = (hb_audio_config_t *) calloc(1, sizeof(*audio));
+ hb_audio_config_init(audio);
+ audio->in.track = [fAudLang2PopUp indexOfSelectedItem] - 1;
+ /* We go ahead and assign values to our audio->out.<properties> */
+ audio->out.track = [fAudLang2PopUp indexOfSelectedItem] - 1;
+ audio->out.codec = [[fAudTrack2CodecPopUp selectedItem] tag];
+ audio->out.mixdown = [[fAudTrack2MixPopUp selectedItem] tag];
+ audio->out.bitrate = [[fAudTrack2BitratePopUp selectedItem] tag];
+ audio->out.samplerate = [[fAudTrack2RatePopUp selectedItem] tag];
+ audio->out.dynamic_range_compression = [fAudTrack2DrcField floatValue];
+
+ hb_audio_add( job, audio );
+ free(audio);
+
+ }
+
+ if ([fAudLang3PopUp indexOfSelectedItem] > 0)
+ {
+ audio = (hb_audio_config_t *) calloc(1, sizeof(*audio));
+ hb_audio_config_init(audio);
+ audio->in.track = [fAudLang3PopUp indexOfSelectedItem] - 1;
+ /* We go ahead and assign values to our audio->out.<properties> */
+ audio->out.track = [fAudLang3PopUp indexOfSelectedItem] - 1;
+ audio->out.codec = [[fAudTrack3CodecPopUp selectedItem] tag];
+ audio->out.mixdown = [[fAudTrack3MixPopUp selectedItem] tag];
+ audio->out.bitrate = [[fAudTrack3BitratePopUp selectedItem] tag];
+ audio->out.samplerate = [[fAudTrack3RatePopUp selectedItem] tag];
+ audio->out.dynamic_range_compression = [fAudTrack3DrcField floatValue];
+
+ hb_audio_add( job, audio );
+ free(audio);
+
+ }
+
+ if ([fAudLang4PopUp indexOfSelectedItem] > 0)
+ {
+ audio = (hb_audio_config_t *) calloc(1, sizeof(*audio));
+ hb_audio_config_init(audio);
+ audio->in.track = [fAudLang4PopUp indexOfSelectedItem] - 1;
+ /* We go ahead and assign values to our audio->out.<properties> */
+ audio->out.track = [fAudLang4PopUp indexOfSelectedItem] - 1;
+ audio->out.codec = [[fAudTrack4CodecPopUp selectedItem] tag];
+ audio->out.mixdown = [[fAudTrack4MixPopUp selectedItem] tag];
+ audio->out.bitrate = [[fAudTrack4BitratePopUp selectedItem] tag];
+ audio->out.samplerate = [[fAudTrack4RatePopUp selectedItem] tag];
+ audio->out.dynamic_range_compression = [fAudTrack4DrcField floatValue];
+
+ hb_audio_add( job, audio );
+ free(audio);
+
+ }
+
+
+
+ /* 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.
+ * The order of the filters is critical
+ */
+
+ /* Detelecine */
+ if ([fPictureFilterController detelecine] == 1)
+ {
+ hb_list_add( job->filters, &hb_filter_detelecine );
+ }
+ if ([fPictureFilterController detelecine] == 2)
+ {
+ /* use a custom detelecine string */
+ hb_filter_detelecine.settings = (char *) [[fPictureFilterController detelecineCustomString] UTF8String];
+ hb_list_add( job->filters, &hb_filter_detelecine );
+ }
+ if ([fPictureFilterController useDecomb] == 1)
+ {
+ /* 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
+ {
+
+ /* 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 ([fPictureFilterController denoise] == 1) // Weak in popup
+ {
+ hb_filter_denoise.settings = "2:1:2:3";
+ hb_list_add( job->filters, &hb_filter_denoise );
+ }
+ 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 ([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 ([fPictureFilterController deblock] != 0)
+ {
+ NSString *deblockStringValue = [NSString stringWithFormat: @"%d",[fPictureFilterController deblock]];
+ hb_filter_deblock.settings = (char *) [deblockStringValue UTF8String];
+ hb_list_add( job->filters, &hb_filter_deblock );
+ }
+
+}
+
+
+#pragma mark -
+#pragma mark Job Handling
+
+
+- (void) prepareJob
+{
+
+ NSMutableDictionary * queueToApply = [QueueFileArray objectAtIndex:currentQueueEncodeIndex];
+ hb_list_t * list = hb_get_titles( fQueueEncodeLibhb );
+ hb_title_t * title = (hb_title_t *) hb_list_item( list,0 ); // is always zero since now its a single title scan
+ hb_job_t * job = title->job;
+ hb_audio_config_t * audio;
+ /* Chapter selection */
+ job->chapter_start = [[queueToApply objectForKey:@"JobChapterStart"] intValue];
+ job->chapter_end = [[queueToApply objectForKey:@"JobChapterEnd"] intValue];
+
+ /* Format (Muxer) and Video Encoder */
+ job->mux = [[queueToApply objectForKey:@"JobFileFormatMux"] intValue];
+ job->vcodec = [[queueToApply objectForKey:@"JobVideoEncoderVcodec"] intValue];
+
+
+ /* 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( [[queueToApply objectForKey:@"Mp4LargeFile"] intValue] == 1)
+ {
+ job->largeFileSize = 1;
+ }
+ else
+ {
+ job->largeFileSize = 0;
+ }
+ /* We set http optimized mp4 here */
+ if( [[queueToApply objectForKey:@"Mp4HttpOptimize"] intValue] == 1 )
+ {
+ job->mp4_optimize = 1;
+ }
+ else
+ {
+ job->mp4_optimize = 0;
+ }
+
+ //}
+
+ /* We set the chapter marker extraction here based on the format being
+ mpeg4 or mkv and the checkbox being checked */
+ if ([[queueToApply objectForKey:@"ChapterMarkers"] intValue] == 1)
+ {
+ job->chapter_markers = 1;
+
+ /* now lets get our saved chapter names out the array in the queue file
+ * and insert them back into the title chapter list. We have it here,
+ * because unless we are inserting chapter markers there is no need to
+ * spend the overhead of iterating through the chapter names array imo
+ * Also, note that if for some reason we don't apply chapter names, the
+ * chapters just come out 001, 002, etc. etc.
+ */
+
+ NSMutableArray *ChapterNamesArray = [queueToApply objectForKey:@"ChapterNames"];
+ int i = 0;
+ NSEnumerator *enumerator = [ChapterNamesArray objectEnumerator];
+ id tempObject;
+ while (tempObject = [enumerator nextObject])
+ {
+ hb_chapter_t *chapter = (hb_chapter_t *) hb_list_item( title->list_chapter, i );
+ if( chapter != NULL )
+ {
+ strncpy( chapter->title, [tempObject UTF8String], 1023);
+ chapter->title[1023] = '\0';
+ }
+ i++;
+ }
+ }
+ else
+ {
+ job->chapter_markers = 0;
+ }
+
+ if( job->vcodec & HB_VCODEC_X264 )
+ {
+ if ([[queueToApply objectForKey:@"Mp4iPodCompatible"] intValue] == 1)
+ {
+ 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 && [[queueToApply objectForKey:@"VideoQualityType"] intValue] == 2)
+ {
+ job->crf = 1;
+ }
+ /* Below Sends x264 options to the core library if x264 is selected*/
+ /* Lets use this as per Nyx, Thanks Nyx!*/
+ job->x264opts = (char *)calloc(1024, 1); /* Fixme, this just leaks */
+ /* Turbo first pass if two pass and Turbo First pass is selected */
+ if( [[queueToApply objectForKey:@"VideoTwoPass"] intValue] == 1 && [[queueToApply objectForKey:@"VideoTurboTwoPass"] intValue] == 1 )
+ {
+ /* pass the "Turbo" string to be appended to the existing x264 opts string into a variable for the first pass */
+ NSString *firstPassOptStringTurbo = @":ref=1:subme=1:me=dia:analyse=none:trellis=0:no-fast-pskip=0:8x8dct=0:weightb=0";
+ /* append the "Turbo" string variable to the existing opts string.
+ Note: the "Turbo" string must be appended, not prepended to work properly*/
+ NSString *firstPassOptStringCombined = [[queueToApply objectForKey:@"x264Option"] stringByAppendingString:firstPassOptStringTurbo];
+ strcpy(job->x264opts, [firstPassOptStringCombined UTF8String]);
+ }
+ else
+ {
+ strcpy(job->x264opts, [[queueToApply objectForKey:@"x264Option"] UTF8String]);
+ }
+
+ }
+
+
+ /* Picture Size Settings */
+ job->width = [[queueToApply objectForKey:@"PictureWidth"] intValue];
+ job->height = [[queueToApply objectForKey:@"PictureHeight"] intValue];
+
+ job->keep_ratio = [[queueToApply objectForKey:@"PictureKeepRatio"] intValue];
+ job->anamorphic.mode = [[queueToApply objectForKey:@"PicturePAR"] intValue];
+
+
+ /* Here we use the crop values saved at the time the preset was saved */
+ job->crop[0] = [[queueToApply objectForKey:@"PictureTopCrop"] intValue];
+ job->crop[1] = [[queueToApply objectForKey:@"PictureBottomCrop"] intValue];
+ job->crop[2] = [[queueToApply objectForKey:@"PictureLeftCrop"] intValue];
+ job->crop[3] = [[queueToApply objectForKey:@"PictureRightCrop"] intValue];
+
+ /* Video settings */
+ /* Framerate */
+
+ /* Set vfr to 0 as it's only on if using same as source in the framerate popup
+ * and detelecine is on, so we handle that in the logic below
+ */
+ job->vfr = 0;
+ if( [[queueToApply objectForKey:@"JobIndexVideoFramerate"] intValue] > 0 )
+ {
+ /* a specific framerate has been chosen */
+ job->vrate = 27000000;
+ job->vrate_base = hb_video_rates[[[queueToApply objectForKey:@"JobIndexVideoFramerate"] intValue]-1].rate;
+ /* We are not same as source so we set job->cfr to 1
+ * to enable constant frame rate since user has specified
+ * a specific framerate*/
+ job->cfr = 1;
+ }
+ else
+ {
+ /* We are same as source (variable) */
+ job->vrate = [[queueToApply objectForKey:@"JobVrate"] intValue];
+ job->vrate_base = [[queueToApply objectForKey:@"JobVrateBase"] intValue];
+ /* We are same as source so we set job->cfr to 0
+ * to enable true same as source framerate */
+ job->cfr = 0;
+ /* If we are same as source and we have detelecine on, we need to turn on
+ * job->vfr
+ */
+ if ([[queueToApply objectForKey:@"PictureDetelecine"] intValue] == 1)
+ {
+ job->vfr = 1;
+ }
+ }
+
+ if ( [[queueToApply objectForKey:@"VideoQualityType"] intValue] != 2 )
+ {
+ /* Target size.
+ Bitrate should already have been calculated and displayed
+ in fVidBitrateField, so let's just use it same as abr*/
+ job->vquality = -1.0;
+ job->vbitrate = [[queueToApply objectForKey:@"VideoAvgBitrate"] intValue];
+ }
+ if ( [[queueToApply objectForKey:@"VideoQualityType"] intValue] == 2 )
+ {
+ job->vquality = [[queueToApply objectForKey:@"VideoQualitySlider"] floatValue];
+ job->vbitrate = 0;
+
+ }
+
+ job->grayscale = [[queueToApply objectForKey:@"VideoGrayScale"] intValue];
+ /* Subtitle settings */
+ job->subtitle = [[queueToApply objectForKey:@"JobSubtitlesIndex"] intValue] - 2;
+
+ /* Audio tracks and mixdowns */
+ /* Lets make sure there arent any erroneous audio tracks in the job list, so lets make sure its empty*/
+ int audiotrack_count = hb_list_count(job->list_audio);
+ for( int i = 0; i < audiotrack_count;i++)
+ {
+ hb_audio_t * temp_audio = (hb_audio_t*) hb_list_item( job->list_audio, 0 );
+ hb_list_rem(job->list_audio, temp_audio);
+ }
+ /* Now lets add our new tracks to the audio list here */
+ if ([[queueToApply objectForKey:@"Audio1Track"] intValue] > 0)
+ {
+ audio = (hb_audio_config_t *) calloc(1, sizeof(*audio));
+ hb_audio_config_init(audio);
+ audio->in.track = [[queueToApply objectForKey:@"Audio1Track"] intValue] - 1;
+ /* We go ahead and assign values to our audio->out.<properties> */
+ audio->out.track = [[queueToApply objectForKey:@"Audio1Track"] intValue] - 1;
+ audio->out.codec = [[queueToApply objectForKey:@"JobAudio1Encoder"] intValue];
+ audio->out.mixdown = [[queueToApply objectForKey:@"JobAudio1Mixdown"] intValue];
+ audio->out.bitrate = [[queueToApply objectForKey:@"JobAudio1Bitrate"] intValue];
+ audio->out.samplerate = [[queueToApply objectForKey:@"JobAudio1Samplerate"] intValue];
+ audio->out.dynamic_range_compression = [[queueToApply objectForKey:@"Audio1TrackDRCSlider"] floatValue];
hb_audio_add( job, audio );
free(audio);
/* 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)
- {
- /* 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)
+ if ([[queueToApply objectForKey:@"PictureDecombDeinterlace"] intValue] == 1)
{
- /* 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
{
otherwise, just rip the queue */
if(fPendingCount == 0)
{
- [self writeToActivityLog: "Rip: No pending jobs, so sending this one to doAddToQueue"];
- [self doAddToQueue];
+ [self writeToActivityLog: "Rip: No pending jobs, so sending this one to doAddToQueue"];
+ [self doAddToQueue];
}
- NSString *destinationDirectory = [[fDstFile2Field stringValue] stringByDeletingLastPathComponent];
- [[NSUserDefaults standardUserDefaults] setObject:destinationDirectory forKey:@"LastDestinationDirectory"];
/* go right to processing the new queue encode */
- [self writeToActivityLog: "Rip: Going right to performNewQueueScan"];
- [self performNewQueueScan:[[QueueFileArray objectAtIndex:currentQueueEncodeIndex] objectForKey:@"SourcePath"] scanTitleNum:[[[QueueFileArray objectAtIndex:currentQueueEncodeIndex] objectForKey:@"TitleNumber"]intValue]];
+ [self writeToActivityLog: "Rip: Going right to performNewQueueScan"];
+ [self performNewQueueScan:[[QueueFileArray objectAtIndex:currentQueueEncodeIndex] objectForKey:@"SourcePath"] scanTitleNum:[[[QueueFileArray objectAtIndex:currentQueueEncodeIndex] objectForKey:@"TitleNumber"]intValue]];
}
}
//------------------------------------------------------------------------------------
-// Cancels and deletes the current job and stops libhb from processing the remaining
-// encodes.
-//------------------------------------------------------------------------------------
-- (void) doCancelCurrentJob
-{
- // Stop the current job. hb_stop will only cancel the current pass and then set
- // its state to HB_STATE_WORKDONE. It also does this asynchronously. So when we
- // see the state has changed to HB_STATE_WORKDONE (in updateUI), we'll delete the
- // remaining passes of the job and then start the queue back up if there are any
- // remaining jobs.
-
-
- hb_stop( fQueueEncodeLibhb );
- fEncodeState = 2; // don't alert at end of processing since this was a cancel
-
- // now that we've stopped the currently encoding job, lets mark it as cancelled
- [[QueueFileArray objectAtIndex:currentQueueEncodeIndex] setObject:[NSNumber numberWithInt:3] forKey:@"Status"];
- // and as always, save it in the queue .plist...
- /* We save all of the Queue data here */
- [self saveQueueFileItem];
- // so now lets move to
- currentQueueEncodeIndex++ ;
- // ... and see if there are more items left in our queue
- int queueItems = [QueueFileArray count];
- /* If we still have more items in our queue, lets go to the next one */
- if (currentQueueEncodeIndex < queueItems)
- {
- [self writeToActivityLog: "doCancelCurrentJob currentQueueEncodeIndex is incremented to: %d", currentQueueEncodeIndex];
- [self writeToActivityLog: "doCancelCurrentJob moving to the next job"];
-
- [self performNewQueueScan:[[QueueFileArray objectAtIndex:currentQueueEncodeIndex] objectForKey:@"SourcePath"] scanTitleNum:[[[QueueFileArray objectAtIndex:currentQueueEncodeIndex] objectForKey:@"TitleNumber"]intValue]];
- }
- else
- {
- [self writeToActivityLog: "doCancelCurrentJob the item queue is complete"];
- }
-
-}
-
-//------------------------------------------------------------------------------------
// Displays an alert asking user if the want to cancel encoding of current job.
// Cancel: returns immediately after posting the alert. Later, when the user
// acknowledges the alert, doCancelCurrentJob is called.
}
}
+//------------------------------------------------------------------------------------
+// Cancels and deletes the current job and stops libhb from processing the remaining
+// encodes.
+//------------------------------------------------------------------------------------
+- (void) doCancelCurrentJob
+{
+ // Stop the current job. hb_stop will only cancel the current pass and then set
+ // its state to HB_STATE_WORKDONE. It also does this asynchronously. So when we
+ // see the state has changed to HB_STATE_WORKDONE (in updateUI), we'll delete the
+ // remaining passes of the job and then start the queue back up if there are any
+ // remaining jobs.
+
+
+ hb_stop( fQueueEncodeLibhb );
+
+ // Delete all remaining jobs since libhb doesn't do this on its own.
+ hb_job_t * job;
+ while( ( job = hb_job(fQueueEncodeLibhb, 0) ) )
+ hb_rem( fQueueEncodeLibhb, job );
+
+ fEncodeState = 2; // don't alert at end of processing since this was a cancel
+
+ // now that we've stopped the currently encoding job, lets mark it as cancelled
+ [[QueueFileArray objectAtIndex:currentQueueEncodeIndex] setObject:[NSNumber numberWithInt:3] forKey:@"Status"];
+ // and as always, save it in the queue .plist...
+ /* We save all of the Queue data here */
+ [self saveQueueFileItem];
+ // so now lets move to
+ currentQueueEncodeIndex++ ;
+ // ... and see if there are more items left in our queue
+ int queueItems = [QueueFileArray count];
+ /* If we still have more items in our queue, lets go to the next one */
+ if (currentQueueEncodeIndex < queueItems)
+ {
+ [self writeToActivityLog: "doCancelCurrentJob currentQueueEncodeIndex is incremented to: %d", currentQueueEncodeIndex];
+ [self writeToActivityLog: "doCancelCurrentJob moving to the next job"];
+
+ [self performNewQueueScan:[[QueueFileArray objectAtIndex:currentQueueEncodeIndex] objectForKey:@"SourcePath"] scanTitleNum:[[[QueueFileArray objectAtIndex:currentQueueEncodeIndex] objectForKey:@"TitleNumber"]intValue]];
+ }
+ else
+ {
+ [self writeToActivityLog: "doCancelCurrentJob the item queue is complete"];
+ }
+
+}
+
- (void) doCancelCurrentJobAndStop
{
hb_stop( fQueueEncodeLibhb );
+
+ // Delete all remaining jobs since libhb doesn't do this on its own.
+ hb_job_t * job;
+ while( ( job = hb_job(fQueueEncodeLibhb, 0) ) )
+ hb_rem( fQueueEncodeLibhb, job );
+
+
fEncodeState = 2; // don't alert at end of processing since this was a cancel
// now that we've stopped the currently encoding job, lets mark it as cancelled
/* Start Get and set the initial pic size for display */
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];
- /* Run Through encoderPopUpChanged to see if there
- needs to be any pic value modifications based on encoder settings */
- //[self encoderPopUpChanged: NULL];
- /* END Get and set the initial pic size for display */
-
+ /* 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];
[[fDstFile2Field stringValue] stringByDeletingPathExtension], extension]];
}
-- (void) shouldEnableHttpMp4CheckBox: (id) sender
-{
- if( [[fAudTrack1CodecPopUp selectedItem] tag] == HB_ACODEC_AC3 || [[fAudTrack2CodecPopUp selectedItem] tag] == HB_ACODEC_AC3 ||
- [[fAudTrack3CodecPopUp selectedItem] tag] == HB_ACODEC_AC3 ||
- [[fAudTrack4CodecPopUp selectedItem] tag] == HB_ACODEC_AC3 )
- [fDstMp4HttpOptFileCheck setEnabled: NO];
- else
- [fDstMp4HttpOptFileCheck setEnabled: YES];
-}
-
/* Method to determine if we should change the UI
To reflect whether or not a Preset is being used or if
the user is using "Custom" settings by determining the sender*/
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
- (IBAction) revertPictureSizeToMax: (id) sender
{
hb_job_t * job = fTitle->job;
- /* Here we apply the max source storage width and height */
- job->width = fTitle->width-fTitle->job->crop[2]-fTitle->job->crop[3];
- job->height = fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1];
+ /* Here we apply the title source and height */
+ job->width = fTitle->width;
+ job->height = fTitle->height;
[self calculatePictureSizing: sender];
/* We call method to change UI to reflect whether a preset is used or not*/
* 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]) {
- [fPicSettingDetelecine setStringValue: @"Yes"];
+ if ([fPictureFilterController detelecine] == 1)
+ {
+ videoFilters = [videoFilters stringByAppendingString:@" - Detelecine (Default)"];
}
- else {
- [fPicSettingDetelecine setStringValue: @"No"];
+ else if ([fPictureFilterController detelecine] == 2)
+ {
+ videoFilters = [videoFilters stringByAppendingString:[NSString stringWithFormat:@" - Detelecine (%@)",[fPictureFilterController detelecineCustomString]]];
}
- /* Decomb */
- if ([fPictureController decomb] == 0)
- {
- [fPicSettingDecomb setStringValue: @"Off"];
- }
- else if ([fPictureController decomb] == 1)
- {
- [fPicSettingDecomb setStringValue: @"1:2:6:9:80:16:16"];
- }
- else if ([fPictureController decomb] == 2)
+
+ if ([fPictureFilterController useDecomb] == 1)
{
- [fPicSettingDecomb setStringValue:[[NSUserDefaults standardUserDefaults] stringForKey:@"DecombCustomString"]];
+ /* Decomb */
+ if ([fPictureFilterController decomb] == 1)
+ {
+ videoFilters = [videoFilters stringByAppendingString:@" - Decomb (Default)"];
+ }
+ else if ([fPictureFilterController decomb] == 2)
+ {
+ videoFilters = [videoFilters stringByAppendingString:[NSString stringWithFormat:@" - Decomb (%@)",[fPictureFilterController decombCustomString]]];
+ }
}
-
- /* VFR (Variable Frame Rate) */
+ 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];
}
if( [fDstFormatPopUp indexOfSelectedItem] == 0 )
{
[self autoSetM4vExtension: sender];
- [self shouldEnableHttpMp4CheckBox: sender];
}
}
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 showPanelInWindow:fWindow 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 -
}
}
+- (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
[fDstMp4HttpOptFileCheck setState:[[chosenPreset objectForKey:@"Mp4HttpOptimize"] intValue]];
/* Video encoder */
+ [fVidEncoderPopUp selectItemWithTitle:[chosenPreset objectForKey:@"VideoEncoder"]];
/* We set the advanced opt string here if applicable*/
[fAdvancedOptions setOptions:[chosenPreset objectForKey:@"x264Option"]];
- /* We use a conditional to account for the new x264 encoder dropdown as well as presets made using legacy x264 settings*/
- if ([[chosenPreset objectForKey:@"VideoEncoder"] isEqualToString:@"x264 (h.264 Main)"] ||
- [[chosenPreset objectForKey:@"VideoEncoder"] isEqualToString:@"x264 (h.264 iPod)"] ||
- [[chosenPreset objectForKey:@"VideoEncoder"] isEqualToString:@"x264"])
- {
- [fVidEncoderPopUp selectItemWithTitle:@"H.264 (x264)"];
- /* special case for legacy preset to check the new fDstMp4HttpOptFileCheck checkbox to set the ipod atom */
- if ([[chosenPreset objectForKey:@"VideoEncoder"] isEqualToString:@"x264 (h.264 iPod)"])
- {
- [fDstMp4iPodFileCheck setState:NSOnState];
- /* We also need to add "level=30:" to the advanced opts string to set the correct level for the iPod when
- encountering a legacy preset as it used to be handled separately from the opt string*/
- [fAdvancedOptions setOptions:[@"level=30:" stringByAppendingString:[fAdvancedOptions optionsString]]];
- }
- else
- {
- [fDstMp4iPodFileCheck setState:NSOffState];
- }
- }
- else if ([[chosenPreset objectForKey:@"VideoEncoder"] isEqualToString:@"FFmpeg"])
- {
- [fVidEncoderPopUp selectItemWithTitle:@"MPEG-4 (FFmpeg)"];
- }
- else if ([[chosenPreset objectForKey:@"VideoEncoder"] isEqualToString:@"XviD"])
- {
- [fVidEncoderPopUp selectItemWithTitle:@"MPEG-4 (XviD)"];
- }
- else
- {
- [fVidEncoderPopUp selectItemWithTitle:[chosenPreset objectForKey:@"VideoEncoder"]];
- }
/* Lets run through the following functions to get variables set there */
[self videoEncoderPopUpChanged:nil];
[fVidRatePopUp selectItemWithTitle:[chosenPreset objectForKey:@"VideoFramerate"]];
}
- /* GrayScale */
- [fVidGrayscaleCheck setState:[[chosenPreset objectForKey:@"VideoGrayScale"] intValue]];
/* 2 Pass Encoding */
[fVidTwoPassCheck setState:[[chosenPreset objectForKey:@"VideoTwoPass"] intValue]];
[self twoPassCheckboxChanged:nil];
+
/* Turbo 1st pass for 2 Pass Encoding */
[fVidTurboPassCheck setState:[[chosenPreset objectForKey:@"VideoTurboTwoPass"] intValue]];
/*Audio*/
- if ([chosenPreset objectForKey:@"FileCodecs"])
+
+ if ([chosenPreset objectForKey:@"Audio1Track"] > 0)
{
- /* We need to handle the audio codec popup by determining what was chosen from the deprecated Codecs PopUp for past presets*/
- if ([[chosenPreset objectForKey:@"FileCodecs"] isEqualToString: @"AVC/H.264 Video / AAC + AC3 Audio"])
- {
- /* We need to address setting languages etc. here in the new multi track audio panel */
- /* Track One set here */
- /*for track one though a track should be selected but lets check here anyway and use track one if its not.*/
- if ([fAudLang1PopUp indexOfSelectedItem] == 0)
- {
- [fAudLang1PopUp selectItemAtIndex: 1];
- [self audioTrackPopUpChanged: fAudLang1PopUp];
- }
- [fAudTrack1CodecPopUp selectItemWithTitle: @"AAC (faac)"];
- [self audioTrackPopUpChanged: fAudTrack1CodecPopUp];
- /* Track Two, set source same as track one */
- [fAudLang2PopUp selectItemAtIndex: [fAudLang1PopUp indexOfSelectedItem]];
- [self audioTrackPopUpChanged: fAudLang2PopUp];
- [fAudTrack2CodecPopUp selectItemWithTitle: @"AC3 Passthru"];
- [self audioTrackPopUpChanged: fAudTrack2CodecPopUp];
- }
- else if ([[chosenPreset objectForKey:@"FileCodecs"] isEqualToString:@"MPEG-4 Video / AAC Audio"] ||
- [[chosenPreset objectForKey:@"FileCodecs"] isEqualToString:@"AVC/H.264 Video / AAC Audio"])
+ if ([fAudLang1PopUp indexOfSelectedItem] == 0)
{
- if ([fAudLang1PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack1CodecPopUp selectItemWithTitle: @"AAC (faac)"];
- [self audioTrackPopUpChanged: fAudTrack1CodecPopUp];
- }
- if ([fAudLang2PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack2CodecPopUp selectItemWithTitle: @"AAC (faac)"];
- [self audioTrackPopUpChanged: fAudTrack2CodecPopUp];
- }
- if ([fAudLang3PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack3CodecPopUp selectItemWithTitle: @"AAC (faac)"];
- [self audioTrackPopUpChanged: fAudTrack3CodecPopUp];
- }
- if ([fAudLang4PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack4CodecPopUp selectItemWithTitle: @"AAC (faac)"];
- [self audioTrackPopUpChanged: fAudTrack4CodecPopUp];
- }
+ [fAudLang1PopUp selectItemAtIndex: 1];
}
- else if ([[chosenPreset objectForKey:@"FileCodecs"] isEqualToString:@"MPEG-4 Video / AC-3 Audio"] ||
- [[chosenPreset objectForKey:@"FileCodecs"] isEqualToString:@"AVC/H.264 Video / AC-3 Audio"])
+ [self audioTrackPopUpChanged: fAudLang1PopUp];
+ [fAudTrack1CodecPopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio1Encoder"]];
+ [self audioTrackPopUpChanged: fAudTrack1CodecPopUp];
+ [fAudTrack1MixPopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio1Mixdown"]];
+ /* check to see if the selections was available, if not, rerun audioTrackPopUpChanged using the codec to just set the default
+ * mixdown*/
+ if ([fAudTrack1MixPopUp selectedItem] == nil)
{
- if ([fAudLang1PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack1CodecPopUp selectItemWithTitle: @"AC3 Passthru"];
- [self audioTrackPopUpChanged: fAudTrack1CodecPopUp];
- }
- if ([fAudLang2PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack2CodecPopUp selectItemWithTitle: @"AC3 Passthru"];
- [self audioTrackPopUpChanged: fAudTrack2CodecPopUp];
- }
- if ([fAudLang3PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack3CodecPopUp selectItemWithTitle: @"AC3 Passthru"];
- [self audioTrackPopUpChanged: fAudTrack3CodecPopUp];
- }
- if ([fAudLang4PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack4CodecPopUp selectItemWithTitle: @"AC3 Passthru"];
- [self audioTrackPopUpChanged: fAudTrack4CodecPopUp];
- }
+ [self audioTrackPopUpChanged: fAudTrack1CodecPopUp];
}
- else if ([[chosenPreset objectForKey:@"FileCodecs"] isEqualToString:@"MPEG-4 Video / MP3 Audio"] ||
- [[chosenPreset objectForKey:@"FileCodecs"] isEqualToString:@"AVC/H.264 Video / MP3 Audio"])
+ [fAudTrack1RatePopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio1Samplerate"]];
+ /* We set the presets bitrate if it is *not* an AC3 track since that uses the input bitrate */
+ if (![[chosenPreset objectForKey:@"Audio1Encoder"] isEqualToString:@"AC3 Passthru"])
{
- if ([fAudLang1PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack1CodecPopUp selectItemWithTitle: @"MP3 (lame)"];
- [self audioTrackPopUpChanged: fAudTrack1CodecPopUp];
- }
- if ([fAudLang2PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack2CodecPopUp selectItemWithTitle: @"MP3 (lame)"];
- [self audioTrackPopUpChanged: fAudTrack2CodecPopUp];
- }
- if ([fAudLang3PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack3CodecPopUp selectItemWithTitle: @"MP3 (lame)"];
- [self audioTrackPopUpChanged: fAudTrack3CodecPopUp];
- }
- if ([fAudLang4PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack4CodecPopUp selectItemWithTitle: @"MP3 (lame)"];
- [self audioTrackPopUpChanged: fAudTrack4CodecPopUp];
- }
+ [fAudTrack1BitratePopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio1Bitrate"]];
}
- else if ([[chosenPreset objectForKey:@"FileCodecs"] isEqualToString:@"MPEG-4 Video / Vorbis Audio"])
+ [fAudTrack1DrcSlider setFloatValue:[[chosenPreset objectForKey:@"Audio1TrackDRCSlider"] floatValue]];
+ [self audioDRCSliderChanged: fAudTrack1DrcSlider];
+ }
+ if ([chosenPreset objectForKey:@"Audio2Track"] > 0)
+ {
+ if ([fAudLang2PopUp indexOfSelectedItem] == 0)
{
- if ([fAudLang1PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack1CodecPopUp selectItemWithTitle: @"Vorbis (vorbis)"];
- [self audioTrackPopUpChanged: fAudTrack1CodecPopUp];
- }
- if ([fAudLang2PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack2CodecPopUp selectItemWithTitle: @"Vorbis (vorbis)"];
- [self audioTrackPopUpChanged: fAudTrack2CodecPopUp];
- }
- if ([fAudLang3PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack3CodecPopUp selectItemWithTitle: @"Vorbis (vorbis)"];
- [self audioTrackPopUpChanged: fAudTrack3CodecPopUp];
- }
- if ([fAudLang4PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack4CodecPopUp selectItemWithTitle: @"Vorbis (vorbis)"];
- [self audioTrackPopUpChanged: fAudTrack4CodecPopUp];
- }
+ [fAudLang2PopUp selectItemAtIndex: 1];
}
- /* We detect here if we have the old audio sample rate and if so we apply samplerate and bitrate to the existing four tracks if chosen
- * UNLESS the CodecPopUp is AC3 in which case the preset values are ignored in favor of rates set in audioTrackMixdownChanged*/
- if ([chosenPreset objectForKey:@"AudioSampleRate"])
+ [self audioTrackPopUpChanged: fAudLang2PopUp];
+ [fAudTrack2CodecPopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio2Encoder"]];
+ [self audioTrackPopUpChanged: fAudTrack2CodecPopUp];
+ [fAudTrack2MixPopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio2Mixdown"]];
+ /* check to see if the selections was available, if not, rerun audioTrackPopUpChanged using the codec to just set the default
+ * mixdown*/
+ if ([fAudTrack2MixPopUp selectedItem] == nil)
{
- if ([fAudLang1PopUp indexOfSelectedItem] > 0 && [fAudTrack1CodecPopUp titleOfSelectedItem] != @"AC3 Passthru")
- {
- [fAudTrack1RatePopUp selectItemWithTitle:[chosenPreset objectForKey:@"AudioSampleRate"]];
- [fAudTrack1BitratePopUp selectItemWithTitle:[chosenPreset objectForKey:@"AudioBitRate"]];
- }
- if ([fAudLang2PopUp indexOfSelectedItem] > 0 && [fAudTrack2CodecPopUp titleOfSelectedItem] != @"AC3 Passthru")
- {
- [fAudTrack2RatePopUp selectItemWithTitle:[chosenPreset objectForKey:@"AudioSampleRate"]];
- [fAudTrack2BitratePopUp selectItemWithTitle:[chosenPreset objectForKey:@"AudioBitRate"]];
- }
- if ([fAudLang3PopUp indexOfSelectedItem] > 0 && [fAudTrack3CodecPopUp titleOfSelectedItem] != @"AC3 Passthru")
- {
- [fAudTrack3RatePopUp selectItemWithTitle:[chosenPreset objectForKey:@"AudioSampleRate"]];
- [fAudTrack3BitratePopUp selectItemWithTitle:[chosenPreset objectForKey:@"AudioBitRate"]];
- }
- if ([fAudLang4PopUp indexOfSelectedItem] > 0 && [fAudTrack4CodecPopUp titleOfSelectedItem] != @"AC3 Passthru")
- {
- [fAudTrack4RatePopUp selectItemWithTitle:[chosenPreset objectForKey:@"AudioSampleRate"]];
- [fAudTrack4BitratePopUp selectItemWithTitle:[chosenPreset objectForKey:@"AudioBitRate"]];
- }
+ [self audioTrackPopUpChanged: fAudTrack2CodecPopUp];
}
- /* We detect here if we have the old DRC Slider and if so we apply it to the existing four tracks if chosen */
- if ([chosenPreset objectForKey:@"AudioDRCSlider"])
+ [fAudTrack2RatePopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio2Samplerate"]];
+ /* We set the presets bitrate if it is *not* an AC3 track since that uses the input bitrate */
+ if (![[chosenPreset objectForKey:@"Audio2Encoder"] isEqualToString:@"AC3 Passthru"])
{
- if ([fAudLang1PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack1DrcSlider setFloatValue:[[chosenPreset objectForKey:@"AudioDRCSlider"] floatValue]];
- [self audioDRCSliderChanged: fAudTrack1DrcSlider];
- }
- if ([fAudLang2PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack2DrcSlider setFloatValue:[[chosenPreset objectForKey:@"AudioDRCSlider"] floatValue]];
- [self audioDRCSliderChanged: fAudTrack2DrcSlider];
- }
- if ([fAudLang3PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack3DrcSlider setFloatValue:[[chosenPreset objectForKey:@"AudioDRCSlider"] floatValue]];
- [self audioDRCSliderChanged: fAudTrack3DrcSlider];
- }
- if ([fAudLang4PopUp indexOfSelectedItem] > 0)
- {
- [fAudTrack4DrcSlider setFloatValue:[[chosenPreset objectForKey:@"AudioDRCSlider"] floatValue]];
- [self audioDRCSliderChanged: fAudTrack4DrcSlider];
- }
+ [fAudTrack2BitratePopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio2Bitrate"]];
}
+ [fAudTrack2DrcSlider setFloatValue:[[chosenPreset objectForKey:@"Audio2TrackDRCSlider"] floatValue]];
+ [self audioDRCSliderChanged: fAudTrack2DrcSlider];
}
- else // since there was no codecs key in the preset we know we can use new multi-audio track presets
+ if ([chosenPreset objectForKey:@"Audio3Track"] > 0)
{
- if ([chosenPreset objectForKey:@"Audio1Track"] > 0)
+ if ([fAudLang3PopUp indexOfSelectedItem] == 0)
{
- if ([fAudLang1PopUp indexOfSelectedItem] == 0)
- {
- [fAudLang1PopUp selectItemAtIndex: 1];
- }
- [self audioTrackPopUpChanged: fAudLang1PopUp];
- [fAudTrack1CodecPopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio1Encoder"]];
- [self audioTrackPopUpChanged: fAudTrack1CodecPopUp];
- [fAudTrack1MixPopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio1Mixdown"]];
- /* check to see if the selections was available, if not, rerun audioTrackPopUpChanged using the codec to just set the default
- * mixdown*/
- if ([fAudTrack1MixPopUp selectedItem] == nil)
- {
- [self audioTrackPopUpChanged: fAudTrack1CodecPopUp];
- }
- [fAudTrack1RatePopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio1Samplerate"]];
- /* We set the presets bitrate if it is *not* an AC3 track since that uses the input bitrate */
- if (![[chosenPreset objectForKey:@"Audio1Encoder"] isEqualToString:@"AC3 Passthru"])
- {
- [fAudTrack1BitratePopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio1Bitrate"]];
- }
- [fAudTrack1DrcSlider setFloatValue:[[chosenPreset objectForKey:@"Audio1TrackDRCSlider"] floatValue]];
- [self audioDRCSliderChanged: fAudTrack1DrcSlider];
+ [fAudLang3PopUp selectItemAtIndex: 1];
}
- if ([chosenPreset objectForKey:@"Audio2Track"] > 0)
+ [self audioTrackPopUpChanged: fAudLang3PopUp];
+ [fAudTrack3CodecPopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio3Encoder"]];
+ [self audioTrackPopUpChanged: fAudTrack3CodecPopUp];
+ [fAudTrack3MixPopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio3Mixdown"]];
+ /* check to see if the selections was available, if not, rerun audioTrackPopUpChanged using the codec to just set the default
+ * mixdown*/
+ if ([fAudTrack3MixPopUp selectedItem] == nil)
{
- if ([fAudLang2PopUp indexOfSelectedItem] == 0)
- {
- [fAudLang2PopUp selectItemAtIndex: 1];
- }
- [self audioTrackPopUpChanged: fAudLang2PopUp];
- [fAudTrack2CodecPopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio2Encoder"]];
- [self audioTrackPopUpChanged: fAudTrack2CodecPopUp];
- [fAudTrack2MixPopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio2Mixdown"]];
- /* check to see if the selections was available, if not, rerun audioTrackPopUpChanged using the codec to just set the default
- * mixdown*/
- if ([fAudTrack2MixPopUp selectedItem] == nil)
- {
- [self audioTrackPopUpChanged: fAudTrack2CodecPopUp];
- }
- [fAudTrack2RatePopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio2Samplerate"]];
- /* We set the presets bitrate if it is *not* an AC3 track since that uses the input bitrate */
- if (![[chosenPreset objectForKey:@"Audio2Encoder"] isEqualToString:@"AC3 Passthru"])
- {
- [fAudTrack2BitratePopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio2Bitrate"]];
- }
- [fAudTrack2DrcSlider setFloatValue:[[chosenPreset objectForKey:@"Audio2TrackDRCSlider"] floatValue]];
- [self audioDRCSliderChanged: fAudTrack2DrcSlider];
+ [self audioTrackPopUpChanged: fAudTrack3CodecPopUp];
}
- if ([chosenPreset objectForKey:@"Audio3Track"] > 0)
+ [fAudTrack3RatePopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio3Samplerate"]];
+ /* We set the presets bitrate if it is *not* an AC3 track since that uses the input bitrate */
+ if (![[chosenPreset objectForKey:@"Audio3Encoder"] isEqualToString: @"AC3 Passthru"])
{
- if ([fAudLang3PopUp indexOfSelectedItem] == 0)
- {
- [fAudLang3PopUp selectItemAtIndex: 1];
- }
- [self audioTrackPopUpChanged: fAudLang3PopUp];
- [fAudTrack3CodecPopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio3Encoder"]];
- [self audioTrackPopUpChanged: fAudTrack3CodecPopUp];
- [fAudTrack3MixPopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio3Mixdown"]];
- /* check to see if the selections was available, if not, rerun audioTrackPopUpChanged using the codec to just set the default
- * mixdown*/
- if ([fAudTrack3MixPopUp selectedItem] == nil)
- {
- [self audioTrackPopUpChanged: fAudTrack3CodecPopUp];
- }
- [fAudTrack3RatePopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio3Samplerate"]];
- /* We set the presets bitrate if it is *not* an AC3 track since that uses the input bitrate */
- if (![[chosenPreset objectForKey:@"Audio3Encoder"] isEqualToString: @"AC3 Passthru"])
- {
- [fAudTrack3BitratePopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio3Bitrate"]];
- }
- [fAudTrack3DrcSlider setFloatValue:[[chosenPreset objectForKey:@"Audio3TrackDRCSlider"] floatValue]];
- [self audioDRCSliderChanged: fAudTrack3DrcSlider];
+ [fAudTrack3BitratePopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio3Bitrate"]];
}
- if ([chosenPreset objectForKey:@"Audio4Track"] > 0)
+ [fAudTrack3DrcSlider setFloatValue:[[chosenPreset objectForKey:@"Audio3TrackDRCSlider"] floatValue]];
+ [self audioDRCSliderChanged: fAudTrack3DrcSlider];
+ }
+ if ([chosenPreset objectForKey:@"Audio4Track"] > 0)
+ {
+ if ([fAudLang4PopUp indexOfSelectedItem] == 0)
+ {
+ [fAudLang4PopUp selectItemAtIndex: 1];
+ }
+ [self audioTrackPopUpChanged: fAudLang4PopUp];
+ [fAudTrack4CodecPopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio4Encoder"]];
+ [self audioTrackPopUpChanged: fAudTrack4CodecPopUp];
+ [fAudTrack4MixPopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio4Mixdown"]];
+ /* check to see if the selections was available, if not, rerun audioTrackPopUpChanged using the codec to just set the default
+ * mixdown*/
+ if ([fAudTrack4MixPopUp selectedItem] == nil)
{
- if ([fAudLang4PopUp indexOfSelectedItem] == 0)
- {
- [fAudLang4PopUp selectItemAtIndex: 1];
- }
- [self audioTrackPopUpChanged: fAudLang4PopUp];
- [fAudTrack4CodecPopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio4Encoder"]];
[self audioTrackPopUpChanged: fAudTrack4CodecPopUp];
- [fAudTrack4MixPopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio4Mixdown"]];
- /* check to see if the selections was available, if not, rerun audioTrackPopUpChanged using the codec to just set the default
- * mixdown*/
- if ([fAudTrack4MixPopUp selectedItem] == nil)
- {
- [self audioTrackPopUpChanged: fAudTrack4CodecPopUp];
- }
- [fAudTrack4RatePopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio4Samplerate"]];
- /* We set the presets bitrate if it is *not* an AC3 track since that uses the input bitrate */
- if (![[chosenPreset objectForKey:@"Audio4Encoder"] isEqualToString:@"AC3 Passthru"])
- {
- [fAudTrack4BitratePopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio4Bitrate"]];
- }
- [fAudTrack4DrcSlider setFloatValue:[[chosenPreset objectForKey:@"Audio4TrackDRCSlider"] floatValue]];
- [self audioDRCSliderChanged: fAudTrack4DrcSlider];
}
-
-
+ [fAudTrack4RatePopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio4Samplerate"]];
+ /* We set the presets bitrate if it is *not* an AC3 track since that uses the input bitrate */
+ if (![[chosenPreset objectForKey:@"Audio4Encoder"] isEqualToString:@"AC3 Passthru"])
+ {
+ [fAudTrack4BitratePopUp selectItemWithTitle:[chosenPreset objectForKey:@"Audio4Bitrate"]];
+ }
+ [fAudTrack4DrcSlider setFloatValue:[[chosenPreset objectForKey:@"Audio4TrackDRCSlider"] floatValue]];
+ [self audioDRCSliderChanged: fAudTrack4DrcSlider];
}
- /* We now cleanup any extra audio tracks that may be previously set if we need to, we do it here so we don't have to
- * duplicate any code for legacy presets.*/
- /* First we handle the legacy Codecs crazy AVC/H.264 Video / AAC + AC3 Audio atv hybrid */
- if ([chosenPreset objectForKey:@"FileCodecs"] && [[chosenPreset objectForKey:@"FileCodecs"] isEqualToString:@"AVC/H.264 Video / AAC + AC3 Audio"])
+ /* We now cleanup any extra audio tracks that may have been previously set if we need to */
+
+ if (![chosenPreset objectForKey:@"Audio2Track"] || [chosenPreset objectForKey:@"Audio2Track"] == 0)
+ {
+ [fAudLang2PopUp selectItemAtIndex: 0];
+ [self audioTrackPopUpChanged: fAudLang2PopUp];
+ }
+ if (![chosenPreset objectForKey:@"Audio3Track"] || [chosenPreset objectForKey:@"Audio3Track"] > 0)
{
[fAudLang3PopUp selectItemAtIndex: 0];
[self audioTrackPopUpChanged: fAudLang3PopUp];
- [fAudLang4PopUp selectItemAtIndex: 0];
- [self audioTrackPopUpChanged: fAudLang4PopUp];
}
- else
+ if (![chosenPreset objectForKey:@"Audio4Track"] || [chosenPreset objectForKey:@"Audio4Track"] > 0)
{
- if (![chosenPreset objectForKey:@"Audio2Track"] || [chosenPreset objectForKey:@"Audio2Track"] == 0)
- {
- [fAudLang2PopUp selectItemAtIndex: 0];
- [self audioTrackPopUpChanged: fAudLang2PopUp];
- }
- if (![chosenPreset objectForKey:@"Audio3Track"] || [chosenPreset objectForKey:@"Audio3Track"] > 0)
- {
- [fAudLang3PopUp selectItemAtIndex: 0];
- [self audioTrackPopUpChanged: fAudLang3PopUp];
- }
- if (![chosenPreset objectForKey:@"Audio4Track"] || [chosenPreset objectForKey:@"Audio4Track"] > 0)
- {
- [fAudLang4PopUp selectItemAtIndex: 0];
- [self audioTrackPopUpChanged: fAudLang4PopUp];
- }
+ [fAudLang4PopUp selectItemAtIndex: 0];
+ [self audioTrackPopUpChanged: fAudLang4PopUp];
}
/*Subtitles*/
[fSubForcedCheck setState:[[chosenPreset objectForKey:@"SubtitlesForced"] intValue]];
/* Picture Settings */
- /* Note: objectForKey:@"UsesPictureSettings" now refers to picture size, this encompasses:
+ /* Note: objectForKey:@"UsesPictureSettings" refers to picture size, which encompasses:
* height, width, keep ar, anamorphic and crop settings.
- * picture filters are now handled separately.
- * We will be able to actually change the key names for legacy preset keys when preset file
- * update code is done. But for now, lets hang onto the old legacy key name for backwards compatibility.
+ * picture filters are handled separately below.
*/
/* Check to see if the objectForKey:@"UsesPictureSettings is greater than 0, as 0 means use picture sizing "None"
- * and the preset completely ignores any picture sizing values in the preset.
+ * ( 2 is use max for source and 1 is use exact size when the preset was created ) and the
+ * preset completely ignores any picture sizing values in the preset.
*/
if ([[chosenPreset objectForKey:@"UsesPictureSettings"] intValue] > 0)
{
hb_job_t * job = fTitle->job;
/* If Cropping is set to custom, then recall all four crop values from
- when the preset was created and apply them */
- if ([[chosenPreset objectForKey:@"PictureAutoCrop"] intValue] == 0)
- {
- [fPictureController setAutoCrop:NO];
-
- /* Here we use the custom crop values saved at the time the preset was saved */
- job->crop[0] = [[chosenPreset objectForKey:@"PictureTopCrop"] intValue];
- job->crop[1] = [[chosenPreset objectForKey:@"PictureBottomCrop"] intValue];
- job->crop[2] = [[chosenPreset objectForKey:@"PictureLeftCrop"] intValue];
- job->crop[3] = [[chosenPreset objectForKey:@"PictureRightCrop"] intValue];
-
- }
- else /* if auto crop has been saved in preset, set to auto and use post scan auto crop */
- {
- [fPictureController setAutoCrop:YES];
- /* Here we use the auto crop values determined right after scan */
- job->crop[0] = AutoCropTop;
- job->crop[1] = AutoCropBottom;
- job->crop[2] = AutoCropLeft;
- job->crop[3] = AutoCropRight;
-
- }
-
+ when the preset was created and apply them */
+ if ([[chosenPreset objectForKey:@"PictureAutoCrop"] intValue] == 0)
+ {
+ [fPictureController setAutoCrop:NO];
+
+ /* Here we use the custom crop values saved at the time the preset was saved */
+ job->crop[0] = [[chosenPreset objectForKey:@"PictureTopCrop"] intValue];
+ job->crop[1] = [[chosenPreset objectForKey:@"PictureBottomCrop"] intValue];
+ job->crop[2] = [[chosenPreset objectForKey:@"PictureLeftCrop"] intValue];
+ job->crop[3] = [[chosenPreset objectForKey:@"PictureRightCrop"] intValue];
+
+ }
+ else /* if auto crop has been saved in preset, set to auto and use post scan auto crop */
+ {
+ [fPictureController setAutoCrop:YES];
+ /* Here we use the auto crop values determined right after scan */
+ job->crop[0] = AutoCropTop;
+ job->crop[1] = AutoCropBottom;
+ job->crop[2] = AutoCropLeft;
+ job->crop[3] = AutoCropRight;
+
+ }
+
/* Check to see if the objectForKey:@"UsesPictureSettings is 2 which is "Use Max for the source */
if ([[chosenPreset objectForKey:@"UsesPictureSettings"] intValue] == 2 || [[chosenPreset objectForKey:@"UsesMaxPictureSettings"] intValue] == 1)
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];
-
-
- /* If the preset has no objectForKey:@"UsesPictureFilters", then we know it is a legacy preset
- * and handle the filters here as before.
- * NOTE: This should be removed when the update presets code is done as we can be assured that legacy
- * presets are updated to work properly with new keys.
- */
- if (![chosenPreset objectForKey:@"UsesPictureFilters"])
- {
- /* Filters */
- /* Deinterlace */
- if ([chosenPreset objectForKey:@"PictureDeinterlace"])
- {
- /* 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)
- {
- [fPictureController setDeinterlace:3];
- }
- else
- {
-
- [fPictureController setDeinterlace:[[chosenPreset objectForKey:@"PictureDeinterlace"] intValue]];
- }
- }
- else
- {
- [fPictureController setDeinterlace:0];
- }
- /* VFR */
- if ([[chosenPreset objectForKey:@"VFR"] intValue] == 1)
- {
- // We make sure that framerate is set to Same as source variable
- // detelecine will take care of itself right below
- //[fPictureController setVFR:[[chosenPreset objectForKey:@"VFR"] intValue]];
- }
-
- /* Detelecine */
- if ([[chosenPreset objectForKey:@"PictureDetelecine"] intValue] == 1)
- {
- [fPictureController setDetelecine:[[chosenPreset objectForKey:@"PictureDetelecine"] intValue]];
- }
- else
- {
- [fPictureController setDetelecine:0];
- }
- /* Denoise */
- if ([chosenPreset objectForKey:@"PictureDenoise"])
- {
- [fPictureController setDenoise:[[chosenPreset objectForKey:@"PictureDenoise"] intValue]];
- }
- else
- {
- [fPictureController setDenoise:0];
- }
- /* Deblock */
- if ([[chosenPreset objectForKey:@"PictureDeblock"] intValue] == 1)
- {
- /* since we used to use 1 to turn on deblock, we now use a 5 in our sliding scale */
- [fPictureController setDeblock:5];
- }
- else
- {
- [fPictureController setDeblock:0];
-
- }
-
- [self calculatePictureSizing:nil];
- }
+ job->anamorphic.mode = [[chosenPreset objectForKey:@"PicturePAR"] intValue];
}
}
- /* If the preset has an objectForKey:@"UsesPictureFilters", then we know it is a newer style filters preset
- * and handle the filters here depending on whether or not the preset specifies applying the filter.
- */
+ /* If the preset has an objectForKey:@"UsesPictureFilters", and handle the filters here */
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 */
- /* Even though we currently allow for a custom setting for decomb, ultimately it will only have Off and
- * Default so we just pay attention to anything greater than 0 as 1 (Default). 0 is Off. */
- if ([[chosenPreset objectForKey:@"PictureDecomb"] intValue] > 0)
+
+ 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:[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*/