OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / macosx / Controller.m
index a72abcf..a744ad2 100644 (file)
@@ -1858,6 +1858,14 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
                 }
                 [fSrcDVD2Field setStringValue:browsedSourceDisplayName];
                 
+                // use the correct extension based on the container
+                int format = [fDstFormatPopUp indexOfSelectedItem];
+                char *ext = "mp4";
+                if (format == 1)
+                {
+                    ext = "mkv";
+                }
+                
                 /* If its a queue rescan for edit, get the queue item output path */
                 /* if not, its a new source scan. */
                 /* Check to see if the last destination has been set,use if so, if not, use Desktop */
@@ -1868,12 +1876,18 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
                 else if ([[NSUserDefaults standardUserDefaults] stringForKey:@"LastDestinationDirectory"])
                 {
                     [fDstFile2Field setStringValue: [NSString stringWithFormat:
-                                                     @"%@/%@.mp4", [[NSUserDefaults standardUserDefaults] stringForKey:@"LastDestinationDirectory"],[browsedSourceDisplayName stringByDeletingPathExtension]]];
+                                                     @"%@/%@.%s", [[NSUserDefaults standardUserDefaults] stringForKey:@"LastDestinationDirectory"],[browsedSourceDisplayName stringByDeletingPathExtension],ext]];
                 }
                 else
                 {
                     [fDstFile2Field setStringValue: [NSString stringWithFormat:
-                                                     @"%@/Desktop/%@.mp4", NSHomeDirectory(),[browsedSourceDisplayName stringByDeletingPathExtension]]];
+                                                     @"%@/Desktop/%@.%s", NSHomeDirectory(),[browsedSourceDisplayName stringByDeletingPathExtension],ext]];
+                }
+                
+                // set m4v extension if necessary - do not override user-specified .mp4 extension
+                if (format == 0 && applyQueueToScan != YES)
+                {
+                    [self autoSetM4vExtension: sender];
                 }
                 
                 /* See if this is the main feature according to libhb */
@@ -4470,15 +4484,7 @@ bool one_burned = FALSE;
     switch( format )
     {
         case 0:
-                       /*Get Default MP4 File Extension*/
-                       if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultMpegName"] > 0)
-                       {
-                               ext = "m4v";
-                       }
-                       else
-                       {
-                               ext = "mp4";
-                       }
+                       [self autoSetM4vExtension: nil];
             /* Add additional video encoders here */
             menuItem = [[fVidEncoderPopUp menu] addItemWithTitle:@"H.264 (x264)" action: NULL keyEquivalent: @""];
             [menuItem setTag: HB_VCODEC_X264];
@@ -4556,22 +4562,23 @@ bool one_burned = FALSE;
 {
     if ( [fDstFormatPopUp indexOfSelectedItem] )
         return;
-
+    
     NSString * extension = @"mp4";
-
+    
        BOOL anyCodecAC3 = [fAudioDelegate anyCodecMatches: HB_ACODEC_AC3] || [fAudioDelegate anyCodecMatches: HB_ACODEC_AC3_PASS];
-       if (YES == anyCodecAC3 ||
-                                                        [fCreateChapterMarkers state] == NSOnState ||
-                                                        [[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultMpegName"] > 0 )
+       
+    if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"] isEqualToString: @".m4v"] || 
+        ((YES == anyCodecAC3 || [fCreateChapterMarkers state] == NSOnState) && 
+         [[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"] isEqualToString: @"Auto"] ))
     {
         extension = @"m4v";
     }
-
+    
     if( [extension isEqualTo: [[fDstFile2Field stringValue] pathExtension]] )
         return;
     else
         [fDstFile2Field setStringValue: [NSString stringWithFormat:@"%@.%@",
-                                    [[fDstFile2Field stringValue] stringByDeletingPathExtension], extension]];
+                                         [[fDstFile2Field stringValue] stringByDeletingPathExtension], extension]];
 }
 
 /* Method to determine if we should change the UI
@@ -4788,6 +4795,12 @@ the user is using "Custom" settings by determining the sender*/
     {
         [fVidQualityRFField setStringValue: [NSString stringWithFormat: @"%.2f", sliderRfInverse]];
     }
+    /* Show a warning if x264 and rf 0 which is lossless */
+    if ([[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_X264 && sliderRfInverse == 0.0)
+    {
+        [fVidQualityRFField setStringValue: [NSString stringWithFormat: @"%.2f (Warning: Lossless)", sliderRfInverse]];
+    }
+    
     [self customSettingUsed: sender];
 }