diff mbox series

[FFmpeg-devel,3/3] avformat/options: Update to new iterating API

Message ID 188ba7bc2cf9beff7541eb86da97f53d3fd85dee.1589014205.git.gang.zhao.42@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/3] avformat: Correctly check the list before accessing
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate fail Make fate failed

Commit Message

Zhao, Gang May 9, 2020, 8:50 a.m. UTC
Signed-off-by: Zhao, Gang <gang.zhao.42@gmail.com>
---
 libavformat/options.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git libavformat/options.c libavformat/options.c
index e14510504f..cec6ee3621 100644
--- libavformat/options.c
+++ libavformat/options.c
@@ -55,26 +55,28 @@  static void *format_child_next(void *obj, void *prev)
 
 static const AVClass *format_child_class_next(const AVClass *prev)
 {
-    AVInputFormat  *ifmt = NULL;
-    AVOutputFormat *ofmt = NULL;
+    const AVInputFormat  *ifmt;
+    const AVOutputFormat *ofmt;
+    void *demuxer_opaque = NULL;
+    void *muxer_opaque = NULL;
 
     if (!prev)
         return &ff_avio_class;
 
-    while ((ifmt = av_iformat_next(ifmt)))
+    while ((ifmt = av_demuxer_iterate(&demuxer_opaque)))
         if (ifmt->priv_class == prev)
             break;
 
     if (!ifmt)
-        while ((ofmt = av_oformat_next(ofmt)))
+        while ((ofmt = av_muxer_iterate(&muxer_opaque)))
             if (ofmt->priv_class == prev)
                 break;
     if (!ofmt)
-        while (ifmt = av_iformat_next(ifmt))
+        while (ifmt = av_demuxer_iterate(&demuxer_opaque))
             if (ifmt->priv_class)
                 return ifmt->priv_class;
 
-    while (ofmt = av_oformat_next(ofmt))
+    while (ofmt = av_muxer_iterate(&muxer_opaque))
         if (ofmt->priv_class)
             return ofmt->priv_class;