[MPlayer-cvslog] r37951 - trunk/libvo/vo_xv.c

al subversion at mplayerhq.hu
Sat Aug 26 23:51:25 EEST 2017


Author: al
Date: Sat Aug 26 23:51:25 2017
New Revision: 37951

Log:
vo_xv: Support NV12/21

Based-on-a-patch-by: Ville Syrjälä >syrjala sci fi<

Modified:
   trunk/libvo/vo_xv.c

Modified: trunk/libvo/vo_xv.c
==============================================================================
--- trunk/libvo/vo_xv.c	Sat Aug 26 23:44:15 2017	(r37950)
+++ trunk/libvo/vo_xv.c	Sat Aug 26 23:51:25 2017	(r37951)
@@ -413,6 +413,18 @@ static int draw_slice(uint8_t * image[],
         memcpy_pic(dst, image[idx_p2], w, h, xvimage[current_buf]->pitches[2],
             stride[idx_p2]);
         break;
+    case IMGFMT_NV12:
+    case IMGFMT_NV21:
+        x &= ~1;
+        y /= 2;
+        w &= ~1;
+        h /= 2;
+
+        dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[1] +
+            xvimage[current_buf]->pitches[1] * y + x;
+        memcpy_pic(dst, image[idx_p1], w, h, xvimage[current_buf]->pitches[1],
+            stride[idx_p1]);
+        break;
     }
 
     return 0;
@@ -496,6 +508,13 @@ static uint32_t get_image(mp_image_t * m
             mpi->stride[1] = xvimage[current_buf]->pitches[idx_p1];
             mpi->stride[2] = xvimage[current_buf]->pitches[idx_p2];
             break;
+        case IMGFMT_NV12:
+        case IMGFMT_NV21:
+            mpi->planes[1] =
+                xvimage[current_buf]->data +
+                xvimage[current_buf]->offsets[1];
+            mpi->stride[1] = xvimage[current_buf]->pitches[1];
+            break;
         }
         mpi->flags |= MP_IMGFLAG_DIRECT;
         mpi->priv = (void *)(intptr_t)current_buf;
@@ -511,6 +530,8 @@ static int is_supported_format(uint32_t
     case IMGFMT_YV12:
     case IMGFMT_I420:
     case IMGFMT_IYUV:
+    case IMGFMT_NV12:
+    case IMGFMT_NV21:
         return 1;
     default:
         return !mp_get_chroma_shift(image_format, NULL, NULL, NULL);


More information about the MPlayer-cvslog mailing list