|
1 | | -cimport libav as lib |
| 1 | +import cython |
| 2 | +import cython.cimports.libav as lib |
2 | 3 |
|
3 | | -# Initialise libraries. |
4 | 4 | lib.avdevice_register_all() |
5 | 5 |
|
6 | 6 | # Exports. |
7 | 7 | time_base = lib.AV_TIME_BASE |
8 | 8 |
|
9 | 9 |
|
10 | | -cdef decode_version(v): |
| 10 | +@cython.cfunc |
| 11 | +def decode_version(v): |
11 | 12 | if v < 0: |
12 | 13 | return (-1, -1, -1) |
13 | 14 |
|
14 | | - cdef int major = (v >> 16) & 0xff |
15 | | - cdef int minor = (v >> 8) & 0xff |
16 | | - cdef int micro = (v) & 0xff |
17 | | - |
| 15 | + major: cython.int = (v >> 16) & 0xFF |
| 16 | + minor: cython.int = (v >> 8) & 0xFF |
| 17 | + micro: cython.int = (v) & 0xFF |
18 | 18 | return (major, minor, micro) |
19 | 19 |
|
| 20 | + |
20 | 21 | # Return an informative version string. |
21 | 22 | # This usually is the actual release version number or a git commit |
22 | 23 | # description. This string has no fixed format and can change any time. It |
|
27 | 28 | "libavutil": dict( |
28 | 29 | version=decode_version(lib.avutil_version()), |
29 | 30 | configuration=lib.avutil_configuration(), |
30 | | - license=lib.avutil_license() |
| 31 | + license=lib.avutil_license(), |
31 | 32 | ), |
32 | 33 | "libavcodec": dict( |
33 | 34 | version=decode_version(lib.avcodec_version()), |
34 | 35 | configuration=lib.avcodec_configuration(), |
35 | | - license=lib.avcodec_license() |
| 36 | + license=lib.avcodec_license(), |
36 | 37 | ), |
37 | 38 | "libavformat": dict( |
38 | 39 | version=decode_version(lib.avformat_version()), |
39 | 40 | configuration=lib.avformat_configuration(), |
40 | | - license=lib.avformat_license() |
| 41 | + license=lib.avformat_license(), |
41 | 42 | ), |
42 | 43 | "libavdevice": dict( |
43 | 44 | version=decode_version(lib.avdevice_version()), |
44 | 45 | configuration=lib.avdevice_configuration(), |
45 | | - license=lib.avdevice_license() |
| 46 | + license=lib.avdevice_license(), |
46 | 47 | ), |
47 | 48 | "libavfilter": dict( |
48 | 49 | version=decode_version(lib.avfilter_version()), |
49 | 50 | configuration=lib.avfilter_configuration(), |
50 | | - license=lib.avfilter_license() |
| 51 | + license=lib.avfilter_license(), |
51 | 52 | ), |
52 | 53 | "libswscale": dict( |
53 | 54 | version=decode_version(lib.swscale_version()), |
54 | 55 | configuration=lib.swscale_configuration(), |
55 | | - license=lib.swscale_license() |
| 56 | + license=lib.swscale_license(), |
56 | 57 | ), |
57 | 58 | "libswresample": dict( |
58 | 59 | version=decode_version(lib.swresample_version()), |
59 | 60 | configuration=lib.swresample_configuration(), |
60 | | - license=lib.swresample_license() |
| 61 | + license=lib.swresample_license(), |
61 | 62 | ), |
62 | 63 | } |
63 | 64 |
|
|
0 commit comments