OSDN Git Service

LinGui: don't disable subme 10 when psy-rd is 0
[handbrake-jp/handbrake-jp-git.git] / macosx / HBPreviewController.mm
index f6ab2ac..052648d 100644 (file)
@@ -304,8 +304,9 @@ return YES;
         viewSize.width = viewSize.width - (viewSize.width - imageScaledSize.width);
         viewSize.height = viewSize.height - (viewSize.height - imageScaledSize.height);
         [fPreviewImage setSize: viewSize];
-        [fPictureView setFrameSize: viewSize];
+        //[fPictureView setFrameSize: viewSize];
     }
+    
     else
     {
         [fPreviewImage setSize: imageScaledSize];
@@ -336,6 +337,13 @@ return YES;
     viewSize.height = viewSize.height - (viewSize.height - imageScaledSize.height);
     [self setViewSize:viewSize];
     
+    /* special case for scaleToScreen */
+    if (scaleToScreen == YES)
+    {
+        [fPreviewImage setSize: viewSize];
+        [fPictureView setImage: fPreviewImage];
+    }
+    
     NSString *scaleString;
     
     if( imageScaledSize.height > [fPictureView frame].size.height)
@@ -533,6 +541,7 @@ return YES;
     else
     {
         [[fPictureControlBox animator] setHidden: YES];
+        [self stopHudTimer];
     }
     
 }
@@ -662,7 +671,6 @@ return YES;
         /* make sure we are set to a still preview */
         [self pictureSliderChanged:nil];
         
-        //[fPreviewWindow setAcceptsMouseMovedEvents:NO];
         [fFullScreenWindow setAcceptsMouseMovedEvents:YES];
         
         
@@ -920,7 +928,33 @@ return YES;
     /* lets go ahead and send it off to libhb
      * Note: unlike a full encode, we only send 1 pass regardless if the final encode calls for 2 passes.
      * this should suffice for a fairly accurate short preview and cuts our preview generation time in half.
+     * However we also need to take into account the indepth scan for subtitles.
+     */
+    /*
+     * If scanning we need to do some extra setup of the job.
      */
+    if( job->indepth_scan == 1 )
+    {
+        char *x264opts_tmp;
+        
+        /*
+         * When subtitle scan is enabled do a fast pre-scan job
+         * which will determine which subtitles to enable, if any.
+         */
+        job->pass = -1;
+        x264opts_tmp = job->x264opts;
+        
+        job->x264opts = NULL;
+        job->indepth_scan = 1;  
+        /*
+         * Add the pre-scan job
+         */
+        hb_add( fPreviewLibhb, job );
+        job->x264opts = x264opts_tmp;
+    }                  
+    /* Go ahead and perform the actual encoding preview scan */
+    job->indepth_scan = 0;
+    job->pass = 0;
     hb_add( fPreviewLibhb, job );
     
     [fEncodingControlBox setHidden: NO];
@@ -1325,16 +1359,35 @@ return YES;
 // Assumes resizeSheetForViewSize: has already been called.
 //
 - (void)setViewSize: (NSSize)viewSize
-{
+{   
+    /* special case for scaleToScreen */
+    if (scaleToScreen == YES)
+    {
+        /* for scaleToScreen, we expand the fPictureView to fit the entire screen */
+        NSSize areaSize = [fPictureViewArea frame].size;
+        CGFloat viewSizeAspect = viewSize.width / viewSize.height;
+        if (viewSizeAspect > 1.0) // we are wider than taller, so expand the width to fill the area and scale the height
+        {
+            viewSize.width = areaSize.width;
+            viewSize.height = viewSize.width / viewSizeAspect;
+        }
+        else
+        {
+            viewSize.height = areaSize.height;
+            viewSize.width = viewSize.height * viewSizeAspect;
+        }
+        
+    }
+    
     [fPictureView setFrameSize:viewSize];
     
-    // center it vertically and horizontally
+        // center it vertically and horizontally
     NSPoint origin = [fPictureViewArea frame].origin;
     origin.y += ([fPictureViewArea frame].size.height -
                  [fPictureView frame].size.height) / 2.0;
-                 
-   origin.x += ([fPictureViewArea frame].size.width -
-                 [fPictureView frame].size.width) / 2.0;
+    
+    origin.x += ([fPictureViewArea frame].size.width -
+                 [fPictureView frame].size.width) / 2.0; 
     
     [fPictureView setFrameOrigin:origin];
     
@@ -1344,8 +1397,8 @@ return YES;
     controlboxorigin.y += 100;
     
     controlboxorigin.x += ([fPictureViewArea frame].size.width -
-                 [fPictureControlBox frame].size.width) / 2.0;
-                 
+                           [fPictureControlBox frame].size.width) / 2.0;
+    
     
     /* origin should be rounded to integer otherwise font/antialiasing
      * may be blurry.