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