ffmpeg/fftools
Andreas Rheinhardt d53d48c799 fftools/cmdutils: Use avfilter_pad_count() for AVFilter's number of pads
Besides being nicer code this also has the advantage of not making
assumptions about the internal implementation: While it is documented
that the AVFilter.inputs and AVFilter.outputs arrays are terminated
by a zeroed sentinel, one is not allowed to infer that one can just
check avfilter_pad_get_name(padarray, i) to see whether one has reached
the sentinel:
It could be that the pointer to the string is contained
in a different structure than AVFilterPad that needs to be accessed
first: return pad->struct->string.
It could be that for small strings an internal buffer in
AVFilterPad is used (to avoid a relocation) whereas for longer strings
an external string is used; this is useful to avoid relocations:
return pad->string_ptr ? pad->string_ptr : pad->interal_string
Or it could be that the name has a default value:
return pad->name ? pad->name : "default"
(This actually made sense for us because the name of most of our
AVFilterPads is just "default"; doing so would save lots of relocations.)

The only thing one is allowed to infer from the existence of the
sentinel is that one is allowed to use avfilter_pad_count() to get
the number of pads. Therefore it is used.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-20 12:52:33 +02:00
..
cmdutils.c fftools/cmdutils: Use avfilter_pad_count() for AVFilter's number of pads 2021-08-20 12:52:33 +02:00
cmdutils.h fftools/cmdutils: Remove unused cpu_count 2021-08-08 18:40:46 +02:00
ffmpeg_filter.c fftools/ffmpeg_filter: add a return at the end of non-void functions 2021-08-06 21:22:49 -03:00
ffmpeg_hw.c ffmpeg_hw: Don't ignore key parameters when initializing a hw device 2021-08-17 10:10:07 -03:00
ffmpeg_opt.c qsvdec: add support for HW_DEVICE_CTX method 2021-08-11 13:45:36 -03:00
ffmpeg_videotoolbox.c ffmpeg_videotoolbox: skip memory copy if hwaccel_output_format match 2021-06-10 19:54:03 +08:00
ffmpeg.c ffmpeg: fix order between field order autodetection and override 2021-07-25 22:40:49 +03:00
ffmpeg.h qsvdec: add support for HW_DEVICE_CTX method 2021-08-11 13:45:36 -03:00
ffplay.c fftools: Don't set default swscale flags in ffmpeg/ffprobe/ffplay 2021-08-05 22:23:49 +08:00
ffprobe.c ffprobe: remove references to frame->pkt_pts 2021-08-07 10:16:07 -03:00
Makefile qsvdec: add support for HW_DEVICE_CTX method 2021-08-11 13:45:36 -03:00