X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Foptions.c;h=a9e2c1cd93240e3daa59c5b8d39d947d1008b23b;hb=4e8d6218c3cb8b9feffb70f8a53859540b975b36;hp=66e01a40821fa9689ea934ebc6efa28a13fd59ad;hpb=32caa7b13cecca59213c73fa94dd683c2b003bfd;p=ffmpeg diff --git a/libavformat/options.c b/libavformat/options.c index 66e01a40821..a9e2c1cd932 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; }