[FFmpeg-cvslog] lavu: make sure av_pix_fmt_desc_next returns a valid pix fmt.

Clément Bœsch git at videolan.org
Sun Dec 16 20:47:02 CET 2012


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Sat Dec 15 23:28:15 2012 +0100| [7fb49639e6b1caf5579ce9663c1ff367663f9048] | committer: Clément Bœsch

lavu: make sure av_pix_fmt_desc_next returns a valid pix fmt.

This is required because there are some "holes" in the list for
compatibility with the fork.

The commit also removes the now unecessary check from cmdutils.

Found-by: wm4

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

 cmdutils.c          |    2 --
 libavutil/pixdesc.c |    7 +++++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/cmdutils.c b/cmdutils.c
index abe5601..fb01a94 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -1195,8 +1195,6 @@ int show_pix_fmts(void *optctx, const char *opt, const char *arg)
 
     while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
         enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
-        if(!pix_desc->name)
-            continue;
         printf("%c%c%c%c%c %-16s       %d            %2d\n",
                sws_isSupportedInput (pix_fmt)      ? 'I' : '.',
                sws_isSupportedOutput(pix_fmt)      ? 'O' : '.',
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 1f2aa58..362edfa 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -1757,8 +1757,11 @@ const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
 {
     if (!prev)
         return &av_pix_fmt_descriptors[0];
-    if (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1)
-        return prev + 1;
+    while (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) {
+        prev++;
+        if (prev->name)
+            return prev;
+    }
     return NULL;
 }
 



More information about the ffmpeg-cvslog mailing list