[MPlayer-dev-eng] [PATCH v2 5/5] vo_xv: Support NV12/21

Alexander Strasser eclipse7 at gmx.net
Sat Aug 26 23:59:15 EEST 2017


Committed the whole series to SVN.

I finally got time to do some more testing. Couldn't find any new issues and
committed basically as is plus slightly more complete cosmetics and a word on
the crashes that may be faced with previous implementation of vo xv should the
Xvideo driver actually support formats we don't.


  Alexander

On 2017-07-09 23:30 +0200, Alexander Strasser wrote:
> Based-on-a-patch-by: Ville Syrjälä >syrjala sci fi<
> Signed-off-by: Alexander Strasser <eclipse7 at gmx.net>
> ---
>  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);
> -- 


More information about the MPlayer-dev-eng mailing list