summaryrefslogtreecommitdiff
path: root/libavformat/options.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2011-11-14 12:24:21 +0100
committerLuca Barbato <lu_zero@gentoo.org>2011-11-14 16:16:32 +0100
commitcaf27e37b654d6f525d47bc62b914cbee4ca6a4b (patch)
tree1c158f799064a58681d68029e76a8035f11ea1f4 /libavformat/options.c
parentac3dbb4d5854e8884daca54fd1f187b7f3769183 (diff)
lavf: simplify format_child_class_next()
And fix the error introduced when adding private option to avio. See 32caa7b13cecca59213c73fa94dd683c2b003bfd
Diffstat (limited to 'libavformat/options.c')
-rw-r--r--libavformat/options.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/libavformat/options.c b/libavformat/options.c
index 66e01a4082..a9e2c1cd93 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -53,26 +53,29 @@ static const AVClass *format_child_class_next(const AVClass *prev)
AVInputFormat *ifmt = NULL;
AVOutputFormat *ofmt = NULL;
- while (prev && (ifmt = av_iformat_next(ifmt)))
+ if (!prev)
+#if !FF_API_OLD_AVIO
+ return &ffio_url_class;
+#else
+ prev = (void *)&ifmt; // Dummy pointer;
+#endif
+
+ while ((ifmt = av_iformat_next(ifmt)))
if (ifmt->priv_class == prev)
break;
- if ((prev && ifmt) || (!prev))
+
+ if (!ifmt)
+ while ((ofmt = av_oformat_next(ofmt)))
+ if (ofmt->priv_class == prev)
+ break;
+ if (!ofmt)
while (ifmt = av_iformat_next(ifmt))
if (ifmt->priv_class)
return ifmt->priv_class;
- while (prev && (ofmt = av_oformat_next(ofmt)))
- if (ofmt->priv_class == prev)
- break;
- if ((prev && ofmt) || (!prev))
- while (ofmt = av_oformat_next(ofmt))
- if (ofmt->priv_class)
- return ofmt->priv_class;
-
-#if !FF_API_OLD_AVIO
- if (prev != &ffio_url_class)
- return &ffio_url_class;
-#endif
+ while (ofmt = av_oformat_next(ofmt))
+ if (ofmt->priv_class)
+ return ofmt->priv_class;
return NULL;
}