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

Sebastien Zwickert dilaroga at gmail.com
Thu Aug 23 14:28:46 CEST 2012


On Aug 23, 2012, at 1:49 PM, Clément Bœsch <ubitux at gmail.com> wrote:

> 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?

An alternative was to use the old Gestalt Manager API but this API became deprecated since 10.8
and apple did not provide any replacement API.
There's a radar opened about this:
http://openradar.appspot.com/11798430

Another one is to use the kCFCoreFoundationVersionNumber macro to do a runtime version check.


Best regards,

--
Sebastien Zwickert



More information about the ffmpeg-devel mailing list