From patchwork Sat Dec 9 21:07:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalev Lember X-Patchwork-Id: 44991 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1225:b0:181:818d:5e7f with SMTP id v37csp2098517pzf; Sat, 9 Dec 2023 13:08:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IE8/eKzRZ6WAE6IFLi2qAdin4A9S9a46ZW6G6cgkS+srDO1fCa7EsUWW39FJt2d93v/dgIK X-Received: by 2002:a17:907:9815:b0:a08:291c:62c9 with SMTP id ji21-20020a170907981500b00a08291c62c9mr1088000ejc.5.1702156110758; Sat, 09 Dec 2023 13:08:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702156110; cv=none; d=google.com; s=arc-20160816; b=r4YxyBaTCD1dW8hehKAhlpkERS8MtC6ysRiitYWV+Cgs3IS5kvBWh6fXlGInZWtDp5 VhgrxUWaFnn17khwqMu/U91ye8NGcDXfB3ehdm4zu+HiwVDwncBJgf4UfbwRLCXZaQpz 0GCKzPTaN+xv7VDOb2+/upqzmxDRpKzCqK5rxqwlRmlAYGHFSF9yfaSYMOMax1jAUPM/ +kt2O2yCmd7YhylArGziFjv44IbXbLuURoCkWXKBhraRe31awPG7nMReHw5EwAyZjhXh yE3IvcY9r0HnoXFzVSm0mZtujRazllZmnPSi4LjMA6eGHfJafi5df1mK0+m1SAaC6BKV hX3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=932uxrzn+aFCMdLAckXlKVrKYt4sjCsPUZFN7uuI45A=; fh=+rq42RRx4hgnT+vZ8smKdAk9ZcXTF6nl9JXuRNqQChE=; b=eWthZL3jxK8gFGchSUj0SMEWaZaLACaIdDGSLjjJGolFN1m34QAT8SWIe5ErFIPDys u0Nqep0tDfkXKtak7jJP4IQnkRxA91mUWh/UQcN6KPQH/KTmaZlM8X83jHXRYxCWBL06 4ddVAcSTt/LekKmvag23YZvppW2LDcjAAP9rP0WG7ZRWBwUMAFqSfLUogv2tiJ/7gT1w vVm1EmadYiqp/E7gPFKcWPdYfypJd3LPg9wREhe+87DTr9euQu1a5pqwtDOCvmtB24A4 MVY4yK28pyEkC+MZQQ38aw/Pep+MBbW4erbVoZ1UAkVxdqg9dgvslmOrkkmf1koZs4Hf 2cQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@redhat.com header.s=mimecast20190719 header.b=HsM7IYSR; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p6-20020a170906b20600b00a1df85e426dsi2131946ejz.872.2023.12.09.13.08.30; Sat, 09 Dec 2023 13:08:30 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@redhat.com header.s=mimecast20190719 header.b=HsM7IYSR; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4330F68D077; Sat, 9 Dec 2023 23:08:27 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B4DB068CF33 for ; Sat, 9 Dec 2023 23:08:20 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702156099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v5FZs/2iyicKf1AYPVaMRbpY4Nh7fiURbqbIawpgH3k=; b=HsM7IYSRL9xQexAAGnA+tqhjp2JPY0PAks64KU9/q/mrYbdNfTxTpyBlA6HZIXLv8EZV9t ymbbEinOcmCi+IwAOt8owJcb+POk8TPreyPV2eBqqLYfG7LVFmXahb5/d5PtvehX+0rvwc er9Jh6hdj/yxk7JXUTdmD7iVcQLZUYA= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-257-FTETbtZGMX-WcLpQjsKHZQ-1; Sat, 09 Dec 2023 16:08:17 -0500 X-MC-Unique: FTETbtZGMX-WcLpQjsKHZQ-1 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2c9fdb15388so25888431fa.2 for ; Sat, 09 Dec 2023 13:08:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702156095; x=1702760895; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=v5FZs/2iyicKf1AYPVaMRbpY4Nh7fiURbqbIawpgH3k=; b=FFbMLUjSk8QCIP+tAslxF9OtSx3LFUfQUuPjwTqCZF9kFTZPqZi0shqIW8bYpobGkq bR/wsS6fiJgEqocHwJaVN+T1vwy8vFr1NCCAZv0Yq4TedoFg+wNGqu7NZOyo7J3VtLXn SzxfVQDsMcCbmm45PP0jyJUXkExTt7TEXaMoDQW7KqXtvXgdvq23qTK7aAWkOA24iN7j C/e45p85tJlo35jEH5uUE8NdZQqTtoZMZ27sm6xtWpmJcsQ9upe1wntei5qhM4nVpI1e 3lw+NYXZRCHq36PmpOXJ15GM2BH/hgHj830qkzAFbziHTIu3kSjVi7kVFWwAPxkLM7ga 57lg== X-Gm-Message-State: AOJu0YyMHx/TypRIgQf13oFJqpXgk+Gl84jALRgcC/Gp10mfjksVXn3B FNMTl9V7Rt5gRTKFlwoeDCPraiISMhi5dXqgeCYZzDuGcbBPOyn+jocdgdwe3/wO+DbSdJn2aHa UEgnF6fp92XZamLAR9Mo/UH/HyIHUlXmK2zuAYXotFQ7+EAWErU7NG0lC8PDqVaeaNtLvkCLTHg qJ X-Received: by 2002:a2e:b048:0:b0:2ca:24ea:fac1 with SMTP id d8-20020a2eb048000000b002ca24eafac1mr712953ljl.79.1702156094993; Sat, 09 Dec 2023 13:08:14 -0800 (PST) X-Received: by 2002:a2e:b048:0:b0:2ca:24ea:fac1 with SMTP id d8-20020a2eb048000000b002ca24eafac1mr712948ljl.79.1702156094593; Sat, 09 Dec 2023 13:08:14 -0800 (PST) Received: from collie.lan (c188-149-247-5.bredband.tele2.se. [188.149.247.5]) by smtp.gmail.com with ESMTPSA id w9-20020a05651c118900b002ca01fd928dsm636655ljo.64.2023.12.09.13.08.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Dec 2023 13:08:14 -0800 (PST) From: Kalev Lember To: ffmpeg-devel@ffmpeg.org Date: Sat, 9 Dec 2023 22:07:31 +0100 Message-ID: <20231209210731.201099-1-klember@redhat.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [FFmpeg-devel] [PATCH] lavc/libopenh264: Drop openh264 runtime version checks X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Kalev Lember Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 7yTfWsSHQkfB With the way the runtime checks are currently set up, every single openh264 release, no matter how minor, is considered an ABI break and requires ffmpeg recompilation. This is unnecessarily strict because it doesn't allow downstream distributions to ship any openh264 bug fix version updates without breaking ffmpeg's openh264 support. Years ago, at the time when ffmpeg's openh264 support was merged, openh264 releases were done without a versioned soname (the library was just libopenh264.so, unversioned). Since then, starting with version 1.3.0, openh264 has started using versioned sonames and the intent has been to bump the soname every time there's a new release with an ABI change. This patch drops the exact version check and instead adds a minimum requirement on 1.3.0 to the configure script. Signed-off-by: Kalev Lember --- configure | 2 +- libavcodec/libopenh264.c | 15 --------------- libavcodec/libopenh264.h | 2 -- libavcodec/libopenh264dec.c | 4 ---- libavcodec/libopenh264enc.c | 4 ---- 5 files changed, 1 insertion(+), 26 deletions(-) diff --git a/configure b/configure index 7d2ee66000..29b0e463a1 100755 --- a/configure +++ b/configure @@ -6799,7 +6799,7 @@ enabled libopencv && { check_headers opencv2/core/core_c.h && { check_pkg_config libopencv opencv opencv2/core/core_c.h cvCreateImageHeader || require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } || require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; } -enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion +enabled libopenh264 && require_pkg_config libopenh264 "openh264 >= 1.3.0" wels/codec_api.h WelsGetCodecVersion enabled libopenjpeg && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version || { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } } enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++" diff --git a/libavcodec/libopenh264.c b/libavcodec/libopenh264.c index 0f6d28ed88..c80c85ea8b 100644 --- a/libavcodec/libopenh264.c +++ b/libavcodec/libopenh264.c @@ -46,18 +46,3 @@ void ff_libopenh264_trace_callback(void *ctx, int level, const char *msg) int equiv_ffmpeg_log_level = libopenh264_to_ffmpeg_log_level(level); av_log(ctx, equiv_ffmpeg_log_level, "%s\n", msg); } - -int ff_libopenh264_check_version(void *logctx) -{ - // Mingw GCC < 4.7 on x86_32 uses an incorrect/buggy ABI for the WelsGetCodecVersion - // function (for functions returning larger structs), thus skip the check in those - // configurations. -#if !defined(_WIN32) || !defined(__GNUC__) || !ARCH_X86_32 || AV_GCC_VERSION_AT_LEAST(4, 7) - OpenH264Version libver = WelsGetCodecVersion(); - if (memcmp(&libver, &g_stCodecVersion, sizeof(libver))) { - av_log(logctx, AV_LOG_ERROR, "Incorrect library version loaded\n"); - return AVERROR(EINVAL); - } -#endif - return 0; -} diff --git a/libavcodec/libopenh264.h b/libavcodec/libopenh264.h index dbb9c5d429..0b462d6fdc 100644 --- a/libavcodec/libopenh264.h +++ b/libavcodec/libopenh264.h @@ -34,6 +34,4 @@ void ff_libopenh264_trace_callback(void *ctx, int level, const char *msg); -int ff_libopenh264_check_version(void *logctx); - #endif /* AVCODEC_LIBOPENH264_H */ diff --git a/libavcodec/libopenh264dec.c b/libavcodec/libopenh264dec.c index 7d650ae03e..b6a9bba2dc 100644 --- a/libavcodec/libopenh264dec.c +++ b/libavcodec/libopenh264dec.c @@ -52,13 +52,9 @@ static av_cold int svc_decode_init(AVCodecContext *avctx) { SVCContext *s = avctx->priv_data; SDecodingParam param = { 0 }; - int err; int log_level; WelsTraceCallback callback_function; - if ((err = ff_libopenh264_check_version(avctx)) < 0) - return AVERROR_DECODER_NOT_FOUND; - if (WelsCreateDecoder(&s->decoder)) { av_log(avctx, AV_LOG_ERROR, "Unable to create decoder\n"); return AVERROR_UNKNOWN; diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c index f518d0894e..6f231d22b2 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -110,14 +110,10 @@ static av_cold int svc_encode_init(AVCodecContext *avctx) { SVCContext *s = avctx->priv_data; SEncParamExt param = { 0 }; - int err; int log_level; WelsTraceCallback callback_function; AVCPBProperties *props; - if ((err = ff_libopenh264_check_version(avctx)) < 0) - return AVERROR_ENCODER_NOT_FOUND; - if (WelsCreateSVCEncoder(&s->encoder)) { av_log(avctx, AV_LOG_ERROR, "Unable to create encoder\n"); return AVERROR_UNKNOWN;