diff options
author | dynaflash <[email protected]> | 2007-09-27 13:03:21 +0000 |
---|---|---|
committer | dynaflash <[email protected]> | 2007-09-27 13:03:21 +0000 |
commit | 19731d61fb8bb93db85d3e22b947104ed99d8915 (patch) | |
tree | 83e52c8fef0ec2d2867462954811dda33254e322 | |
parent | 82cb9ecad1eff3cbde808a6d58626450431d4a5e (diff) |
MacGui: Add the auto detected framerate to the "Same as source" item in the "Frame Rate" popup button.
- Note: presets still use "Same as source" if applicable for backwards compatibility.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@994 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | macosx/Controller.mm | 70 |
1 files changed, 66 insertions, 4 deletions
diff --git a/macosx/Controller.mm b/macosx/Controller.mm index 1ace6bef4..63525db2a 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -2009,8 +2009,54 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It /* so call audioTrackPopUpChanged for both audio tracks to update the mixdown popups */ [self audioTrackPopUpChanged: fAudLang1PopUp]; [self audioTrackPopUpChanged: fAudLang2PopUp]; - /* lets call tableViewSelected to make sure that any preset we have selected is enforced after a title change */ - [self tableViewSelected:NULL]; + + /* We repopulate the Video Framerate popup and show the detected framerate along with "Same as Source"*/ + [fVidRatePopUp removeAllItems]; + if (fTitle->rate_base == 1126125) // 23.976 NTSC Film + { + [fVidRatePopUp addItemWithTitle: @"Same as source (23.976)"]; + } + else if (fTitle->rate_base == 1080000) // 25 PAL Film/Video + { + [fVidRatePopUp addItemWithTitle: @"Same as source (25)"]; + } + else if (fTitle->rate_base == 900900) // 29.97 NTSC Video + { + [fVidRatePopUp addItemWithTitle: @"Same as source (29.97)"]; + } + else + { + /* if none of the common dvd source framerates is detected, just use "Same as source" */ + [fVidRatePopUp addItemWithTitle: @"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]]) + { + [fVidRatePopUp addItemWithTitle:[NSString stringWithFormat: @"%@%@", + [NSString stringWithCString: hb_video_rates[i].string], @" (NTSC Film)"]]; + } + else if ([[NSString stringWithCString: hb_video_rates[i].string] isEqualToString: [NSString stringWithFormat: @"%d",25]]) + { + [fVidRatePopUp addItemWithTitle:[NSString stringWithFormat: @"%@%@", + [NSString stringWithCString: hb_video_rates[i].string], @" (PAL Film/Video)"]]; + } + else if ([[NSString stringWithCString: hb_video_rates[i].string] isEqualToString: [NSString stringWithFormat: @"%.2f",29.97]]) + { + [fVidRatePopUp addItemWithTitle:[NSString stringWithFormat: @"%@%@", + [NSString stringWithCString: hb_video_rates[i].string], @" (NTSC Video)"]]; + } + else + { + [fVidRatePopUp addItemWithTitle: + [NSString stringWithCString: hb_video_rates[i].string]]; + } + } + [fVidRatePopUp selectItemAtIndex: 0]; + + /* lets call tableViewSelected to make sure that any preset we have selected is enforced after a title change */ + [self tableViewSelected:NULL]; + } - (IBAction) chapterPopUpChanged: (id) sender @@ -2974,7 +3020,14 @@ the user is using "Custom" settings by determining the sender*/ [preset setObject:[NSNumber numberWithFloat:[fVidQualitySlider floatValue]] forKey:@"VideoQualitySlider"]; /* Video framerate */ - [preset setObject:[fVidRatePopUp titleOfSelectedItem] forKey:@"VideoFramerate"]; + if ([fVidRatePopUp indexOfSelectedItem] == 0) // Same as source is selected + { + [preset setObject:[NSString stringWithFormat: @"Same as source"] forKey:@"VideoFramerate"]; + } + else // we can record the actual titleOfSelectedItem + { + [preset setObject:[fVidRatePopUp titleOfSelectedItem] forKey:@"VideoFramerate"]; + } /* GrayScale */ [preset setObject:[NSNumber numberWithInt:[fVidGrayscaleCheck state]] forKey:@"VideoGrayScale"]; /* 2 Pass Encoding */ @@ -4340,7 +4393,16 @@ the user is using "Custom" settings by determining the sender*/ [self videoMatrixChanged: NULL]; /* Video framerate */ - [fVidRatePopUp selectItemWithTitle: [NSString stringWithFormat:[chosenPreset valueForKey:@"VideoFramerate"]]]; + /* For video preset video framerate, we want to make sure that Same as source does not conflict with the + detected framerate in the fVidRatePopUp so we use index 0*/ + if ([[NSString stringWithFormat:[chosenPreset valueForKey:@"VideoFramerate"]] isEqualToString: @"Same as source"]) + { + [fVidRatePopUp selectItemAtIndex: 0]; + } + else + { + [fVidRatePopUp selectItemWithTitle: [NSString stringWithFormat:[chosenPreset valueForKey:@"VideoFramerate"]]]; + } /* GrayScale */ [fVidGrayscaleCheck setState:[[chosenPreset objectForKey:@"VideoGrayScale"] intValue]]; |