[PATCH v2 5/5] vo_xv: Support NV12/21

Alexander Strasser <[email protected]>
Newsgroups gmane.comp.video.mplayer.devel
Message-ID <1f033dd354a0597c0816fbbfe49a00241ce4b7f8.1499634736.git.eclipse7@gmx.net>
Based-on-a-patch-by: Ville Syrjälä >syrjala sci fi<
Signed-off-by: Alexander Strasser <[email protected]>
---
 libvo/vo_xv.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index 3aaf12417..0fc55130d 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -413,6 +413,18 @@ static int draw_slice(uint8_t * image[], int stride[], int w, int h,
         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 * mpi)
             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 format)
     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);
-- 
2.13.2


  Alexander
_______________________________________________
MPlayer-dev-eng mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.