All pastes #716253 Raw Edit

Unnamed

public text v1 · immutable
#716253 ·published 2007-09-26 17:40 UTC
rendered paste body
Index: macosx/Controller.mm
===================================================================
--- macosx/Controller.mm	(revision 990)
+++ macosx/Controller.mm	(working copy)
@@ -1074,6 +1074,7 @@
 	   }
        
 	}
+    
 }
 
 -(IBAction)showGrowlDoneNotification:(id)sender
@@ -2006,6 +2007,50 @@
 	[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];
 }
 
 - (IBAction) chapterPopUpChanged: (id) sender
@@ -2969,7 +3014,14 @@
 	[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 */
@@ -4334,9 +4386,18 @@
 			[fVidQualitySlider setFloatValue: [[chosenPreset valueForKey:@"VideoQualitySlider"] floatValue]];
 			[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]];