From: Rodeo Date: Sun, 3 May 2015 22:13:15 +0000 (+0000) Subject: merge MacGui: fix a couple nasty rounding errors. X-Git-Tag: 0.10.2~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6016e80d557741dc222d2d4f844e7c4bced67e53;p=handbrake merge MacGui: fix a couple nasty rounding errors. git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/0.10.x@7155 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/macosx/Controller.m b/macosx/Controller.m index bf0e079bb..c54a2a35d 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -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]];