[FFmpeg-devel] [PATCH 1/2] osx: detect version of mac os

Clément Bœsch ubitux at gmail.com
Thu Aug 23 13:49:18 CEST 2012


On Thu, Aug 23, 2012 at 10:49:05AM +0000, Paul B Mahol wrote:
[...]
> > diff --git a/libavutil/osx.h b/libavutil/osx.h
> > new file mode 100644
> > index 0000000..afd6c4e
> > --- /dev/null
> > +++ b/libavutil/osx.h
> > @@ -0,0 +1,34 @@
> > +/*
> > + * Copyright (c) 2012, Xidorn Quan
> > + *
> > + * This file is part of FFmpeg.
> > + *
> > + * FFmpeg is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU Lesser General Public
> > + * License as published by the Free Software Foundation; either
> > + * version 2.1 of the License, or (at your option) any later version.
> > + *
> > + * FFmpeg is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > + * Lesser General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU Lesser General Public
> > + * License along with FFmpeg; if not, write to the Free Software
> > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
> > USA
> > + */
> > +
> > +#ifndef AVUTIL_OSX_H
> > +#define AVUTIL_OSX_H
> > +
> > +/**
> > + * Get version of Mac OS X
> > + *
> > + * @param major  pointer to store major version
> > + * @param minor  pointer to store minor version
> > + * @param bugfix pointer to store bugfix version
> > + * @return       zero if succeed, -1 otherwise
> > + */
> > +int av_get_osx_version(int *major, int *minor, int *bugfix);
> > +
> > +#endif /* AVUTIL_OSX_H */
> 
> I dislike such approach.

Can you elaborate on this and the potential alternatives?

One thing that doesn't seem to be OK with that is that the version doesn't
exist if you're not on OSX, so you can't use such function without a
previous check for OSX, or else it won't link. Also, having a public
function which might not be defined sounds wrong to me.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120823/325067b6/attachment.asc>


More information about the ffmpeg-devel mailing list