[MPlayer-dev-eng] libvo return values

Ivo ivop at euronet.nl
Thu Jul 28 21:59:33 CEST 2005


On Thursday 28 July 2005 20:55, Rich Felker wrote:
> On Thu, Jul 28, 2005 at 05:17:32PM +0200, Ivo wrote:
> > Another inconsistency is the following: some functions return VO_TRUE
> > (1) on success and VO_FALSE(0) on failure, which seems correct to me.
> > But others return 0 on success. Shouldn't all functions follow the same
> > rules? And preferably return VO_TRUE/FALSE/ERROR/etc. ?
>
> IMO it doesn't matter for internal functions that aren't part of the
> vo api.

Yes, agreed. But for example config(), which is part of the api, behaves 
wrong IMO. It returns 0 on success and -1 on failure (which doesn't work 
because the return value is unsigned atm, but that will be fixed). In fact, 
the calling code in vf_vo inverts the return value:

[the end of vf_vo's config function]
[..]
if(video_out->config(width,height,d_width,d_height,flags,"MPlayer",outfmt))
    return 0;

    ++vo_config_count;
    return 1;
}

So it returns 0 (failure) if it receives !0 from the vo, and 1 (success) if 
it receives 0. I think config should also return proper VO_TRUE/FALSE 
return values. Might be a lot of work though, because all vo->config()'s 
have to fixed then. What do you think?

--Ivo




More information about the MPlayer-dev-eng mailing list