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 0EF8B453BD for ; Mon, 28 Aug 2023 08:52:40 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B0F1768C4FB; Mon, 28 Aug 2023 11:52:37 +0300 (EEST) Received: from out162-62-57-87.mail.qq.com (out162-62-57-87.mail.qq.com [162.62.57.87]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5187A6801DB for ; Mon, 28 Aug 2023 11:52:30 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1693212741; bh=iXXuNMPKDDkWkKBhzsUdnD4MS80SfwXJPLWRxRCHoo0=; h=From:To:Cc:Subject:Date; b=uXrj5uuzDpRJ7jvey5Pp3yfKWTURgUSF2SHeTqfieWQx8ti3DyfewojhSRk6wMjB3 bT2WbcI/7PTJwMJhfxTsZGZ1l7bWPxfG0yZkSpmMKuMhFu/HACaXI+SSpqMRutHkw4 vXqxodhsKrg1GLq1orVEnGlgr2+kF4aEiVrOeN3M= Received: from localhost.localdomain ([119.147.10.189]) by newxmesmtplogicsvrszb9-0.qq.com (NewEsmtp) with SMTP id D149CE6B; Mon, 28 Aug 2023 16:52:20 +0800 X-QQ-mid: xmsmtpt1693212740to9gw1gyr Message-ID: X-QQ-XMAILINFO: N7NMbzIEsXzdFh6ZiFCeLVImHwnZeNO6xx6rKkpvSLzo3cftRQczCXs6XMynMl IJzS53fcu5IBV1S6lG7gX6wkF7VuNUQNcYR3O7tcJLyP0YHtRIPATNylWDQCy3cNd6TuAeY0TdOV vHt0KPIPb6zi+3T33NQzIOYklKzAwz8sO+uw6sScqqiM+jN64G3Ir7Z4QNJ/F3NrHr3MVJbok3JF /+ZebX7fz7lYn16M7CCqSqPi/sP91jwYGUyLVeujMonmt2j7/PDBX//7HznFUBaDd7I38LuHptJc chJXxLLNSx+W/DwW6KpnBN5/vzVird4VLeLDhquduQgR99GK4ufbLDDSquC2tdV8h824aINH0bTy rDZcZlb0xF2mvD6IEKH1I4XXldjPc7wpVubyrrSMcn0HDn1cphnto1WIHKEwcezQOIn/VUroOvCD 7q8Y+S4cjwIHvVRa5ZhlltaOBgXQMrDziolB/kcCnOo8Qxt3UFvgTUopgzSUXm0UkeYbt4fmbbxg sJFaOqRUL97wGmY3mSSqSUave2fUJQRuEh4WFo8mTHEw/KV/gO/E7QKFsZ0lFe4s2ezVGKcAioBd cjHa+9iolNFi+m+8SWP4+hWb4uCWLQSHZ4Msr5oMQmFnGPVd7CF2LFp8P7Lm/q0qULN9Al+WO5o+ Zmf6tFnsfiyR26HoKK4ExpmsWODMzcDgZYqj+9dQiTsDFtanamFohAhjgiZNtPtWVLb6+0wdSn/8 GQ6KrTIQhFWdODaOnzBn3FtqqTwVOQEJbpJTyw2j7ibAjNSjObbTZCBDnMC2+OeWrFSs7uesKMNa WBcSdvn+tdcsUkJ3/a0o0BNCQBFz9L5U30ozxpPyh9A+EkOxmmcHBtgzXA5uMivNRe9jFPBQ1Mlx uv6rw5bo3pajlg9eV7hZJOPVtJfP2XEb0bjn8iZT8/BIL0Wjb6scPSzz4up9aPmxWB/jqmSNa0g2 0eiJcAIPazqa+6bUiMh5AtUo75cVVdCG6CeATfOdPKJh0bAdpmeMmqHuB8V15YWLD6g1GElXIgL7 DJ2+hltPP1FErX7R86IdhcRx3ZQbGRAF04uyfbtZjbWYPWotfz X-QQ-XMRINFO: OWPUhxQsoeAVDbp3OJHYyFg= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Tue, 29 Aug 2023 00:52:18 +0800 X-OQ-MSGID: <20230828165218.617020-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avutil/avutil: make AV_TIME_BASE_Q available in C++ 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: Zhao Zhili 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: From: Zhao Zhili ISO C++ forbids compound-literals. It's not available with MSVC. This is a known issue from 10 years ago, and that's why there is a av_get_time_base_q(). Since we have no plan to remove AV_TIME_BASE_Q, just make it available in C++. There are multiple choices: 1. Use C++11 syntax: AVRational{1, AV_TIME_BASE} Users may still use C++98 to write new code. So no. 2. Use av_get_time_base_q(). It's for this purpose. But it's not compile time constants as AV_TIME_BASE_Q in C. So I choose av_make_q() as Anton's suggestion. https://libav-devel.libav.narkive.com/ZQCWfTun/patch-0-2-fix-avutil-h-usage-from-c Signed-off-by: Zhao Zhili --- doc/APIchanges | 3 +++ libavutil/avutil.h | 5 +++++ libavutil/version.h | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index ad1efe708d..233c53b04a 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09 API changes, most recent first: +2023-08-28 - xxxxxxxxxx - lavu 58.18.100 - avutil.h + Make AV_TIME_BASE_Q compatible with C++. + 2023-08-18 - xxxxxxxxxx - lavu 58.17.100 - channel_layout.h All AV_CHANNEL_LAYOUT_* macros are now compatible with C++ 17 and older. diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 64b68bdbd3..48e54e25b9 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -257,7 +257,12 @@ const char *av_get_media_type_string(enum AVMediaType media_type); * Internal time base represented as fractional value */ +#ifdef __cplusplus +/* ISO C++ forbids compound-literals. */ +#define AV_TIME_BASE_Q av_make_q(1, AV_TIME_BASE) +#else #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} +#endif /** * @} diff --git a/libavutil/version.h b/libavutil/version.h index bc43baca9f..6d27f91cce 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 58 -#define LIBAVUTIL_VERSION_MINOR 17 +#define LIBAVUTIL_VERSION_MINOR 18 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ -- 2.25.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".