Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streaming API improvements #35

Open
randy408 opened this issue Oct 24, 2019 · 3 comments
Open

Streaming API improvements #35

randy408 opened this issue Oct 24, 2019 · 3 comments
Labels
discussion enhancement New feature or request

Comments

@randy408
Copy link
Owner

The streaming API is similar to libpng's which is great when it comes porting code but it has some drawbacks, this issue is for listing potential improvements.

@randy408 randy408 added enhancement New feature or request discussion labels Oct 24, 2019
@randy408
Copy link
Owner Author

The current streaming API expects the read callback to copy data to a library-controlled buffer, this introduces unnecessary copying if the user is also storing the PNG in memory.

Add a new function spng_set_png_stream2() that takes a different type of callback:

typedef int spng_read_fn2(spng_ctx *ctx, void *user, void **dest, size_t length);

This callback function assigns the pointer dest to the requested amount of bytes.

@michaelforney
Copy link

It also might be nice to allow a push-style or asynchronous decoding interface. For example, in netsurf's png handler, it receives image data in chunks, and pushes it into libpng with png_process_data:

http://git.netsurf-browser.org/netsurf.git/tree/content/handlers/image/png.c#n315

I'm don't believe there is a way to do this with the current libspng API.

@randy408
Copy link
Owner Author

I created a new issue for that: #39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants