static int FormatSettings[4][10] =
{ { HB_MUX_MP4 | HB_VCODEC_FFMPEG | HB_ACODEC_FAAC,
HB_MUX_MP4 | HB_VCODEC_X264 | HB_ACODEC_FAAC,
- 0,
+ HB_MUX_MP4 | HB_VCODEC_X264 | HB_ACODEC_FAAC,
+ HB_MUX_MP4 | HB_VCODEC_X264 | HB_ACODEC_AC3,
+ 0,
0 },
{ HB_MUX_MKV | HB_VCODEC_FFMPEG | HB_ACODEC_FAAC,
HB_MUX_MKV | HB_VCODEC_FFMPEG | HB_ACODEC_AC3,
- (void) applicationDidFinishLaunching: (NSNotification *) notification
{
- int build;
- char * version;
+ /* Variables from legacy update system, leave but commented out until Sparkle is compeletely vetted */
+ //int build;
+ //char * version;
// Init libhb
- int debugLevel = [[NSUserDefaults standardUserDefaults] boolForKey:@"ShowVerboseOutput"] ? HB_DEBUG_ALL : HB_DEBUG_NONE;
- /* Old update method using hb_init, commented out but code left for a few revs til new sparkle updater is vetted */
+ /* Old update method using hb_init, commented out but code left for a few revs til new sparkle updater is vetted */
//fHandle = hb_init(debugLevel, [[NSUserDefaults standardUserDefaults] boolForKey:@"CheckForUpdates"]);
/* New Init libhb with check for updates libhb style set to "0" so its ignored and lets sparkle take care of it */
- fHandle = hb_init(debugLevel, 0);
-
+ fHandle = hb_init(HB_DEBUG_ALL, 0);
// Set the Growl Delegate
[GrowlApplicationBridge setGrowlDelegate: self];
job->audios[0] = -1;
}
+ /*
+ * Where one or more of the audio tracks has a mixdown of DPLII+AC3 we need to create an extra
+ * track for each.
+ */
+ if (job->audio_mixdowns[0] == HB_AMIXDOWN_DOLBYPLII_AC3)
+ {
+ /*
+ * Make space for the AC3 track by moving 1 to 2
+ */
+ job->audios[2] = job->audios[1];
+ job->audio_mixdowns[2] = job->audio_mixdowns[1];
+ job->audios[1] = job->audios[0];
+ job->audio_mixdowns[0] = HB_AMIXDOWN_DOLBYPLII;
+ job->audio_mixdowns[1] = HB_AMIXDOWN_AC3;
+ }
+
+ if (job->audio_mixdowns[1] == HB_AMIXDOWN_DOLBYPLII_AC3)
+ {
+ job->audios[2] = job->audios[1];
+ job->audio_mixdowns[1] = HB_AMIXDOWN_DOLBYPLII;
+ job->audio_mixdowns[2] = HB_AMIXDOWN_AC3;
+ job->audios[3] = -1;
+ }
+
+ if (job->audio_mixdowns[2] == HB_AMIXDOWN_DOLBYPLII_AC3)
+ {
+ job->audios[3] = job->audios[2];
+ job->audio_mixdowns[2] = HB_AMIXDOWN_DOLBYPLII;
+ job->audio_mixdowns[3] = HB_AMIXDOWN_AC3;
+ job->audios[4] = -1;
+ }
+
/* Audio settings */
job->arate = hb_audio_rates[[fAudRatePopUp
indexOfSelectedItem]].rate;
/* Deinterlace */
if ([fPictureController deinterlace] == 1)
{
- /* Run old deinterlacer by default */
+ /* Run old deinterlacer fd by default */
hb_filter_deinterlace.settings = "-1";
hb_list_add( job->filters, &hb_filter_deinterlace );
}
else if ([fPictureController deinterlace] == 2)
{
- /* Yadif mode 0 (1-pass with spatial deinterlacing.) */
- hb_filter_deinterlace.settings = "0";
+ /* Yadif mode 0 (without spatial deinterlacing.) */
+ hb_filter_deinterlace.settings = "2";
hb_list_add( job->filters, &hb_filter_deinterlace );
}
else if ([fPictureController deinterlace] == 3)
{
- /* Yadif (1-pass w/o spatial deinterlacing) and Mcdeint */
- hb_filter_deinterlace.settings = "2:-1:1";
- hb_list_add( job->filters, &hb_filter_deinterlace );
- }
- else if ([fPictureController deinterlace] == 4)
- {
- /* Yadif (2-pass w/ spatial deinterlacing) and Mcdeint*/
- hb_filter_deinterlace.settings = "1:-1:1";
+ /* Yadif (with spatial deinterlacing) */
+ hb_filter_deinterlace.settings = "0";
hb_list_add( job->filters, &hb_filter_deinterlace );
}
AutoCropLeft = job->crop[2];
AutoCropRight = job->crop[3];
- /* we run the picture size values through
- calculatePictureSizing to get all picture size
- information*/
- [self calculatePictureSizing: NULL];
/* Run Through encoderPopUpChanged to see if there
needs to be any pic value modifications based on encoder settings */
//[self encoderPopUpChanged: NULL];
}
[fVidRatePopUp selectItemAtIndex: 0];
+ /* we run the picture size values through calculatePictureSizing to get all picture setting information*/
+ [self calculatePictureSizing: NULL];
+
/* lets call tableViewSelected to make sure that any preset we have selected is enforced after a title change */
[self selectPreset:NULL];
[fDstCodecsPopUp addItemWithTitle:_( @"MPEG-4 Video / AAC Audio" )];
[fDstCodecsPopUp addItemWithTitle:_( @"AVC/H.264 Video / AAC Audio" )];
-
+ /* We add a new codecs entry which will allow the new aac/ ac3 hybrid */
+ [fDstCodecsPopUp addItemWithTitle:_( @"AVC/H.264 Video / AAC + AC3 Audio" )];
+ [fDstCodecsPopUp addItemWithTitle:_( @"AVC/H.264 Video / AC3 Audio" )];
/* We enable the create chapters checkbox here since we are .mp4*/
[fCreateChapterMarkers setEnabled: YES];
/* We show the Large File (64 bit formatting) checkbox since we are .mp4
{
[fPicSettingDeinterlace setStringValue: @"Slower"];
}
- else if ([fPictureController deinterlace] ==4)
- {
- [fPicSettingDeinterlace setStringValue: @"Slowest"];
- }
/* Denoise */
if ([fPictureController denoise] == 0)
{
/* get the index of the selected audio */
int thisAudioIndex = [sender indexOfSelectedItem] - 1;
+#if 0
/* Handbrake can't currently cope with ripping the same source track twice */
/* So, if this audio is also selected in the other audio track popup, set that popup's selection to "none" */
/* get a reference to the two audio track popups */
[otherAudioPopUp selectItemAtIndex: 0];
[self audioTrackPopUpChanged: otherAudioPopUp];
}
+#endif
/* pointer for the hb_audio_s struct we will use later on */
hb_audio_t * audio;
int format = [fDstFormatPopUp indexOfSelectedItem];
int codecs = [fDstCodecsPopUp indexOfSelectedItem];
int acodec = FormatSettings[format][codecs] & HB_ACODEC_MASK;
+
+ /*HACK: Lets setup a convenience variable to decide whether or not to allow aac hybrid (aac + ac3 passthru )*/
+ bool mp4AacAc3;
+ if (format == 0 && codecs == 2) // if mp4 and aac + ac3
+ {
+ mp4AacAc3 = 1;
+ }
+ else
+ {
+ mp4AacAc3 = 0;
+ }
/* pointer to this track's mixdown NSPopUpButton */
NSTextField * mixdownTextField;
/* check for AC-3 passthru */
if (audio->codec == HB_ACODEC_AC3 && acodec == HB_ACODEC_AC3)
{
+
[[mixdownPopUp menu] addItemWithTitle:
[NSString stringWithCString: "AC3 Passthru"]
action: NULL keyEquivalent: @""];
int layout = audio->input_channel_layout & HB_INPUT_CH_LAYOUT_DISCRETE_NO_LFE_MASK;
/* do we want to add a mono option? */
- if (audioCodecsSupportMono == 1) {
+ if (!mp4AacAc3 && audioCodecsSupportMono == 1) {
NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
[NSString stringWithCString: hb_audio_mixdowns[0].human_readable_name]
action: NULL keyEquivalent: @""];
/* do we want to add a stereo option? */
/* offer stereo if we have a mono source and non-mono-supporting codecs, as otherwise we won't have a mixdown at all */
/* also offer stereo if we have a stereo-or-better source */
- if ((layout == HB_INPUT_CH_LAYOUT_MONO && audioCodecsSupportMono == 0) || layout >= HB_INPUT_CH_LAYOUT_STEREO) {
+ if ((!mp4AacAc3 && ((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]
action: NULL keyEquivalent: @""];
}
/* do we want to add a dolby surround (DPL1) option? */
- if (layout == HB_INPUT_CH_LAYOUT_3F1R || layout == HB_INPUT_CH_LAYOUT_3F2R || layout == HB_INPUT_CH_LAYOUT_DOLBY) {
+ if (!mp4AacAc3 && (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]
action: NULL keyEquivalent: @""];
}
/* do we want to add a dolby pro logic 2 (DPL2) option? */
- if (layout == HB_INPUT_CH_LAYOUT_3F2R) {
+ if ((!mp4AacAc3 || audio->codec == HB_ACODEC_DCA) && layout == HB_INPUT_CH_LAYOUT_3F2R) {
NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
[NSString stringWithCString: hb_audio_mixdowns[3].human_readable_name]
action: NULL keyEquivalent: @""];
}
/* do we want to add a 6-channel discrete option? */
- if (audioCodecsSupport6Ch == 1 && layout == HB_INPUT_CH_LAYOUT_3F2R && (audio->input_channel_layout & HB_INPUT_CH_LAYOUT_HAS_LFE)) {
+ if (!mp4AacAc3 && (audioCodecsSupport6Ch == 1 && layout == HB_INPUT_CH_LAYOUT_3F2R && (audio->input_channel_layout & HB_INPUT_CH_LAYOUT_HAS_LFE))) {
NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
[NSString stringWithCString: hb_audio_mixdowns[4].human_readable_name]
action: NULL keyEquivalent: @""];
maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[4].amixdown);
}
+ /* do we want to add an AC-3 passthrough option? */
+ if (audio->codec == HB_ACODEC_AC3 && acodec == HB_ACODEC_AC3) {
+ NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
+ [NSString stringWithCString: hb_audio_mixdowns[5].human_readable_name]
+ action: NULL keyEquivalent: @""];
+ [menuItem setTag: hb_audio_mixdowns[5].amixdown];
+ if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[5].amixdown;
+ maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[5].amixdown);
+ }
+
+ /* do we want to add the DPLII+AC3 passthrough option? */
+ if (mp4AacAc3 && audio->codec == HB_ACODEC_AC3) {
+ NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
+ [NSString stringWithCString: hb_audio_mixdowns[6].human_readable_name]
+ action: NULL keyEquivalent: @""];
+ [menuItem setTag: hb_audio_mixdowns[6].amixdown];
+ if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[6].amixdown;
+ maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[6].amixdown);
+ }
/* auto-select the best mixdown based on our saved mixdown preference */
/* for now, this is hard-coded to a "best" mixdown of HB_AMIXDOWN_DOLBYPLII */
{
case HB_ACODEC_FAAC:
/* check if we have a 6ch discrete conversion in either audio track */
- if ([[fAudTrack1MixPopUp selectedItem] tag] == HB_AMIXDOWN_6CH || [[fAudTrack2MixPopUp selectedItem] tag] == HB_AMIXDOWN_6CH)
+ if ([[fAudTrack1MixPopUp selectedItem] tag] == HB_AMIXDOWN_6CH ||
+ [[fAudTrack2MixPopUp selectedItem] tag] == HB_AMIXDOWN_6CH ||
+ [[fAudTrack1MixPopUp selectedItem] tag] == HB_AMIXDOWN_AC3 ||
+ [[fAudTrack2MixPopUp selectedItem] tag] == HB_AMIXDOWN_AC3)
{
/* FAAC is happy using our min bitrate of 32 kbps, even for 6ch */
minbitrate = 32;
}
/* select the default bitrate (but use 384 for 6-ch AAC) */
- if ([[fAudTrack1MixPopUp selectedItem] tag] == HB_AMIXDOWN_6CH || [[fAudTrack2MixPopUp selectedItem] tag] == HB_AMIXDOWN_6CH)
+ if ([[fAudTrack1MixPopUp selectedItem] tag] == HB_AMIXDOWN_6CH ||
+ [[fAudTrack2MixPopUp selectedItem] tag] == HB_AMIXDOWN_6CH ||
+ [[fAudTrack1MixPopUp selectedItem] tag] == HB_AMIXDOWN_AC3 ||
+ [[fAudTrack2MixPopUp selectedItem] tag] == HB_AMIXDOWN_AC3)
{
[fAudBitratePopUp selectItemWithTag: 384];
}
[fAudBitratePopUp selectItemWithTitle: [NSString stringWithFormat:[chosenPreset valueForKey:@"AudioBitRate"]]];
/*Subtitles*/
[fSubPopUp selectItemWithTitle: [NSString stringWithFormat:[chosenPreset valueForKey:@"Subtitles"]]];
+ /* Forced Subtitles */
+ [fSubForcedCheck setState:[[chosenPreset objectForKey:@"SubtitlesForced"] intValue]];
+
/* Dynamic Range Control Slider */
[fAudDrcSlider setFloatValue: [[chosenPreset valueForKey:@"AudioDRCSlider"] floatValue]];
[self audioDRCSliderChanged: NULL];
}
else // /* If not 0 or 2 we assume objectForKey:@"UsesPictureSettings is 1 which is "Use picture sizing from when the preset was set" */
{
- job->width = [[chosenPreset objectForKey:@"PictureWidth"] intValue];
- job->height = [[chosenPreset objectForKey:@"PictureHeight"] intValue];
+ /* we check to make sure the presets width/height does not exceed the sources width/height */
+ 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;
+ }
+ else // source width/height is >= the preset height/width
+ {
+ /* we can go ahead and use the presets values for height and width */
+ job->width = [[chosenPreset objectForKey:@"PictureWidth"] intValue];
+ job->height = [[chosenPreset objectForKey:@"PictureHeight"] intValue];
+ }
job->keep_ratio = [[chosenPreset objectForKey:@"PictureKeepRatio"] intValue];
if (job->keep_ratio == 1)
{
/* Deinterlace */
if ([chosenPreset objectForKey:@"PictureDeinterlace"])
{
- [fPictureController setDeinterlace:[[chosenPreset objectForKey:@"PictureDeinterlace"] intValue]];
+ /* 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
{
/* Deinterlace */
if ([chosenPreset objectForKey:@"PictureDeinterlace"])
{
- [fPictureController setDeinterlace:[[chosenPreset objectForKey:@"PictureDeinterlace"] intValue]];
+ /* 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
{
[preset setObject:[fAudBitratePopUp titleOfSelectedItem] forKey:@"AudioBitRate"];
/* Subtitles*/
[preset setObject:[fSubPopUp titleOfSelectedItem] forKey:@"Subtitles"];
+ /* Forced Subtitles */
+ [preset setObject:[NSNumber numberWithInt:[fSubForcedCheck state]] forKey:@"SubtitlesForced"];
/* Dynamic Range Control Slider */
[preset setObject:[NSNumber numberWithFloat:[fAudDrcSlider floatValue]] forKey:@"AudioDRCSlider"];