FLIF-hub / FLIF

Free Lossless Image Format
Other
3.72k stars 229 forks source link

Documentation for new `user_data` parameter? #388

Closed saschanaz closed 7 years ago

saschanaz commented 7 years ago

The PR #383 briefly explains the parameter but not really sure how should it be used, especially when the sample code viewflif.c just passes NULL. Please provide more documentation about it.

hrj commented 7 years ago

@SaschaNaz You can have a look at this recent commit in PolyFLIF https://github.com/UprootLabs/poly-flif/commit/d271d337a6600fecfd821d26a5d3ccb423a2b33c for an example use of user_data.

saschanaz commented 7 years ago

Thanks, so it seems user_data is completely user defined rather than decoder specific.

hrj commented 7 years ago

Yup, it lets the user pass a context into the decoder. But the decoder doesn't have to know what it is. It will simply store it as void * and pass it back to the callback function.

saschanaz commented 7 years ago

Great, can you add your explanation here?: https://github.com/FLIF-hub/FLIF/blob/2bd9cf51f52e7346a1e6165bdb052899f18a8f50/src/library/flif_dec.h#L73