summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/options.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/libavformat/options.c b/libavformat/options.c
index 4afb8b52bc..3290f92a37 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -53,30 +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 (ifmt->priv_class == prev){
- prev = NULL;
- break;
- }
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 (!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){
- prev = NULL;
- break;
- }
- if (!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;
}