[FFmpeg-devel] [PATCH 1/2] drawutils: publish the list of supported formats.
Stefano Sabatini
stefasab at gmail.com
Fri Feb 24 16:23:41 CET 2012
On date Thursday 2012-02-23 14:44:26 +0100, Nicolas George encoded:
> The list was until now in vf_pad's query format.
>
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
> libavfilter/drawutils.c | 20 ++++++++++++++++++++
> libavfilter/drawutils.h | 6 ++++++
> libavfilter/vf_pad.c | 17 +----------------
> 3 files changed, 27 insertions(+), 16 deletions(-)
>
> diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c
> index bf308a1..f698f73 100644
> --- a/libavfilter/drawutils.c
> +++ b/libavfilter/drawutils.c
> @@ -120,3 +120,23 @@ void ff_copy_rectangle(uint8_t *dst[4], int dst_linesize[4],
> }
> }
> }
> +
> +AVFilterFormats *ff_drawutils_supported_pixel_formats(void)
> +{
> + static const enum PixelFormat pix_fmts[] = {
> + PIX_FMT_ARGB, PIX_FMT_RGBA,
> + PIX_FMT_ABGR, PIX_FMT_BGRA,
> + PIX_FMT_RGB24, PIX_FMT_BGR24,
> +
> + PIX_FMT_YUV444P, PIX_FMT_YUV422P,
> + PIX_FMT_YUV420P, PIX_FMT_YUV411P,
> + PIX_FMT_YUV410P, PIX_FMT_YUV440P,
> + PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P,
> + PIX_FMT_YUVJ420P, PIX_FMT_YUVJ440P,
> + PIX_FMT_YUVA420P,
> +
> + PIX_FMT_NONE
> + };
> +
> + return avfilter_make_format_list(pix_fmts);
> +}
> diff --git a/libavfilter/drawutils.h b/libavfilter/drawutils.h
> index 330b1cb..53c9c9b 100644
> --- a/libavfilter/drawutils.h
> +++ b/libavfilter/drawutils.h
> @@ -25,6 +25,7 @@
> */
>
> #include <stdint.h>
> +#include "avfilter.h"
> #include "libavutil/pixfmt.h"
>
> int ff_fill_rgba_map(uint8_t *rgba_map, enum PixelFormat pix_fmt);
> @@ -42,4 +43,9 @@ void ff_copy_rectangle(uint8_t *dst[4], int dst_linesize[4],
> uint8_t *src[4], int src_linesize[4], int pixelstep[4],
> int hsub, int vsub, int x, int y, int y2, int w, int h);
>
> +/**
> + * Return the list of pixel formats supported by the drawutils functions.
> + */
> +AVFilterFormats *ff_drawutils_supported_pixel_formats(void);
> +
> #endif /* AVFILTER_DRAWUTILS_H */
> diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
> index e226a00..6bd4b75 100644
> --- a/libavfilter/vf_pad.c
> +++ b/libavfilter/vf_pad.c
> @@ -67,22 +67,7 @@ enum var_name {
>
> static int query_formats(AVFilterContext *ctx)
> {
> - static const enum PixelFormat pix_fmts[] = {
> - PIX_FMT_ARGB, PIX_FMT_RGBA,
> - PIX_FMT_ABGR, PIX_FMT_BGRA,
> - PIX_FMT_RGB24, PIX_FMT_BGR24,
> -
> - PIX_FMT_YUV444P, PIX_FMT_YUV422P,
> - PIX_FMT_YUV420P, PIX_FMT_YUV411P,
> - PIX_FMT_YUV410P, PIX_FMT_YUV440P,
> - PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P,
> - PIX_FMT_YUVJ420P, PIX_FMT_YUVJ440P,
> - PIX_FMT_YUVA420P,
> -
> - PIX_FMT_NONE
> - };
> -
> - avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
> + avfilter_set_common_pixel_formats(ctx, ff_drawutils_supported_pixel_formats());
> return 0;
> }
Looks fine, thanks.
Note: a more flexible solution may require to provide some tools for
filtering formats based on their properties (e.g. to specify all
non-paletted formats with 8-bits for each plane pixel component, RGB
and YUV colorspaces), so that we don't need to update lists for
"generic" filters when new pixel formats are added.
--
FFmpeg = Friendly Formidable Mysterious Peaceless Eager Game
More information about the ffmpeg-devel
mailing list