[PATCH 5/5] vo_xv: Support NV12/21
Alexander Strasser <[email protected]>
| Newsgroups | gmane.comp.video.mplayer.devel |
|---|---|
| Message-ID | <a9536a34619d85114ddd628c320208b0ae2d40e1.1497479932.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 | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c index 3febbf748..222c72f5f 100644 --- a/libvo/vo_xv.c +++ b/libvo/vo_xv.c @@ -386,6 +386,7 @@ static int draw_slice(uint8_t * image[], int stride[], int w, int h, int x, int y) { uint8_t *dst; + unsigned num_planes = 2; int idx_p1 = 1, idx_p2 = 2; dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[0] + @@ -398,9 +399,14 @@ static int draw_slice(uint8_t * image[], int stride[], int w, int h, idx_p1 = 2; idx_p2 = 1; case IMGFMT_I420: case IMGFMT_IYUV: + num_planes = 3; x /= 2; - y /= 2; w /= 2; + case IMGFMT_NV12: + case IMGFMT_NV21: + x &= ~1; + w &= ~1; + y /= 2; h /= 2; dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[1] + @@ -408,10 +414,12 @@ static int draw_slice(uint8_t * image[], int stride[], int w, int h, memcpy_pic(dst, image[idx_p1], w, h, xvimage[current_buf]->pitches[1], stride[idx_p1]); + if (num_planes == 3) { dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[2] + xvimage[current_buf]->pitches[2] * y + x; memcpy_pic(dst, image[idx_p2], w, h, xvimage[current_buf]->pitches[2], stride[idx_p2]); + } break; } @@ -496,6 +504,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 +526,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 0; -- 2.11.0 _______________________________________________ MPlayer-dev-eng mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng