Print both compiled and linked versions of libs

On --version, print both the version scrcpy had been compiled against,
and the version linked at runtime.
This commit is contained in:
Romain Vimont 2022-02-08 21:06:49 +01:00
parent 9477594f80
commit 9a546ef1af

View file

@ -9,21 +9,49 @@
void void
scrcpy_print_version(void) { scrcpy_print_version(void) {
printf("\ndependencies:\n"); printf("\nDependencies (compiled / linked):\n");
printf(" - SDL %d.%d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION,
SDL_PATCHLEVEL); SDL_version sdl;
printf(" - libavcodec %d.%d.%d\n", LIBAVCODEC_VERSION_MAJOR, SDL_GetVersion(&sdl);
LIBAVCODEC_VERSION_MINOR, printf(" - SDL: %u.%u.%u / %u.%u.%u\n",
LIBAVCODEC_VERSION_MICRO); SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL,
printf(" - libavformat %d.%d.%d\n", LIBAVFORMAT_VERSION_MAJOR, (unsigned) sdl.major, (unsigned) sdl.minor, (unsigned) sdl.patch);
LIBAVFORMAT_VERSION_MINOR,
LIBAVFORMAT_VERSION_MICRO); unsigned avcodec = avcodec_version();
printf(" - libavutil %d.%d.%d\n", LIBAVUTIL_VERSION_MAJOR, printf(" - libavcodec: %u.%u.%u / %u.%u.%u\n",
LIBAVUTIL_VERSION_MINOR, LIBAVCODEC_VERSION_MAJOR,
LIBAVUTIL_VERSION_MICRO); LIBAVCODEC_VERSION_MINOR,
LIBAVCODEC_VERSION_MICRO,
AV_VERSION_MAJOR(avcodec),
AV_VERSION_MINOR(avcodec),
AV_VERSION_MICRO(avcodec));
unsigned avformat = avformat_version();
printf(" - libavformat: %u.%u.%u / %u.%u.%u\n",
LIBAVFORMAT_VERSION_MAJOR,
LIBAVFORMAT_VERSION_MINOR,
LIBAVFORMAT_VERSION_MICRO,
AV_VERSION_MAJOR(avformat),
AV_VERSION_MINOR(avformat),
AV_VERSION_MICRO(avformat));
unsigned avutil = avutil_version();
printf(" - libavutil: %u.%u.%u / %u.%u.%u\n",
LIBAVUTIL_VERSION_MAJOR,
LIBAVUTIL_VERSION_MINOR,
LIBAVUTIL_VERSION_MICRO,
AV_VERSION_MAJOR(avutil),
AV_VERSION_MINOR(avutil),
AV_VERSION_MICRO(avutil));
#ifdef HAVE_V4L2 #ifdef HAVE_V4L2
printf(" - libavdevice %d.%d.%d\n", LIBAVDEVICE_VERSION_MAJOR, unsigned avdevice = avdevice_version();
LIBAVDEVICE_VERSION_MINOR, printf(" - libavdevice: %u.%u.%u / %u.%u.%u\n",
LIBAVDEVICE_VERSION_MICRO); LIBAVDEVICE_VERSION_MAJOR,
LIBAVDEVICE_VERSION_MINOR,
LIBAVDEVICE_VERSION_MICRO,
AV_VERSION_MAJOR(avdevice),
AV_VERSION_MINOR(avdevice),
AV_VERSION_MICRO(avdevice));
#endif #endif
} }