[vlc-commits] macosx vout: really fix crop this time

David Fuhrmann git at videolan.org
Fri Apr 20 12:35:48 CEST 2012


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Fri Apr 20 12:26:02 2012 +0200| [4a1c818c067a5481f06bcbcf0d7a5d7b56db1a8b] | committer: David Fuhrmann

macosx vout: really fix crop this time

...hopefully.
This avoids distorted images, and also preserves a correct ar, even on crop 1:1.

refs #6080

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4a1c818c067a5481f06bcbcf0d7a5d7b56db1a8b
---

 modules/video_output/macosx.m |   34 +---------------------------------
 1 files changed, 1 insertions(+), 33 deletions(-)

diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index d135ef4..de8001d 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -296,7 +296,7 @@ static void PictureDisplay(vout_display_t *vd, picture_t *pic, subpicture_t *sub
 {
     vout_display_sys_t *sys = vd->sys;
     [sys->glView setVoutFlushing:YES];
-    vout_display_opengl_Display(sys->vgl, &vd->fmt );
+    vout_display_opengl_Display(sys->vgl, &vd->source );
     [sys->glView setVoutFlushing:NO];
     picture_Release (pic);
     sys->has_first_frame = true;
@@ -388,34 +388,6 @@ static int Control (vout_display_t *vd, int query, va_list ap)
 
             vout_display_PlacePicture (&place, source, &cfg_tmp, false);
 
-            if (query == VOUT_DISPLAY_CHANGE_SOURCE_CROP || query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT)
-            {
-                vd->fmt.i_width  = vd->source.i_width  * place.width  / vd->source.i_visible_width;
-                vd->fmt.i_height = vd->source.i_height * place.height / vd->source.i_visible_height;
-                vd->fmt.i_visible_width  = vd->source.i_visible_width;
-                vd->fmt.i_visible_height = vd->source.i_visible_height;
-                vd->fmt.i_x_offset = vd->source.i_x_offset * place.width  / vd->source.i_visible_width;
-                vd->fmt.i_y_offset = vd->source.i_y_offset * place.height / vd->source.i_visible_height;
-
-                if (vd->fmt.i_x_offset > 0)
-                {
-                    if (vd->source.i_width / vd->fmt.i_x_offset <= 4)
-                    {
-                        /* hack and special case for the "Default" state
-                         * The 'Default' state tries to set the dimensions with a huge x offset and a weird
-                         * width / height ratio, which definitely isn't the default for the played media. 
-                         * That's why, we enforce the media's actual dimensions here.
-                         * The quotient of 4 is a stochastic value, which isn't reached by any other crop state. */
-                        vd->fmt.i_width  = vd->source.i_width;
-                        vd->fmt.i_height = vd->source.i_height;
-                        vd->fmt.i_visible_width  = vd->source.i_width;
-                        vd->fmt.i_visible_height = vd->source.i_height;
-                        vd->fmt.i_x_offset = 0;
-                        vd->fmt.i_y_offset = 0;
-                    }
-                }
-            }
-
             /* For resize, we call glViewport in reshape and not here.
                This has the positive side effect that we avoid erratic sizing as we animate every resize. */
             if (query != VOUT_DISPLAY_CHANGE_DISPLAY_SIZE)
@@ -424,10 +396,6 @@ static int Control (vout_display_t *vd, int query, va_list ap)
                 glViewport (place.x, cfg_tmp.display.height - (place.y + place.height), place.width, place.height);
             }
 
-            // this should not be needed, but currently it improves crop somehow, when we are in fullscreen
-            if (query == VOUT_DISPLAY_CHANGE_SOURCE_CROP)
-                [sys->glView performSelectorOnMainThread:@selector(reshapeView:) withObject:nil waitUntilDone:NO];
-
             [o_pool release];
             return VLC_SUCCESS;
         }



More information about the vlc-commits mailing list