[FFmpeg-devel] [RFC PATCH] avutil/avutil: make AV_TIME_BASE_Q available in C++

Anton Khirnov anton at khirnov.net
Tue Aug 22 15:29:44 EEST 2023


Quoting Zhao Zhili (2023-08-18 20: 11:31)
> From: Zhao Zhili <zhilizhao at tencent.com>
Date: Tue, 22 Aug 2023 14:29:44 +0200
Message-ID: <169270738483.26513.18411031229205897825 at lain.khirnov.net>
User-Agent: alot/0.8.1
MIME-Version: 1.0

> 
> It still different than AV_TIME_BASE_Q in C, like you cannot take
> address of AV_TIME_BASE_Q in C++. It's better than nothing.
> ---
>  libavutil/avutil.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libavutil/avutil.h b/libavutil/avutil.h
> index 64b68bdbd3..5201cc6c5e 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          AVRational{1, AV_TIME_BASE}

How about av_make_q(1, AV_TIME_BASE_Q)? I don't know how the above
syntax works.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list