diff options
author | dynaflash <[email protected]> | 2008-06-04 19:58:25 +0000 |
---|---|---|
committer | dynaflash <[email protected]> | 2008-06-04 19:58:25 +0000 |
commit | 4576706b8db62654aa4ab529eca0c5b5ad4488b1 (patch) | |
tree | a5b298da95973f457ac67fe5cfc0d4de4eee7ea3 /macosx/Controller.mm | |
parent | 61f09e3aaf680a46703bad685c451c5a83b610cc (diff) |
MacGui: Add "Auto" to audio sample rate selections
- Auto simply uses the input audio's sample rate
- Built in presets updated to use Auto for all but device presets which still use 48.
- prepareJob now uses the selectedIndex's tag from the sample rate NSPopUp instead of libhb's built in array of sample rates
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1495 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/Controller.mm')
-rw-r--r-- | macosx/Controller.mm | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/macosx/Controller.mm b/macosx/Controller.mm index f8d70850e..c7f077140 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -1581,7 +1581,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It audio->out.codec = [[fAudTrack1CodecPopUp selectedItem] tag]; audio->out.mixdown = [[fAudTrack1MixPopUp selectedItem] tag]; audio->out.bitrate = [[fAudTrack1BitratePopUp selectedItem] tag]; - audio->out.samplerate = hb_audio_rates[[fAudTrack1RatePopUp indexOfSelectedItem]].rate; + audio->out.samplerate = [[fAudTrack1RatePopUp selectedItem] tag]; audio->out.dynamic_range_compression = [fAudTrack1DrcField floatValue]; hb_audio_add( job, audio ); @@ -1597,7 +1597,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It audio->out.codec = [[fAudTrack2CodecPopUp selectedItem] tag]; audio->out.mixdown = [[fAudTrack2MixPopUp selectedItem] tag]; audio->out.bitrate = [[fAudTrack2BitratePopUp selectedItem] tag]; - audio->out.samplerate = hb_audio_rates[[fAudTrack2RatePopUp indexOfSelectedItem]].rate; + audio->out.samplerate = [[fAudTrack2RatePopUp selectedItem] tag]; audio->out.dynamic_range_compression = [fAudTrack2DrcField floatValue]; hb_audio_add( job, audio ); @@ -1615,7 +1615,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It audio->out.codec = [[fAudTrack3CodecPopUp selectedItem] tag]; audio->out.mixdown = [[fAudTrack3MixPopUp selectedItem] tag]; audio->out.bitrate = [[fAudTrack3BitratePopUp selectedItem] tag]; - audio->out.samplerate = hb_audio_rates[[fAudTrack3RatePopUp indexOfSelectedItem]].rate; + audio->out.samplerate = [[fAudTrack3RatePopUp selectedItem] tag]; audio->out.dynamic_range_compression = [fAudTrack3DrcField floatValue]; hb_audio_add( job, audio ); @@ -1633,7 +1633,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It audio->out.codec = [[fAudTrack4CodecPopUp selectedItem] tag]; audio->out.mixdown = [[fAudTrack4MixPopUp selectedItem] tag]; audio->out.bitrate = [[fAudTrack4BitratePopUp selectedItem] tag]; - audio->out.samplerate = hb_audio_rates[[fAudTrack4RatePopUp indexOfSelectedItem]].rate; + audio->out.samplerate = [[fAudTrack4RatePopUp selectedItem] tag]; audio->out.dynamic_range_compression = [fAudTrack4DrcField floatValue]; hb_audio_add( job, audio ); @@ -3503,6 +3503,15 @@ the user is using "Custom" settings by determining the sender*/ maxbitrate = 384; } + + /* make sure we have a selected title before continuing */ + if (fTitle == NULL) return; + /* get the audio so we can find out what input rates are*/ + hb_audio_config_t * audio; + audio = (hb_audio_config_t *) hb_list_audio_config_item( fTitle->list_audio, [audiotrackPopUp indexOfSelectedItem] - 1 ); + int inputbitrate = audio->in.bitrate / 1000; + int inputsamplerate = audio->in.samplerate; + if ([[mixdownPopUp selectedItem] tag] != HB_ACODEC_AC3) { [bitratePopUp removeAllItems]; @@ -3533,31 +3542,32 @@ the user is using "Custom" settings by determining the sender*/ /* populate and set the sample rate popup */ /* Audio samplerate */ [sampleratePopUp removeAllItems]; + /* we create a same as source selection (Auto) so that we can choose to use the input sample rate */ + NSMenuItem *menuItem = [[sampleratePopUp menu] addItemWithTitle: @"Auto" action: NULL keyEquivalent: @""]; + [menuItem setTag: inputsamplerate]; + for( int i = 0; i < hb_audio_rates_count; i++ ) { NSMenuItem *menuItem = [[sampleratePopUp menu] addItemWithTitle: - [NSString stringWithCString: hb_audio_rates[i].string] - action: NULL keyEquivalent: @""]; + [NSString stringWithCString: hb_audio_rates[i].string] + action: NULL keyEquivalent: @""]; [menuItem setTag: hb_audio_rates[i].rate]; } - /* We use 48 hz as the default sample rate as almost every dvd made uses that as source - * and there is no compelling reason to use anything else as default + /* We use the input sample rate as the default sample rate as downsampling just makes audio worse + * and there is no compelling reason to use anything else as default, though the users default + * preset will likely override any setting chosen here. */ - [sampleratePopUp selectItemWithTitle: @"48"]; + [sampleratePopUp selectItemWithTag: inputsamplerate]; + - /* Since AC3 Pass Thru uses the input ac3 bitrate and a sample rate of 48, we get the input tracks + /* Since AC3 Pass Thru uses the input ac3 bitrate and sample rate, we get the input tracks * bitrate and dispay it in the bitrate popup even though libhb happily ignores any bitrate input from * the gui. We do this for better user feedback in the audio tab as well as the queue for the most part */ if ([[mixdownPopUp selectedItem] tag] == HB_ACODEC_AC3) { - /* make sure we have a selected title before continuing */ - if (fTitle == NULL) return; + /* lets also set the bitrate popup to the input bitrate as thats what passthru will use */ - /* get the audio */ - hb_audio_config_t * audio; - audio = (hb_audio_config_t *) hb_list_audio_config_item( fTitle->list_audio, [audiotrackPopUp indexOfSelectedItem] - 1 ); - int inputbitrate = audio->in.bitrate / 1000; [bitratePopUp removeAllItems]; NSMenuItem *menuItem = [[bitratePopUp menu] addItemWithTitle: [NSString stringWithFormat:@"%d", inputbitrate] |