[FFmpeg-cvslog] sws/tests/pixdesc_query: save every pix fmts in a list

Clément Bœsch git at videolan.org
Sun Jul 30 17:08:41 EEST 2017


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Thu Mar 23 23:21:07 2017 +0100| [ca23d3491d4c3e316b968242dc14140603b27e70] | committer: Clément Bœsch

sws/tests/pixdesc_query: save every pix fmts in a list

This will be required for the next commit.

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

 libswscale/tests/pixdesc_query.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/libswscale/tests/pixdesc_query.c b/libswscale/tests/pixdesc_query.c
index a4aa8ac487..34b33c6851 100644
--- a/libswscale/tests/pixdesc_query.c
+++ b/libswscale/tests/pixdesc_query.c
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/mem.h"
 #include "libswscale/swscale_internal.h"
 
 static const struct {
@@ -45,17 +46,27 @@ static const struct {
 
 int main(void)
 {
-    int i;
+    int i, j;
 
     for (i = 0; i < FF_ARRAY_ELEMS(query_tab); i++) {
+        const char **pix_fmts = NULL;
+        int nb_pix_fmts = 0;
         const AVPixFmtDescriptor *pix_desc = NULL;
-        printf("%s:\n", query_tab[i].class);
+
         while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
             enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
             if (query_tab[i].cond(pix_fmt))
-                printf("  %s\n", pix_desc->name);
+                av_dynarray_add(&pix_fmts, &nb_pix_fmts, (void *)pix_desc->name);
+        }
+
+        if (pix_fmts) {
+            printf("%s:\n", query_tab[i].class);
+            for (j = 0; j < nb_pix_fmts; j++)
+                printf("  %s\n", pix_fmts[j]);
+            printf("\n");
+
+            free(pix_fmts);
         }
-        printf("\n");
     }
     return 0;
 }



More information about the ffmpeg-cvslog mailing list