On 12/09/2012 05:34 AM, Luca Barbato wrote:
> Hi, I'm wondering if we could completely hide the avio checksum fields
> from the public structure by moving it to an internal field or extend it
> to be able to use any hash function from avutil and fully expose it to
> our users.
>
> The current situation is less than optimal.
Sort of related, I'd provide some wrapper api over our crypto/hash stuff
along those lines.
typedef struct AVHash {
const AVClass *av_class;
int context_size;
void *context;
int (*init) (struct AVHash);
void (*update)(struct AVHash, const uint8_t *src, const int len);
void (*close) (struct AVHash, uint8_t *dst);
} AVHash;
/**
* given a name describing the hash return an yet to be
* initialized context.
*/
int av_hash_lookup(AVHash **hash, const char *name);
/**
* Wipe the internal state and reset it, optional parameters can be set
* using the options dictionary.
*/
int av_hash_open(AVHash *ctx, AVDictionary **options);
/**
* Feed the hasher with new data
*/
void av_hash_update(AVHash *ctx, const uint8_t *src, const int len);
/**
* Return the hash value and invalidate the state.
*/
void av_hash_close(AVHash *ctx, uint8_t *dst);
/**
* Shortcut for the previous two functions
*/
void av_hash_sum(AVHash *ctx, uint8_t *dst, const uint8_t *src, const
int len);
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel