]> granicus.if.org Git - handbrake/commitdiff
merge MacGui: fix a couple nasty rounding errors.
authorRodeo <tdskywalker@gmail.com>
Sun, 3 May 2015 22:13:15 +0000 (22:13 +0000)
committerRodeo <tdskywalker@gmail.com>
Sun, 3 May 2015 22:13:15 +0000 (22:13 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/0.10.x@7155 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/Controller.m

index bf0e079bb3e907b8a54872f8764bc7194590ada3..c54a2a35d1625a48c7b00c6199f7e5bfca033079 100644 (file)
@@ -4290,8 +4290,7 @@ fWorkingCount = 0;
     [fSrcTimeEndEncodingField setStringValue: [NSString stringWithFormat: @"%d", duration]];
     /* For point a to point b frame encoding, set the start and end fields to 0 and the title duration * announced fps in seconds respectively */
     [fSrcFrameStartEncodingField setStringValue: [NSString stringWithFormat: @"%d", 1]];
-    //[fSrcFrameEndEncodingField setStringValue: [NSString stringWithFormat: @"%d", ((title->hours * 3600) + (title->minutes * 60) + (title->seconds)) * 24]];
-    [fSrcFrameEndEncodingField setStringValue: [NSString stringWithFormat: @"%d", duration * (title->rate / title->rate_base)]];    
+    [fSrcFrameEndEncodingField setStringValue: [NSString stringWithFormat: @"%d", (title->duration / 90000.) * (title->rate / (double)title->rate_base)]];    
 
     /* Update encode start / stop variables */
 
@@ -4455,7 +4454,7 @@ fWorkingCount = 0;
     hb_title_t * title = (hb_title_t*)
     hb_list_item( list, (int)[fSrcTitlePopUp indexOfSelectedItem] );
     
-    int duration = ([fSrcFrameEndEncodingField intValue] - [fSrcFrameStartEncodingField intValue]) / (title->rate / title->rate_base);
+    int duration = ([fSrcFrameEndEncodingField intValue] - [fSrcFrameStartEncodingField intValue]) / (title->rate / (double)title->rate_base);
     [fSrcDuration2Field setStringValue: [NSString stringWithFormat:
                                          @"%02d:%02d:%02d", duration / 3600, ( duration / 60 ) % 60,
                                          duration % 60]];