diff options
-rw-r--r-- | Jamfile | 7 | ||||
-rw-r--r-- | libhb/common.h | 1 | ||||
-rw-r--r-- | libhb/dvd.c | 2 | ||||
-rw-r--r-- | macosx/English.lproj/Express.nib/classes.nib | 2 | ||||
-rw-r--r-- | macosx/English.lproj/Express.nib/info.nib | 2 | ||||
-rw-r--r-- | macosx/English.lproj/Express.nib/keyedobjects.nib | bin | 34816 -> 35003 bytes | |||
-rw-r--r-- | macosx/ExpressController.h | 2 | ||||
-rw-r--r-- | macosx/ExpressController.m | 67 |
8 files changed, 78 insertions, 5 deletions
@@ -49,7 +49,12 @@ if $(OS) = MACOSX macosx/English.lproj/InfoPlist.strings macosx/English.lproj/MainMenu.nib/classes.nib macosx/English.lproj/MainMenu.nib/info.nib - macosx/English.lproj/MainMenu.nib/keyedobjects.nib ; + macosx/English.lproj/MainMenu.nib/keyedobjects.nib + macosx/ExpressController.h macosx/ExpressController.m + macosx/English.lproj/Express.nib/classes.nib + macosx/English.lproj/Express.nib/info.nib + macosx/English.lproj/Express.nib/keyedobjects.nib ; + OSXApp HandBrake.app : $(OSX_SRC) $(HB_LIBS) ; # Package diff --git a/libhb/common.h b/libhb/common.h index a0c22ff27..f5af73c03 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -189,6 +189,7 @@ struct hb_audio_s { int id; char lang[1024]; + char lang_simple[1024]; int codec; int rate; int bitrate; diff --git a/libhb/dvd.c b/libhb/dvd.c index 54b5e5e92..f0cc521bc 100644 --- a/libhb/dvd.c +++ b/libhb/dvd.c @@ -247,6 +247,8 @@ hb_title_t * hb_dvd_title_scan( hb_dvd_t * d, int t ) lang_for_code( vts->vtsi_mat->vts_audio_attr[i].lang_code ), audio->codec == HB_ACODEC_AC3 ? "AC3" : ( audio->codec == HB_ACODEC_MPGA ? "MPEG" : "LPCM" ) ); + snprintf( audio->lang_simple, sizeof( audio->lang_simple ), "%s", + lang_for_code( vts->vtsi_mat->vts_audio_attr[i].lang_code ) ); hb_log( "scan: id=%x, lang=%s", audio->id, audio->lang ); diff --git a/macosx/English.lproj/Express.nib/classes.nib b/macosx/English.lproj/Express.nib/classes.nib index 5498cdf8c..6fd9650d7 100644 --- a/macosx/English.lproj/Express.nib/classes.nib +++ b/macosx/English.lproj/Express.nib/classes.nib @@ -39,10 +39,12 @@ LANGUAGE = ObjC; OUTLETS = { fConvertAspectPopUp = NSPopUpButton; + fConvertAudioPopUp = NSPopUpButton; fConvertFolderPopUp = NSPopUpButton; fConvertFormatPopUp = NSPopUpButton; fConvertIndicator = NSProgressIndicator; fConvertInfoString = NSTextField; + fConvertSubtitlePopUp = NSPopUpButton; fConvertTableView = NSTableView; fConvertView = NSView; fEmptyView = NSView; diff --git a/macosx/English.lproj/Express.nib/info.nib b/macosx/English.lproj/Express.nib/info.nib index ae8fc644e..078c0be99 100644 --- a/macosx/English.lproj/Express.nib/info.nib +++ b/macosx/English.lproj/Express.nib/info.nib @@ -18,6 +18,6 @@ <key>IBFramework Version</key> <string>443.0</string> <key>IBSystem Version</key> - <string>8G1454</string> + <string>8I1119</string> </dict> </plist> diff --git a/macosx/English.lproj/Express.nib/keyedobjects.nib b/macosx/English.lproj/Express.nib/keyedobjects.nib Binary files differindex 960c3e022..59442d000 100644 --- a/macosx/English.lproj/Express.nib/keyedobjects.nib +++ b/macosx/English.lproj/Express.nib/keyedobjects.nib diff --git a/macosx/ExpressController.h b/macosx/ExpressController.h index 303651b5c..9a2f407c8 100644 --- a/macosx/ExpressController.h +++ b/macosx/ExpressController.h @@ -29,6 +29,8 @@ IBOutlet NSPopUpButton * fConvertFolderPopUp; IBOutlet NSPopUpButton * fConvertFormatPopUp; IBOutlet NSPopUpButton * fConvertAspectPopUp; + IBOutlet NSPopUpButton * fConvertAudioPopUp; + IBOutlet NSPopUpButton * fConvertSubtitlePopUp; IBOutlet NSTextField * fConvertInfoString; IBOutlet NSProgressIndicator * fConvertIndicator; NSMutableArray * fConvertCheckArray; diff --git a/macosx/ExpressController.m b/macosx/ExpressController.m index 2ffddf56e..f496accdc 100644 --- a/macosx/ExpressController.m +++ b/macosx/ExpressController.m @@ -189,7 +189,7 @@ - (void) convertGo: (id) sender { - int i; + int i, j; for( i = 0; i < hb_list_count( fList ); i++ ) { @@ -241,7 +241,47 @@ hb_set_size( job, aspect, pixels ); job->vquality = -1.0; - job->file = strdup( [[NSString stringWithFormat: + + const char * lang; + + /* Audio selection */ + hb_audio_t * audio; + lang = [[fConvertAudioPopUp titleOfSelectedItem] UTF8String]; + job->audios[0] = -1; + for( j = 0; j < hb_list_count( title->list_audio ); j++ ) + { + /* Choose the first track that matches the language */ + audio = hb_list_item( title->list_audio, j ); + if( !strcmp( lang, audio->lang_simple ) ) + { + job->audios[0] = j; + break; + } + } + if( job->audios[0] == -1 ) + { + /* If the language isn't available in this title, choose + the first track */ + job->audios[0] = 0; + } + job->audios[1] = -1; + + /* Subtitle selection */ + hb_subtitle_t * subtitle; + lang = [[fConvertSubtitlePopUp titleOfSelectedItem] UTF8String]; + job->subtitle = -1; + for( j = 0; j < hb_list_count( title->list_subtitle ); j++ ) + { + /* Choose the first track that matches the language */ + subtitle = hb_list_item( title->list_subtitle, j ); + if( !strcmp( lang, subtitle->lang ) ) + { + job->subtitle = j; + break; + } + } + + job->file = strdup( [[NSString stringWithFormat: @"%@/%p - Title %d.mp4", fConvertFolderString, self, title->index] UTF8String] ); hb_add( fHandle, job ); @@ -355,16 +395,37 @@ - (void) convertShow { - int i; + int i, j; fConvertCheckArray = [[NSMutableArray alloc] initWithCapacity: hb_list_count( fList )]; + [fConvertAudioPopUp removeAllItems]; + [fConvertSubtitlePopUp removeAllItems]; + [fConvertSubtitlePopUp addItemWithTitle: @"None"]; for( i = 0; i < hb_list_count( fList ); i++ ) { /* Default is to convert titles longer than 30 minutes. */ hb_title_t * title = hb_list_item( fList, i ); [fConvertCheckArray addObject: [NSNumber numberWithBool: ( 60 * title->hours + title->minutes > 30 )]]; + + /* Update audio popup */ + hb_audio_t * audio; + for( j = 0; j < hb_list_count( title->list_audio ); j++ ) + { + audio = hb_list_item( title->list_audio, j ); + [fConvertAudioPopUp addItemWithTitle: + [NSString stringWithUTF8String: audio->lang_simple]]; + } + + /* Update subtitle popup */ + hb_subtitle_t * subtitle; + for( j = 0; j < hb_list_count( title->list_subtitle ); j++ ) + { + subtitle = hb_list_item( title->list_subtitle, j ); + [fConvertSubtitlePopUp addItemWithTitle: + [NSString stringWithUTF8String: subtitle->lang]]; + } } [fConvertTableView reloadData]; |