diff mbox

[FFmpeg-devel,2/6] lavf/img2dec: use new iteration API

Message ID 20180401023945.42053-2-josh@itanimul.li
State New
Headers show

Commit Message

Josh de Kock April 1, 2018, 2:39 a.m. UTC
Signed-off-by: Josh de Kock <josh@itanimul.li>
---
 libavformat/img2dec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

wm4 April 2, 2018, 1:39 a.m. UTC | #1
On Sun,  1 Apr 2018 03:39:41 +0100
Josh de Kock <josh@itanimul.li> wrote:

> Signed-off-by: Josh de Kock <josh@itanimul.li>
> ---
>  libavformat/img2dec.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
> index f3f52c83b3..5fda850e7d 100644
> --- a/libavformat/img2dec.c
> +++ b/libavformat/img2dec.c
> @@ -323,7 +323,8 @@ int ff_img_read_header(AVFormatContext *s1)
>          if (s1->pb) {
>              int probe_buffer_size = 2048;
>              uint8_t *probe_buffer = av_realloc(NULL, probe_buffer_size + AVPROBE_PADDING_SIZE);
> -            AVInputFormat *fmt = NULL;
> +            const AVInputFormat *fmt = NULL;
> +            void *opaque = NULL;
>              AVProbeData pd = { 0 };
>  
>              if (!probe_buffer)
> @@ -340,7 +341,7 @@ int ff_img_read_header(AVFormatContext *s1)
>              pd.buf_size = probe_buffer_size;
>              pd.filename = s1->url;
>  
> -            while ((fmt = av_iformat_next(fmt))) {
> +            while ((fmt = av_demuxer_iterate(&opaque))) {
>                  if (fmt->read_header != ff_img_read_header ||
>                      !fmt->read_probe ||
>                      (fmt->flags & AVFMT_NOFILE) ||

I'd consider using a better name for the opaque variable, maybe
something like iter_fmt.
diff mbox

Patch

diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index f3f52c83b3..5fda850e7d 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -323,7 +323,8 @@  int ff_img_read_header(AVFormatContext *s1)
         if (s1->pb) {
             int probe_buffer_size = 2048;
             uint8_t *probe_buffer = av_realloc(NULL, probe_buffer_size + AVPROBE_PADDING_SIZE);
-            AVInputFormat *fmt = NULL;
+            const AVInputFormat *fmt = NULL;
+            void *opaque = NULL;
             AVProbeData pd = { 0 };
 
             if (!probe_buffer)
@@ -340,7 +341,7 @@  int ff_img_read_header(AVFormatContext *s1)
             pd.buf_size = probe_buffer_size;
             pd.filename = s1->url;
 
-            while ((fmt = av_iformat_next(fmt))) {
+            while ((fmt = av_demuxer_iterate(&opaque))) {
                 if (fmt->read_header != ff_img_read_header ||
                     !fmt->read_probe ||
                     (fmt->flags & AVFMT_NOFILE) ||