Browse code

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.

Anton Khirnov authored on 2014/05/24 18:15:15
Showing 1 changed files
... ...
@@ -50,9 +50,10 @@ static int query_formats(AVFilterContext *ctx)
50 50
     /** accept any input pixel format that is not hardware accelerated, not
51 51
      *  a bitstream format, and does not have vertically sub-sampled chroma */
52 52
     if (ctx->inputs[0]) {
53
+        const AVPixFmtDescriptor *desc = NULL;
53 54
         formats = NULL;
54
-        for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++) {
55
-            const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
55
+        while ((desc = av_pix_fmt_desc_next(desc))) {
56
+            pix_fmt = av_pix_fmt_desc_get_id(desc);
56 57
             if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL ||
57 58
                   desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) &&
58 59
                 desc->nb_components && !desc->log2_chroma_h &&