client API: add and use the MPV_MAKE_VERSION macro

This is probably nicer. The actual version number doesn't change (other
than the minor being incremented).

The "| 0UL" is to make the type unsigned long int, like it was before.
This commit is contained in:
wm4 2014-08-05 02:23:14 +02:00
parent bdf607ea5f
commit 43ddf2099b
3 changed files with 9 additions and 10 deletions

View File

@ -25,6 +25,7 @@ API changes
:: ::
1.3 - add MPV_MAKE_VERSION()
1.2 - remove "stream-time-pos" property (no replacement) 1.2 - remove "stream-time-pos" property (no replacement)
1.1 - remap dvdnav:// to dvd:// 1.1 - remap dvdnav:// to dvd://
- add "--cache-file", "--cache-file-size" - add "--cache-file", "--cache-file-size"

View File

@ -158,12 +158,11 @@ extern "C" {
* number is incremented. This affects only C part, and not properties and * number is incremented. This affects only C part, and not properties and
* options. * options.
* *
* The version number is often converted into a human readable form by writing * You can use MPV_MAKE_VERSION() and compare the result with integer
* the major and minor version number in decimal. E.g.: * relational operators (<, >, <=, >=).
* version 0x001001FF
* becomes 16.511 (dec(0x0010) + "." + dec(0x01FF))
*/ */
#define MPV_CLIENT_API_VERSION 0x00010002UL #define MPV_MAKE_VERSION(major, minor) (((major) << 16) | (minor) | 0UL)
#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 3)
/** /**
* Return the MPV_CLIENT_API_VERSION the mpv source has been compiled with. * Return the MPV_CLIENT_API_VERSION the mpv source has been compiled with.

View File

@ -450,11 +450,10 @@ def build(ctx):
if build_shared or build_static: if build_shared or build_static:
if build_shared: if build_shared:
ctx.load("syms") ctx.load("syms")
vnum = int(re.search('^#define MPV_CLIENT_API_VERSION 0x(.*)UL$', vre = '^#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION\((.*), (.*)\)$'
ctx.path.find_node("libmpv/client.h").read(), libmpv_header = ctx.path.find_node("libmpv/client.h").read()
re.M) major, minor = re.search(vre, libmpv_header, re.M).groups()
.group(1), 16) libversion = major + '.' + minor + '.0'
libversion = str(vnum >> 16) + '.' + str(vnum & 0xffff) + '.0'
def _build_libmpv(shared): def _build_libmpv(shared):
features = "c " features = "c "