[FFmpeg-cvslog] buffersrc: avoid using AV_PIX_FMT_NB

Anton Khirnov git at videolan.org
Tue May 27 03:22:28 CEST 2014


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat May 24 11:15:15 2014 +0200| [b03b2d86aa9d79670825b42d8a8a7c41f59cb444] | committer: Anton Khirnov

buffersrc: avoid using AV_PIX_FMT_NB

That hardcodes the number of pixel formats into lavfi and will break
when a shared lavu is updated, adding new pixel formats.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b03b2d86aa9d79670825b42d8a8a7c41f59cb444
---

 libavfilter/buffersrc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index 480dca9..00e28f8 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -264,7 +264,7 @@ static av_cold int init_video(AVFilterContext *ctx)
     if ((c->pix_fmt = av_get_pix_fmt(c->pix_fmt_str)) == AV_PIX_FMT_NONE) {
         char *tail;
         c->pix_fmt = strtol(c->pix_fmt_str, &tail, 10);
-        if (*tail || c->pix_fmt < 0 || c->pix_fmt >= AV_PIX_FMT_NB) {
+        if (*tail || c->pix_fmt < 0 || !av_pix_fmt_desc_get(c->pix_fmt)) {
             av_log(ctx, AV_LOG_ERROR, "Invalid pixel format string '%s'\n", c->pix_fmt_str);
             return AVERROR(EINVAL);
         }



More information about the ffmpeg-cvslog mailing list