OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / macosx / Controller.mm
index d92619a..4c6f50c 100644 (file)
@@ -1007,11 +1007,23 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
                for( int i = 0; i < hb_list_count( list ); i++ )
                {
                        title = (hb_title_t *) hb_list_item( list, i );
-                       /*Set DVD Name at top of window*/
-                       [fSrcDVD2Field setStringValue:[NSString stringWithUTF8String: title->name]];
-                       
-                       currentSource = [NSString stringWithUTF8String: title->dvd];
                        
+            currentSource = [NSString stringWithUTF8String: title->dvd];
+            
+            /* To get the source name as well as the default output name, first we check to see if
+               the selected directory is the VIDEO_TS Directory */
+            if ([[currentSource lastPathComponent] isEqualToString: @"VIDEO_TS"])
+            {
+            /* If VIDEO_TS Folder is chosen, choose its parent folder for the source display name */
+            sourceDisplayName = [NSString stringWithFormat:[[currentSource stringByDeletingLastPathComponent] lastPathComponent]];
+            }
+            else
+            {
+            /* if not the VIDEO_TS Folder, we can assume the chosen folder is the source name */
+            sourceDisplayName = [NSString stringWithFormat:[currentSource lastPathComponent]];
+            }
+                       /*Set DVD Name at top of window*/
+                       [fSrcDVD2Field setStringValue:[NSString stringWithFormat: @"%@", sourceDisplayName]];
                        
                        /* Use the dvd name in the default output field here 
                                May want to add code to remove blank spaces for some dvd names*/
@@ -1019,14 +1031,12 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
                        if ([[NSUserDefaults standardUserDefaults] stringForKey:@"LastDestinationDirectory"])
                        {
                                [fDstFile2Field setStringValue: [NSString stringWithFormat:
-                                       @"%@/%@.mp4", [[NSUserDefaults standardUserDefaults] stringForKey:@"LastDestinationDirectory"],[NSString
-                  stringWithUTF8String: title->name]]];
+                                       @"%@/%@.mp4", [[NSUserDefaults standardUserDefaults] stringForKey:@"LastDestinationDirectory"],sourceDisplayName]];
                        }
                        else
                        {
                                [fDstFile2Field setStringValue: [NSString stringWithFormat:
-                                       @"%@/Desktop/%@.mp4", NSHomeDirectory(),[NSString
-                  stringWithUTF8String: title->name]]];
+                                       @"%@/Desktop/%@.mp4", NSHomeDirectory(),sourceDisplayName]];
                        }
                        
                        
@@ -1094,11 +1104,7 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
         SuccessfulScan = 1;
                [self enableUI: YES];
                
-               /* we record the current source name here in case the next scan is unsuccessful,
-                               then we can replace the scan progress with the old name if necessary */
-       sourceDisplayName = [NSString stringWithFormat:[fSrcDVD2Field stringValue]];
-       
-       /* if its the initial successful scan after awakeFromNib */
+               /* if its the initial successful scan after awakeFromNib */
           if (currentSuccessfulScanCount == 1)
           {
            [self selectDefaultPreset: NULL];
@@ -2084,6 +2090,7 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
 - (IBAction) formatPopUpChanged: (id) sender
 {
     NSString * string = [fDstFile2Field stringValue];
+    NSString * selectedCodecs = [fDstCodecsPopUp titleOfSelectedItem];
     int format = [fDstFormatPopUp indexOfSelectedItem];
     char * ext = NULL;
        /* Initially set the large file (64 bit formatting) output checkbox to hidden */
@@ -2170,6 +2177,11 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
                        [fCreateChapterMarkers setEnabled: YES];
                        break;
     }
+    if ( SuccessfulScan ) {
+        [fDstCodecsPopUp selectItemWithTitle:selectedCodecs];
+        if ( [fDstCodecsPopUp selectedItem] == NULL )
+            [fDstCodecsPopUp selectItemAtIndex:0];
+        }
     [self codecsPopUpChanged: NULL];
 
     /* Add/replace to the correct extension */
@@ -2460,7 +2472,8 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
             int audioCodecsSupportMono = ((audio->codec == HB_ACODEC_AC3 ||
                 audio->codec == HB_ACODEC_DCA) && acodec == HB_ACODEC_FAAC);
             int audioCodecsSupport6Ch =  ((audio->codec == HB_ACODEC_AC3 ||
-                audio->codec == HB_ACODEC_DCA) && acodec == HB_ACODEC_FAAC);
+                audio->codec == HB_ACODEC_DCA) && (acodec == HB_ACODEC_FAAC ||
+                acodec == HB_ACODEC_VORBIS));
 
             /* check for AC-3 passthru */
             if (audio->codec == HB_ACODEC_AC3 && acodec == HB_ACODEC_AC3)
@@ -2614,11 +2627,22 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
             break;
 
         case HB_ACODEC_VORBIS:
+        if ([[fAudTrack1MixPopUp selectedItem] tag] == HB_AMIXDOWN_6CH || [[fAudTrack2MixPopUp selectedItem] tag] == HB_AMIXDOWN_6CH)
+            {
+                /* Vorbis causes a crash if we use a bitrate below 192 kbps with 6 channel */
+                minbitrate = 192;
+                /* If either mixdown popup includes 6-channel discrete, then allow up to 384 kbps */
+                maxbitrate = 384;
+                break;
+            }
+            else
+            {
             /* Vorbis causes a crash if we use a bitrate below 48 kbps */
             minbitrate = 48;
             /* Vorbis can cope with 384 kbps quite happily, even for stereo */
             maxbitrate = 384;
             break;
+            }
 
         default:
             /* AC3 passthru disables the bitrate dropdown anyway, so we might as well just use the min and max bitrate */