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 | |
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')
-rw-r--r-- | macosx/Controller.h | 112 | ||||
-rw-r--r-- | macosx/Controller.mm | 950 | ||||
-rw-r--r-- | macosx/English.lproj/InfoPlist.strings | bin | 496 -> 500 bytes | |||
-rw-r--r-- | macosx/English.lproj/MainMenu.nib/classes.nib | 94 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.nib/info.nib | 22 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.nib/objects.nib | bin | 18081 -> 19591 bytes | |||
-rw-r--r-- | macosx/HandBrake.xcode/project.pbxproj (renamed from macosx/HandBrake.pbproj/project.pbxproj) | 219 | ||||
-rw-r--r-- | macosx/TargetSizeField.h | 9 | ||||
-rw-r--r-- | macosx/TargetSizeField.mm | 38 | ||||
-rwxr-xr-x | macosx/genstrings.sh | 7 | ||||
-rw-r--r-- | macosx/i18n/French.strings | bin | 0 -> 10044 bytes | |||
-rw-r--r-- | macosx/i18n/German.strings | bin | 0 -> 4318 bytes | |||
-rw-r--r-- | macosx/i18n/Localizable.strings | bin | 0 -> 9912 bytes |
13 files changed, 857 insertions, 594 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index 435e2216e..400246af8 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -1,4 +1,4 @@ -/* $Id: Controller.h,v 1.6 2003/11/13 01:40:44 titer Exp $ +/* $Id: Controller.h,v 1.14 2004/02/13 13:45:51 titer Exp $ This file is part of the HandBrake source code. Homepage: <http://handbrake.m0k.org/>. @@ -13,51 +13,65 @@ @interface HBController : NSObject { - bool fDie; - IBOutlet NSWindow * fWindow; /* Scan view */ - IBOutlet NSView * fScanView; - IBOutlet NSMatrix * fScanMatrix; - IBOutlet NSPopUpButton * fDVDPopUp; - IBOutlet NSTextField * fDVDFolderField; - IBOutlet NSButton * fScanBrowseButton; - IBOutlet NSTextField * fScanStatusField; - IBOutlet NSProgressIndicator * fScanProgress; - IBOutlet NSButton * fScanButton; + IBOutlet NSView * fScView; + IBOutlet NSTextField * fScWelcomeField; + IBOutlet NSTextField * fScSelectField; + IBOutlet NSMatrix * fScMatrix; + IBOutlet NSButtonCell * fScDetectedCell; + IBOutlet NSPopUpButton * fScDetectedPopUp; + IBOutlet NSButtonCell * fScFolderCell; + IBOutlet NSTextField * fScFolderField; + IBOutlet NSButton * fScBrowseButton; + IBOutlet NSTextField * fScStatusField; + IBOutlet NSProgressIndicator * fScProgress; + IBOutlet NSButton * fScOpenButton; IBOutlet NSView * fTempView; /* Rip view */ IBOutlet NSView * fRipView; + /* General box */ + IBOutlet NSTextField * fRipGeneralField; + IBOutlet NSTextField * fRipTitleField; + IBOutlet NSPopUpButton * fRipTitlePopUp; + IBOutlet NSTextField * fRipFormatField; + IBOutlet NSPopUpButton * fRipFormatPopUp; + IBOutlet NSTextField * fRipFileField1; + IBOutlet NSTextField * fRipFileField2; + IBOutlet NSButton * fRipBrowseButton; + /* Video box */ - IBOutlet NSPopUpButton * fTitlePopUp; - IBOutlet NSPopUpButton * fVideoCodecPopUp; - IBOutlet NSMatrix * fVideoMatrix; - IBOutlet NSTextField * fCustomBitrateField; - IBOutlet HBTargetSizeField * fTargetSizeField; - IBOutlet NSButton * fTwoPassCheck; - IBOutlet NSButton * fCropButton; + IBOutlet NSTextField * fRipVideoField; + IBOutlet NSTextField * fRipEncoderField; + IBOutlet NSPopUpButton * fRipEncoderPopUp; + IBOutlet NSTextField * fRipBitrateField; + IBOutlet NSMatrix * fRipVideoMatrix; + IBOutlet NSButtonCell * fRipCustomCell; + IBOutlet NSTextField * fRipCustomField; + IBOutlet NSButtonCell * fRipTargetCell; + IBOutlet HBTargetSizeField * fRipTargetField; + IBOutlet NSButton * fRipTwoPassCheck; + IBOutlet NSButton * fRipCropButton; /* Audio box */ - IBOutlet NSPopUpButton * fLanguagePopUp; - IBOutlet NSPopUpButton * fSecondaryLanguagePopUp; - IBOutlet NSPopUpButton * fAudioCodecPopUp; - IBOutlet NSPopUpButton * fAudioBitratePopUp; - - /* Destination box */ - IBOutlet NSPopUpButton * fFileFormatPopUp; - IBOutlet NSTextField * fFileField; - IBOutlet NSButton * fFileBrowseButton; + IBOutlet NSTextField * fRipAudioField; + IBOutlet NSTextField * fRipLang1Field; + IBOutlet NSPopUpButton * fRipLang1PopUp; + IBOutlet NSTextField * fRipLang2Field; + IBOutlet NSPopUpButton * fRipLang2PopUp; + IBOutlet NSTextField * fRipAudBitField; + IBOutlet NSPopUpButton * fRipAudBitPopUp; /* Bottom */ IBOutlet NSTextField * fRipStatusField; IBOutlet NSTextField * fRipInfoField; IBOutlet NSProgressIndicator * fRipProgress; - IBOutlet NSButton * fPauseButton; - IBOutlet NSButton * fRipButton; + IBOutlet NSButton * fRipPauseButton; + IBOutlet NSButton * fRipRipButton; /* "Done" alert panel */ IBOutlet NSPanel * fDonePanel; @@ -65,25 +79,41 @@ /* Crop & scale panel */ IBOutlet NSPanel * fPicturePanel; IBOutlet HBPictureGLView * fPictureGLView; - IBOutlet NSTextField * fWidthField; + IBOutlet NSTextField * fWidthField1; + IBOutlet NSTextField * fWidthField2; IBOutlet NSStepper * fWidthStepper; IBOutlet NSButton * fDeinterlaceCheck; - IBOutlet NSTextField * fTopField; + IBOutlet NSTextField * fTopField1; + IBOutlet NSTextField * fTopField2; IBOutlet NSStepper * fTopStepper; - IBOutlet NSTextField * fBottomField; + IBOutlet NSTextField * fBottomField1; + IBOutlet NSTextField * fBottomField2; IBOutlet NSStepper * fBottomStepper; - IBOutlet NSTextField * fLeftField; + IBOutlet NSTextField * fLeftField1; + IBOutlet NSTextField * fLeftField2; IBOutlet NSStepper * fLeftStepper; - IBOutlet NSTextField * fRightField; + IBOutlet NSTextField * fRightField1; + IBOutlet NSTextField * fRightField2; IBOutlet NSStepper * fRightStepper; - IBOutlet NSTextField * fInfoField; - IBOutlet NSButton * fOpenGLCheck; IBOutlet NSButton * fPreviousButton; IBOutlet NSButton * fNextButton; + IBOutlet NSButton * fAutocropButton; + IBOutlet NSButton * fOpenGLCheck; + IBOutlet NSTextField * fInfoField; + IBOutlet NSButton * fCloseButton; int fPicture; HBHandle * fHandle; + int fTitle; + int fTitleCount; HBList * fTitleList; + float fPosition; + int fPass; + int fPassCount; + float fCurFrameRate; + float fAvgFrameRate; + int fRemainingTime; + int fResult; } - (IBAction) ScanMatrixChanged: (id) sender; @@ -93,6 +123,7 @@ - (IBAction) Scan: (id) sender; - (IBAction) TitlePopUpChanged: (id) sender; +- (IBAction) FormatPopUpChanged: (id) sender; - (IBAction) VideoMatrixChanged: (id) sender; - (IBAction) AudioPopUpChanged: (id) sender; - (IBAction) BrowseFile: (id) sender; @@ -113,8 +144,15 @@ - (IBAction) PreviousPicture: (id) sender; - (IBAction) NextPicture: (id) sender; - (IBAction) UpdatePicture: (id) sender; +- (IBAction) AutoCrop: (id) sender; -- (void) UpdateIntf: (NSTimer *) timer; - (void) DetectDrives: (NSNotification *) notification; +/* libhb callbacks */ +- (void) Scanning: (id) sender; +- (void) ScanDone: (id) sender; +- (void) Encoding: (id) sender; +- (void) RipDone: (id) sender; + @end + diff --git a/macosx/Controller.mm b/macosx/Controller.mm index ea5a2c161..206c76369 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -1,4 +1,4 @@ -/* $Id: Controller.mm,v 1.10 2003/11/13 01:40:44 titer Exp $ +/* $Id: Controller.mm,v 1.27 2004/02/18 17:07:20 titer Exp $ This file is part of the HandBrake source code. Homepage: <http://handbrake.m0k.org/>. @@ -12,19 +12,34 @@ #include "Controller.h" +#define _(a) NSLocalizedString(a,nil) + +static void _Scanning( void * data, int title, int titleCount ); +static void _ScanDone( void * data, HBList * titleList ); +static void _Encoding( void * data, float position, int pass, + int passCount, float curFrameRate, + float avgFrameRate, int remainingTime ); +static void _RipDone( void * data, int result ); + +/******************************* + * HBController implementation * + *******************************/ @implementation HBController - (void) applicationDidFinishLaunching: (NSNotification *) notification { /* Init libhb */ + HBCallbacks callbacks; + callbacks.data = self; + callbacks.scanning = _Scanning; + callbacks.scanDone = _ScanDone; + callbacks.encoding = _Encoding; + callbacks.ripDone = _RipDone; + fHandle = HBInit( 1, 0 ); - [fPictureGLView SetHandle: fHandle]; + HBSetCallbacks( fHandle, callbacks ); - /* Update the GUI every 1/10 sec */ - fDie = false; - [NSTimer scheduledTimerWithTimeInterval: 0.1 - target: self selector: @selector( UpdateIntf: ) - userInfo: nil repeats: YES]; + [fPictureGLView SetHandle: fHandle]; /* Detect drives mounted after the app is started */ [[[NSWorkspace sharedWorkspace] notificationCenter] @@ -36,7 +51,6 @@ (NSApplication *) app { /* Clean up */ - fDie = true; HBClose( &fHandle ); return NSTerminateNow; @@ -44,33 +58,99 @@ - (void) awakeFromNib { - [fDVDPopUp removeAllItems]; - [fScanProgress setStyle: NSProgressIndicatorSpinningStyle]; - [fScanProgress setDisplayedWhenStopped: NO]; - [fVideoCodecPopUp removeAllItems]; - [fVideoCodecPopUp addItemWithTitle: @"MPEG-4 (Ffmpeg)"]; - [fVideoCodecPopUp addItemWithTitle: @"MPEG-4 (XviD)"]; - [fVideoCodecPopUp selectItemWithTitle: @"MPEG-4 (Ffmpeg)"]; - [fAudioBitratePopUp removeAllItems]; - [fAudioBitratePopUp addItemWithTitle: @"32"]; - [fAudioBitratePopUp addItemWithTitle: @"64"]; - [fAudioBitratePopUp addItemWithTitle: @"96"]; - [fAudioBitratePopUp addItemWithTitle: @"128"]; - [fAudioBitratePopUp addItemWithTitle: @"160"]; - [fAudioBitratePopUp addItemWithTitle: @"192"]; - [fAudioBitratePopUp addItemWithTitle: @"224"]; - [fAudioBitratePopUp addItemWithTitle: @"256"]; - [fAudioBitratePopUp addItemWithTitle: @"288"]; - [fAudioBitratePopUp addItemWithTitle: @"320"]; - [fAudioBitratePopUp selectItemWithTitle: @"128"]; - - char string[1024]; memset( string, 0, 1024 ); - snprintf( string, 1024, "%s/Desktop/Movie.avi", getenv( "HOME" ) ); - [fFileField setStringValue: [NSString stringWithCString: string]]; + /* Strings for the Scan view */ + [fScWelcomeField setStringValue: _( @"Welcome to HandBrake" )]; + [fScSelectField setStringValue: _( @"Select a DVD:" )]; + [fScDetectedCell setTitle: _( @"Detected volume" )]; + [fScDetectedPopUp removeAllItems]; + [fScFolderCell setTitle: _( @"DVD Folder" )]; + [fScBrowseButton setTitle: _( @"Browse" )]; + [fScStatusField setStringValue: @""]; + [fScOpenButton setTitle: _( @"Open" )]; + + /* Strings for the Rip view */ + /* General box */ + [fRipGeneralField setStringValue: _( @"General" )]; + [fRipTitleField setStringValue: _( @"DVD title" )]; + [fRipTitlePopUp removeAllItems]; + [fRipFormatField setStringValue: _( @"Output format" )]; + [fRipFormatPopUp removeAllItems]; + [fRipFormatPopUp addItemWithTitle: + _( @"MP4 file / MPEG-4 video / AAC audio" )]; + [fRipFormatPopUp addItemWithTitle: + _( @"AVI file / MPEG-4 video / MP3 audio" )]; + [fRipFormatPopUp addItemWithTitle: + _( @"AVI file / H264 video / MP3 audio" )]; + [fRipFormatPopUp addItemWithTitle: + _( @"OGM file / MPEG-4 video / Vorbis audio" )]; + [fRipFileField1 setStringValue: _( @"File" )]; + [fRipFileField2 setStringValue: [NSString stringWithFormat: + @"%@/Desktop/Movie.mp4", NSHomeDirectory()]]; + [fRipBrowseButton setTitle: _( @"Browse" )]; + + /* Video box */ + [fRipVideoField setStringValue: _( @"Video" )]; + [fRipEncoderField setStringValue: _( @"MPEG-4 encoder" )]; + [fRipEncoderPopUp removeAllItems]; + [fRipEncoderPopUp addItemWithTitle: @"FFmpeg"]; + [fRipEncoderPopUp addItemWithTitle: @"XviD"]; + [fRipBitrateField setStringValue: _( @"Bitrate" )]; + [fRipCustomCell setTitle: _( @"Custom (kbps)" )]; + [fRipCustomField setIntValue: 1024]; + [fRipTargetCell setTitle: _( @"Target size (MB)" )]; + [fRipTargetField setIntValue: 700]; + [fRipTwoPassCheck setTitle: _( @"2-pass encoding" )]; + [fRipCropButton setTitle: _( @"Crop & Scale..." )]; + + /* Audio box */ + [fRipAudioField setStringValue: _( @"Audio" )]; + [fRipLang1Field setStringValue: _( @"Language 1" )]; + [fRipLang1PopUp removeAllItems]; + [fRipLang2Field setStringValue: _( @"Language 2 (optional)" )]; + [fRipLang2PopUp removeAllItems]; + [fRipAudBitField setStringValue: _( @"Bitrate (kbps)" )]; + [fRipAudBitPopUp removeAllItems]; + [fRipAudBitPopUp addItemWithTitle: @"32"]; + [fRipAudBitPopUp addItemWithTitle: @"40"]; + [fRipAudBitPopUp addItemWithTitle: @"48"]; + [fRipAudBitPopUp addItemWithTitle: @"56"]; + [fRipAudBitPopUp addItemWithTitle: @"64"]; + [fRipAudBitPopUp addItemWithTitle: @"80"]; + [fRipAudBitPopUp addItemWithTitle: @"96"]; + [fRipAudBitPopUp addItemWithTitle: @"112"]; + [fRipAudBitPopUp addItemWithTitle: @"128"]; + [fRipAudBitPopUp addItemWithTitle: @"160"]; + [fRipAudBitPopUp addItemWithTitle: @"192"]; + [fRipAudBitPopUp addItemWithTitle: @"224"]; + [fRipAudBitPopUp addItemWithTitle: @"256"]; + [fRipAudBitPopUp addItemWithTitle: @"320"]; + [fRipAudBitPopUp selectItemWithTitle: @"128"]; + + /* Bottom */ + [fRipStatusField setStringValue: @""]; + [fRipInfoField setStringValue: @""]; + [fRipPauseButton setTitle: _( @"Pause" )]; + [fRipRipButton setTitle: _( @"Rip" )]; + + /* Strings for the crop panel */ + [fWidthField1 setStringValue: _( @"Picture width" )]; + [fDeinterlaceCheck setTitle: _( @"Deinterlace picture" )]; + [fTopField1 setStringValue: _( @"Top cropping" )]; + [fBottomField1 setStringValue: _( @"Bottom cropping" )]; + [fLeftField1 setStringValue: _( @"Left cropping" )]; + [fRightField1 setStringValue: _( @"Right cropping" )]; + [fPreviousButton setTitle: _( @"Previous" )]; + [fNextButton setTitle: _( @"Next" )]; + [fAutocropButton setTitle: _( @"Autocrop" )]; + [fOpenGLCheck setTitle: _( @"Useless OpenGL effects" )]; + [fInfoField setStringValue: @""]; + [fCloseButton setTitle: _( @"Close" )]; + + [self VideoMatrixChanged: self]; /* Show the scan view */ - [fWindow setContentSize: [fScanView frame].size]; - [fWindow setContentView: fScanView]; + [fWindow setContentSize: [fScView frame].size]; + [fWindow setContentView: fScView]; [fWindow center]; /* Detect DVD drives */ @@ -105,23 +185,30 @@ { if( returnCode == NSOKButton ) { - [fDVDFolderField setStringValue: + [fScFolderField setStringValue: [[sheet filenames] objectAtIndex: 0]]; } } - (IBAction) VideoMatrixChanged: (id) sender; { - if( ![fVideoMatrix selectedRow] ) + if( ![fRipVideoMatrix isEnabled] ) { - [fCustomBitrateField setEnabled: YES]; - [fTargetSizeField setEnabled: NO]; + [fRipCustomField setEnabled: NO]; + [fRipTargetField setEnabled: NO]; + return; + } + + if( ![fRipVideoMatrix selectedRow] ) + { + [fRipCustomField setEnabled: YES]; + [fRipTargetField setEnabled: NO]; } else { - [fCustomBitrateField setEnabled: NO]; - [fTargetSizeField setEnabled: YES]; - [fTargetSizeField UpdateBitrate]; + [fRipCustomField setEnabled: NO]; + [fRipTargetField setEnabled: YES]; + [fRipTargetField UpdateBitrate]; } } @@ -141,35 +228,42 @@ { if( returnCode == NSOKButton ) { - [fFileField setStringValue: [sheet filename]]; + [fRipFileField2 setStringValue: [sheet filename]]; + [self FormatPopUpChanged: self]; } } - (IBAction) Scan: (id) sender { + [fScMatrix setEnabled: NO]; + [fScDetectedPopUp setEnabled: NO]; + [fScFolderField setEnabled: NO]; + [fScBrowseButton setEnabled: NO]; + [fScProgress setIndeterminate: YES]; + [fScProgress startAnimation: self]; + [fScOpenButton setEnabled: NO]; + [fScStatusField setStringValue: _( @"Opening device..." )]; + /* Ask libhb to start scanning the specified volume */ - - if( ![fScanMatrix selectedRow] ) + if( ![fScMatrix selectedRow] ) { /* DVD drive */ - HBScanDevice( fHandle, - (char*) [[fDVDPopUp titleOfSelectedItem] cString], - 0 ); + HBScanDVD( fHandle, + [[fScDetectedPopUp titleOfSelectedItem] cString], 0 ); } else { /* DVD folder */ - HBScanDevice( fHandle, - (char*) [[fDVDFolderField stringValue] cString], - 0 ); + HBScanDVD( fHandle, + [[fScFolderField stringValue] cString], 0 ); } } - (IBAction) ShowPicturePanel: (id) sender { HBTitle * title = (HBTitle*) - HBListItemAt( fTitleList, [fTitlePopUp indexOfSelectedItem] ); - + HBListItemAt( fTitleList, [fRipTitlePopUp indexOfSelectedItem] ); + [fPictureGLView SetTitle: title]; fPicture = 0; @@ -180,7 +274,7 @@ [fWidthStepper setMinValue: 16]; [fWidthStepper setMaxValue: title->outWidthMax]; [fWidthStepper setIntValue: title->outWidth]; - [fWidthField setIntValue: title->outWidth]; + [fWidthField2 setIntValue: title->outWidth]; [fDeinterlaceCheck setState: title->deinterlace ? NSOnState : NSOffState]; [fTopStepper setValueWraps: NO]; @@ -188,40 +282,38 @@ [fTopStepper setMinValue: 0]; [fTopStepper setMaxValue: title->inHeight / 4]; [fTopStepper setIntValue: title->topCrop]; - [fTopField setIntValue: title->topCrop]; + [fTopField2 setIntValue: title->topCrop]; [fBottomStepper setValueWraps: NO]; [fBottomStepper setIncrement: 2]; [fBottomStepper setMinValue: 0]; [fBottomStepper setMaxValue: title->inHeight / 4]; [fBottomStepper setIntValue: title->bottomCrop]; - [fBottomField setIntValue: title->bottomCrop]; + [fBottomField2 setIntValue: title->bottomCrop]; [fLeftStepper setValueWraps: NO]; [fLeftStepper setIncrement: 2]; [fLeftStepper setMinValue: 0]; [fLeftStepper setMaxValue: title->inWidth / 4]; [fLeftStepper setIntValue: title->leftCrop]; - [fLeftField setIntValue: title->leftCrop]; + [fLeftField2 setIntValue: title->leftCrop]; [fRightStepper setValueWraps: NO]; [fRightStepper setIncrement: 2]; [fRightStepper setMinValue: 0]; [fRightStepper setMaxValue: title->inWidth / 4]; [fRightStepper setIntValue: title->rightCrop]; - [fRightField setIntValue: title->rightCrop]; + [fRightField2 setIntValue: title->rightCrop]; [fPreviousButton setEnabled: NO]; [fNextButton setEnabled: YES]; - char string[1024]; memset( string, 0, 1024 ); - sprintf( string, "Final size: %dx%d", - title->outWidth, title->outHeight ); - [fInfoField setStringValue: [NSString stringWithCString: string]]; + [fInfoField setStringValue: [NSString stringWithFormat: + _( @"Final size: %dx%d" ), title->outWidth, title->outHeight] ]; /* Resize the panel */ NSSize newSize; /* XXX */ newSize.width = 762 /*fPicturePanelSize.width*/ + title->outWidthMax - 720; - newSize.height = 740 /*fPicturePanelSize.height*/ + + newSize.height = 755 /*fPicturePanelSize.height*/ + title->outHeightMax - 576; [fPicturePanel setContentSize: newSize]; @@ -240,45 +332,45 @@ - (IBAction) Rip: (id) sender { /* Rip or Cancel ? */ - if( [[fRipButton title] compare: @"Cancel" ] == NSOrderedSame ) + if( [[fRipRipButton title] compare: _( @"Cancel" ) ] + == NSOrderedSame ) { [self Cancel: self]; return; } - - if( [fCustomBitrateField intValue] < 256 ) + + if( [fRipCustomField intValue] < 64 ) { - NSBeginCriticalAlertSheet( @"Invalid video bitrate", @"Ooops", - nil, nil, fWindow, self, nil, nil, nil, - @"Video bitrate is too low !" ); + NSBeginCriticalAlertSheet( _( @"Invalid video bitrate" ), + _( @"Ooops" ), nil, nil, fWindow, self, nil, nil, nil, + _( @"Video bitrate is too low." ) ); return; } - if( [fCustomBitrateField intValue] > 8192 ) + if( [fRipCustomField intValue] > 8192 ) { - NSBeginCriticalAlertSheet( @"Invalid video bitrate", @"Ooops", - nil, nil, fWindow, self, nil, nil, nil, - @"Video bitrate is too high !" ); + NSBeginCriticalAlertSheet( _( @"Invalid video bitrate" ), + _( @"Ooops" ), nil, nil, fWindow, self, nil, nil, nil, + _( @"Video bitrate is too high." ) ); return; } - if( [fLanguagePopUp indexOfSelectedItem] == - [fSecondaryLanguagePopUp indexOfSelectedItem] ) + if( [fRipLang1PopUp indexOfSelectedItem] == + [fRipLang2PopUp indexOfSelectedItem] ) { - NSBeginCriticalAlertSheet( @"Invalid secondary language", - @"Ooops", nil, nil, fWindow, self, nil, nil, nil, - @"Do you _really_ want to encode the same audio track twice?" ); + NSBeginCriticalAlertSheet( _( @"Invalid secondary language" ), + _( @"Ooops" ), nil, nil, fWindow, self, nil, nil, nil, + _( @"You can't encode the same audio track twice." ) ); return; } - FILE * file; - if( ( file = fopen( [[fFileField stringValue] cString], "r" ) ) ) + if( [[NSFileManager defaultManager] fileExistsAtPath: + [fRipFileField2 stringValue]] ) { - fclose( file ); - NSBeginCriticalAlertSheet( @"File already exists", - @"Nooo!", @"Yes, go ahead", nil, fWindow, self, + NSBeginCriticalAlertSheet( _( @"File already exists" ), + _( @"No" ), _( @"Yes" ), nil, fWindow, self, @selector( OverwriteAlertDone:returnCode:contextInfo: ), - nil, nil, - [NSString stringWithFormat: @"Do you want to overwrite %s?", - [[fFileField stringValue] cString]] ); + nil, nil, [NSString stringWithFormat: + _( @"Do you want to overwrite %@?" ), + [fRipFileField2 stringValue]] ); return; } @@ -297,40 +389,68 @@ - (void) _Rip { /* Get the specified title & audio track(s) */ - HBTitle * title = (HBTitle*) - HBListItemAt( fTitleList, [fTitlePopUp indexOfSelectedItem] ); - HBAudio * audio1 = (HBAudio*) - HBListItemAt( title->audioList, - [fLanguagePopUp indexOfSelectedItem] ); - HBAudio * audio2 = (HBAudio*) - HBListItemAt( title->audioList, - [fSecondaryLanguagePopUp indexOfSelectedItem] ); + HBTitle * title = (HBTitle*) HBListItemAt( fTitleList, + [fRipTitlePopUp indexOfSelectedItem] ); + HBAudio * audio1 = (HBAudio*) HBListItemAt( title->audioList, + [fRipLang1PopUp indexOfSelectedItem] ); + HBAudio * audio2 = (HBAudio*) HBListItemAt( title->audioList, + [fRipLang2PopUp indexOfSelectedItem] ); /* Use user settings */ - title->file = strdup( [[fFileField stringValue] cString] ); - title->bitrate = [fCustomBitrateField intValue]; - title->twoPass = ( [fTwoPassCheck state] == NSOnState ); - title->codec = ( [[fVideoCodecPopUp titleOfSelectedItem] compare: - @"MPEG-4 (Ffmpeg)"] == NSOrderedSame ) ? - HB_CODEC_FFMPEG : HB_CODEC_XVID; - audio1->outBitrate = [[fAudioBitratePopUp titleOfSelectedItem] + title->file = strdup( [[fRipFileField2 stringValue] cString] ); + title->bitrate = [fRipCustomField intValue]; + title->twoPass = ( [fRipTwoPassCheck state] == NSOnState ); + + int format = [fRipFormatPopUp indexOfSelectedItem]; + int codec = [fRipEncoderPopUp indexOfSelectedItem]; + title->mux = ( !format ) ? HB_MUX_MP4 : ( ( format == 3 ) ? + HB_MUX_OGM : HB_MUX_AVI ); + title->codec = ( format == 2 ) ? HB_CODEC_X264 : ( ( !codec ) ? + HB_CODEC_FFMPEG : HB_CODEC_XVID ); + + audio1->outBitrate = [[fRipAudBitPopUp titleOfSelectedItem] intValue]; + audio1->codec = ( !format ) ? HB_CODEC_AAC : ( ( format == 3 ) ? + HB_CODEC_VORBIS : HB_CODEC_MP3 );; + HBListAdd( title->ripAudioList, audio1 ); if( audio2 ) { - audio2->outBitrate = - [[fAudioBitratePopUp titleOfSelectedItem] intValue]; + audio2->outBitrate = [[fRipAudBitPopUp + titleOfSelectedItem] intValue]; + audio2->codec = ( !format ) ? HB_CODEC_AAC : ( ( format == 3 ) ? + HB_CODEC_VORBIS : HB_CODEC_MP3 ); + HBListAdd( title->ripAudioList, audio2 ); } + /* Disable interface */ + [fRipTitlePopUp setEnabled: NO]; + [fRipFormatPopUp setEnabled: NO]; + [fRipVideoMatrix setEnabled: NO]; + [fRipCustomField setEnabled: NO]; + [fRipTargetField setEnabled: NO]; + [fRipTwoPassCheck setEnabled: NO]; + [fRipCropButton setEnabled: NO]; + [fRipLang1PopUp setEnabled: NO]; + [fRipLang2PopUp setEnabled: NO]; + [fRipAudBitPopUp setEnabled: NO]; + [fRipFileField2 setEnabled: NO]; + [fRipEncoderPopUp setEnabled: NO]; + [fRipBrowseButton setEnabled: NO]; + [fRipPauseButton setEnabled: YES]; + [fRipRipButton setTitle: _( @"Cancel" )]; + [fRipProgress setIndeterminate: YES]; + [fRipProgress startAnimation: self];; + /* Let libhb do the job */ - HBStartRip( fHandle, title, audio1, audio2 ); + HBStartRip( fHandle, title ); } - (IBAction) Cancel: (id) sender { - NSBeginCriticalAlertSheet( @"Cancel - Are you sure?", - @"Nooo, keep going!", @"Yep, stop it", nil, fWindow, self, - @selector( _Cancel:returnCode:contextInfo: ), - nil, nil, @"Encoding won't be recoverable." ); + NSBeginCriticalAlertSheet( _( @"Cancel - Are you sure?" ), + _( @"No" ), _( @"Yes" ), nil, fWindow, self, + @selector( _Cancel:returnCode:contextInfo: ), nil, nil, + _( @"Encoding won't be recoverable." ) ); } - (void) _Cancel: (NSWindow *) sheet @@ -338,23 +458,31 @@ { if( returnCode == NSAlertAlternateReturn ) { + if( [[fRipPauseButton title] compare: _( @"Resume" ) ] + == NSOrderedSame ) + { + HBResumeRip( fHandle ); + } HBStopRip( fHandle ); } } - (IBAction) Pause: (id) sender { - if( [[fPauseButton title] compare: @"Resume" ] == NSOrderedSame ) + if( [[fRipPauseButton title] compare: _( @"Resume" ) ] + == NSOrderedSame ) { [self Resume: self]; return; } + [fRipPauseButton setTitle: _( @"Resume" )]; HBPauseRip( fHandle ); } - (IBAction) Resume: (id) sender { + [fRipPauseButton setTitle: _( @"Pause" )]; HBResumeRip( fHandle ); } @@ -397,7 +525,7 @@ - (IBAction) UpdatePicture: (id) sender { HBTitle * title = (HBTitle*) - HBListItemAt( fTitleList, [fTitlePopUp indexOfSelectedItem] ); + HBListItemAt( fTitleList, [fRipTitlePopUp indexOfSelectedItem] ); title->outWidth = [fWidthStepper intValue]; title->deinterlace = ( [fDeinterlaceCheck state] == NSOnState ); title->topCrop = [fTopStepper intValue]; @@ -412,298 +540,40 @@ [fBottomStepper setIntValue: title->bottomCrop]; [fLeftStepper setIntValue: title->leftCrop]; [fRightStepper setIntValue: title->rightCrop]; - [fWidthField setIntValue: [fWidthStepper intValue]]; - [fTopField setIntValue: [fTopStepper intValue]]; - [fBottomField setIntValue: [fBottomStepper intValue]]; - [fLeftField setIntValue: [fLeftStepper intValue]]; - [fRightField setIntValue: [fRightStepper intValue]]; - - char string[1024]; memset( string, 0, 1024 ); - sprintf( string, "Final size: %dx%d", - title->outWidth, title->outHeight ); - [fInfoField setStringValue: [NSString stringWithCString: string]]; + [fWidthField2 setIntValue: [fWidthStepper intValue]]; + [fTopField2 setIntValue: [fTopStepper intValue]]; + [fBottomField2 setIntValue: [fBottomStepper intValue]]; + [fLeftField2 setIntValue: [fLeftStepper intValue]]; + [fRightField2 setIntValue: [fRightStepper intValue]]; + + [fInfoField setStringValue: [NSString stringWithFormat: + _( @"Final size: %dx%d" ), title->outWidth, title->outHeight]]; } -- (void) UpdateIntf: (NSTimer *) timer +- (IBAction) AutoCrop: (id) sender { - if( fDie ) - { - [timer invalidate]; - return; - } - - int modeChanged; - HBStatus status; - - modeChanged = HBGetStatus( fHandle, &status ); - - switch( status.mode ) - { - case HB_MODE_NEED_DEVICE: - break; - - case HB_MODE_SCANNING: - { - if( modeChanged ) - { - [fScanMatrix setEnabled: NO]; - [fDVDPopUp setEnabled: NO]; - [fDVDFolderField setEnabled: NO]; - [fScanBrowseButton setEnabled: NO]; - [fScanProgress startAnimation: self]; - [fScanButton setEnabled: NO]; - } - - char string[1024]; memset( string, 0, 1024 ); - if( status.scannedTitle ) - { - sprintf( string, "Scanning title %d...", - status.scannedTitle ); - } - else - { - sprintf( string, "Opening device..." ); - } - [fScanStatusField setStringValue: - [NSString stringWithCString: string]]; - - break; - } - - case HB_MODE_INVALID_DEVICE: - { - if( !modeChanged ) - break; - - [fScanMatrix setEnabled: YES]; - [self ScanMatrixChanged: self]; - [fScanProgress stopAnimation: self]; - [fScanButton setEnabled: YES]; - - [fScanStatusField setStringValue: - @"Invalid volume, try again" ]; - break; - } - - case HB_MODE_READY_TO_RIP: - { - if( !modeChanged ) - break; - - fTitleList = status.titleList; - - /* Show a temporary empty view while the window - resizing animation */ - [fWindow setContentView: fTempView ]; - - /* Actually resize it */ - NSRect newFrame; - newFrame = [NSWindow contentRectForFrameRect: [fWindow frame] - styleMask: [fWindow styleMask]]; - newFrame.origin.y += newFrame.size.height - - [fRipView frame].size.height; - newFrame.size.height = [fRipView frame].size.height; - newFrame.size.width = [fRipView frame].size.width; - newFrame = [NSWindow frameRectForContentRect: newFrame - styleMask: [fWindow styleMask]]; - [fWindow setFrame: newFrame display: YES animate: YES]; - - /* Show the new GUI */ - [fWindow setContentView: fRipView ]; - [fPauseButton setEnabled: NO]; - - [fTitlePopUp removeAllItems]; - HBTitle * title; - for( int i = 0; i < HBListCountItems( fTitleList ); i++ ) - { - title = (HBTitle*) HBListItemAt( fTitleList, i ); - char string[1024]; memset( string, 0, 1024 ); - sprintf( string, "%d - %02dh%02dm%02ds", - title->index, title->length / 3600, - ( title->length % 3600 ) / 60, - title->length % 60 ); - [[fTitlePopUp menu] addItemWithTitle: - [NSString stringWithCString: string] - action: nil keyEquivalent: @""]; - } - [self TitlePopUpChanged: self]; - - break; - } - - case HB_MODE_ENCODING: - { - if( modeChanged ) - { - [fTitlePopUp setEnabled: NO]; - [fVideoCodecPopUp setEnabled: NO]; - [fVideoMatrix setEnabled: NO]; - [fCustomBitrateField setEnabled: NO]; - [fTargetSizeField setEnabled: NO]; - [fTwoPassCheck setEnabled: NO]; - [fCropButton setEnabled: NO]; - [fLanguagePopUp setEnabled: NO]; - [fSecondaryLanguagePopUp setEnabled: NO]; - [fAudioCodecPopUp setEnabled: NO]; - [fAudioBitratePopUp setEnabled: NO]; - [fFileFormatPopUp setEnabled: NO]; - [fFileField setEnabled: NO]; - [fFileBrowseButton setEnabled: NO]; - [fPauseButton setEnabled: YES]; - [fPauseButton setTitle: @"Pause"]; - [fRipButton setTitle: @"Cancel"]; - } - - if( !status.position ) - { - [fRipStatusField setStringValue: @"Starting..."]; - [fRipProgress setIndeterminate: YES]; - [fRipProgress startAnimation: self];; - } - else - { - char string[1024]; - memset( string, 0, 1024 ); - sprintf( string, "Encoding: %.2f %% (pass %d of %d)", - 100 * status.position, status.pass, - status.passCount ); - [fRipStatusField setStringValue: - [NSString stringWithCString: string]]; - memset( string, 0, 1024 ); - sprintf( string, "Speed: %.2f fps (avg %.2f fps, " - "%02dh%02dm%02ds remaining)", - status.frameRate, status.avFrameRate, - status.remainingTime / 3600, - ( status.remainingTime / 60 ) % 60, - status.remainingTime % 60 ); - [fRipInfoField setStringValue: - [NSString stringWithCString: string]]; - - [fRipProgress setIndeterminate: NO]; - [fRipProgress setDoubleValue: 100 * status.position]; - } - - break; - } - - case HB_MODE_PAUSED: - { - if( !modeChanged ) - break; - - char string[1024]; memset( string, 0, 1024 ); - sprintf( string, "Encoding: %.2f %% (PAUSED)", - 100 * status.position ) ; - [fRipStatusField setStringValue: - [NSString stringWithCString: string]]; - [fRipInfoField setStringValue: @""]; - - [fRipProgress setDoubleValue: 100 * status.position]; - - [fPauseButton setTitle: @"Resume"]; - break; - } - - case HB_MODE_STOPPING: - if( !modeChanged ) - break; - - [fRipStatusField setStringValue: @"Stopping..."]; - [fRipInfoField setStringValue: @""]; - [fRipProgress setIndeterminate: YES]; - [fRipProgress startAnimation: self];; - break; - - case HB_MODE_DONE: - case HB_MODE_CANCELED: - case HB_MODE_ERROR: - if( !modeChanged ) - break; - - /* Warn the finder to update itself */ - [[NSWorkspace sharedWorkspace] noteFileSystemChanged: - [fFileField stringValue]]; - - [fRipProgress setIndeterminate: NO]; - [fRipInfoField setStringValue: @""]; - - if( status.mode == HB_MODE_DONE ) - { - [fRipProgress setDoubleValue: 100]; - [fRipStatusField setStringValue: @"Done." ]; - NSBeep(); - [NSApp requestUserAttention: NSInformationalRequest]; - [NSApp beginSheet: fDonePanel - modalForWindow: fWindow modalDelegate: nil - didEndSelector: nil contextInfo: nil]; - [NSApp runModalForWindow: fDonePanel]; - [NSApp endSheet: fDonePanel]; - [fDonePanel orderOut: self]; - } - else if( status.mode == HB_MODE_CANCELED ) - { - [fRipProgress setDoubleValue: 0]; - [fRipStatusField setStringValue: @"Canceled." ]; - } - else - { - [fRipProgress setDoubleValue: 0]; - switch( status.error ) - { - case HB_ERROR_A52_SYNC: - [fRipStatusField setStringValue: - @"An error occured (corrupted AC3 data)." ]; - break; - case HB_ERROR_AVI_WRITE: - [fRipStatusField setStringValue: - @"An error occured (could not write to file)." ]; - break; - case HB_ERROR_DVD_OPEN: - [fRipStatusField setStringValue: - @"An error occured (could not open device)." ]; - break; - case HB_ERROR_DVD_READ: - [fRipStatusField setStringValue: - @"An error occured (DVD read failed)." ]; - break; - case HB_ERROR_MP3_INIT: - [fRipStatusField setStringValue: - @"An error occured (could not init MP3 encoder)." ]; - break; - case HB_ERROR_MP3_ENCODE: - [fRipStatusField setStringValue: - @"An error occured (MP3 encoder failed)." ]; - break; - case HB_ERROR_MPEG4_INIT: - [fRipStatusField setStringValue: - @"An error occured (could not init MPEG4 encoder)." ]; - break; - } - } - - [fTitlePopUp setEnabled: YES]; - [fVideoCodecPopUp setEnabled: YES]; - [fVideoMatrix setEnabled: YES]; - [fTwoPassCheck setEnabled: YES]; - [fCropButton setEnabled: YES]; - [fLanguagePopUp setEnabled: YES]; - [fSecondaryLanguagePopUp setEnabled: YES]; - [fAudioCodecPopUp setEnabled: YES]; - [fAudioBitratePopUp setEnabled: YES]; - [fFileFormatPopUp setEnabled: YES]; - [fFileField setEnabled: YES]; - [fFileBrowseButton setEnabled: YES]; - [fPauseButton setEnabled: NO]; - [fPauseButton setTitle: @"Pause"]; - [fRipButton setTitle: @"Rip"]; - - [self VideoMatrixChanged: self]; + HBTitle * title = (HBTitle*) + HBListItemAt( fTitleList, [fRipTitlePopUp indexOfSelectedItem] ); + title->topCrop = title->autoTopCrop; + title->bottomCrop = title->autoBottomCrop; + title->leftCrop = title->autoLeftCrop; + title->rightCrop = title->autoRightCrop; - break; + [fPictureGLView ShowPicture: fPicture animate: HB_ANIMATE_NONE]; - default: - break; - } + [fWidthStepper setIntValue: title->outWidth]; + [fTopStepper setIntValue: title->topCrop]; + [fBottomStepper setIntValue: title->bottomCrop]; + [fLeftStepper setIntValue: title->leftCrop]; + [fRightStepper setIntValue: title->rightCrop]; + [fWidthField2 setIntValue: [fWidthStepper intValue]]; + [fTopField2 setIntValue: [fTopStepper intValue]]; + [fBottomField2 setIntValue: [fBottomStepper intValue]]; + [fLeftField2 setIntValue: [fLeftStepper intValue]]; + [fRightField2 setIntValue: [fRightStepper intValue]]; + + [fInfoField setStringValue: [NSString stringWithFormat: + _( @"Final size: %dx%d" ), title->outWidth, title->outHeight]]; } - (void) DetectDrives: (NSNotification *) notification @@ -781,10 +651,10 @@ IOObjectRelease( media_iterator ); - [fDVDPopUp removeAllItems]; + [fScDetectedPopUp removeAllItems]; for( unsigned i = 0; i < [drivesList count]; i++ ) { - [[fDVDPopUp menu] addItemWithTitle: + [[fScDetectedPopUp menu] addItemWithTitle: [drivesList objectAtIndex: i] action: nil keyEquivalent: @""]; } @@ -793,61 +663,297 @@ - (IBAction) ScanMatrixChanged: (id) sender { - if( ![fScanMatrix selectedRow] ) + if( ![fScMatrix selectedRow] ) { - [fDVDPopUp setEnabled: YES]; - [fDVDFolderField setEnabled: NO]; - [fScanBrowseButton setEnabled: NO]; - [fScanButton setEnabled: ( [fDVDPopUp selectedItem] != nil )]; + [fScDetectedPopUp setEnabled: YES]; + [fScFolderField setEnabled: NO]; + [fScBrowseButton setEnabled: NO]; + [fScOpenButton setEnabled: ( [fScDetectedPopUp selectedItem] != nil )]; } else { - [fDVDPopUp setEnabled: NO]; - [fDVDFolderField setEnabled: YES]; - [fScanBrowseButton setEnabled: YES]; - [fScanButton setEnabled: YES]; + [fScDetectedPopUp setEnabled: NO]; + [fScFolderField setEnabled: YES]; + [fScBrowseButton setEnabled: YES]; + [fScOpenButton setEnabled: YES]; } } - (IBAction) TitlePopUpChanged: (id) sender { HBTitle * title = (HBTitle*) - HBListItemAt( fTitleList, [fTitlePopUp indexOfSelectedItem] ); + HBListItemAt( fTitleList, [fRipTitlePopUp indexOfSelectedItem] ); + + [fRipLang1PopUp removeAllItems]; + [fRipLang2PopUp removeAllItems]; - [fLanguagePopUp removeAllItems]; - [fSecondaryLanguagePopUp removeAllItems]; - HBAudio * audio; - for( int i = 0; i < HBListCountItems( title->audioList ); i++ ) + for( int i = 0; i < HBListCount( title->audioList ); i++ ) { audio = (HBAudio*) HBListItemAt( title->audioList, i ); /* We cannot use NSPopUpButton's addItemWithTitle because it checks for duplicate entries */ - [[fLanguagePopUp menu] addItemWithTitle: + [[fRipLang1PopUp menu] addItemWithTitle: [NSString stringWithCString: audio->language] action: nil keyEquivalent: @""]; - [[fSecondaryLanguagePopUp menu] addItemWithTitle: + [[fRipLang2PopUp menu] addItemWithTitle: [NSString stringWithCString: audio->language] action: nil keyEquivalent: @""]; } - [fSecondaryLanguagePopUp addItemWithTitle: @"None"]; - [fSecondaryLanguagePopUp selectItemWithTitle: @"None"]; - [fSecondaryLanguagePopUp setEnabled: - ( HBListCountItems( title->audioList ) > 1 )]; + [fRipLang2PopUp addItemWithTitle: _( @"None" )]; + [fRipLang2PopUp selectItemWithTitle: _( @"None" )]; + [fRipLang2PopUp setEnabled: + ( HBListCount( title->audioList ) > 1 )]; - [fTargetSizeField SetHBTitle: title]; - if( [fVideoMatrix selectedRow] ) + [fRipTargetField SetHBTitle: title]; + if( [fRipVideoMatrix selectedRow] ) { - [fTargetSizeField UpdateBitrate]; + [fRipTargetField UpdateBitrate]; } } +- (IBAction) FormatPopUpChanged: (id) sender +{ + /* Headers size changes depending on the format, so let's + recalculate the bitrate if necessary */ + if( [fRipVideoMatrix selectedRow] ) + { + [fRipTargetField UpdateBitrate]; + } + + /* Add/replace to the correct extension */ + NSString * string = [fRipFileField2 stringValue]; + int format = [fRipFormatPopUp indexOfSelectedItem]; + if( [string characterAtIndex: [string length] - 4] == '.' ) + { + [fRipFileField2 setStringValue: [NSString stringWithFormat: + @"%@.%s", [string substringToIndex: [string length] - 4], + ( !format ) ? "mp4" : ( ( format == 3 ) ? + "ogm" : "avi" )]]; + } + else + { + [fRipFileField2 setStringValue: [NSString stringWithFormat: + @"%@.%s", string, ( !format ) ? "mp4" : + ( ( format == 3 ) ? "ogm" : "avi" )]]; + } + + if( format == 2 ) + { + /* Can't set X264 bitrate */ + [fRipEncoderPopUp setEnabled: NO]; + [fRipVideoMatrix setEnabled: NO]; + [fRipTwoPassCheck setEnabled: NO]; + + [fRipAudBitPopUp setEnabled: YES]; + } + else if( format == 3 ) + { + [fRipEncoderPopUp setEnabled: YES]; + [fRipVideoMatrix setEnabled: YES]; + [fRipTwoPassCheck setEnabled: YES]; + + /* Can't set Vorbis bitrate */ + [fRipAudBitPopUp setEnabled: NO]; + } + else + { + [fRipEncoderPopUp setEnabled: YES]; + [fRipVideoMatrix setEnabled: YES]; + [fRipTwoPassCheck setEnabled: YES]; + [fRipAudBitPopUp setEnabled: YES]; + } + [self VideoMatrixChanged: self]; +} + - (IBAction) AudioPopUpChanged: (id) sender { - if( [fVideoMatrix selectedRow] ) + /* Recalculate the bitrate */ + if( [fRipVideoMatrix selectedRow] ) + { + [fRipTargetField UpdateBitrate]; + } +} + +/******************* + * libhb callbacks * + *******************/ +static void _Scanning( void * data, int title, int titleCount ) +{ + HBController * controller = (HBController*) data; + controller->fTitle = title; + controller->fTitleCount = titleCount; + [controller performSelectorOnMainThread: @selector(Scanning:) + withObject: nil waitUntilDone: YES]; +} +- (void) Scanning: (id) sender +{ + [fScProgress stopAnimation: self]; + [fScProgress setIndeterminate: NO]; + [fScProgress setDoubleValue: 100.0 * fTitle / fTitleCount]; + + [fScStatusField setStringValue: [NSString stringWithFormat: + _( @"Scanning title %d of %d..." ), fTitle, fTitleCount]]; +} + +static void _ScanDone( void * data, HBList * titleList ) +{ + HBController * controller = (HBController*) data; + controller->fTitleList = titleList; + [controller performSelectorOnMainThread: @selector(ScanDone:) + withObject: nil waitUntilDone: YES]; +} +- (void) ScanDone: (id) sender +{ + if( !fTitleList ) { - [fTargetSizeField UpdateBitrate]; + [fScMatrix setEnabled: YES]; + [self ScanMatrixChanged: self]; + [fScProgress stopAnimation: self]; + [fScProgress setIndeterminate: NO]; + [fScOpenButton setEnabled: YES]; + [fScStatusField setStringValue: + _( @"Invalid volume, try again" ) ]; + return; + } + + /* Show a temporary empty view while the window + resizing animation */ + [fWindow setContentView: fTempView ]; + + /* Actually resize it */ + NSRect newFrame; + newFrame = [NSWindow contentRectForFrameRect: [fWindow frame] + styleMask: [fWindow styleMask]]; + newFrame.origin.y += newFrame.size.height - + [fRipView frame].size.height; + newFrame.size.height = [fRipView frame].size.height; + newFrame.size.width = [fRipView frame].size.width; + newFrame = [NSWindow frameRectForContentRect: newFrame + styleMask: [fWindow styleMask]]; + [fWindow setFrame: newFrame display: YES animate: YES]; + + /* Show the new GUI */ + [fWindow setContentView: fRipView ]; + [fRipPauseButton setEnabled: NO]; + + [fRipTitlePopUp removeAllItems]; + HBTitle * title; + for( int i = 0; i < HBListCount( fTitleList ); i++ ) + { + title = (HBTitle*) HBListItemAt( fTitleList, i ); + [[fRipTitlePopUp menu] addItemWithTitle: + [NSString stringWithFormat: @"%d - %02dh%02dm%02ds", + title->index, title->length / 3600, ( title->length % 3600 ) + / 60, title->length % 60] action: nil keyEquivalent: @""]; + } + [self TitlePopUpChanged: self]; +} + +static void _Encoding( void * data, float position, int pass, + int passCount, float curFrameRate, + float avgFrameRate, int remainingTime ) +{ + HBController * controller = (HBController*) data; + controller->fPosition = position; + controller->fPass = pass; + controller->fPassCount = passCount; + controller->fCurFrameRate = curFrameRate; + controller->fAvgFrameRate = avgFrameRate; + controller->fRemainingTime = remainingTime; + [controller performSelectorOnMainThread: @selector(Encoding:) + withObject: nil waitUntilDone: YES]; +} +- (void) Encoding: (id) sender +{ + [fRipStatusField setStringValue: [NSString stringWithFormat: + _( @"Encoding: %.2f %% (pass %d of %d)" ), + 100.0 * fPosition, fPass, fPassCount]]; + [fRipInfoField setStringValue: [NSString stringWithFormat: + _( @"Speed: %.2f fps (avg %.2f fps), %02dh%02dm%02ds remaining" ), + fCurFrameRate, fAvgFrameRate, fRemainingTime / 3600, + ( fRemainingTime / 60 ) % 60, fRemainingTime % 60]]; + + [fRipProgress setIndeterminate: NO]; + [fRipProgress setDoubleValue: 100.0 * fPosition]; +} + +static void _RipDone( void * data, int result ) +{ + HBController * controller = (HBController*) data; + controller->fResult = result; + [controller performSelectorOnMainThread: @selector(RipDone:) + withObject: nil waitUntilDone: YES]; +} +- (void) RipDone: (id) sender +{ + [fRipTitlePopUp setEnabled: YES]; + [fRipFormatPopUp setEnabled: YES]; + [fRipVideoMatrix setEnabled: YES]; + [fRipTwoPassCheck setEnabled: YES]; + [fRipCropButton setEnabled: YES]; + [fRipLang1PopUp setEnabled: YES]; + [fRipLang2PopUp setEnabled: YES]; + [fRipAudBitPopUp setEnabled: YES]; + [fRipFileField2 setEnabled: YES]; + [fRipBrowseButton setEnabled: YES]; + [fRipEncoderPopUp setEnabled: YES]; + [fRipPauseButton setEnabled: NO]; + [fRipPauseButton setTitle: _( @"Pause" )]; + [fRipRipButton setTitle: _( @"Rip" )]; + [fRipProgress setIndeterminate: NO]; + [fRipProgress setDoubleValue: 0.0]; + [self VideoMatrixChanged: self]; + + switch( fResult ) + { + case HB_SUCCESS: + [fRipStatusField setStringValue: _( @"Rip completed." )]; + [fRipInfoField setStringValue: @""]; + NSBeep(); + [NSApp requestUserAttention: NSInformationalRequest]; + [NSApp beginSheet: fDonePanel + modalForWindow: fWindow modalDelegate: nil + didEndSelector: nil contextInfo: nil]; + [NSApp runModalForWindow: fDonePanel]; + [NSApp endSheet: fDonePanel]; + [fDonePanel orderOut: self]; + break; + case HB_CANCELED: + [fRipStatusField setStringValue: _( @"Canceled." )]; + [fRipInfoField setStringValue: @""]; + break; + case HB_ERROR_A52_SYNC: + [fRipStatusField setStringValue: @"Error."]; + [fRipInfoField setStringValue: @"Corrupted AC3 data"]; + break; + case HB_ERROR_AVI_WRITE: + [fRipStatusField setStringValue: @"Error."]; + [fRipInfoField setStringValue: @"Write error"]; + break; + case HB_ERROR_DVD_OPEN: + [fRipStatusField setStringValue: @"Error."]; + [fRipInfoField setStringValue: @"Could not open the DVD"]; + break; + case HB_ERROR_DVD_READ: + [fRipStatusField setStringValue: @"Error."]; + [fRipInfoField setStringValue: @"DVD read error"]; + break; + case HB_ERROR_MP3_INIT: + [fRipStatusField setStringValue: @"Error."]; + [fRipInfoField setStringValue: + @"MP3 encoder initialization failed"]; + break; + case HB_ERROR_MP3_ENCODE: + [fRipStatusField setStringValue: @"Error."]; + [fRipInfoField setStringValue: @"MP3 encoder failed"]; + break; + case HB_ERROR_MPEG4_INIT: + [fRipStatusField setStringValue: @"Error."]; + [fRipInfoField setStringValue: + @"MPEG4 encoder initialization failed"]; + break; } } diff --git a/macosx/English.lproj/InfoPlist.strings b/macosx/English.lproj/InfoPlist.strings Binary files differindex ce3b28a62..714d974fa 100644 --- a/macosx/English.lproj/InfoPlist.strings +++ b/macosx/English.lproj/InfoPlist.strings diff --git a/macosx/English.lproj/MainMenu.nib/classes.nib b/macosx/English.lproj/MainMenu.nib/classes.nib index 161d51070..b77248ae6 100644 --- a/macosx/English.lproj/MainMenu.nib/classes.nib +++ b/macosx/English.lproj/MainMenu.nib/classes.nib @@ -4,17 +4,23 @@ { ACTIONS = { AudioPopUpChanged = id; + AutoCrop = id; BrowseDVD = id; BrowseFile = id; Cancel = id; ClosePanel = id; + Encoding = id; + FormatPopUpChanged = id; NextPicture = id; Pause = id; PreviousPicture = id; Resume = id; Rip = id; + RipDone = id; Scan = id; + ScanDone = id; ScanMatrixChanged = id; + Scanning = id; ShowPicturePanel = id; TitlePopUpChanged = id; UpdatePicture = id; @@ -23,52 +29,75 @@ CLASS = HBController; LANGUAGE = ObjC; OUTLETS = { - fAudioBitratePopUp = NSPopUpButton; - fAudioCodecPopUp = NSPopUpButton; - fBottomField = NSTextField; + fAutocropButton = NSButton; + fBottomField1 = NSTextField; + fBottomField2 = NSTextField; fBottomStepper = NSStepper; - fCropButton = NSButton; - fCustomBitrateField = NSTextField; - fDVDFolderField = NSTextField; - fDVDPopUp = NSPopUpButton; + fCloseButton = NSButton; fDeinterlaceCheck = NSButton; fDonePanel = NSPanel; - fFileBrowseButton = NSButton; - fFileField = NSTextField; - fFileFormatPopUp = NSPopUpButton; fInfoField = NSTextField; - fLanguagePopUp = NSPopUpButton; - fLeftField = NSTextField; + fLeftField1 = NSTextField; + fLeftField2 = NSTextField; fLeftStepper = NSStepper; fNextButton = NSButton; fOpenGLCheck = NSButton; - fPauseButton = NSButton; fPictureGLView = HBPictureGLView; fPicturePanel = NSPanel; fPreviousButton = NSButton; - fRightField = NSTextField; + fRightField1 = NSTextField; + fRightField2 = NSTextField; fRightStepper = NSStepper; - fRipButton = NSButton; + fRipAudBitField = NSTextField; + fRipAudBitPopUp = NSPopUpButton; + fRipAudioField = NSTextField; + fRipBitrateField = NSTextField; + fRipBrowseButton = NSButton; + fRipCropButton = NSButton; + fRipCustomCell = NSButtonCell; + fRipCustomField = NSTextField; + fRipEncoderField = NSTextField; + fRipEncoderPopUp = NSPopUpButton; + fRipFileField1 = NSTextField; + fRipFileField2 = NSTextField; + fRipFormatField = NSTextField; + fRipFormatPopUp = NSPopUpButton; + fRipGeneralField = NSTextField; fRipInfoField = NSTextField; + fRipLang1Field = NSTextField; + fRipLang1PopUp = NSPopUpButton; + fRipLang2Field = NSTextField; + fRipLang2PopUp = NSPopUpButton; + fRipPauseButton = NSButton; fRipProgress = NSProgressIndicator; + fRipRipButton = NSButton; fRipStatusField = NSTextField; + fRipTargetCell = NSButtonCell; + fRipTargetField = HBTargetSizeField; + fRipTitleField = NSTextField; + fRipTitlePopUp = NSPopUpButton; + fRipTwoPassCheck = NSButton; + fRipVideoField = NSTextField; + fRipVideoMatrix = NSMatrix; fRipView = NSView; - fScanBrowseButton = NSButton; - fScanButton = NSButton; - fScanMatrix = NSMatrix; - fScanProgress = NSProgressIndicator; - fScanStatusField = NSTextField; - fScanView = NSView; - fSecondaryLanguagePopUp = NSPopUpButton; - fTargetSizeField = HBTargetSizeField; + fScBrowseButton = NSButton; + fScDetectedCell = NSButtonCell; + fScDetectedPopUp = NSPopUpButton; + fScFolderCell = NSButtonCell; + fScFolderField = NSTextField; + fScMatrix = NSMatrix; + fScOpenButton = NSButton; + fScProgress = NSProgressIndicator; + fScSelectField = NSTextField; + fScStatusField = NSTextField; + fScView = NSView; + fScWelcomeField = NSTextField; fTempView = NSView; - fTitlePopUp = NSPopUpButton; - fTopField = NSTextField; + fTopField1 = NSTextField; + fTopField2 = NSTextField; fTopStepper = NSStepper; - fTwoPassCheck = NSButton; - fVideoCodecPopUp = NSPopUpButton; - fVideoMatrix = NSMatrix; - fWidthField = NSTextField; + fWidthField1 = NSTextField; + fWidthField2 = NSTextField; fWidthStepper = NSStepper; fWindow = NSWindow; }; @@ -79,9 +108,10 @@ CLASS = HBTargetSizeField; LANGUAGE = ObjC; OUTLETS = { - fAudioBitratePopUp = NSPopUpButton; - fBitrateField = NSTextField; - fSecondaryLanguagePopUp = NSPopUpButton; + fRipAudBitPopUp = NSPopUpButton; + fRipCustomField = NSTextField; + fRipFormatPopUp = NSPopUpButton; + fRipLang2PopUp = NSPopUpButton; }; SUPERCLASS = NSTextField; }, diff --git a/macosx/English.lproj/MainMenu.nib/info.nib b/macosx/English.lproj/MainMenu.nib/info.nib index a4c078c28..80f27b803 100644 --- a/macosx/English.lproj/MainMenu.nib/info.nib +++ b/macosx/English.lproj/MainMenu.nib/info.nib @@ -3,31 +3,31 @@ <plist version="1.0"> <dict> <key>IBDocumentLocation</key> - <string>25 188 381 380 0 0 1440 878 </string> + <string>43 111 381 380 0 0 1440 878 </string> <key>IBEditorPositions</key> <dict> <key>29</key> - <string>407 469 205 44 0 0 1440 878 </string> + <string>297 654 165 44 0 0 1440 878 </string> <key>556</key> - <string>510 481 420 244 0 0 1440 878 </string> + <string>513 432 417 306 0 0 1440 878 </string> <key>583</key> - <string>648 517 144 171 0 0 1440 878 </string> - <key>589</key> - <string>510 282 420 586 0 0 1440 878 </string> + <string>573 493 144 171 0 0 1440 878 </string> + <key>689</key> + <string>513 258 418 610 0 0 1440 878 </string> </dict> <key>IBFramework Version</key> <string>349.0</string> <key>IBOpenObjects</key> <array> - <integer>556</integer> - <integer>589</integer> + <integer>689</integer> <integer>365</integer> - <integer>434</integer> - <integer>29</integer> <integer>583</integer> + <integer>29</integer> + <integer>556</integer> + <integer>434</integer> <integer>21</integer> </array> <key>IBSystem Version</key> - <string>7C107</string> + <string>7D24</string> </dict> </plist> diff --git a/macosx/English.lproj/MainMenu.nib/objects.nib b/macosx/English.lproj/MainMenu.nib/objects.nib Binary files differindex 956897bce..b088624ed 100644 --- a/macosx/English.lproj/MainMenu.nib/objects.nib +++ b/macosx/English.lproj/MainMenu.nib/objects.nib diff --git a/macosx/HandBrake.pbproj/project.pbxproj b/macosx/HandBrake.xcode/project.pbxproj index c47e0176a..6416e2c67 100644 --- a/macosx/HandBrake.pbproj/project.pbxproj +++ b/macosx/HandBrake.xcode/project.pbxproj @@ -35,9 +35,9 @@ sourceTree = "<group>"; }; 089C165DFE840E0CC02AAC07 = { - expectedFileType = text.plist.strings; fileEncoding = 10; isa = PBXFileReference; + lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; refType = 4; @@ -71,9 +71,9 @@ sourceTree = "<group>"; }; 1058C7A1FEA54F0111CA2CBB = { - expectedFileType = wrapper.framework; fallbackIsa = PBXFileReference; isa = PBXFrameworkReference; + lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; refType = 0; @@ -106,7 +106,7 @@ //173 //174 17587328FF379C6511CA2CBB = { - expectedFileType = wrapper.application; + explicitFileType = wrapper.application; fallbackIsa = PBXFileReference; isa = PBXApplicationReference; path = HandBrake.app; @@ -185,15 +185,19 @@ sourceTree = "<group>"; }; 29B97316FDCFA39411CA2CEA = { - expectedFileType = sourcecode.cpp.objcpp; fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; refType = 4; sourceTree = "<group>"; }; 29B97317FDCFA39411CA2CEA = { children = ( + 4D194F36059E0FBC004A33A1, + 4D548205059E100C00AD5E02, + 4D194F37059E0FBC004A33A1, + 4D194F38059E0FBC004A33A1, 29B97318FDCFA39411CA2CEA, 4D929FED0527907200A80101, 4D69F5C80527944A00A80101, @@ -206,6 +210,8 @@ 4DDEF3B905474DCC002904DE, 4D118405053054CD00C39CA9, 089C165CFE840E0CC02AAC07, + 4D0AEC1805747B7A00FAB0FD, + 4D0AEC1C05747B8C00FAB0FD, ); isa = PBXGroup; name = Resources; @@ -224,8 +230,8 @@ sourceTree = "<group>"; }; 29B97319FDCFA39411CA2CEA = { - expectedFileType = wrapper.nib; isa = PBXFileReference; + lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; refType = 4; @@ -243,18 +249,18 @@ sourceTree = "<group>"; }; 29B97324FDCFA39411CA2CEA = { - expectedFileType = wrapper.framework; fallbackIsa = PBXFileReference; isa = PBXFrameworkReference; + lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; refType = 0; sourceTree = "<absolute>"; }; 29B97325FDCFA39411CA2CEA = { - expectedFileType = wrapper.framework; fallbackIsa = PBXFileReference; isa = PBXFrameworkReference; + lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; refType = 0; @@ -271,9 +277,9 @@ FRAMEWORK_SEARCH_PATHS = ""; GCC_TREAT_WARNINGS_AS_ERRORS = YES; HEADER_SEARCH_PATHS = ""; - LIBRARY_SEARCH_PATHS = ../core; + LIBRARY_SEARCH_PATHS = "../core ../contrib/liba52 ../contrib/libavcodec ../contrib/libdvdcss ../contrib/libdvdplay ../contrib/libdvdread ../contrib/libfaac ../contrib/libmp3lame ../contrib/libmp4v2 ../contrib/libmpeg2 ../contrib/libogg ../contrib/libvorbis ../contrib/libx264 ../contrib/libxvidcore"; OPTIMIZATION_CFLAGS = "-O3"; - OTHER_CFLAGS = "-DSYS_MACOSX"; + OTHER_CFLAGS = "-DHB_MACOSX"; OTHER_LDFLAGS = ""; PRODUCT_NAME = HandBrake; SECTORDER_FLAGS = ""; @@ -295,7 +301,7 @@ <key>CFBundleExecutable</key> <string>HandBrake</string> <key>CFBundleGetInfoString</key> - <string>HandBrake 0.5.2 - By Eric Petit <[email protected]></string> + <string>HandBrake 0.5.2+ - By Eric Petit <[email protected]></string> <key>CFBundleIconFile</key> <string>HandBrake.icns</string> <key>CFBundleIdentifier</key> @@ -307,11 +313,11 @@ <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>0.5.2</string> + <string>0.5.2+</string> <key>CFBundleSignature</key> <string>HB##</string> <key>CFBundleVersion</key> - <string>0.5.2</string> + <string>0.5.2+</string> <key>NSMainNibFile</key> <string>MainMenu</string> <key>NSPrincipalClass</key> @@ -375,6 +381,12 @@ 4DEB2025052B055F00C39CA9, 4DDE9725052B7B2B00C39CA9, 4DDEF3BA05474DCC002904DE, + 4D0AEC1905747B7A00FAB0FD, + 4D0AEC1D05747B8C00FAB0FD, + 4D194F39059E0FBC004A33A1, + 4D194F3A059E0FBC004A33A1, + 4D194F3B059E0FBC004A33A1, + 4D548206059E100C00AD5E02, ); isa = PBXFrameworksBuildPhase; runOnlyForDeploymentPostprocessing = 0; @@ -394,11 +406,12 @@ ); buildSettings = { COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_DYNAMIC_NO_PIC = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - OPTIMIZATION_CFLAGS = "-O0"; + GCC_OPTIMIZATION_LEVEL = 3; + LIBRARY_SEARCH_PATHS = "../core ../contrib/lib"; + OPTIMIZATION_CFLAGS = "-O3"; ZERO_LINK = YES; }; isa = PBXBuildStyle; @@ -425,9 +438,37 @@ //4D2 //4D3 //4D4 + 4D0AEC1805747B7A00FAB0FD = { + isa = PBXFileReference; + lastKnownFileType = archive.ar; + name = libfaac.a; + path = ../contrib/libfaac/libfaac.a; + refType = 2; + sourceTree = SOURCE_ROOT; + }; + 4D0AEC1905747B7A00FAB0FD = { + fileRef = 4D0AEC1805747B7A00FAB0FD; + isa = PBXBuildFile; + settings = { + }; + }; + 4D0AEC1C05747B8C00FAB0FD = { + isa = PBXFileReference; + lastKnownFileType = archive.ar; + name = libmp4v2.a; + path = ../contrib/libmp4v2/libmp4v2.a; + refType = 2; + sourceTree = SOURCE_ROOT; + }; + 4D0AEC1D05747B8C00FAB0FD = { + fileRef = 4D0AEC1C05747B8C00FAB0FD; + isa = PBXBuildFile; + settings = { + }; + }; 4D118405053054CD00C39CA9 = { - expectedFileType = image.icns; isa = PBXFileReference; + lastKnownFileType = image.icns; path = HandBrake.icns; refType = 4; sourceTree = "<group>"; @@ -438,18 +479,60 @@ settings = { }; }; + 4D194F36059E0FBC004A33A1 = { + isa = PBXFileReference; + lastKnownFileType = archive.ar; + name = libvorbis.a; + path = ../contrib/libvorbis/libvorbis.a; + refType = 2; + sourceTree = SOURCE_ROOT; + }; + 4D194F37059E0FBC004A33A1 = { + isa = PBXFileReference; + lastKnownFileType = archive.ar; + name = libvorbisenc.a; + path = ../contrib/libvorbis/libvorbisenc.a; + refType = 2; + sourceTree = SOURCE_ROOT; + }; + 4D194F38059E0FBC004A33A1 = { + isa = PBXFileReference; + lastKnownFileType = archive.ar; + name = libx264.a; + path = ../contrib/libx264/libx264.a; + refType = 2; + sourceTree = SOURCE_ROOT; + }; + 4D194F39059E0FBC004A33A1 = { + fileRef = 4D194F36059E0FBC004A33A1; + isa = PBXBuildFile; + settings = { + }; + }; + 4D194F3A059E0FBC004A33A1 = { + fileRef = 4D194F37059E0FBC004A33A1; + isa = PBXBuildFile; + settings = { + }; + }; + 4D194F3B059E0FBC004A33A1 = { + fileRef = 4D194F38059E0FBC004A33A1; + isa = PBXBuildFile; + settings = { + }; + }; 4D358C000534A91300D654EB = { - expectedFileType = sourcecode.c.h; fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = TargetSizeField.h; refType = 4; sourceTree = "<group>"; }; 4D358C010534A91300D654EB = { - expectedFileType = sourcecode.cpp.objcpp; fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.objcpp; path = TargetSizeField.mm; refType = 4; sourceTree = "<group>"; @@ -466,6 +549,20 @@ settings = { }; }; + 4D548205059E100C00AD5E02 = { + isa = PBXFileReference; + lastKnownFileType = archive.ar; + name = libogg.a; + path = ../contrib/libogg/libogg.a; + refType = 2; + sourceTree = SOURCE_ROOT; + }; + 4D548206059E100C00AD5E02 = { + fileRef = 4D548205059E100C00AD5E02; + isa = PBXBuildFile; + settings = { + }; + }; 4D6615EA05288C2300A80101 = { fileRef = 4DF3C8CB052889CD00A80101; isa = PBXBuildFile; @@ -473,60 +570,60 @@ }; }; 4D69F5C80527944A00A80101 = { - expectedFileType = archive.ar; isa = PBXFileReference; + lastKnownFileType = archive.ar; name = liba52.a; - path = /usr/local/lib/liba52.a; - refType = 0; - sourceTree = "<absolute>"; + path = ../contrib/liba52/liba52.a; + refType = 2; + sourceTree = SOURCE_ROOT; }; 4D69F5C90527944A00A80101 = { - expectedFileType = archive.ar; isa = PBXFileReference; + lastKnownFileType = archive.ar; name = libavcodec.a; - path = /usr/local/lib/libavcodec.a; - refType = 0; - sourceTree = "<absolute>"; + path = ../contrib/libavcodec/libavcodec.a; + refType = 2; + sourceTree = SOURCE_ROOT; }; 4D69F5CA0527944A00A80101 = { - expectedFileType = archive.ar; isa = PBXFileReference; + lastKnownFileType = archive.ar; name = libdvdcss.a; - path = /usr/local/lib/libdvdcss.a; - refType = 0; - sourceTree = "<absolute>"; + path = ../contrib/libdvdcss/libdvdcss.a; + refType = 2; + sourceTree = SOURCE_ROOT; }; 4D69F5CB0527944A00A80101 = { - expectedFileType = archive.ar; isa = PBXFileReference; + lastKnownFileType = archive.ar; name = libdvdplay.a; - path = /usr/local/lib/libdvdplay.a; - refType = 0; - sourceTree = "<absolute>"; + path = ../contrib/libdvdplay/libdvdplay.a; + refType = 2; + sourceTree = SOURCE_ROOT; }; 4D69F5CC0527944A00A80101 = { - expectedFileType = archive.ar; isa = PBXFileReference; + lastKnownFileType = archive.ar; name = libdvdread.a; - path = /usr/local/lib/libdvdread.a; - refType = 0; - sourceTree = "<absolute>"; + path = ../contrib/libdvdread/libdvdread.a; + refType = 2; + sourceTree = SOURCE_ROOT; }; 4D69F5CD0527944A00A80101 = { - expectedFileType = archive.ar; isa = PBXFileReference; + lastKnownFileType = archive.ar; name = libmp3lame.a; - path = /usr/local/lib/libmp3lame.a; - refType = 0; - sourceTree = "<absolute>"; + path = ../contrib/libmp3lame/libmp3lame.a; + refType = 2; + sourceTree = SOURCE_ROOT; }; 4D69F5CE0527944A00A80101 = { - expectedFileType = archive.ar; isa = PBXFileReference; + lastKnownFileType = archive.ar; name = libmpeg2.a; - path = /usr/local/lib/libmpeg2.a; - refType = 0; - sourceTree = "<absolute>"; + path = ../contrib/libmpeg2/libmpeg2.a; + refType = 2; + sourceTree = SOURCE_ROOT; }; 4D69F5CF0527944A00A80101 = { fileRef = 4D69F5C80527944A00A80101; @@ -571,17 +668,17 @@ }; }; 4D85758E052B78E300C39CA9 = { - expectedFileType = sourcecode.cpp.objcpp; fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.objcpp; path = PictureGLView.mm; refType = 4; sourceTree = "<group>"; }; 4D85758F052B78E300C39CA9 = { - expectedFileType = sourcecode.c.h; fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = PictureGLView.h; refType = 4; sourceTree = "<group>"; @@ -599,12 +696,12 @@ }; }; 4D929FED0527907200A80101 = { - expectedFileType = archive.ar; isa = PBXFileReference; + lastKnownFileType = archive.ar; name = libhb.a; path = ../core/libhb.a; - refType = 4; - sourceTree = "<group>"; + refType = 2; + sourceTree = SOURCE_ROOT; }; 4D929FEE0527907200A80101 = { fileRef = 4D929FED0527907200A80101; @@ -613,9 +710,9 @@ }; }; 4DDE9724052B7B2B00C39CA9 = { - expectedFileType = wrapper.framework; fallbackIsa = PBXFileReference; isa = PBXFrameworkReference; + lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; refType = 0; @@ -628,12 +725,12 @@ }; }; 4DDEF3B905474DCC002904DE = { - expectedFileType = archive.ar; isa = PBXFileReference; + lastKnownFileType = archive.ar; name = libxvidcore.a; - path = /usr/local/lib/libxvidcore.a; - refType = 0; - sourceTree = "<absolute>"; + path = ../contrib/libxvidcore/libxvidcore.a; + refType = 2; + sourceTree = SOURCE_ROOT; }; 4DDEF3BA05474DCC002904DE = { fileRef = 4DDEF3B905474DCC002904DE; @@ -642,9 +739,9 @@ }; }; 4DEB2024052B055F00C39CA9 = { - expectedFileType = wrapper.framework; fallbackIsa = PBXFileReference; isa = PBXFrameworkReference; + lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; refType = 0; @@ -657,17 +754,17 @@ }; }; 4DF3C8CB052889CD00A80101 = { - expectedFileType = sourcecode.c.h; fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = Controller.h; refType = 4; sourceTree = "<group>"; }; 4DF3C8CC052889CD00A80101 = { - expectedFileType = sourcecode.cpp.objcpp; fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.objcpp; path = Controller.mm; refType = 4; sourceTree = "<group>"; @@ -679,9 +776,9 @@ }; }; 4DFDC318054AC84C00151618 = { - expectedFileType = sourcecode.c.h; fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; name = HandBrake.h; path = ../core/HandBrake.h; refType = 4; diff --git a/macosx/TargetSizeField.h b/macosx/TargetSizeField.h index 6bc4a716f..d9396ee3a 100644 --- a/macosx/TargetSizeField.h +++ b/macosx/TargetSizeField.h @@ -1,4 +1,4 @@ -/* $Id: TargetSizeField.h,v 1.1.1.1 2003/11/03 12:03:51 titer Exp $ +/* $Id: TargetSizeField.h,v 1.3 2004/01/28 14:41:31 titer Exp $ This file is part of the HandBrake source code. Homepage: <http://handbrake.m0k.org/>. @@ -12,9 +12,10 @@ { HBTitle * fTitle; - IBOutlet NSTextField * fBitrateField; - IBOutlet NSPopUpButton * fSecondaryLanguagePopUp; - IBOutlet NSPopUpButton * fAudioBitratePopUp; + IBOutlet NSPopUpButton * fRipFormatPopUp; + IBOutlet NSTextField * fRipCustomField; + IBOutlet NSPopUpButton * fRipLang2PopUp; + IBOutlet NSPopUpButton * fRipAudBitPopUp; } - (void) SetHBTitle: (HBTitle *) title; 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 diff --git a/macosx/genstrings.sh b/macosx/genstrings.sh new file mode 100755 index 000000000..38da1de92 --- /dev/null +++ b/macosx/genstrings.sh @@ -0,0 +1,7 @@ +#! /bin/sh +rm -f genstrings.tmp +cat Controller.mm | grep -v "^#define.*_(" | \ + sed 's/_( \(@"[^"]*"\) )/NSLocalizedString( \1, nil )/g' > \ + genstrings.tmp +genstrings genstrings.tmp +rm -f genstrings.tmp diff --git a/macosx/i18n/French.strings b/macosx/i18n/French.strings Binary files differnew file mode 100644 index 000000000..a81b4ad56 --- /dev/null +++ b/macosx/i18n/French.strings diff --git a/macosx/i18n/German.strings b/macosx/i18n/German.strings Binary files differnew file mode 100644 index 000000000..99220c2cc --- /dev/null +++ b/macosx/i18n/German.strings diff --git a/macosx/i18n/Localizable.strings b/macosx/i18n/Localizable.strings Binary files differnew file mode 100644 index 000000000..cbad7b524 --- /dev/null +++ b/macosx/i18n/Localizable.strings |