diff options
author | handbrake <[email protected]> | 2006-01-14 13:21:55 +0000 |
---|---|---|
committer | handbrake <[email protected]> | 2006-01-14 13:21:55 +0000 |
commit | dc8de40de13c3f3e643b980a95ef48ccafb542e3 (patch) | |
tree | 953b97afe7082bbe2ce4247c703a51aa8e29a3c9 /macosx/TargetSizeField.mm | |
parent | 4beb6a8b483c9d84677b21cc271ce315f136335c (diff) |
HandBrake 0.6.0-test1
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@10 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/TargetSizeField.mm')
-rw-r--r-- | macosx/TargetSizeField.mm | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/macosx/TargetSizeField.mm b/macosx/TargetSizeField.mm index bde9f0ec2..e113a4bf1 100644 --- a/macosx/TargetSizeField.mm +++ b/macosx/TargetSizeField.mm @@ -1,4 +1,4 @@ -/* $Id: TargetSizeField.mm,v 1.1.1.1 2003/11/03 12:03:51 titer Exp $ +/* $Id: TargetSizeField.mm,v 1.4 2004/01/28 14:41:31 titer Exp $ This file is part of the HandBrake source code. Homepage: <http://handbrake.m0k.org/>. @@ -33,32 +33,16 @@ - (void) UpdateBitrate { - int64_t available; - available = (int64_t) [self intValue] * 1024 * 1024; - - /* AVI headers */ - available -= 2048; - - /* Video chunk headers (8 bytes / frame) - and index (16 bytes / frame) */ - available -= 24 * fTitle->length * fTitle->rate / fTitle->rateBase; - - /* Audio tracks */ - available -= ( ( [[fSecondaryLanguagePopUp titleOfSelectedItem] - compare: @"None"] == NSOrderedSame ) ? 1 : 2 ) * - ( fTitle->length * - [[fAudioBitratePopUp titleOfSelectedItem] intValue] * - 128 + 24 * fTitle->length * 44100 / 1152 ); - - if( available < 0 ) - { - [fBitrateField setIntValue: 0]; - } - else - { - [fBitrateField setIntValue: - available / ( 128 * fTitle->length )]; - } + int size = [self intValue]; + int format = [fRipFormatPopUp indexOfSelectedItem]; + int muxer = ( format == 0 ) ? HB_MUX_MP4 : ( ( format == 1 ) ? + HB_MUX_OGM : HB_MUX_AVI ); + int audioCount = ( [fRipLang2PopUp selectedItem] == + [fRipLang2PopUp lastItem] ) ? 1 : 2; + int audioBitrate = [[fRipAudBitPopUp titleOfSelectedItem] intValue]; + + [fRipCustomField setIntValue: HBGetBitrateForSize( fTitle, size, + muxer, audioCount, audioBitrate )]; } @end |