On Tue, Apr 12, 2011 at 11:08:13AM +0300, Martin Storsjö wrote:
> This can later be extended to support other AES bit sizes,
> encryption, other crypto algorithms, reading the key from a URL, etc.
> 
> --- /dev/null
> +++ b/libavformat/crypto.c
> @@ -0,0 +1,170 @@
> +/*
> + * Decryption protocol handler
> + * Copyright (c) 2011 Martin Storsjo

You skip the umlaut in your own name?

> +#define OFFSET(x) offsetof(CryptoContext, x)
> +static const AVOption options[] = {
> +{"key", "", OFFSET(key), FF_OPT_TYPE_BINARY },
> +{"iv", "", OFFSET(iv), FF_OPT_TYPE_BINARY },
> +{NULL}
> +};
> +static const AVClass crypto_class = {
> +    "crypto", av_default_item_name, options, LIBAVUTIL_VERSION_INT
> +};

That looks quite unreadable unindented and without separating empty
lines.

> +    if (av_strstart(uri, "crypto+", &nested_url)) {
> +    } else if (av_strstart(uri, "crypto:", &nested_url)) {
> +    } else {
> +        av_log(NULL, AV_LOG_ERROR, "Unsupported url %s\n", uri);
> +        ret = AVERROR(EINVAL);
> +        goto err;
> +    }

Two empty if blocks?

> +        c->outptr += size;
> +        c->outdata -= size;

extra good alignment karma awaits here

> +    c->outdata = BLOCKSIZE * blocks;
> +    c->outptr = c->outbuffer;
> +    c->indata_used += BLOCKSIZE * blocks;

ditto

> +        c->indata -= c->indata_used;
> +        c->indata_used = 0;

ditto

> +static int crypto_close(URLContext *h)
> +{
> +    CryptoContext *c = h->priv_data;
> +    if (c->hd)
> +        ffurl_close(c->hd);

unrelated: Maybe ffurl_close should be made NULL-tolerant.

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

Reply via email to