| 1 |
from __future__ import annotations |
| 2 |
|
| 3 |
import argparse |
| 4 |
|
| 5 |
|
| 6 |
def main() -> None: |
| 7 |
parser = argparse.ArgumentParser() |
| 8 |
parser.add_argument("--codecs", action="store_true") |
| 9 |
parser.add_argument("--hwdevices", action="store_true") |
| 10 |
parser.add_argument("--hwconfigs", action="store_true") |
| 11 |
parser.add_argument("--version", action="store_true") |
| 12 |
args = parser.parse_args() |
| 13 |
|
| 14 |
if args.version: |
| 15 |
import av |
| 16 |
import av._core |
| 17 |
|
| 18 |
print(f"PyAV v{av.__version__}") |
| 19 |
|
| 20 |
by_config: dict = {} |
| 21 |
for libname, config in sorted(av._core.library_meta.items()): |
| 22 |
version = config["version"] |
| 23 |
if version[0] >= 0: |
| 24 |
by_config.setdefault( |
| 25 |
(config["configuration"], config["license"]), [] |
| 26 |
).append((libname, config)) |
| 27 |
|
| 28 |
for (config, license), libs in sorted(by_config.items()): |
| 29 |
print("library configuration:", config) |
| 30 |
print("library license:", license) |
| 31 |
for libname, config in libs: |
| 32 |
version = config["version"] |
| 33 |
print(f"{libname:<13} {version[0]:3d}.{version[1]:3d}.{version[2]:3d}") |
| 34 |
|
| 35 |
if args.hwdevices: |
| 36 |
from av.codec.hwaccel import hwdevices_available |
| 37 |
|
| 38 |
print("Hardware device types:") |
| 39 |
for x in hwdevices_available(): |
| 40 |
print(" ", x) |
| 41 |
|
| 42 |
if args.hwconfigs: |
| 43 |
from av.codec.codec import dump_hwconfigs |
| 44 |
|
| 45 |
dump_hwconfigs() |
| 46 |
|
| 47 |
if args.codecs: |
| 48 |
from av.codec.codec import dump_codecs |
| 49 |
|
| 50 |
dump_codecs() |
| 51 |
|
| 52 |
|
| 53 |
if __name__ == "__main__": |
| 54 |
main() |