[vlc-commits] yuv: deal with crop (fixes #9160)

Rémi Denis-Courmont git at videolan.org
Wed Mar 12 17:50:50 CET 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Mar 12 18:50:10 2014 +0200| [202c1123af31ca78eb65d1388831d210dd2d1fe9] | committer: Rémi Denis-Courmont

yuv: deal with crop (fixes #9160)

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

 modules/video_output/yuv.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/modules/video_output/yuv.c b/modules/video_output/yuv.c
index deab061..f61d7b5 100644
--- a/modules/video_output/yuv.c
+++ b/modules/video_output/yuv.c
@@ -247,12 +247,19 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
     fprintf(sys->f, "FRAME\n");
     for (int i = 0; i < picture->i_planes; i++) {
         const plane_t *plane = &picture->p[i];
+        const uint8_t *pixels = plane->p_pixels;
+
+        pixels += (vd->fmt.i_x_offset * plane->i_visible_pitch)
+                  / vd->fmt.i_visible_height;
+
         for( int y = 0; y < plane->i_visible_lines; y++) {
-            const size_t written = fwrite(&plane->p_pixels[y*plane->i_pitch],
-                                          1, plane->i_visible_pitch, sys->f);
+            const size_t written = fwrite(pixels, 1, plane->i_visible_pitch,
+                                          sys->f);
             if (written != (size_t)plane->i_visible_pitch)
                 msg_Warn(vd, "only %zd of %d bytes written",
                          written, plane->i_visible_pitch);
+
+            pixels += plane->i_pitch;
         }
     }
     fflush(sys->f);



More information about the vlc-commits mailing list