Signed-off-by: Zhao, Gang <gang.zhao...@gmail.com> --- libavdevice/avdevice.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-)
diff --git libavdevice/avdevice.c libavdevice/avdevice.c index 3d03d89f04..8c1b296d71 100644 --- libavdevice/avdevice.c +++ libavdevice/avdevice.c @@ -83,16 +83,33 @@ static void *device_next(void *prev, int output, { const AVClass *pc; AVClassCategory category = AV_CLASS_CATEGORY_NA; + void *opaque = NULL; + void *orig_prev = prev; + int found_prev = 0; + do { - if (output) { - if (!(prev = av_oformat_next(prev))) - break; + if (output) + prev = (void *)av_muxer_iterate(&opaque); + else + prev = (void *)av_demuxer_iterate(&opaque); + + if (!prev) + break; + + /* if orig_prev is NULL, start from the first muxer/demuxer */ + orig_prev = orig_prev ? orig_prev : prev; + + if (!found_prev) { + if (orig_prev == prev) + found_prev = 1; + continue; + } + + if (output) pc = ((AVOutputFormat *)prev)->priv_class; - } else { - if (!(prev = av_iformat_next(prev))) - break; + else pc = ((AVInputFormat *)prev)->priv_class; - } + if (!pc) continue; category = pc->category; -- 2.17.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".