summaryrefslogtreecommitdiffstats
path: root/macosx/ExpressController.m
diff options
context:
space:
mode:
authortiter <[email protected]>2006-04-17 19:34:42 +0000
committertiter <[email protected]>2006-04-17 19:34:42 +0000
commitc1dbdecc75629ddebad41f236445a89b6cc9cd9a (patch)
treed23d8dca8d32a5ae8089c72e6dde3297f641e844 /macosx/ExpressController.m
parentb30c3a727aa539f10adeae2220b4aa48e0b18feb (diff)
Implemented audio and subtitle selection
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@62 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/ExpressController.m')
-rw-r--r--macosx/ExpressController.m67
1 files changed, 64 insertions, 3 deletions
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];