From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 9B6CC40BC3 for ; Tue, 28 Dec 2021 15:07:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5E3E168AF34; Tue, 28 Dec 2021 17:07:22 +0200 (EET) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B0E1F68A8DB for ; Tue, 28 Dec 2021 17:07:16 +0200 (EET) Received: by mail-lf1-f42.google.com with SMTP id bu9so42028738lfb.7 for ; Tue, 28 Dec 2021 07:07:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vFLrZVCwJMCWwXGo4BU8yAgmpv5pHCbYMN+A/UYF8y8=; b=Y4btb4IRorjxiArKWRCcNvEiSbomT40OtAAAq89e0DLTCuNzKsLoQwT8Oq9+tGhtYr Lb3YXLsGKUd2wEzjyN0FRYDDWg+ltTux8aCjjgbynAqiSntsgZ5JseMYdgQwPHO7wTjp YZ+qu5Zz6b8Dimz4vQtjP/YXxLi1ZjS0kS9w+hYokF0tCfSaLcygzipIg3DLho8aUx9I PTyqlELgxhWE8FwMR77ngNx+DItdrbMPKfyJzm+gq1B7fqISCPVZHNadhhyttTp56Itl C46IEp6WHPqFAEpyAT8jHy7iwQ1dwbHy2ZobJJcvNq+uAvZR7/V2szFQHNZgWuHY2ptw UnZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vFLrZVCwJMCWwXGo4BU8yAgmpv5pHCbYMN+A/UYF8y8=; b=omh4pceTOA8O3Wqj3s8sSWswnEqb6zbdNLAHvGbGSFfpEkVwKXo3JurBVQzcBFTI/t x39pldyJyWRSbe2MoS2xrpOayMlC5XDFNV1Nc6lsa+krfGNaHf7wcX3/MNcEtRNKGLL7 qbPamnt2CmQAJBZtM9UZkY20xJzmxNdqC1h1rsvavsCAOwr5KuqkHfXTNcA4+EE4g2lE YIfGRPQOHA0RpFteVO1YyVfI3sd8BqbfS75YOaj6y3jhEj3B8iEg5vKYSw5mJpVn9mVT JUR7q2Y0ACbKQECW/IK40vahCnCZv5+YsDYPqxoaCYpArpDKzRB/hssnQXhfbnJc5vuB rWzA== X-Gm-Message-State: AOAM533/OIzJFO/nI/vIfK5M8BuFDRKwbeprJLUh34p/WlOoTAzS8iKn 2BVkemCqh7MNC72wWvUIkS4OBfZasf0= X-Google-Smtp-Source: ABdhPJzXLLJ48G4Tsl1YVFxetlxx0pRDTuEqKgErHoqd0Wt7JQLTKWkTsIuI5VzXwvK+HwHl68wK1w== X-Received: by 2002:a05:6512:c0b:: with SMTP id z11mr19803684lfu.48.1640704035570; Tue, 28 Dec 2021 07:07:15 -0800 (PST) Received: from localhost.localdomain (84-217-56-54.customers.ownit.se. [84.217.56.54]) by smtp.gmail.com with ESMTPSA id q2sm1961507lfr.64.2021.12.28.07.07.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Dec 2021 07:07:15 -0800 (PST) From: Diederick Niehorster To: ffmpeg-devel@ffmpeg.org Date: Tue, 28 Dec 2021 16:07:03 +0100 Message-Id: <20211228150703.1228-1-dcnieho@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [RFC v2] avdevice: lock to minor version of avformat 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: Diederick Niehorster Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: As per discussion on the list ( https://ffmpeg.org/pipermail/ffmpeg-devel/2021-June/281513.html, see especially https://ffmpeg.org/pipermail/ffmpeg-devel/2021-June/281586.html), to resolve the the unholy ABI-relationship between libavdevice and libavformat and allow easier working on the part of the avdevice API that lives in avformat, lock avdevice to a specific major and minor version of avformat. Signed-off-by: Diederick Niehorster --- libavdevice/avdevice.c | 10 ++++++++++ libavdevice/version.h | 10 ++++++++++ libavformat/utils.c | 5 +++++ libavformat/version.h | 11 +++++++++++ libavutil/macros.h | 3 +++ 5 files changed, 39 insertions(+) diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c index 8f460c7564..0c9b702eda 100644 --- a/libavdevice/avdevice.c +++ b/libavdevice/avdevice.c @@ -38,6 +38,16 @@ unsigned avdevice_version(void) return LIBAVDEVICE_VERSION_INT; } +unsigned avdevice_version_same_minor() +{ + // check version of loaded lavf has same major and minor version as + // this library was compiled against + if ((avformat_version_same_minor()) & ~0xFF != (LIBAVFORMAT_VERSION_INT & ~0xFF)) + abort(); + + return avdevice_version(); +} + const char * avdevice_configuration(void) { return FFMPEG_CONFIGURATION; diff --git a/libavdevice/version.h b/libavdevice/version.h index 41f568d6b0..83d8c67511 100644 --- a/libavdevice/version.h +++ b/libavdevice/version.h @@ -26,6 +26,7 @@ */ #include "libavutil/version.h" +#include "libavutil/macros.h" #define LIBAVDEVICE_VERSION_MAJOR 59 #define LIBAVDEVICE_VERSION_MINOR 1 @@ -48,4 +49,13 @@ */ #define FF_API_DEVICE_CAPABILITIES (LIBAVDEVICE_VERSION_MAJOR < 60) +/** + * avdevice_version_same_minor() expands to a function with + * the same minor and major version it was compiled against + * encoded in it. Enables locking to the minor version of + * other libraries they were compiled against. + */ +#define avdevice_version_same_minor AV_MAKE_MAJOR_MINOR_FUNC_NAME(device,LIBAVFORMAT_VERSION_MAJOR,LIBAVFORMAT_VERSION_MINOR) +unsigned avdevice_version_same_minor(); + #endif /* AVDEVICE_VERSION_H */ diff --git a/libavformat/utils.c b/libavformat/utils.c index 332ba534d2..607a777c3f 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -63,6 +63,11 @@ unsigned avformat_version(void) return LIBAVFORMAT_VERSION_INT; } +unsigned avformat_version_same_minor() +{ + return avformat_version(); +} + const char *avformat_configuration(void) { return FFMPEG_CONFIGURATION; diff --git a/libavformat/version.h b/libavformat/version.h index 379a68cc7c..661d074b12 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -28,6 +28,7 @@ */ #include "libavutil/version.h" +#include "libavutil/macros.h" // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) // Also please add any ticket numbers that you believe might be affected here @@ -63,4 +64,14 @@ #define FF_API_R_FRAME_RATE 1 + +/** + * avformat_version_same_minor() expands to a function with + * the same minor and major version it was compiled against + * encoded in it. Enables locking to the minor version of + * other libraries they were compiled against. + */ +#define avformat_version_same_minor AV_MAKE_MAJOR_MINOR_FUNC_NAME(format,LIBAVFORMAT_VERSION_MAJOR,LIBAVFORMAT_VERSION_MINOR) +unsigned avformat_version_same_minor(); + #endif /* AVFORMAT_VERSION_H */ diff --git a/libavutil/macros.h b/libavutil/macros.h index 2a7567c3ea..dab530a8a0 100644 --- a/libavutil/macros.h +++ b/libavutil/macros.h @@ -73,6 +73,9 @@ * @} */ +#define AV_MAKE_MAJOR_MINOR_FUNC_NAME_IMPL(name,major,minor) av ## name ## _version_ ## major ## _ ## minor +#define AV_MAKE_MAJOR_MINOR_FUNC_NAME(name,major,minor) AV_MAKE_MAJOR_MINOR_FUNC_NAME_IMPL(name,major,minor) + #define AV_PRAGMA(s) _Pragma(#s) #define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) -- 2.28.0.windows.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".