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

Buffer-based streams. #1212

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Buffer-based streams. #1212

wants to merge 4 commits into from

Conversation

thinkoid
Copy link

@thinkoid thinkoid commented Sep 9, 2019

This existed previously as #583 and stayed here for a number of years. If there is still interest in it, here it is, in one commit.

I left the management of the buffer memory to the user instead of hooking it up in the logic of opj_stream_destroy. Make sure you dispose of the memory the library allocates during compression.

@rouault
Copy link
Collaborator

rouault commented Nov 17, 2019

I don't think the opj_buffer_info structure should be exposed in openjpeg.h, in particular because the use of the cur pointer is purely an implementation detail of openjpeg. And for the sake of const correctness, we should probably distinguish the input and output cases

So the API should rather be

OPJ_API opj_stream_t* OPJ_CALLCONV
opj_stream_create_input_stream_from_buffer (const void*, size_t);

OPJ_API opj_stream_t* OPJ_CALLCONV
opj_stream_create_output_stream_from_buffer (void*, size_t);

Some testing of this implementation might be welcome as well.
The CI also complains about code formatting

@nickdademo
Copy link

Any plan to get this PR merged into master?

@calixteman
Copy link

Is there any chance to have this change merged ?
We're using openjpeg in pdf.js (the Firefox' pdf viewer) and I had to add a slightly modified version of this patch:
https://github.com/mozilla/pdf.js.openjpeg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants