Luca Barbato <[email protected]> writes: > On 12/9/12 5:37 PM, Måns Rullgård wrote: >> Luca Barbato <[email protected]> writes: >> >>> On 12/9/12 1:32 PM, Måns Rullgård wrote: >>>> Luca Barbato <[email protected]> writes: >>>> >>>>> 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; >>>> >>>> That's something I've been thinking of doing for a long time. >>>> >>> >>> Anything to add to the the drafted api? >> >> You've already made more progress than I ever did on this. >> >>> I'd craft it, implement it for md5, sha and crc and then make AVIO use >>> an AVHash pointer. >>> >>> The open question is if we want to add a muxer capability to signal it >>> is internally used and let people use it in their external code. >> >> What is it currently used for? > > ogg and nut (and probably transogg or whichever will be the name of > the new container) have some optional checksumming of fields. > > avio has a way to register a checksum function so that from that point > till you request the final result, all the io operations will update > the checksum automatically. > > It is quite nice since the resulting code is really terse: > > ffio_init_checksum > > as many avio operations as you want > > ffio_get_checksum
What happens if you seek? > the current situation is annoying since ff_crc04C11DB7_update is the > only function matching the callback signature and you can't use > something else since the state isn't really forwarded properly. With a generic checksum/hash interface, this would all be solved, right? -- Måns Rullgård [email protected] _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
