From 63a8165740a751daf0d57e0a2401381f9ec99060 Mon Sep 17 00:00:00 2001 From: Vignesh Venkatasubramanian Date: Wed, 20 Sep 2023 12:13:27 -0700 Subject: [PATCH] android_jni: Include libyuv in version string only when available --- .../avifandroidjni/src/main/jni/libavif_jni.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/android_jni/avifandroidjni/src/main/jni/libavif_jni.cc b/android_jni/avifandroidjni/src/main/jni/libavif_jni.cc index 9b25fafb11..79a94f4ad1 100644 --- a/android_jni/avifandroidjni/src/main/jni/libavif_jni.cc +++ b/android_jni/avifandroidjni/src/main/jni/libavif_jni.cc @@ -376,10 +376,17 @@ FUNC(jstring, resultToString, jint result) { FUNC(jstring, versionString) { char codec_versions[256]; avifCodecVersions(codec_versions); + char libyuv_version[64]; + if (avifLibYUVVersion() > 0) { + snprintf(libyuv_version, sizeof(libyuv_version), " libyuv: %d.", + avifLibYUVVersion()); + } else { + *libyuv_version = 0; + } char version_string[512]; snprintf(version_string, sizeof(version_string), - "libavif: %s. Codecs: %s. libyuv: %d.", avifVersion(), - codec_versions, avifLibYUVVersion()); + "libavif: %s. Codecs: %s.%s", avifVersion(), + codec_versions, libyuv_version); return env->NewStringUTF(version_string); }