[FFmpeg-cvslog] vf_fieldorder: avoid using AV_PIX_FMT_NB

Anton Khirnov git at videolan.org
Tue May 27 03:09:43 CEST 2014


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

vf_fieldorder: 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=a7d070acb55c3ebbdd5e93e3366f32865732b8a3
---

 libavfilter/vf_fieldorder.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_fieldorder.c b/libavfilter/vf_fieldorder.c
index a4df87f..c05d081 100644
--- a/libavfilter/vf_fieldorder.c
+++ b/libavfilter/vf_fieldorder.c
@@ -50,9 +50,10 @@ static int query_formats(AVFilterContext *ctx)
     /** accept any input pixel format that is not hardware accelerated, not
      *  a bitstream format, and does not have vertically sub-sampled chroma */
     if (ctx->inputs[0]) {
+        const AVPixFmtDescriptor *desc = NULL;
         formats = NULL;
-        for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++) {
-            const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+        while ((desc = av_pix_fmt_desc_next(desc))) {
+            pix_fmt = av_pix_fmt_desc_get_id(desc);
             if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL ||
                   desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) &&
                 desc->nb_components && !desc->log2_chroma_h &&



More information about the ffmpeg-cvslog mailing list