On Tue,  4 Sep 2012 16:07:29 +0200, Luca Barbato <[email protected]> wrote:
> ---
> 
> We should support iformat == NULL condition probably,
> not 100% sure not closing the pb over those two conditions is correct.
> 
>  libavformat/utils.c | 20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)
> 

What is this supposed to accomplish? It looks like mixing
some unrelated things together.

> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 81a4b34..352abe4 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -2702,15 +2702,23 @@ void av_close_input_file(AVFormatContext *s)
>  void avformat_close_input(AVFormatContext **ps)
>  {
>      AVFormatContext *s = *ps;
> -    AVIOContext *pb = (s->iformat->flags & AVFMT_NOFILE) || (s->flags & 
> AVFMT_FLAG_CUSTOM_IO) ?
> -                       NULL : s->pb;
> +    AVIOContext *pb = s->pb;
> +
> +    if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) &&
> +        (s->flags & AVFMT_FLAG_CUSTOM_IO))
> +        pb = NULL;
> +
> +    if (s->iformat) {
> +        if (s->iformat->read_close)
> +            s->iformat->read_close(s);
> +    }
> +
>      flush_packet_queue(s);
> -    if (s->iformat->read_close)
> -        s->iformat->read_close(s);

This looks like allowing iformat to be NULL.
If so, there should be a comment saying why/when would that be useful,
since that's not very clear.

>      avformat_free_context(s);
> +
>      *ps = NULL;
> -    if (pb)
> -        avio_close(pb);
> +
> +    avio_close(pb);

And this should be in a separate patch.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to