[MPlayer-dev-eng] [PATCH 4/5] vo xv: Limit output formats to what the vo actually supports

Alexander Strasser eclipse7 at gmx.net
Tue Jun 27 23:13:07 EEST 2017


On 2017-06-21 23:46 +0300, Ville Syrjälä wrote:
> 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 <eclipse7 at gmx.net>
> > ---
> >  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.

Yeah, that went too far :(

I am not yet exactly sure how I will extend this.

I was also confused because in vo xv and a (few others I guess) we
support packed formats in draw_image but not in draw_slice.

> 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()).

Thank you for testing and having a look at the patches!

I am intending to push when I have code in place to allow the packed
formats again.


  Alexander


> > +    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++)
> > -- 


More information about the MPlayer-dev-eng mailing list