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 6E8CD40BB4 for ; Tue, 28 Dec 2021 13:20:14 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9C81868AF6B; Tue, 28 Dec 2021 15:20:11 +0200 (EET) Received: from mail-ua1-f43.google.com (mail-ua1-f43.google.com [209.85.222.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8CDDE68AE5A for ; Tue, 28 Dec 2021 15:20:05 +0200 (EET) Received: by mail-ua1-f43.google.com with SMTP id az37so11106085uab.12 for ; Tue, 28 Dec 2021 05:20:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=CzAzYemK880ZG3qowEEXgVvUExMy8+Za0JzugH/KBEo=; b=pu4ImbnfFIwD/98lzodwa93p6ozhctEi/GG7bq0nqtmuNqfBrpO9yoY/Zcm6I55zIo j1Y/v/0J0a5LHWb8+pV+iQrt4ruMp2qyMxSy/N8kDJ0uTnT7kosn59NrM3IvIfaGxC53 SNOzElS781ZjjElKa+70xpSaHjuEdiMxffUxr1ZyOoQDj/gqWKPI9ebTKaQwLVx/m9bF 6u+TXZ+uRvuWNQAg4EaiyDpCoyqGvhFsyQujOj846P9Tn99d2150GcM+pEIcJUIaLYmN X5341PDx3aCJdZTbcbV//gRhTX+N5Yfcwu0BPK9Rx7hGIdgdJwz9cHg1GtfHoOBX0Y4e IK6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=CzAzYemK880ZG3qowEEXgVvUExMy8+Za0JzugH/KBEo=; b=ZHdoTBznr4N8zwTaQM4BYtPYqFQ7ZhWyKtuUfgD5DVevdiPEtvuc+V3VZI4xxt7lwT de7Q/d2c6RS993BbC95t62mVL0ckFoJGjjQ+nvsDNX04PZtBaspYbhYXOxm2wPHUfbq+ VwWJK3Y+1qZ32PB+/f84TZB1dFp0IJKvVzXXqqfPJ/d8Q4DSDGny4MGTnYtu9Lu/S5d7 OeLjrRFb/L5erGGpiXe6c7AH1RniaQ9c3icT/7K1wQ2Vq3qGr30SELfx4JnmgVDYOnMy BLsz3yUG72Clr45EdYbJ5N1S4xkdrlLl8qhUSmi5IEu0LTAnswk4BFnuhuTxwDnRrv8C 94gg== X-Gm-Message-State: AOAM532nQ62BWuUh5xTv2JPGZuw0zZBmd1FRqHHs8b4U8BkBTY4vEo4b C/4QtIzd8/SL+pwouIciP2b3byd4iiNbPqf3TJ/to4B9/UY= X-Google-Smtp-Source: ABdhPJw1YxDmx5oCNvqizvXXxypJkH9MFhakWRRg1J56mELidm73ggbbC+knafJI7MliIw5nxxathcyRAq31Mb+fSHo= X-Received: by 2002:a05:6102:3911:: with SMTP id e17mr4073631vsu.27.1640697603696; Tue, 28 Dec 2021 05:20:03 -0800 (PST) MIME-Version: 1.0 References: <20211226171650.372-1-dcnieho@gmail.com> In-Reply-To: <20211226171650.372-1-dcnieho@gmail.com> From: "Diederick C. Niehorster" Date: Tue, 28 Dec 2021 14:19:47 +0100 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [RFC] 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 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: FWIW, the macro #define AV_MAKE_MAJOR_MINOR_FUNC_NAME(name,major,minor) AV_GLUE(av,name)AV_GLUE(_version_,major)AV_GLUE(_,minor) doesn't compile on patchwork (https://patchwork.ffmpeg.org/check/49062/), but worked fine for me on MSVC. Is MSVC non-compliant somehow? Suggestions appreciated, I'm no star in C macros. In any case, this is a discussion starter, so let it not compiling not hold us back from that. Cheers, Dee On Sun, Dec 26, 2021 at 6:17 PM Diederick Niehorster wrote: > > 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 | 2 ++ > 5 files changed, 38 insertions(+) > > diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c > index 8f460c7564..b608ec532f 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 avformat_version(); > +} > + > const char * avdevice_configuration(void) > { > return FFMPEG_CONFIGURATION; > diff --git a/libavdevice/version.h b/libavdevice/version.h > index 41f568d6b0..4c511a7f53 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 linking 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..2423800687 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 linking 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..dda1bf6452 100644 > --- a/libavutil/macros.h > +++ b/libavutil/macros.h > @@ -73,6 +73,8 @@ > * @} > */ > > +#define AV_MAKE_MAJOR_MINOR_FUNC_NAME(name,major,minor) AV_GLUE(av,name)AV_GLUE(_version_,major)AV_GLUE(_,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".