[fVidRatePopUp addItemWithTitle: NSLocalizedString( @"Same as source", @"" )];
for( int i = 0; i < hb_video_rates_count; i++ )
{
- if ([[NSString stringWithCString: hb_video_rates[i].string] isEqualToString: [NSString stringWithFormat: @"%.3f",23.976]])
+ if ([[NSString stringWithUTF8String: hb_video_rates[i].string] isEqualToString: [NSString stringWithFormat: @"%.3f",23.976]])
{
[fVidRatePopUp addItemWithTitle:[NSString stringWithFormat: @"%@%@",
- [NSString stringWithCString: hb_video_rates[i].string], @" (NTSC Film)"]];
+ [NSString stringWithUTF8String: hb_video_rates[i].string], @" (NTSC Film)"]];
}
- else if ([[NSString stringWithCString: hb_video_rates[i].string] isEqualToString: [NSString stringWithFormat: @"%d",25]])
+ else if ([[NSString stringWithUTF8String: hb_video_rates[i].string] isEqualToString: [NSString stringWithFormat: @"%d",25]])
{
[fVidRatePopUp addItemWithTitle:[NSString stringWithFormat: @"%@%@",
- [NSString stringWithCString: hb_video_rates[i].string], @" (PAL Film/Video)"]];
+ [NSString stringWithUTF8String: hb_video_rates[i].string], @" (PAL Film/Video)"]];
}
- else if ([[NSString stringWithCString: hb_video_rates[i].string] isEqualToString: [NSString stringWithFormat: @"%.2f",29.97]])
+ else if ([[NSString stringWithUTF8String: hb_video_rates[i].string] isEqualToString: [NSString stringWithFormat: @"%.2f",29.97]])
{
[fVidRatePopUp addItemWithTitle:[NSString stringWithFormat: @"%@%@",
- [NSString stringWithCString: hb_video_rates[i].string], @" (NTSC Video)"]];
+ [NSString stringWithUTF8String: hb_video_rates[i].string], @" (NTSC Video)"]];
}
else
{
[fVidRatePopUp addItemWithTitle:
- [NSString stringWithCString: hb_video_rates[i].string]];
+ [NSString stringWithUTF8String: hb_video_rates[i].string]];
}
}
[fVidRatePopUp selectItemAtIndex: 0];
for( int i = 0; i < hb_audio_bitrates_count; i++ )
{
[fAudTrack1BitratePopUp addItemWithTitle:
- [NSString stringWithCString: hb_audio_bitrates[i].string]];
+ [NSString stringWithUTF8String: hb_audio_bitrates[i].string]];
}
[fAudTrack1BitratePopUp selectItemAtIndex: hb_audio_bitrates_default];
for( int i = 0; i < hb_audio_rates_count; i++ )
{
[fAudTrack1RatePopUp addItemWithTitle:
- [NSString stringWithCString: hb_audio_rates[i].string]];
+ [NSString stringWithUTF8String: hb_audio_rates[i].string]];
}
[fAudTrack1RatePopUp selectItemAtIndex: hb_audio_rates_default];
if (fHandle)
{
hb_state_t s;
+
+ hb_get_state( fHandle, &s );
+ if (s.state == HB_STATE_SCANNING && ([ident isEqualToString: StartEncodingIdentifier] || [ident isEqualToString: AddToQueueIdentifier]))
+ return NO;
+
hb_get_state2( fQueueEncodeLibhb, &s );
if (s.state == HB_STATE_WORKING || s.state == HB_STATE_MUXING)
if( [detector isVideoDVD] )
{
+ int hb_arch;
+#if defined( __LP64__ )
+ /* we are 64 bit */
+ hb_arch = 64;
+#else
+ /* we are 32 bit */
+ hb_arch = 32;
+#endif
+
+
// The chosen path was actually on a DVD, so use the raw block
// device path instead.
path = [detector devicePath];
[self writeToActivityLog: "trying to open a physical dvd at: %s", [scanPath UTF8String]];
-#if defined( __LP64__ )
- /* If we are 64 bit, we cannot read encrypted dvd's as vlc is 32 bit only */
- cancelScanDecrypt = 1;
- [self writeToActivityLog: "64 bit mode cannot read dvd's, scan cancelled"];
- /*On Screen Notification*/
- int status;
- NSBeep();
- status = NSRunAlertPanel(@"64-bit HandBrake cannot read encrypted dvds!",@"", @"Cancel Scan", @"Attempt Scan Anyway", nil);
- [NSApp requestUserAttention:NSCriticalRequest];
-
- if (status == NSAlertDefaultReturn)
- {
- /* User chose to cancel the scan */
- [self writeToActivityLog: "cannot open physical dvd , scan cancelled"];
- cancelScanDecrypt = 1;
- }
- else
- {
- [self writeToActivityLog: "user overrode 64-bit warning trying to open physical dvd without decryption"];
- cancelScanDecrypt = 0;
- }
-
-#else
/* lets check for vlc here to make sure we have a dylib available to use for decrypting */
NSString *vlcPath = @"/Applications/VLC.app/Contents/MacOS/lib/libdvdcss.2.dylib";
NSFileManager * fileManager = [NSFileManager defaultManager];
if (status == NSAlertDefaultReturn)
{
/* User chose to go download vlc (as they rightfully should) so we send them to the vlc site */
- [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.videolan.org/"]];
+ [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.videolan.org/vlc/download-macosx.html"]];
}
else if (status == NSAlertAlternateReturn)
{
/* VLC was found in /Applications so all is well, we can carry on using vlc's libdvdcss.dylib for decrypting if needed */
[self writeToActivityLog: "VLC app found for decrypting physical dvd"];
}
-#endif
+ /* test for architecture of the vlc app */
+ NSArray *vlc_architecturesArray = [[NSBundle bundleWithPath:@"/Applications/VLC.app"] executableArchitectures];
+ BOOL vlcIntel32bit = NO;
+ BOOL vlcIntel64bit = NO;
+ BOOL vlcPPC32bit = NO;
+ BOOL vlcPPC64bit = NO;
+ /* check the available architectures for vlc and note accordingly */
+ NSEnumerator *enumerator = [vlc_architecturesArray objectEnumerator];
+ id tempObject;
+ while (tempObject = [enumerator nextObject])
+ {
+
+ if ([tempObject intValue] == NSBundleExecutableArchitectureI386)
+ {
+ vlcIntel32bit = YES;
+ }
+ if ([tempObject intValue] == NSBundleExecutableArchitectureX86_64)
+ {
+ vlcIntel64bit = YES;
+ }
+ if ([tempObject intValue] == NSBundleExecutableArchitecturePPC)
+ {
+ vlcPPC32bit = YES;
+ }
+ if ([tempObject intValue] == NSBundleExecutableArchitecturePPC64)
+ {
+ vlcPPC64bit = YES;
+ }
+
+ }
+ /* Write vlc architecture findings to activity window */
+ if (vlcIntel32bit)
+ {
+ [self writeToActivityLog: " 32-Bit VLC app found for decrypting physical dvd"];
+ }
+ if (vlcIntel64bit)
+ {
+ [self writeToActivityLog: " 64-Bit VLC app found for decrypting physical dvd"];
+ }
+
+
+
+ if (hb_arch == 64 && !vlcIntel64bit && cancelScanDecrypt != 1)
+ {
+
+ /* we are 64 bit */
+
+ /* Appropriate VLC not found, so cancel */
+ cancelScanDecrypt = 1;
+ [self writeToActivityLog: "This version of HandBrake is 64 bit, 64 bit version of vlc not found, scan cancelled"];
+ /*On Screen Notification*/
+ int status;
+ NSBeep();
+ status = NSRunAlertPanel(@"This version of HandBrake is 64 bit, VLC found but not 64 bit!",@"", @"Cancel Scan", @"Attempt Scan Anyway", @"Get 64 bit VLC", nil);
+ [NSApp requestUserAttention:NSCriticalRequest];
+
+ if (status == NSAlertDefaultReturn)
+ {
+ /* User chose to cancel the scan */
+ [self writeToActivityLog: "cannot open physical dvd VLC found but not 64 bit, scan cancelled"];
+ cancelScanDecrypt = 1;
+ }
+ else if (status == NSAlertDefaultReturn)
+ {
+ [self writeToActivityLog: "user overrode 64-bit warning trying to open physical dvd without proper decryption"];
+ cancelScanDecrypt = 0;
+ }
+ else
+ {
+ /* User chose to go download vlc (as they rightfully should) so we send them to the vlc site */
+ [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.videolan.org/vlc/download-macosx.html"]];
+ }
+
+ }
+ else if (hb_arch == 32 && !vlcIntel32bit && cancelScanDecrypt != 1)
+ {
+ /* we are 32 bit */
+ /* Appropriate VLC not found, so cancel */
+ cancelScanDecrypt = 1;
+ [self writeToActivityLog: "This version of HandBrake is 32 bit, 32 bit version of vlc not found, scan cancelled"];
+ /*On Screen Notification*/
+ int status;
+ NSBeep();
+ status = NSRunAlertPanel(@"This version of HandBrake is 32 bit, VLC found but not 32 bit!",@"", @"Cancel Scan", @"Attempt Scan Anyway", @"Get 32 bit VLC", nil);
+ [NSApp requestUserAttention:NSCriticalRequest];
+
+ if (status == NSAlertDefaultReturn)
+ {
+ /* User chose to cancel the scan */
+ [self writeToActivityLog: "cannot open physical dvd VLC found but not 32 bit, scan cancelled"];
+ cancelScanDecrypt = 1;
+ }
+ else if (status == NSAlertDefaultReturn)
+ {
+ [self writeToActivityLog: "user overrode 32-bit warning trying to open physical dvd without proper decryption"];
+ cancelScanDecrypt = 0;
+ }
+ else
+ {
+ /* User chose to go download vlc (as they rightfully should) so we send them to the vlc site */
+ [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.videolan.org/vlc/download-macosx.html"]];
+ }
+
+ }
}
if (cancelScanDecrypt == 0)
/* if we are custom anamorphic, store the exact storage, par and display dims */
if (fTitle->job->anamorphic.mode == 3)
{
+ [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.modulus] forKey:@"PicturePARModulus"];
+
[queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->width] forKey:@"PicturePARStorageWidth"];
[queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PicturePARStorageHeight"];
if( job->vcodec & HB_VCODEC_X264 )
{
- /* Set this flag to switch from Constant Quantizer(default) to Constant Rate Factor Thanks jbrjake
- Currently only used with Constant Quality setting*/
- if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultCrf"] > 0 && [fVidQualityMatrix selectedRow] == 2)
- {
- job->crf = 1;
- }
/* Below Sends x264 options to the core library if x264 is selected*/
/* Lets use this as per Nyx, Thanks Nyx!*/
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 */
job->width = [[queueToApply objectForKey:@"PicturePARStorageWidth"] intValue];
job->height = [[queueToApply objectForKey:@"PicturePARStorageHeight"] intValue];
+ job->anamorphic.modulus = [[queueToApply objectForKey:@"PicturePARModulus"] intValue];
+
job->anamorphic.par_width = [[queueToApply objectForKey:@"PicturePARPixelWidth"] intValue];
job->anamorphic.par_height = [[queueToApply objectForKey:@"PicturePARPixelHeight"] intValue];
/* As x264 allows for qp/rf values that are fractional, we get the value from the preferences */
int fractionalGranularity = 1 / [[NSUserDefaults standardUserDefaults] floatForKey:@"x264CqSliderFractional"];
[fVidQualitySlider setNumberOfTickMarks:(([fVidQualitySlider maxValue] - [fVidQualitySlider minValue]) * fractionalGranularity) + 1];
- if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultCrf"] > 0)
- {
- qpRFLabelString = @"RF:";
- }
+ qpRFLabelString = @"RF:";
}
/* ffmpeg 1-31 */
if ([[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_FFMPEG )
[fAudTrack1MixPopUp removeAllItems];
[fAudTrack1RatePopUp removeAllItems];
[fAudTrack1BitratePopUp removeAllItems];
- [fAudTrack1DrcSlider setFloatValue: 1.00];
+ [fAudTrack1DrcSlider setFloatValue: 0.00];
[self audioDRCSliderChanged: fAudTrack1DrcSlider];
}
else if ([[fAudTrack1MixPopUp selectedItem] tag] == HB_ACODEC_AC3 || [[fAudTrack1MixPopUp selectedItem] tag] == HB_ACODEC_DCA)
[fAudTrack2MixPopUp removeAllItems];
[fAudTrack2RatePopUp removeAllItems];
[fAudTrack2BitratePopUp removeAllItems];
- [fAudTrack2DrcSlider setFloatValue: 1.00];
+ [fAudTrack2DrcSlider setFloatValue: 0.00];
[self audioDRCSliderChanged: fAudTrack2DrcSlider];
}
else if ([[fAudTrack2MixPopUp selectedItem] tag] == HB_ACODEC_AC3 || [[fAudTrack2MixPopUp selectedItem] tag] == HB_ACODEC_DCA)
[fAudTrack3MixPopUp removeAllItems];
[fAudTrack3RatePopUp removeAllItems];
[fAudTrack3BitratePopUp removeAllItems];
- [fAudTrack3DrcSlider setFloatValue: 1.00];
+ [fAudTrack3DrcSlider setFloatValue: 0.00];
[self audioDRCSliderChanged: fAudTrack3DrcSlider];
}
else if ([[fAudTrack3MixPopUp selectedItem] tag] == HB_ACODEC_AC3 || [[fAudTrack3MixPopUp selectedItem] tag] == HB_ACODEC_DCA)
[fAudTrack4MixPopUp removeAllItems];
[fAudTrack4RatePopUp removeAllItems];
[fAudTrack4BitratePopUp removeAllItems];
- [fAudTrack4DrcSlider setFloatValue: 1.00];
+ [fAudTrack4DrcSlider setFloatValue: 0.00];
[self audioDRCSliderChanged: fAudTrack4DrcSlider];
}
else if ([[fAudTrack4MixPopUp selectedItem] tag] == HB_ACODEC_AC3 || [[fAudTrack4MixPopUp selectedItem] tag] == HB_ACODEC_DCA)
{
audio = (hb_audio_config_t *) hb_list_audio_config_item( title->list_audio, i );
[[sender menu] addItemWithTitle:
- [NSString stringWithCString: audio->lang.description]
+ [NSString stringWithUTF8String: audio->lang.description]
action: NULL keyEquivalent: @""];
}
[sender selectItemAtIndex: 0];
{
NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
- [NSString stringWithCString: "AC3 Passthru"]
+ [NSString stringWithUTF8String: "AC3 Passthru"]
action: NULL keyEquivalent: @""];
[menuItem setTag: HB_ACODEC_AC3];
}
else if (audio->in.codec == HB_ACODEC_DCA && acodec == HB_ACODEC_DCA)
{
NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
- [NSString stringWithCString: "DTS Passthru"]
+ [NSString stringWithUTF8String: "DTS Passthru"]
action: NULL keyEquivalent: @""];
[menuItem setTag: HB_ACODEC_DCA];
}
if (audioCodecsSupportMono == 1)
{
NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
- [NSString stringWithCString: hb_audio_mixdowns[0].human_readable_name]
+ [NSString stringWithUTF8String: hb_audio_mixdowns[0].human_readable_name]
action: NULL keyEquivalent: @""];
[menuItem setTag: hb_audio_mixdowns[0].amixdown];
if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[0].amixdown;
if ((layout == HB_INPUT_CH_LAYOUT_MONO && audioCodecsSupportMono == 0) || layout >= HB_INPUT_CH_LAYOUT_STEREO)
{
NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
- [NSString stringWithCString: hb_audio_mixdowns[1].human_readable_name]
+ [NSString stringWithUTF8String: hb_audio_mixdowns[1].human_readable_name]
action: NULL keyEquivalent: @""];
[menuItem setTag: hb_audio_mixdowns[1].amixdown];
if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[1].amixdown;
if (layout == HB_INPUT_CH_LAYOUT_3F1R || layout == HB_INPUT_CH_LAYOUT_3F2R || layout == HB_INPUT_CH_LAYOUT_DOLBY)
{
NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
- [NSString stringWithCString: hb_audio_mixdowns[2].human_readable_name]
+ [NSString stringWithUTF8String: hb_audio_mixdowns[2].human_readable_name]
action: NULL keyEquivalent: @""];
[menuItem setTag: hb_audio_mixdowns[2].amixdown];
if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[2].amixdown;
if (layout == HB_INPUT_CH_LAYOUT_3F2R)
{
NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
- [NSString stringWithCString: hb_audio_mixdowns[3].human_readable_name]
+ [NSString stringWithUTF8String: hb_audio_mixdowns[3].human_readable_name]
action: NULL keyEquivalent: @""];
[menuItem setTag: hb_audio_mixdowns[3].amixdown];
if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[3].amixdown;
if (audioCodecsSupport6Ch == 1 && layout == HB_INPUT_CH_LAYOUT_3F2R && (audio->in.channel_layout & HB_INPUT_CH_LAYOUT_HAS_LFE))
{
NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
- [NSString stringWithCString: hb_audio_mixdowns[4].human_readable_name]
+ [NSString stringWithUTF8String: hb_audio_mixdowns[4].human_readable_name]
action: NULL keyEquivalent: @""];
[menuItem setTag: hb_audio_mixdowns[4].amixdown];
if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[4].amixdown;
if (audio->in.codec == HB_ACODEC_AC3 && acodec == HB_ACODEC_AC3)
{
NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
- [NSString stringWithCString: hb_audio_mixdowns[5].human_readable_name]
+ [NSString stringWithUTF8String: hb_audio_mixdowns[5].human_readable_name]
action: NULL keyEquivalent: @""];
[menuItem setTag: HB_ACODEC_AC3];
if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[5].amixdown;
if (audio->in.codec == HB_ACODEC_DCA && acodec == HB_ACODEC_DCA)
{
NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
- [NSString stringWithCString: hb_audio_mixdowns[5].human_readable_name]
+ [NSString stringWithUTF8String: hb_audio_mixdowns[5].human_readable_name]
action: NULL keyEquivalent: @""];
[menuItem setTag: HB_ACODEC_DCA];
if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[5].amixdown;
{
/* add a new menuitem for this bitrate */
NSMenuItem *menuItem = [[bitratePopUp menu] addItemWithTitle:
- [NSString stringWithCString: hb_audio_bitrates[i].string]
+ [NSString stringWithUTF8String: hb_audio_bitrates[i].string]
action: NULL keyEquivalent: @""];
/* set its tag to be the actual bitrate as an integer, so we can retrieve it later */
[menuItem setTag: hb_audio_bitrates[i].rate];
for( int i = 0; i < hb_audio_rates_count; i++ )
{
NSMenuItem *menuItem = [[sampleratePopUp menu] addItemWithTitle:
- [NSString stringWithCString: hb_audio_rates[i].string]
+ [NSString stringWithUTF8String: hb_audio_rates[i].string]
action: NULL keyEquivalent: @""];
[menuItem setTag: hb_audio_rates[i].rate];
}
[bitratePopUp setEnabled: NO];
[sampleratePopUp setEnabled: NO];
- [drcSlider setFloatValue: 1.00];
+ [drcSlider setFloatValue: 0.00];
[self audioDRCSliderChanged: drcSlider];
[drcSlider setEnabled: NO];
[drcField setEnabled: NO];
/* First we check to see if we are using the current audio track layout based on AudioList array */
if ([chosenPreset objectForKey:@"AudioList"])
{
+
+ /* pointer to this track's mixdown, codec, sample rate and bitrate NSPopUpButton's */
+ NSPopUpButton * trackLangPopUp = nil;
+ NSPopUpButton * mixdownPopUp = nil;
+ NSPopUpButton * audiocodecPopUp = nil;
+ NSPopUpButton * sampleratePopUp = nil;
+ NSPopUpButton * bitratePopUp = nil;
+ NSSlider * drcSlider = nil;
+
+
/* Populate the audio widgets based on the contents of the AudioList array */
int i = 0;
NSEnumerator *enumerator = [[chosenPreset objectForKey:@"AudioList"] objectEnumerator];
i++;
if( i == 1 )
{
- if ([fAudLang1PopUp indexOfSelectedItem] == 0)
- {
- [fAudLang1PopUp selectItemAtIndex: 1];
- }
- [self audioTrackPopUpChanged: fAudLang1PopUp];
- [fAudTrack1CodecPopUp selectItemWithTitle:[tempObject objectForKey:@"AudioEncoder"]];
- /* check our pref for core audio and use it in place of faac if applicable */
- if ([[NSUserDefaults standardUserDefaults] boolForKey: @"UseCoreAudio"] == YES &&
- [[tempObject objectForKey:@"AudioEncoder"] isEqualToString: @"AAC (faac)"])
- {
- [fAudTrack1CodecPopUp selectItemWithTitle:@"AAC (CoreAudio)"];
- }
-
- [self audioTrackPopUpChanged: fAudTrack1CodecPopUp];
- [fAudTrack1MixPopUp selectItemWithTitle:[tempObject objectForKey:@"AudioMixdown"]];
- /* 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:[tempObject objectForKey:@"AudioSamplerate"]];
- /* We set the presets bitrate if it is *not* an AC3 track since that uses the input bitrate */
- if (![[tempObject objectForKey:@"AudioEncoder"] isEqualToString:@"AC3 Passthru"])
- {
- [fAudTrack1BitratePopUp selectItemWithTitle:[tempObject objectForKey:@"AudioBitrate"]];
- }
- [fAudTrack1DrcSlider setFloatValue:[[tempObject objectForKey:@"AudioTrackDRCSlider"] floatValue]];
- [self audioDRCSliderChanged: fAudTrack1DrcSlider];
+ trackLangPopUp = fAudLang1PopUp;
+ mixdownPopUp = fAudTrack1MixPopUp;
+ audiocodecPopUp = fAudTrack1CodecPopUp;
+ sampleratePopUp = fAudTrack1RatePopUp;
+ bitratePopUp = fAudTrack1BitratePopUp;
+ drcSlider = fAudTrack1DrcSlider;
}
-
if( i == 2 )
{
-
- if ([fAudLang2PopUp indexOfSelectedItem] == 0)
- {
- [fAudLang2PopUp selectItemAtIndex: 1];
- }
- [self audioTrackPopUpChanged: fAudLang2PopUp];
- [fAudTrack2CodecPopUp selectItemWithTitle:[tempObject objectForKey:@"AudioEncoder"]];
- /* check our pref for core audio and use it in place of faac if applicable */
- if ([[NSUserDefaults standardUserDefaults] boolForKey: @"UseCoreAudio"] == YES &&
- [[tempObject objectForKey:@"AudioEncoder"] isEqualToString: @"AAC (faac)"])
- {
- [fAudTrack2CodecPopUp selectItemWithTitle:@"AAC (CoreAudio)"];
- }
- [self audioTrackPopUpChanged: fAudTrack2CodecPopUp];
- [fAudTrack2MixPopUp selectItemWithTitle:[tempObject objectForKey:@"AudioMixdown"]];
- /* 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:[tempObject objectForKey:@"AudioSamplerate"]];
- /* We set the presets bitrate if it is *not* an AC3 track since that uses the input bitrate */
- if (![[tempObject objectForKey:@"AudioEncoder"] isEqualToString:@"AC3 Passthru"])
+ trackLangPopUp = fAudLang2PopUp;
+ mixdownPopUp = fAudTrack2MixPopUp;
+ audiocodecPopUp = fAudTrack2CodecPopUp;
+ sampleratePopUp = fAudTrack2RatePopUp;
+ bitratePopUp = fAudTrack2BitratePopUp;
+ drcSlider = fAudTrack2DrcSlider;
+ }
+ if( i == 3 )
+ {
+ trackLangPopUp = fAudLang3PopUp;
+ mixdownPopUp = fAudTrack3MixPopUp;
+ audiocodecPopUp = fAudTrack3CodecPopUp;
+ sampleratePopUp = fAudTrack3RatePopUp;
+ bitratePopUp = fAudTrack3BitratePopUp;
+ drcSlider = fAudTrack3DrcSlider;
+ }
+ if( i == 4 )
+ {
+ trackLangPopUp = fAudLang4PopUp;
+ mixdownPopUp = fAudTrack4MixPopUp;
+ audiocodecPopUp = fAudTrack4CodecPopUp;
+ sampleratePopUp = fAudTrack4RatePopUp;
+ bitratePopUp = fAudTrack4BitratePopUp;
+ drcSlider = fAudTrack4DrcSlider;
+ }
+
+
+ if ([trackLangPopUp indexOfSelectedItem] == 0)
+ {
+ [trackLangPopUp selectItemAtIndex: 1];
+ }
+ [self audioTrackPopUpChanged: trackLangPopUp];
+ [audiocodecPopUp selectItemWithTitle:[tempObject objectForKey:@"AudioEncoder"]];
+ /* check our pref for core audio and use it in place of faac if applicable */
+ if ([[NSUserDefaults standardUserDefaults] boolForKey: @"UseCoreAudio"] == YES &&
+ [[tempObject objectForKey:@"AudioEncoder"] isEqualToString: @"AAC (faac)"])
+ {
+ [audiocodecPopUp selectItemWithTitle:@"AAC (CoreAudio)"];
+ }
+
+ [self audioTrackPopUpChanged: audiocodecPopUp];
+ [mixdownPopUp selectItemWithTitle:[tempObject objectForKey:@"AudioMixdown"]];
+ /* check to see if the selections was available, if not, rerun audioTrackPopUpChanged using the codec to just set the default
+ * mixdown*/
+ if ([mixdownPopUp selectedItem] == nil)
+ {
+ [self audioTrackPopUpChanged: audiocodecPopUp];
+ }
+ [sampleratePopUp selectItemWithTitle:[tempObject objectForKey:@"AudioSamplerate"]];
+ /* We set the presets bitrate if it is *not* an AC3 track since that uses the input bitrate */
+ if (![[tempObject objectForKey:@"AudioEncoder"] isEqualToString:@"AC3 Passthru"])
+ {
+ [bitratePopUp selectItemWithTitle:[tempObject objectForKey:@"AudioBitrate"]];
+ }
+ [drcSlider setFloatValue:[[tempObject objectForKey:@"AudioTrackDRCSlider"] floatValue]];
+ [self audioDRCSliderChanged: drcSlider];
+
+
+ /* If we are any track greater than 1 check to make sure we have a matching source codec is using ac3 passthru or dts passthru,
+ * if not we will set the track to "None". Track 1 is allowed to mixdown to a suitable DPL2 mix if we cannot passthru */
+
+ if( i > 1 )
+ {
+ /* Check to see if the preset asks for a passhthru track (AC3 or DTS) and verify there is a matching source track if not, set the track to "None". */
+ if (([[tempObject objectForKey:@"AudioEncoder"] isEqualToString:@"AC3 Passthru"] || [[tempObject objectForKey:@"AudioEncoder"] isEqualToString:@"DTS Passthru"]) && [trackLangPopUp indexOfSelectedItem] != 0)
{
- [fAudTrack2BitratePopUp selectItemWithTitle:[tempObject objectForKey:@"AudioBitrate"]];
+ hb_audio_config_t * audio;
+ /* get the audio source audio codec */
+ audio = (hb_audio_config_t *) hb_list_audio_config_item( fTitle->list_audio, [trackLangPopUp indexOfSelectedItem] - 1 );
+ if ([[tempObject objectForKey:@"AudioEncoder"] isEqualToString:@"AC3 Passthru"] && audio->in.codec != HB_ACODEC_AC3 ||
+ [[tempObject objectForKey:@"AudioEncoder"] isEqualToString:@"DTS Passthru"] && audio->in.codec != HB_ACODEC_DCA )
+ {
+ /* We have a preset using ac3 passthru but no ac3 source audio, so set the track to "None" and bail */
+ if ([[tempObject objectForKey:@"AudioEncoder"] isEqualToString:@"AC3 Passthru"])
+ {
+ [self writeToActivityLog: "Preset calls for AC3 Pass thru ..."];
+ }
+ if ([[tempObject objectForKey:@"AudioEncoder"] isEqualToString:@"DTS Passthru"])
+ {
+ [self writeToActivityLog: "Preset calls for DTS Pass thru ..."];
+ }
+ [self writeToActivityLog: "No matching source codec, setting track %d to None", i];
+ [trackLangPopUp selectItemAtIndex: 0];
+ [self audioTrackPopUpChanged: trackLangPopUp];
+ }
}
- [fAudTrack2DrcSlider setFloatValue:[[tempObject objectForKey:@"AudioTrackDRCSlider"] floatValue]];
- [self audioDRCSliderChanged: fAudTrack2DrcSlider];
-
}
-
}
- /* We now cleanup any extra audio tracks that may have been previously set if we need to */
+ /* We now cleanup any extra audio tracks that may have been previously set if we need to */
if (i < 4)
{
[fAudTrack1DrcSlider setFloatValue:[[chosenPreset objectForKey:@"Audio1TrackDRCSlider"] floatValue]];
[self audioDRCSliderChanged: fAudTrack1DrcSlider];
}
+
if ([chosenPreset objectForKey:@"Audio2Track"] > 0)
{
if ([fAudLang2PopUp indexOfSelectedItem] == 0)