[FFmpeg-devel] [PATCH] avdevice/alldevices: constify some function parameters
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Mon Jan 3 16:00:46 EET 2022
James Almer:
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> libavdevice/alldevices.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c
> index fbbe187a51..3db489b83c 100644
> --- a/libavdevice/alldevices.c
> +++ b/libavdevice/alldevices.c
> @@ -68,7 +68,7 @@ void avdevice_register_all(void)
> avpriv_register_devices(outdev_list, indev_list);
> }
>
> -static const void *next_input(const AVInputFormat *prev, AVClassCategory c2)
> +static const void *next_input(const AVInputFormat *prev, const AVClassCategory c2)
> {
> const AVClass *pc;
> const AVClassCategory c1 = AV_CLASS_CATEGORY_DEVICE_INPUT;
> @@ -94,7 +94,7 @@ static const void *next_input(const AVInputFormat *prev, AVClassCategory c2)
> return fmt;
> }
>
> -static const void *next_output(const AVOutputFormat *prev, AVClassCategory c2)
> +static const void *next_output(const AVOutputFormat *prev, const AVClassCategory c2)
> {
> const AVClass *pc;
> const AVClassCategory c1 = AV_CLASS_CATEGORY_DEVICE_OUTPUT;
>
AVClassCategory is an ordinary arithmetic type, not a pointer type; due
to call-by-value you can't change the caller's value at all. We
typically don't constify such parameters and doing so is highly unusual.
That being said, I am not against changing this policy.
- Andreas
More information about the ffmpeg-devel
mailing list