Re: [PATCH 4/5] vo xv: Limit output formats to what the vo actually supports

Ville Syrjälä <[email protected]>
Newsgroups gmane.comp.video.mplayer.devel
Message-ID <[email protected]>
On Thu, Jun 15, 2017 at 12:50:34AM +0200, Alexander Strasser wrote:
> Assumes the format IDs (FourCCs in this case) are the same in MPlayer
> and Xvideo.
> 
> That assumption is nothing new, but it was never checked if in case
> of a match, we actually supported that image format in vo xv.
> 
> Signed-off-by: Alexander Strasser <[email protected]>
> ---
>  libvo/vo_xv.c | 21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
> index ebce39a6b..3febbf748 100644
> --- a/libvo/vo_xv.c
> +++ b/libvo/vo_xv.c
> @@ -396,7 +396,8 @@ static int draw_slice(uint8_t * image[], int stride[], int w, int h,
>      switch (image_format) {
>      case IMGFMT_YV12:
>          idx_p1 = 2; idx_p2 = 1;
> -    default:
> +    case IMGFMT_I420:
> +    case IMGFMT_IYUV:
>          x /= 2;
>          y /= 2;
>          w /= 2;
> @@ -484,7 +485,8 @@ static uint32_t get_image(mp_image_t * mpi)
>          switch (image_format) {
>          case IMGFMT_YV12:
>              idx_p1 = 2; idx_p2 = 1;
> -        default:
> +        case IMGFMT_I420:
> +        case IMGFMT_IYUV:
>              mpi->planes[1] =
>                  xvimage[current_buf]->data +
>                  xvimage[current_buf]->offsets[idx_p1];
> @@ -503,10 +505,25 @@ static uint32_t get_image(mp_image_t * mpi)
>      return VO_FALSE;
>  }
>  
> +static int is_supported_format(uint32_t format)
> +{
> +    switch (format) {
> +    case IMGFMT_YV12:
> +    case IMGFMT_I420:
> +    case IMGFMT_IYUV:
> +        return 1;

This rejects all packed formats, which is probably not what you
intended.

Apart from that the patches look good to me. And they survived
a quick smoke test using NV12, YV12, I420, and YUY2 (after hacking
it into is_supported_format()).

> +    default:
> +        return 0;
> +    }
> +}
> +
>  static int query_format(uint32_t format)
>  {
>      uint32_t i;
>      int flag = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD | VFCAP_ACCEPT_STRIDE;       // FIXME! check for DOWN
> +    if (!is_supported_format(format)) {
> +        return 0;
> +    }
>  
>      /* check image formats */
>      for (i = 0; i < formats; i++)
> -- 
> 2.11.0
> _______________________________________________
> MPlayer-dev-eng mailing list
> [email protected]
> https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng

-- 
Ville Syrjälä
[email protected]
http://www.sci.fi/~syrjala/
_______________________________________________
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.