- /* We will be setting the enabled/disabled state of each tracks audio controls based on
- * the settings of the source audio for that track. We leave the samplerate and bitrate
- * to audiotrackMixdownChanged
- */
-
- /* We will first verify that a lower track number has been selected before enabling each track
- * for example, make sure a track is selected for track 1 before enabling track 2, etc.
- */
- if ([fAudLang1PopUp indexOfSelectedItem] == 0)
- {
- [fAudLang2PopUp setEnabled: NO];
- [fAudLang2PopUp selectItemAtIndex: 0];
- }
- else
- {
- [fAudLang2PopUp setEnabled: YES];
- }
-
- if ([fAudLang2PopUp indexOfSelectedItem] == 0)
- {
- [fAudLang3PopUp setEnabled: NO];
- [fAudLang3PopUp selectItemAtIndex: 0];
- }
- else
- {
- [fAudLang3PopUp setEnabled: YES];
- }
- if ([fAudLang3PopUp indexOfSelectedItem] == 0)
- {
- [fAudLang4PopUp setEnabled: NO];
- [fAudLang4PopUp selectItemAtIndex: 0];
- }
- else
- {
- [fAudLang4PopUp setEnabled: YES];
- }
- /* enable/disable the mixdown text and popupbutton for audio track 1 */
- [fAudTrack1CodecPopUp setEnabled: ([fAudLang1PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack1MixPopUp setEnabled: ([fAudLang1PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack1RatePopUp setEnabled: ([fAudLang1PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack1BitratePopUp setEnabled: ([fAudLang1PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack1DrcSlider setEnabled: ([fAudLang1PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack1DrcField setEnabled: ([fAudLang1PopUp indexOfSelectedItem] == 0) ? NO : YES];
- if ([fAudLang1PopUp indexOfSelectedItem] == 0)
- {
- [fAudTrack1CodecPopUp removeAllItems];
- [fAudTrack1MixPopUp removeAllItems];
- [fAudTrack1RatePopUp removeAllItems];
- [fAudTrack1BitratePopUp removeAllItems];
- [fAudTrack1DrcSlider setFloatValue: 0.00];
- [self audioDRCSliderChanged: fAudTrack1DrcSlider];
- }
- else if ([[fAudTrack1MixPopUp selectedItem] tag] == HB_ACODEC_AC3 || [[fAudTrack1MixPopUp selectedItem] tag] == HB_ACODEC_DCA)
- {
- [fAudTrack1RatePopUp setEnabled: NO];
- [fAudTrack1BitratePopUp setEnabled: NO];
- [fAudTrack1DrcSlider setEnabled: NO];
- [fAudTrack1DrcField setEnabled: NO];
- }
-
- /* enable/disable the mixdown text and popupbutton for audio track 2 */
- [fAudTrack2CodecPopUp setEnabled: ([fAudLang2PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack2MixPopUp setEnabled: ([fAudLang2PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack2RatePopUp setEnabled: ([fAudLang2PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack2BitratePopUp setEnabled: ([fAudLang2PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack2DrcSlider setEnabled: ([fAudLang2PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack2DrcField setEnabled: ([fAudLang2PopUp indexOfSelectedItem] == 0) ? NO : YES];
- if ([fAudLang2PopUp indexOfSelectedItem] == 0)
- {
- [fAudTrack2CodecPopUp removeAllItems];
- [fAudTrack2MixPopUp removeAllItems];
- [fAudTrack2RatePopUp removeAllItems];
- [fAudTrack2BitratePopUp removeAllItems];
- [fAudTrack2DrcSlider setFloatValue: 0.00];
- [self audioDRCSliderChanged: fAudTrack2DrcSlider];
- }
- else if ([[fAudTrack2MixPopUp selectedItem] tag] == HB_ACODEC_AC3 || [[fAudTrack2MixPopUp selectedItem] tag] == HB_ACODEC_DCA)
- {
- [fAudTrack2RatePopUp setEnabled: NO];
- [fAudTrack2BitratePopUp setEnabled: NO];
- [fAudTrack2DrcSlider setEnabled: NO];
- [fAudTrack2DrcField setEnabled: NO];
- }
-
- /* enable/disable the mixdown text and popupbutton for audio track 3 */
- [fAudTrack3CodecPopUp setEnabled: ([fAudLang3PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack3MixPopUp setEnabled: ([fAudLang3PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack3RatePopUp setEnabled: ([fAudLang3PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack3BitratePopUp setEnabled: ([fAudLang3PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack3DrcSlider setEnabled: ([fAudLang3PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack3DrcField setEnabled: ([fAudLang3PopUp indexOfSelectedItem] == 0) ? NO : YES];
- if ([fAudLang3PopUp indexOfSelectedItem] == 0)
- {
- [fAudTrack3CodecPopUp removeAllItems];
- [fAudTrack3MixPopUp removeAllItems];
- [fAudTrack3RatePopUp removeAllItems];
- [fAudTrack3BitratePopUp removeAllItems];
- [fAudTrack3DrcSlider setFloatValue: 0.00];
- [self audioDRCSliderChanged: fAudTrack3DrcSlider];
- }
- else if ([[fAudTrack3MixPopUp selectedItem] tag] == HB_ACODEC_AC3 || [[fAudTrack3MixPopUp selectedItem] tag] == HB_ACODEC_DCA)
- {
- [fAudTrack3RatePopUp setEnabled: NO];
- [fAudTrack3BitratePopUp setEnabled: NO];
- [fAudTrack3DrcSlider setEnabled: NO];
- [fAudTrack3DrcField setEnabled: NO];
- }
-
- /* enable/disable the mixdown text and popupbutton for audio track 4 */
- [fAudTrack4CodecPopUp setEnabled: ([fAudLang4PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack4MixPopUp setEnabled: ([fAudLang4PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack4RatePopUp setEnabled: ([fAudLang4PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack4BitratePopUp setEnabled: ([fAudLang4PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack4DrcSlider setEnabled: ([fAudLang4PopUp indexOfSelectedItem] == 0) ? NO : YES];
- [fAudTrack4DrcField setEnabled: ([fAudLang4PopUp indexOfSelectedItem] == 0) ? NO : YES];
- if ([fAudLang4PopUp indexOfSelectedItem] == 0)
- {
- [fAudTrack4CodecPopUp removeAllItems];
- [fAudTrack4MixPopUp removeAllItems];
- [fAudTrack4RatePopUp removeAllItems];
- [fAudTrack4BitratePopUp removeAllItems];
- [fAudTrack4DrcSlider setFloatValue: 0.00];
- [self audioDRCSliderChanged: fAudTrack4DrcSlider];
- }
- else if ([[fAudTrack4MixPopUp selectedItem] tag] == HB_ACODEC_AC3 || [[fAudTrack4MixPopUp selectedItem] tag] == HB_ACODEC_DCA)
- {
- [fAudTrack4RatePopUp setEnabled: NO];
- [fAudTrack4BitratePopUp setEnabled: NO];
- [fAudTrack4DrcSlider setEnabled: NO];
- [fAudTrack4DrcField setEnabled: NO];
- }
-
-}
-
-- (IBAction) addAllAudioTracksToPopUp: (id) sender
-{
-
- hb_list_t * list = hb_get_titles( fHandle );
- hb_title_t * title = (hb_title_t*)
- hb_list_item( list, [fSrcTitlePopUp indexOfSelectedItem] );
-
- hb_audio_config_t * audio;
-
- [sender removeAllItems];
- [sender addItemWithTitle: NSLocalizedString( @"None", @"" )];
- for( int i = 0; i < hb_list_count( title->list_audio ); i++ )
- {
- audio = (hb_audio_config_t *) hb_list_audio_config_item( title->list_audio, i );
- [[sender menu] addItemWithTitle:
- [NSString stringWithUTF8String: audio->lang.description]
- action: NULL keyEquivalent: @""];
- }
- [sender selectItemAtIndex: 0];
-
-}
-
-- (IBAction) selectAudioTrackInPopUp: (id) sender searchPrefixString: (NSString *) searchPrefixString selectIndexIfNotFound: (int) selectIndexIfNotFound
-{
-
- /* this method can be used to find a language, or a language-and-source-format combination, by passing in the appropriate string */
- /* e.g. to find the first French track, pass in an NSString * of "Francais" */
- /* e.g. to find the first English 5.1 AC3 track, pass in an NSString * of "English (AC3) (5.1 ch)" */
- /* if no matching track is found, then selectIndexIfNotFound is used to choose which track to select instead */
-
- if (searchPrefixString)
- {
-
- for( int i = 0; i < [sender numberOfItems]; i++ )
- {
- /* Try to find the desired search string */
- if ([[[sender itemAtIndex: i] title] hasPrefix:searchPrefixString])
- {
- [sender selectItemAtIndex: i];
- return;
- }
- }
- /* couldn't find the string, so select the requested "search string not found" item */
- /* index of 0 means select the "none" item */
- /* index of 1 means select the first audio track */
- [sender selectItemAtIndex: selectIndexIfNotFound];
- }
- else
- {
- /* if no search string is provided, then select the selectIndexIfNotFound item */
- [sender selectItemAtIndex: selectIndexIfNotFound];
- }
-
-}
-- (IBAction) audioAddAudioTrackCodecs: (id)sender
-{
- int format = [fDstFormatPopUp indexOfSelectedItem];
-
- /* setup pointers to the appropriate popups for the correct track */
- NSPopUpButton * audiocodecPopUp;
- NSPopUpButton * audiotrackPopUp;
- if (sender == fAudTrack1CodecPopUp)
- {
- audiotrackPopUp = fAudLang1PopUp;
- audiocodecPopUp = fAudTrack1CodecPopUp;
- }
- else if (sender == fAudTrack2CodecPopUp)
- {
- audiotrackPopUp = fAudLang2PopUp;
- audiocodecPopUp = fAudTrack2CodecPopUp;
- }
- else if (sender == fAudTrack3CodecPopUp)
- {
- audiotrackPopUp = fAudLang3PopUp;
- audiocodecPopUp = fAudTrack3CodecPopUp;
- }
- else
- {
- audiotrackPopUp = fAudLang4PopUp;
- audiocodecPopUp = fAudTrack4CodecPopUp;
- }
-
- [audiocodecPopUp removeAllItems];
- /* Make sure "None" isnt selected in the source track */
- if ([audiotrackPopUp indexOfSelectedItem] > 0)
- {
- [audiocodecPopUp setEnabled:YES];
- NSMenuItem *menuItem;
- /* We setup our appropriate popups for codecs and put the int value in the popup tag for easy retrieval */
- switch( format )
- {
- case 0:
- /* MP4 */
- // FAAC
- menuItem = [[audiocodecPopUp menu] addItemWithTitle:@"AAC (faac)" action: NULL keyEquivalent: @""];
- [menuItem setTag: HB_ACODEC_FAAC];
-
- // CA_AAC
- menuItem = [[audiocodecPopUp menu] addItemWithTitle:@"AAC (CoreAudio)" action: NULL keyEquivalent: @""];
- [menuItem setTag: HB_ACODEC_CA_AAC];
-
- // AC3 Passthru
- menuItem = [[audiocodecPopUp menu] addItemWithTitle:@"AC3 Passthru" action: NULL keyEquivalent: @""];
- [menuItem setTag: HB_ACODEC_AC3];
- break;
-
- case 1:
- /* MKV */
- // FAAC
- menuItem = [[audiocodecPopUp menu] addItemWithTitle:@"AAC (faac)" action: NULL keyEquivalent: @""];
- [menuItem setTag: HB_ACODEC_FAAC];
- // CA_AAC
- menuItem = [[audiocodecPopUp menu] addItemWithTitle:@"AAC (CoreAudio)" action: NULL keyEquivalent: @""];
- [menuItem setTag: HB_ACODEC_CA_AAC];
- // AC3 Passthru
- menuItem = [[audiocodecPopUp menu] addItemWithTitle:@"AC3 Passthru" action: NULL keyEquivalent: @""];
- [menuItem setTag: HB_ACODEC_AC3];
- // DTS Passthru
- menuItem = [[audiocodecPopUp menu] addItemWithTitle:@"DTS Passthru" action: NULL keyEquivalent: @""];
- [menuItem setTag: HB_ACODEC_DCA];
- // MP3
- menuItem = [[audiocodecPopUp menu] addItemWithTitle:@"MP3 (lame)" action: NULL keyEquivalent: @""];
- [menuItem setTag: HB_ACODEC_LAME];
- // Vorbis
- menuItem = [[audiocodecPopUp menu] addItemWithTitle:@"Vorbis (vorbis)" action: NULL keyEquivalent: @""];
- [menuItem setTag: HB_ACODEC_VORBIS];
- break;
-
- case 2:
- /* AVI */
- // MP3
- menuItem = [[audiocodecPopUp menu] addItemWithTitle:@"MP3 (lame)" action: NULL keyEquivalent: @""];
- [menuItem setTag: HB_ACODEC_LAME];
- // AC3 Passthru
- menuItem = [[audiocodecPopUp menu] addItemWithTitle:@"AC3 Passthru" action: NULL keyEquivalent: @""];
- [menuItem setTag: HB_ACODEC_AC3];
- break;
-
- case 3:
- /* OGM */
- // Vorbis
- menuItem = [[audiocodecPopUp menu] addItemWithTitle:@"Vorbis (vorbis)" action: NULL keyEquivalent: @""];
- [menuItem setTag: HB_ACODEC_VORBIS];
- // MP3
- menuItem = [[audiocodecPopUp menu] addItemWithTitle:@"MP3 (lame)" action: NULL keyEquivalent: @""];
- [menuItem setTag: HB_ACODEC_LAME];
- break;
- }
- [audiocodecPopUp selectItemAtIndex:0];
- }
- else
- {
- [audiocodecPopUp setEnabled:NO];
- }
-}
-
-- (IBAction) audioTrackPopUpChanged: (id) sender
-{
- /* utility function to call audioTrackPopUpChanged without passing in a mixdown-to-use */
- [self audioTrackPopUpChanged: sender mixdownToUse: 0];
-}
-
-- (IBAction) audioTrackPopUpChanged: (id) sender mixdownToUse: (int) mixdownToUse
-{
-
- /* make sure we have a selected title before continuing */
- if (fTitle == NULL) return;
- /* if the sender is the lanaguage popup and there is nothing in the codec popup, lets call
- * audioAddAudioTrackCodecs on the codec popup to populate it properly before moving on
- */
- if (sender == fAudLang1PopUp && [[fAudTrack1CodecPopUp menu] numberOfItems] == 0)
- {
- [self audioAddAudioTrackCodecs: fAudTrack1CodecPopUp];
- }
- if (sender == fAudLang2PopUp && [[fAudTrack2CodecPopUp menu] numberOfItems] == 0)
- {
- [self audioAddAudioTrackCodecs: fAudTrack2CodecPopUp];
- }
- if (sender == fAudLang3PopUp && [[fAudTrack3CodecPopUp menu] numberOfItems] == 0)
- {
- [self audioAddAudioTrackCodecs: fAudTrack3CodecPopUp];
- }
- if (sender == fAudLang4PopUp && [[fAudTrack4CodecPopUp menu] numberOfItems] == 0)
- {
- [self audioAddAudioTrackCodecs: fAudTrack4CodecPopUp];
- }
-
- /* Now lets make the sender the appropriate Audio Track popup from this point on */
- if (sender == fAudTrack1CodecPopUp || sender == fAudTrack1MixPopUp)
- {
- sender = fAudLang1PopUp;
- }
- if (sender == fAudTrack2CodecPopUp || sender == fAudTrack2MixPopUp)
- {
- sender = fAudLang2PopUp;
- }
- if (sender == fAudTrack3CodecPopUp || sender == fAudTrack3MixPopUp)
- {
- sender = fAudLang3PopUp;
- }
- if (sender == fAudTrack4CodecPopUp || sender == fAudTrack4MixPopUp)
- {
- sender = fAudLang4PopUp;
- }
-
- /* pointer to this track's mixdown, codec, sample rate and bitrate NSPopUpButton's */
- NSPopUpButton * mixdownPopUp;
- NSPopUpButton * audiocodecPopUp;
- NSPopUpButton * sampleratePopUp;
- NSPopUpButton * bitratePopUp;
- if (sender == fAudLang1PopUp)
- {
- mixdownPopUp = fAudTrack1MixPopUp;
- audiocodecPopUp = fAudTrack1CodecPopUp;
- sampleratePopUp = fAudTrack1RatePopUp;
- bitratePopUp = fAudTrack1BitratePopUp;
- }
- else if (sender == fAudLang2PopUp)
- {
- mixdownPopUp = fAudTrack2MixPopUp;
- audiocodecPopUp = fAudTrack2CodecPopUp;
- sampleratePopUp = fAudTrack2RatePopUp;
- bitratePopUp = fAudTrack2BitratePopUp;
- }
- else if (sender == fAudLang3PopUp)
- {
- mixdownPopUp = fAudTrack3MixPopUp;
- audiocodecPopUp = fAudTrack3CodecPopUp;
- sampleratePopUp = fAudTrack3RatePopUp;
- bitratePopUp = fAudTrack3BitratePopUp;
- }
- else
- {
- mixdownPopUp = fAudTrack4MixPopUp;
- audiocodecPopUp = fAudTrack4CodecPopUp;
- sampleratePopUp = fAudTrack4RatePopUp;
- bitratePopUp = fAudTrack4BitratePopUp;
- }
-
- /* get the index of the selected audio Track*/
- int thisAudioIndex = [sender indexOfSelectedItem] - 1;
-
- /* pointer for the hb_audio_s struct we will use later on */
- hb_audio_config_t * audio;
-
- int acodec;
- /* check if the audio mixdown controls need their enabled state changing */
- [self setEnabledStateOfAudioMixdownControls:nil];
-
- if (thisAudioIndex != -1)
- {
-
- /* get the audio */
- audio = (hb_audio_config_t *) hb_list_audio_config_item( fTitle->list_audio, thisAudioIndex );// Should "fTitle" be title and be setup ?
-
- /* actually manipulate the proper mixdowns here */
- /* delete the previous audio mixdown options */
- [mixdownPopUp removeAllItems];
-
- acodec = [[audiocodecPopUp selectedItem] tag];
-
- if (audio != NULL)
- {
-
- /* find out if our selected output audio codec supports mono and / or 6ch */
- /* we also check for an input codec of AC3 or DCA,
- as they are the only libraries able to do the mixdown to mono / conversion to 6-ch */
- /* audioCodecsSupportMono and audioCodecsSupport6Ch are the same for now,
- but this may change in the future, so they are separated for flexibility */
- int audioCodecsSupportMono =
- (audio->in.codec & (HB_ACODEC_AC3|HB_ACODEC_DCA)) &&
- (acodec != HB_ACODEC_LAME);
- int audioCodecsSupport6Ch =
- (audio->in.codec & (HB_ACODEC_AC3|HB_ACODEC_DCA)) &&
- (acodec != HB_ACODEC_LAME);
-
- /* check for AC-3 passthru */
- if (audio->in.codec == HB_ACODEC_AC3 && acodec == HB_ACODEC_AC3)
- {
-
- NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
- [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 stringWithUTF8String: "DTS Passthru"]
- action: NULL keyEquivalent: @""];
- [menuItem setTag: HB_ACODEC_DCA];
- }
- else
- {
-
- /* add the appropriate audio mixdown menuitems to the popupbutton */
- /* in each case, we set the new menuitem's tag to be the amixdown value for that mixdown,
- so that we can reference the mixdown later */
-
- /* keep a track of the min and max mixdowns we used, so we can select the best match later */
- int minMixdownUsed = 0;
- int maxMixdownUsed = 0;
-
- /* get the input channel layout without any lfe channels */
- int layout = audio->in.channel_layout & HB_INPUT_CH_LAYOUT_DISCRETE_NO_LFE_MASK;
-
- /* do we want to add a mono option? */
- if (audioCodecsSupportMono == 1)
- {
- NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
- [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;
- maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[0].amixdown);
- }
-
- /* 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)
- {
- NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
- [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;
- maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[1].amixdown);
- }
-
- /* 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)
- {
- NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
- [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;
- maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[2].amixdown);
- }
-
- /* do we want to add a dolby pro logic 2 (DPL2) option? */
- if (layout == HB_INPUT_CH_LAYOUT_3F2R)
- {
- NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
- [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;
- maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[3].amixdown);
- }
-
- /* do we want to add a 6-channel discrete option? */
- 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 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;
- maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[4].amixdown);
- }
-
- /* do we want to add an AC-3 passthrough option? */
- if (audio->in.codec == HB_ACODEC_AC3 && acodec == HB_ACODEC_AC3)
- {
- NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
- [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;
- maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[5].amixdown);
- }
-
- /* do we want to add a DTS Passthru option ? HB_ACODEC_DCA*/
- if (audio->in.codec == HB_ACODEC_DCA && acodec == HB_ACODEC_DCA)
- {
- NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:
- [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;
- maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[5].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 */
- /* ultimately this should be a prefs option */
- int useMixdown;
-
- /* if we passed in a mixdown to use - in order to load a preset - then try and use it */
- if (mixdownToUse > 0)
- {
- useMixdown = mixdownToUse;
- }
- else
- {
- useMixdown = HB_AMIXDOWN_DOLBYPLII;
- }
-
- /* if useMixdown > maxMixdownUsed, then use maxMixdownUsed */
- if (useMixdown > maxMixdownUsed)
- {
- useMixdown = maxMixdownUsed;
- }
-
- /* if useMixdown < minMixdownUsed, then use minMixdownUsed */
- if (useMixdown < minMixdownUsed)
- {
- useMixdown = minMixdownUsed;
- }
-
- /* select the (possibly-amended) preferred mixdown */
- [mixdownPopUp selectItemWithTag: useMixdown];
-
- }
- /* In the case of a source track that is not AC3 and the user tries to use AC3 Passthru (which does not work)
- * we force the Audio Codec choice back to a workable codec. We use MP3 for avi and aac for all
- * other containers.
- */
- if (audio->in.codec != HB_ACODEC_AC3 && [[audiocodecPopUp selectedItem] tag] == HB_ACODEC_AC3)
- {
- /* If we are using the avi container, we select MP3 as there is no aac available*/
- if ([[fDstFormatPopUp selectedItem] tag] == HB_MUX_AVI)
- {
- [audiocodecPopUp selectItemWithTag: HB_ACODEC_LAME];
- }
- else
- {
- [audiocodecPopUp selectItemWithTag: HB_ACODEC_FAAC];
- }
- }
-
- /* In the case of a source track that is not DTS and the user tries to use DTS Passthru (which does not work)
- * we force the Audio Codec choice back to a workable codec. We use MP3 for avi and aac for all
- * other containers.
- */
- if (audio->in.codec != HB_ACODEC_DCA && [[audiocodecPopUp selectedItem] tag] == HB_ACODEC_DCA)
- {
- /* If we are using the avi container, we select MP3 as there is no aac available*/
- if ([[fDstFormatPopUp selectedItem] tag] == HB_MUX_AVI)
- {
- [audiocodecPopUp selectItemWithTag: HB_ACODEC_LAME];
- }
- else
- {
- [audiocodecPopUp selectItemWithTag: HB_ACODEC_FAAC];
- }
- }
-
- /* Setup our samplerate and bitrate popups we will need based on mixdown */
- [self audioTrackMixdownChanged: mixdownPopUp];
- }
-
- }
- if( [fDstFormatPopUp indexOfSelectedItem] == 0 )
- {
- [self autoSetM4vExtension: sender];
- }