[FFmpeg-devel] [PATCH] urlconcat protocol

Michael Niedermayer michaelni
Fri Feb 5 19:25:55 CET 2010


On Fri, Feb 05, 2010 at 12:39:32PM +0100, Michele Orr? wrote:
> 2010/2/5 Michael Niedermayer <michaelni at gmx.at>
> 
> > On Fri, Feb 05, 2010 at 08:07:50AM +0100, Michele Orr? wrote:
> > > >
[...]
> +        /* creating URLContext */
> +        if ((err = url_open(&uc, urinod, flags)) < 0)
> +            break;
> +        /* creating size */
> +        if ((size = url_filesize(uc)) < 0) {
> +            err = AVERROR(ENOSYS);
> +            break;
> +        }

uc isnt closed from this break

also the whole error handling looks a little obfuscated
maybe it could be made less obfuscated by using a few lines
more code. I personally dont really mind either way but we might
overlook bugs in this ...


> +        /* assembling */
> +        unodes[i].uc   = uc;
> +        unodes[i].size = size;
> +    }
> +    av_free(urinod);
> +    udata->length = i;

> +    if (err < 0)
> +        urlconcat_close(h);
> +    else if (!(unodes = av_realloc(unodes, udata->length * sizeof(*unodes)))) {
> +        urlconcat_close(h);
> +        err = AVERROR(ENOMEM);
> +    } else
> +        udata->nodes = unodes;
> +    return err;


> +}
> +
> +static int urlconcat_read(URLContext *h, unsigned char *buf, int size)
> +{
> +    int result, total = 0;
> +    struct urlconcat_data *udata = h->priv_data;
> +    struct urlconcat_nodes *unodes = udata->nodes;
> +    size_t i = udata->current;
> +
> +    while (size > 0) {
> +        result = url_read(unodes[i].uc, buf, size);
> +        if (result < 0)
> +            return result;

that looks wrong
url_read() succeeds and reads some data and 2nd call fails the
caller must be told the amount that was read successfully.
especially if the error code is something like EAGAIN


> +        else if (!result)

you dont strictly need the else here as theres return in the if()


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Frequently ignored awnser#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100205/c86878fc/attachment.pgp>



More information about the ffmpeg-devel mailing list