diff options
author | Clément Bœsch <ubitux@gmail.com> | 2012-12-16 02:28:15 +0400 |
---|---|---|
committer | Clément Bœsch <ubitux@gmail.com> | 2012-12-16 23:39:39 +0400 |
commit | 7fb49639e6b1caf5579ce9663c1ff367663f9048 (patch) | |
tree | af47d645e83d9584f4f7e94c2d99e334021375a1 /libavutil | |
parent | cb8163d0bdf687d5f20783c64e39a2f0e5b017c6 (diff) |
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
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/pixdesc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 1f2aa58a42..362edfa07f 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; } |